You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Blume, Karsten" <Ka...@hermes-ottoint.com> on 2019/04/12 09:17:08 UTC
Sharing Dataformat between bundles
Hello everybody,
i have a problem with jaxb dataformat & usage over several bundles
-env: blueprint bundles, camel 2.16.3, servicemix 6.1.2
I would like to use a jaxb dataformat in a bundle D,
the dataformat is referencing the context property (generated from some xsd) from another bundle C,
also i would like to have the validation by the schema property of dataformat.
Blueprint test runs fine, during bundle startup in the server i get an error "cannot load XSD via classpath".
Without schema property set, I can use the dataformat. But i would like to have the validation. I don't want the XSDs spread over all my bundles where i use this jaxb dataformat. What might be the solution?
i cannot define the dataformat in C because org.apache.camel.model.dataformat.JaxbDataFormat as bean has no interface for service referencing.
i don't know how to reference the XSD from D to C.
Thanks in advance Karsten
RE: Sharing Dataformat between bundles
Posted by "Blume, Karsten" <Ka...@hermes-ottoint.com>.
Hi,
My solution looks like this:
I have created a small context with those jaxb dataformats and corresponding routes which are calling (un)marshall.
These routes are connected by vm: endpoints and use InOut-Pattern.
So I have all XSDs, jaxb generation and jaxb-dataformat in one bundle which is a dependency to all other bundles which use the XSDs/dataformats.
The only drawback is for testing that these marshalling routes have to be mocked up because I cannot have two Blueprint Camel contexts in one Camel test.
This could be done by adviceWith or -what I have done - I use context.addRoutes in my test class:
@Override
@Before
public void setUp() throws Exception {
super.setUp();
context.addRoutes( new MyCoreOsgiRouteBuilder( context));
}
private static final class MyCoreOsgiRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
final JaxbDataFormat dataFormat = new JaxbDataFormat( ".....");
....
from( "vm:core.unmarshall.source").unmarshal( dataFormat);
}
}
Greetings
Karsten
-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
Sent: Freitag, 12. April 2019 12:14
To: users@camel.apache.org
Subject: Re: Sharing Dataformat between bundles
Hi
No a data format is per camel context, and ditto for components etc.
You can create your own osgi service with some jaxb stuff that does similar to this and share it. Since its standard JAXB then it should not be as hard to do.
But mind the more fine grained osgi services you have the more complex your apps lifecycles are as they are then all depend on this same service.
On Fri, Apr 12, 2019 at 11:55 AM Blume, Karsten <Ka...@hermes-ottoint.com> wrote:
>
> Hi,
> i was scared somebody saying something like this.
> This is a bunch of several XSDs which results in > 400 classes being generated.
> I would like to avoid this maintenance horror, keeping every bundles XSDs, maven config in sync.
>
> No possibility?
> Karsten
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: Sharing Dataformat between bundles
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
No a data format is per camel context, and ditto for components etc.
You can create your own osgi service with some jaxb stuff that does
similar to this and share it. Since its standard JAXB then it should
not be as hard to do.
But mind the more fine grained osgi services you have the more complex
your apps lifecycles are as they are then all depend on this same
service.
On Fri, Apr 12, 2019 at 11:55 AM Blume, Karsten
<Ka...@hermes-ottoint.com> wrote:
>
> Hi,
> i was scared somebody saying something like this.
> This is a bunch of several XSDs which results in > 400 classes being generated.
> I would like to avoid this maintenance horror, keeping every bundles XSDs, maven config in sync.
>
> No possibility?
> Karsten
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
RE: Sharing Dataformat between bundles
Posted by "Blume, Karsten" <Ka...@hermes-ottoint.com>.
Hi,
i was scared somebody saying something like this.
This is a bunch of several XSDs which results in > 400 classes being generated.
I would like to avoid this maintenance horror, keeping every bundles XSDs, maven config in sync.
No possibility?
Karsten
Re: Sharing Dataformat between bundles
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Dont do this.
Setup the dataformat in both bundles. Its not intended for having a
Camel data format shared across different CamelContext.
On Fri, Apr 12, 2019 at 11:18 AM Blume, Karsten
<Ka...@hermes-ottoint.com> wrote:
>
> Hello everybody,
> i have a problem with jaxb dataformat & usage over several bundles
> -env: blueprint bundles, camel 2.16.3, servicemix 6.1.2
>
> I would like to use a jaxb dataformat in a bundle D,
> the dataformat is referencing the context property (generated from some xsd) from another bundle C,
> also i would like to have the validation by the schema property of dataformat.
>
> Blueprint test runs fine, during bundle startup in the server i get an error "cannot load XSD via classpath".
> Without schema property set, I can use the dataformat. But i would like to have the validation. I don't want the XSDs spread over all my bundles where i use this jaxb dataformat. What might be the solution?
> i cannot define the dataformat in C because org.apache.camel.model.dataformat.JaxbDataFormat as bean has no interface for service referencing.
> i don't know how to reference the XSD from D to C.
> Thanks in advance Karsten
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2