On 11/23/2010 03:53 PM, Claus Ibsen wrote:
You put that file inside your own JAR. And in that file you add a text
line which is a package name for the package where your @Converter
class is.
Claus, if you have a minute, please tell me if I am doing it right.

Here is my String to Jdom type converter:

package uk.org.llgc.camel;

import java.io.IOException;
import java.io.StringReader;

import org.apache.camel.Converter;
import org.apache.camel.Exchange;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

@Converter
public class JdomTypeConverter {

    @Converter
public static Document toJdomDocument(String pString, Exchange pExchange) throws JDOMException, IOException{

        SAXBuilder tBuilder = new SAXBuilder();
Document tDoc = tBuilder.build(new StringReader((String)pExchange.getIn().getBody(String.class)));
        return tDoc;
    }
}

I place the JdomTypeConverter.class in a type_converter.jar .
I also add the TypeConverter inside the type_converter.jar .
inside the TypeConverter there is apache license disclaimer + two lines:

org.apache.activemq.camel.converter
uk.org.llgc.camel.JdomTypeConverter

I've tried placing the TypeConverter directly inside my jar, inside the METS-INF directory and also tried placing the whole: services/org/apache/camel/TypeConverter structure, both directly and inside the METS-INF directory (of my jar).

My jar file is in the activemq_home/lib directory.

I've also tried placing the above set-ups inside the activemq/webapps/camel/METS-INF with same results.


Remi

Reply via email to