Hi,

I am currently developing an EDIFACT extension for Camel, that parses EDIFACT header information and provides them for further routing. It contributes DataFormat, TypeConverter and an extension to the Camel SimpleLanguage. All works very nice and seamless (junit tests) unless it is used in an OSGi environment.

To be able to use the SimpleLanguage extension in Spring configured routes like in this example:
<camelContext xmlns="http://camel.apache.org/schema/spring/version-edifact";>
<route>
<from uri="file:e:/temp/file-io/file-in" />
<choice>
<when>
<edifact>
                    ${ediPath(UNH/S009/D0065)} == 'DESADV'
</edifact>
<to uri="file:e:/temp/file-io/file-out/desadv" />
</when>
<otherwise>
<to uri="file:e:/temp/file-io/file-out/other" />
</otherwise>
</choice>
</route>
</camelContext>

I extended org.apache.camel.spring.handler.CamelNamespaceHandler.
My XSD includes the Camel XSD and consists furthermore of just one element declaration: <element name="edifact" type="camel:simpleExpression" substitutionGroup="camel:simple"/>

My NamespaceHandler just overrides Set<Class> CamelNamespaceHandler.getJaxbPackages() to add my JAXB package. The JAXBContext is created with the ClassLoader of my NamespaceHandler.class, any other ClassLoader like the ClassLoader of CamelNamespaceHandler.class would not be able to access my classes/resources. The ClassLoader of my NamespaceHandler.class cannot access classes and resources of Camel unless they are imported in the OSGi manifest instructions. But the package org.apache.camel.core.xml is not exported and required to create the JAXBContex.
This is the point where i stuck now.

Suggestions?

Thanks,
Stefan

P.S. Camel is genious

Reply via email to