-
1. Re: custom TypeConverter
davsclaus May 12, 2010 12:05 PM (in response to fsalceda)See here
http://camel.apache.org/type-converter.html
Or chapter 3 in the Camel in Action book which discusses and shows how to write custom type converters. The source code for the book also shows how to do it.
-
2. Re: custom TypeConverter
fsalceda May 17, 2010 5:21 AM (in response to davsclaus)I wrote my TypeConverter following the example "PurchaseOrder" in camel in action source and also added the TypeConverter file with the package name of my TypeConverter. Now I would like to packege it as an osgi bundle and install it in Fuse 4.2 to be available for my other bundles when conversion is needed. Should I install it as a features in Fuse? How can I do that?
-
3. Re: custom TypeConverter
davsclaus May 17, 2010 7:05 AM (in response to fsalceda)How to use OSGi with FUSE ESB is documented here:
http://fusesource.com/docs/esb/4.2/deploy_osgi/index.html
No a feature is not needed. A feature is a xml file which is like a super bundle which just tells Fuse ESB which other bundles belongs in this group. And then it can install all those bundles together.
You most likely one have one .jar file then you just have to include the OSGi metadata in the MANIFEST.MF file. Then you should be able to deploy the .jar in the FUSE ESB container.
-
4. Re: custom TypeConverter
fsalceda May 17, 2010 7:07 AM (in response to davsclaus)I added my TypeConverter jar as an embeded-dependency to my osgi-bundle project to test the converter but I get...
...
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList to the required type: com.andago.piel.types.PielInputInfo with value com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@1ffaab5
I append my TypeConverter and my RecicpientList method that causes the exception
Thx.
-
PielInputInfoConverter.java 1.3 KB
-
5. Re: custom TypeConverter
fsalceda May 17, 2010 7:14 AM (in response to davsclaus)Ok, then I can install my custom TypeConverter as a normal osgi-bundle and it will be available when a type conversion happens in other bundles, dont it?
Thx.
-
6. Re: custom TypeConverter
njiang May 18, 2010 10:44 AM (in response to fsalceda)Can you add a converter which can turn a NodeList into the PielInputInfo?
I just found a bytes to PielInputInfo method in your custom TypeConverter.
Willem
-
7. Re: custom TypeConverter
fsalceda May 19, 2010 6:19 AM (in response to njiang)Yes I can, which type of NodeList is it? Could you help me with a method example with the exact type of NodeList? Is it a org.w3c.dom.NodeList? Cannot find com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList type.
Edited by: fsalceda on May 19, 2010 10:18 AM
-
8. Re: custom TypeConverter
fsalceda May 26, 2010 4:50 AM (in response to fsalceda)I would appreciate any help with type conversion from NodeList?? to extract elements to a java bean.
Thx.
-
9. Re: custom TypeConverter
davsclaus May 27, 2010 12:26 AM (in response to fsalceda)The XML API in JDK is terrible to work with.
You may just have to google a bit to find some code snippets for how to work with NodeList.
If you only need a couple of data from it you may be able to use XPath to extract the data.