You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/09/25 13:10:09 UTC

svn commit: r818818 - in /camel/trunk: apache-camel/ apache-camel/src/main/descriptors/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/m...

Author: davsclaus
Date: Fri Sep 25 11:10:07 2009
New Revision: 818818

URL: http://svn.apache.org/viewvc?rev=818818&view=rev
Log:
CAMEL-2034: Added camel-castor as new data format. Thanks to Sagara Gunathunga for contribution.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
      - copied, changed from r818745, camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java
    camel/trunk/components/camel-castor/
    camel/trunk/components/camel-castor/pom.xml   (with props)
    camel/trunk/components/camel-castor/src/
    camel/trunk/components/camel-castor/src/main/
    camel/trunk/components/camel-castor/src/main/java/
    camel/trunk/components/camel-castor/src/main/java/org/
    camel/trunk/components/camel-castor/src/main/java/org/apache/
    camel/trunk/components/camel-castor/src/main/java/org/apache/camel/
    camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/
    camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/
    camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java   (with props)
    camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java   (with props)
    camel/trunk/components/camel-castor/src/main/resources/
    camel/trunk/components/camel-castor/src/main/resources/META-INF/
    camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt   (with props)
    camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt   (with props)
    camel/trunk/components/camel-castor/src/test/
    camel/trunk/components/camel-castor/src/test/java/
    camel/trunk/components/camel-castor/src/test/java/org/
    camel/trunk/components/camel-castor/src/test/java/org/apache/
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java   (with props)
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java   (with props)
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java   (with props)
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java   (with props)
    camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java   (with props)
    camel/trunk/components/camel-castor/src/test/resources/
    camel/trunk/components/camel-castor/src/test/resources/log4j.properties   (with props)
    camel/trunk/components/camel-castor/src/test/resources/map.xml   (with props)
    camel/trunk/components/camel-castor/src/test/resources/org/
    camel/trunk/components/camel-castor/src/test/resources/org/apache/
    camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/
    camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/
    camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/
    camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml   (with props)
Modified:
    camel/trunk/apache-camel/pom.xml
    camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultClassResolver.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ClassResolver.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
    camel/trunk/components/pom.xml
    camel/trunk/parent/pom.xml

Modified: camel/trunk/apache-camel/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/apache-camel/pom.xml?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/apache-camel/pom.xml (original)
+++ camel/trunk/apache-camel/pom.xml Fri Sep 25 11:10:07 2009
@@ -64,6 +64,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-castor</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-cometd</artifactId>
     </dependency>
     <dependency>

Modified: camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
URL: http://svn.apache.org/viewvc/camel/trunk/apache-camel/src/main/descriptors/common-bin.xml?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/apache-camel/src/main/descriptors/common-bin.xml (original)
+++ camel/trunk/apache-camel/src/main/descriptors/common-bin.xml Fri Sep 25 11:10:07 2009
@@ -37,6 +37,7 @@
         <include>org.apache.camel:camel-atom</include>
         <include>org.apache.camel:camel-bam</include>
         <include>org.apache.camel:camel-cache</include>
+        <include>org.apache.camel:camel-castor</include>
         <include>org.apache.camel:camel-core</include>
         <include>org.apache.camel:camel-cometd</include>
         <include>org.apache.camel:camel-csv</include>

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java Fri Sep 25 11:10:07 2009
@@ -26,6 +26,7 @@
 import org.apache.camel.model.dataformat.ArtixDSDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.BindyType;
+import org.apache.camel.model.dataformat.CastorDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.GzipDataFormat;
 import org.apache.camel.model.dataformat.HL7DataFormat;
@@ -124,6 +125,45 @@
     }
 
     /**
+     * Uses the Castor data format
+     */
+    public T castor() {
+        return dataFormat(new CastorDataFormat());
+    }
+
+    /**
+     * Uses the Castor data format
+     *
+     * @param mappingFile name of mapping file to locate in classpath
+     */
+    public T castor(String mappingFile) {
+        CastorDataFormat castor = new CastorDataFormat();
+        castor.setMappingFile(mappingFile);
+        return dataFormat(castor);
+    }
+
+    /**
+     * Uses the Castor data format
+     *
+     * @param mappingFile name of mapping file to locate in classpath
+     * @param validation whether validation is enabled or not
+     */
+    public T castor(String mappingFile, boolean validation) {
+        CastorDataFormat castor = new CastorDataFormat();
+        castor.setMappingFile(mappingFile);
+        castor.setValidation(validation);
+        return dataFormat(castor);
+    }
+
+    /**
+     * Uses the GZIP deflater data format
+     */
+    public T gzip() {
+        GzipDataFormat gzdf = new GzipDataFormat();
+        return dataFormat(gzdf);
+    }
+
+    /**
      * Uses the HL7 data format
      */
     public T hl7() {
@@ -154,6 +194,34 @@
     }
 
     /**
+     * Uses the JSON data format using the XStream json library
+     */
+    public T json() {
+        return dataFormat(new JsonDataFormat());
+    }
+
+    /**
+     * Uses the JSON data format
+     *
+     * @param library the json library to use
+     */
+    public T json(JsonLibrary library) {
+        return dataFormat(new JsonDataFormat(library));
+    }
+
+    /**
+     * Uses the JSON data format
+     *
+     * @param type the json type to use
+     * @param unmarshalType unmarshal type for json jackson type
+     */
+    public T json(JsonLibrary type, Class<?> unmarshalType) {
+        JsonDataFormat json = new JsonDataFormat(type);
+        json.setUnmarshalType(unmarshalType);
+        return dataFormat(json);
+    }
+
+    /**
      * Uses the RSS data format
      */
     public T rss() {
@@ -184,13 +252,6 @@
     }
 
     /**
-     * Uses the JAXB data format
-     */
-    public T xmlBeans() {
-        return dataFormat(new XMLBeansDataFormat());
-    }
-
-    /**
      * Return WellFormed HTML (an XML Document) either 
      * {@link java.lang.String} or {@link org.w3c.dom.Node}
      */
@@ -206,7 +267,6 @@
         return dataFormat(new TidyMarkupDataFormat(Node.class));
     }
 
-    
     /**
      * Uses the XStream data format
      */
@@ -215,34 +275,6 @@
     }
     
     /**
-     * Uses the JSON data format using the XStream json library
-     */
-    public T json() {
-        return dataFormat(new JsonDataFormat());
-    }
-
-    /**
-     * Uses the JSON data format
-     *
-     * @param library the json library to use
-     */
-    public T json(JsonLibrary library) {
-        return dataFormat(new JsonDataFormat(library));
-    }
-
-    /**
-     * Uses the JSON data format
-     *
-     * @param type the json type to use
-     * @param unmarshalType unmarshal type for json jackson type
-     */
-    public T json(JsonLibrary type, Class<?> unmarshalType) {
-        JsonDataFormat json = new JsonDataFormat(type);
-        json.setUnmarshalType(unmarshalType);
-        return dataFormat(json);
-    }
-
-    /**
      * Uses the XML Security data format
      */
     public T secureXML() {
@@ -275,6 +307,13 @@
     }
 
     /**
+     * Uses the xmlBeans data format
+     */
+    public T xmlBeans() {
+        return dataFormat(new XMLBeansDataFormat());
+    }
+
+    /**
      * Uses the ZIP deflater data format
      */
     public T zip() {
@@ -290,14 +329,6 @@
         return dataFormat(zdf);
     }
     
-    /**
-     * Uses the GZIP deflater data format
-     */
-    public T gzip() {
-        GzipDataFormat gzdf = new GzipDataFormat();
-        return dataFormat(gzdf);
-    }
-
     @SuppressWarnings("unchecked")
     private T dataFormat(DataFormatDefinition dataFormatType) {
         switch (operation) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultClassResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultClassResolver.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultClassResolver.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultClassResolver.java Fri Sep 25 11:10:07 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.impl;
 
 import java.io.InputStream;
+import java.net.URL;
 
 import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.util.ObjectHelper;
@@ -83,6 +84,11 @@
         return ObjectHelper.loadResourceAsStream(uri);
     }
 
+    public URL loadResourceAsURL(String uri) {
+        ObjectHelper.notEmpty(uri, "uri");
+        return ObjectHelper.loadResourceAsURL(uri);
+    }
+
     protected Class loadClass(String name, ClassLoader loader) {
         ObjectHelper.notEmpty(name, "name");
         return ObjectHelper.loadClass(name, loader);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java Fri Sep 25 11:10:07 2009
@@ -25,10 +25,14 @@
 
 import org.apache.camel.Processor;
 import org.apache.camel.model.dataformat.ArtixDSDataFormat;
+import org.apache.camel.model.dataformat.BindyDataFormat;
+import org.apache.camel.model.dataformat.CastorDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.FlatpackDataFormat;
+import org.apache.camel.model.dataformat.GzipDataFormat;
 import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
+import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.RssDataFormat;
 import org.apache.camel.model.dataformat.SerializationDataFormat;
 import org.apache.camel.model.dataformat.StringDataFormat;
@@ -53,10 +57,14 @@
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
     @XmlElement(required = false, name = "artixDS", type = ArtixDSDataFormat.class),
+    @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+    @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
     @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
     @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
+    @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
     @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
     @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
+    @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
     @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
     @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
     @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java Fri Sep 25 11:10:07 2009
@@ -25,10 +25,14 @@
 
 import org.apache.camel.Processor;
 import org.apache.camel.model.dataformat.ArtixDSDataFormat;
+import org.apache.camel.model.dataformat.BindyDataFormat;
+import org.apache.camel.model.dataformat.CastorDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.FlatpackDataFormat;
+import org.apache.camel.model.dataformat.GzipDataFormat;
 import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
+import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.RssDataFormat;
 import org.apache.camel.model.dataformat.SerializationDataFormat;
 import org.apache.camel.model.dataformat.StringDataFormat;
@@ -54,10 +58,14 @@
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
     @XmlElement(required = false, name = "artixDS", type = ArtixDSDataFormat.class),
+    @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+    @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
     @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
     @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
+    @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
     @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
     @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
+    @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
     @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
     @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
     @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java (from r818745, camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java&r1=818745&r2=818818&rev=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java Fri Sep 25 11:10:07 2009
@@ -25,36 +25,86 @@
 import org.apache.camel.spi.DataFormat;
 
 /**
- * Represents a <a href="http://camel.apache.org/hl7.html">HL7</a> {@link org.apache.camel.spi.DataFormat}.
+ * Represents a <a href="http://camel.apache.org/castor.html">Castor</a> {@link org.apache.camel.spi.DataFormat}.
  *
  * @version $Revision$
  */
-@XmlRootElement(name = "hl7")
+@XmlRootElement(name = "castor")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class HL7DataFormat extends DataFormatDefinition {
+public class CastorDataFormat extends DataFormatDefinition {
 
     @XmlAttribute(required = false)
-    private Boolean validate = Boolean.TRUE;
+    private String mappingFile;
+    @XmlAttribute(required = false)
+    private Boolean validation = Boolean.TRUE;
+    @XmlAttribute(required = false)
+    private String encoding;
+    @XmlAttribute(required = false)
+    private String[] packages;
+    @XmlAttribute(required = false)
+    private String[] classes;
+
+    public CastorDataFormat() {
+        super("org.apache.camel.dataformat.castor.CastorDataFormat");
+    }
+
+    public Boolean isValidation() {
+        return validation;
+    }
+
+    public void setValidation(Boolean validation) {
+        this.validation = validation;
+    }
+
+    public String getMappingFile() {
+        return mappingFile;
+    }
+
+    public void setMappingFile(String mappingFile) {
+        this.mappingFile = mappingFile;
+    }
+
+    public String[] getPackages() {
+        return packages;
+    }
+
+    public void setPackages(String[] packages) {
+        this.packages = packages;
+    }
+
+    public String[] getClasses() {
+        return classes;
+    }
 
-    public HL7DataFormat() {
-        super("org.apache.camel.component.hl7.HL7DataFormat");
+    public void setClasses(String[] classes) {
+        this.classes = classes;
     }
 
-    public Boolean isValidate() {
-        return validate;
+    public String getEncoding() {
+        return encoding;
     }
 
-    public void setValidate(Boolean validate) {
-        this.validate = validate;
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
     }
 
     @Override
     protected void configureDataFormat(DataFormat dataFormat) {
-        if (validate != null) {
-            setProperty(dataFormat, "validate", validate);
+        if (mappingFile != null) {
+            setProperty(dataFormat, "mappingFile", mappingFile);
+        }
+        if (validation != null) {
+            setProperty(dataFormat, "validation", validation);
+        }
+        if (encoding != null) {
+            setProperty(dataFormat, "encoding", encoding);
+        }
+        if (packages != null) {
+            setProperty(dataFormat, "packages", packages);
+        }
+        if (classes != null) {
+            setProperty(dataFormat, "classes", classes);
         }
     }
 
-
-
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java Fri Sep 25 11:10:07 2009
@@ -39,6 +39,7 @@
     @XmlElements({
         @XmlElement(required = false, name = "artixDS", type = ArtixDSDataFormat.class),
         @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+        @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
         @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
         @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
         @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ClassResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ClassResolver.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ClassResolver.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ClassResolver.java Fri Sep 25 11:10:07 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.spi;
 
 import java.io.InputStream;
+import java.net.URL;
 
 /**
  * A class resolver for loading classes in a loosly coupled manner to cater for different platforms such
@@ -44,7 +45,7 @@
     /**
      * Resolves the given class by its name
      *
-     * @param name full qualified name of class
+     * @param name   full qualified name of class
      * @param loader use the provided class loader
      * @return the class if resolved, <tt>null</tt> if not found.
      */
@@ -53,8 +54,8 @@
     /**
      * Resolves the given class by its name
      *
-     * @param name full qualified name of class
-     * @param type the expected type of the class
+     * @param name   full qualified name of class
+     * @param type   the expected type of the class
      * @param loader use the provided class loader
      * @return the class if resolved, <tt>null</tt> if not found.
      */
@@ -82,9 +83,9 @@
     /**
      * Resolves the given class by its name
      *
-     * @param name full qualified name of class
-     * @return the class if resolved, <tt>null</tt> if not found.
+     * @param name   full qualified name of class
      * @param loader use the provided class loader
+     * @return the class if resolved, <tt>null</tt> if not found.
      * @throws ClassNotFoundException is thrown if class not found
      */
     Class resolveMandatoryClass(String name, ClassLoader loader) throws ClassNotFoundException;
@@ -92,8 +93,8 @@
     /**
      * Resolves the given class by its name
      *
-     * @param name full qualified name of class
-     * @param type the expected type of the class
+     * @param name   full qualified name of class
+     * @param type   the expected type of the class
      * @param loader use the provided class loader
      * @return the class if resolved, <tt>null</tt> if not found.
      * @throws ClassNotFoundException is thrown if class not found
@@ -102,9 +103,18 @@
 
     /**
      * Loads the given resource as a stream
+     *
      * @param uri the uri of the resource
      * @return as a stream
      */
     InputStream loadResourceAsStream(String uri);
 
+    /**
+     * Loads the given resource as a URL
+     *
+     * @param uri the uri of the resource
+     * @return as a URL
+     */
+    URL loadResourceAsURL(String uri);
+
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Fri Sep 25 11:10:07 2009
@@ -34,6 +34,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Scanner;
+import java.net.URL;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -677,6 +678,27 @@
     }
 
     /**
+     * Attempts to load the given resource as a stream using the thread context
+     * class loader or the class loader used to load this class
+     *
+     * @param name the name of the resource to load
+     * @return the stream or null if it could not be loaded
+     */
+    public static URL loadResourceAsURL(String name) {
+        URL url = null;
+
+        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+        if (contextClassLoader != null) {
+            url = contextClassLoader.getResource(name);
+        }
+        if (url == null) {
+            url = ObjectHelper.class.getClassLoader().getResource(name);
+        }
+
+        return url;
+    }
+
+    /**
      * A helper method to invoke a method via reflection and wrap any exceptions
      * as {@link RuntimeCamelException} instances
      *

Modified: camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index (original)
+++ camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index Fri Sep 25 11:10:07 2009
@@ -18,6 +18,7 @@
 ArtixDSDataFormat
 BindyDataFormat
 BindyType
+CastorDataFormat
 CsvDataFormat
 DataFormatsDefinition
 FlatpackDataFormat

Added: camel/trunk/components/camel-castor/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/pom.xml?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/pom.xml (added)
+++ camel/trunk/components/camel-castor/pom.xml Fri Sep 25 11:10:07 2009
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-parent</artifactId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-castor</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Castor</name>
+  <description>Camel Castor support</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.dataformat.castor.*</camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>	  
+	<dependency>
+      <groupId>org.codehaus.castor</groupId>
+      <artifactId>castor-xml</artifactId>
+	  <version>1.3</version>
+    </dependency>
+	<dependency>
+      <groupId>org.codehaus.castor</groupId>
+      <artifactId>castor-core</artifactId>
+	  <version>1.3</version>
+    </dependency>
+    
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>      
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+  
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- to allow Spring annotations (jmx) to be tested -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <optional>true</optional>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aop</artifactId>
+      <optional>true</optional>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

Propchange: camel/trunk/components/camel-castor/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-castor/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java (added)
+++ camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,169 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.util.ObjectHelper;
+import org.exolab.castor.mapping.Mapping;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.XMLContext;
+
+/**
+ * An abstract class which implement <a
+ * href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
+ * interface which leverage the Castor library for XML marshaling and
+ * unmarshaling
+ *
+ * @version $Revision$
+ */
+public abstract class AbstractCastorDataFormat implements DataFormat {
+
+    /**
+     * The default encoding used for stream access.
+     */
+    public static final String DEFAULT_ENCODING = "UTF-8";
+
+    private String encoding = DEFAULT_ENCODING;
+    private XMLContext xmlContext;
+    private String mappingFile;
+    private String[] classNames;
+    private String[] packages;
+    private boolean validation;
+
+    private Marshaller marshaller;
+    private Unmarshaller unmarshaller;
+
+    public AbstractCastorDataFormat() {
+    }
+
+    public AbstractCastorDataFormat(XMLContext xmlContext) {
+        this.xmlContext = xmlContext;
+    }
+
+    public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
+        Writer writer = new OutputStreamWriter(outputStream, encoding);
+        getMarshaller(exchange).marshal(body, writer);
+    }
+
+    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
+        Reader reader = new InputStreamReader(inputStream);
+        return getUnmarshaller(exchange).unmarshal(reader);
+    }
+
+    public XMLContext getXmlContext(ClassResolver resolver) throws Exception {
+        if (xmlContext == null) {
+            xmlContext = new XMLContext();
+
+            if (ObjectHelper.isNotEmpty(getMappingFile())) {
+                Mapping xmlMap = new Mapping();
+                xmlMap.loadMapping(resolver.loadResourceAsURL(getMappingFile()));
+                xmlContext.addMapping(xmlMap);
+            }
+
+            if (getPackages() != null) {
+                xmlContext.addPackages(getPackages());
+            }
+            if (getClassNames() != null) {
+                for (String name : getClassNames()) {
+                    Class clazz = resolver.resolveClass(name);
+                    xmlContext.addClass(clazz);
+                }
+            }
+        }
+
+        return xmlContext;
+    }
+
+    public Unmarshaller getUnmarshaller(Exchange exchange) throws Exception {
+        if (this.unmarshaller == null) {
+            this.unmarshaller = getXmlContext(exchange.getContext().getClassResolver()).createUnmarshaller();
+            this.unmarshaller.setValidation(isValidation());
+        }
+        return this.unmarshaller;
+    }
+
+    public Marshaller getMarshaller(Exchange exchange) throws Exception {
+        if (this.marshaller == null) {
+            this.marshaller = getXmlContext(exchange.getContext().getClassResolver()).createMarshaller();
+            this.marshaller.setValidation(isValidation());
+        }
+        return this.marshaller;
+    }
+
+    public void setXmlContext(XMLContext xmlContext) {
+        this.xmlContext = xmlContext;
+    }
+
+    public String getMappingFile() {
+        return mappingFile;
+    }
+
+    public void setMappingFile(String mappingFile) {
+        this.mappingFile = mappingFile;
+    }
+
+    public void setMarshaller(Marshaller marshaller) {
+        this.marshaller = marshaller;
+    }
+
+    public void setUnmarshaller(Unmarshaller unmarshaller) {
+        this.unmarshaller = unmarshaller;
+    }
+
+    public String[] getClassNames() {
+        return classNames;
+    }
+
+    public void setClassNames(String[] classNames) {
+        this.classNames = classNames;
+    }
+
+    public String[] getPackages() {
+        return packages;
+    }
+
+    public void setPackages(String[] packages) {
+        this.packages = packages;
+    }
+
+    public String getEncoding() {
+        return encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public boolean isValidation() {
+        return validation;
+    }
+
+    public void setValidation(boolean validation) {
+        this.validation = validation;
+    }
+
+}

Propchange: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java (added)
+++ camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import org.apache.camel.spi.DataFormat;
+import org.exolab.castor.xml.XMLContext;
+
+/**
+ * A <a href="http://camel.apache.org/data-format.html">data format</a>
+ * ({@link DataFormat}) using Castor to marshal to and from XML
+ *
+ * @version $Revision$
+ */
+public class CastorDataFormat extends AbstractCastorDataFormat {
+
+    public CastorDataFormat() {
+    }
+
+    public CastorDataFormat(XMLContext xmlContext) {
+        super(xmlContext);
+    }
+
+}

Propchange: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/CastorDataFormat.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt (added)
+++ camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt Fri Sep 25 11:10:07 2009
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Propchange: camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt (added)
+++ camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt Fri Sep 25 11:10:07 2009
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

Propchange: camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java (added)
+++ camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ * Marhsal tests with domain objects.
+ */
+public class MarshalDomainObjectTest extends CamelTestSupport {
+
+    @Test
+    public void testMarshalDomainObject() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+
+        PurchaseOrder order = new PurchaseOrder();
+        order.setName("Tiger");
+        order.setAmount(1);
+        order.setPrice(99.95);
+
+        template.sendBody("direct:in", order);
+
+        mock.assertIsSatisfied();
+    }
+
+    @Test
+    public void testMarshalDomainObjectTwice() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(2);
+
+        PurchaseOrder order = new PurchaseOrder();
+        order.setName("Tiger");
+        order.setAmount(1);
+        order.setPrice(99.95);
+
+        template.sendBody("direct:in", order);
+        template.sendBody("direct:in", order);
+
+        mock.assertIsSatisfied();
+
+        String body1 = mock.getExchanges().get(0).getIn().getBody(String.class);
+        String body2 = mock.getExchanges().get(1).getIn().getBody(String.class);
+        assertEquals("The body should marshalled to the same", body1, body2);
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:in").marshal().castor().to("mock:result");
+                from("direct:marshal").marshal().castor();
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalDomainObjectTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java (added)
+++ camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ * Marhsal tests with domain objects.
+ */
+public class MarshalWithMappingDomainObjectTest extends CamelTestSupport {
+
+    @Test
+    public void testMarshalDomainObject() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:marshal");
+        mock.expectedMessageCount(1);
+
+        Student student = new Student();
+        student.setStuName("Dilshan");
+        student.setStuAge(25);
+        template.sendBody("direct:marshal", student);
+
+        mock.assertIsSatisfied();
+    }
+
+    @Test
+    public void testUnmarshalDomainObject() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:unmarshal");
+        mock.expectedMessageCount(1);
+
+        String xml = "<student><name>Sagara Gunathunga</name><age>27</age></student>";
+        template.sendBody("direct:unmarshal", xml);
+
+        Student student = new Student();
+        student.setStuName("Sagara Gunathunga");
+        student.setStuAge(27);
+
+        mock.assertIsSatisfied();
+        mock.message(0).body().isInstanceOf(Student.class);
+        mock.message(0).body().equals(student);
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+
+                CastorDataFormat myformat = new CastorDataFormat();
+                myformat.setMappingFile("map.xml");
+
+                myformat.setValidation(true);
+                from("direct:marshal").marshal(myformat).to("mock:marshal");
+                from("direct:unmarshal").unmarshal(myformat).to("mock:unmarshal");
+
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/MarshalWithMappingDomainObjectTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java (added)
+++ camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import org.apache.camel.util.ObjectHelper;
+
+public class PurchaseOrder {
+    private String name;
+    private double price;
+    private double amount;
+
+    @Override
+    public String toString() {
+        return "PurchaseOrder[name: " + name + " amount: " + amount
+                + " price: " + price + "]";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof PurchaseOrder) {
+            PurchaseOrder that = (PurchaseOrder) o;
+            return ObjectHelper.equal(this.name, that.name)
+                    && ObjectHelper.equal(this.amount, that.amount)
+                    && ObjectHelper.equal(this.price, that.price);
+        }
+        return false;
+    }
+
+    public int hashCode() {
+        return (int) (name.hashCode() + (price * 100) + (amount * 100));
+    }
+
+    public double getAmount() {
+        return amount;
+    }
+
+    public void setAmount(double amount) {
+        this.amount = amount;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public double getPrice() {
+        return price;
+    }
+
+    public void setPrice(double price) {
+        this.price = price;
+    }
+}

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/PurchaseOrder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java (added)
+++ camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Service;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringMarshalDomainObjectTest extends MarshalDomainObjectTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        setUseRouteBuilder(false);
+
+        final AbstractXmlApplicationContext applicationContext =
+                new ClassPathXmlApplicationContext("org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml");
+        setCamelContextService(new Service() {
+            public void start() throws Exception {
+                applicationContext.start();
+            }
+
+            public void stop() throws Exception {
+                applicationContext.stop();
+            }
+        });
+
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+}

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java (added)
+++ camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java Fri Sep 25 11:10:07 2009
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.castor;
+
+public class Student {
+    private String stuName;
+    private Integer stuAge;
+
+    public Integer getStuAge() {
+        return stuAge;
+    }
+
+    public void setStuAge(Integer stuAge) {
+        this.stuAge = stuAge;
+    }
+
+    public String getStuName() {
+        return stuName;
+    }
+
+    public void setStuName(String stuName) {
+        this.stuName = stuName;
+    }
+
+    @Override
+    public String toString() {
+        return "Name : " + getStuName();
+    }
+
+}

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/Student.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-castor/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/resources/log4j.properties?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-castor/src/test/resources/log4j.properties Fri Sep 25 11:10:07 2009
@@ -0,0 +1,37 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, out
+
+log4j.logger.org.apache.activemq.spring=WARN
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/camel-castor-test.log
+log4j.appender.out.append=true
+
+#log4j.logger.org.apache.camel=DEBUG

Propchange: camel/trunk/components/camel-castor/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-castor/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-castor/src/test/resources/map.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/resources/map.xml?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/resources/map.xml (added)
+++ camel/trunk/components/camel-castor/src/test/resources/map.xml Fri Sep 25 11:10:07 2009
@@ -0,0 +1,47 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<mapping>
+  <class name="org.apache.camel.dataformat.castor.Student" auto-complete="false">
+    <description>Default mapping </description>
+    <map-to xml="student"/>
+    <field name="stuName" 
+    	   type="string" 
+    	   required="false"                          
+           direct="false"
+           transient="false"                       
+           get-method="getStuName"
+           set-method="setStuName">
+           
+          <bind-xml name="name" 
+          			node="element"/>
+           <sql name="name" type="char"/>
+    </field>
+    
+    <field name="stuAge" 
+    	   type="integer" 
+    	   required="false"
+           direct="false" 
+           transient="false"  
+           get-method="getStuAge"
+           set-method="setStuAge">
+           
+      <bind-xml name="age" 
+                node="element"/>
+      <sql name="name" type="numeric"/>
+    </field>
+  </class>
+  </mapping>
\ No newline at end of file

Propchange: camel/trunk/components/camel-castor/src/test/resources/map.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/resources/map.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-castor/src/test/resources/map.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml?rev=818818&view=auto
==============================================================================
--- camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml (added)
+++ camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml Fri Sep 25 11:10:07 2009
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+      
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">        
+       
+        <dataFormats>
+            <castor id="castor"/>
+        </dataFormats>
+
+        <route>
+            <from uri="direct:in"/>
+            <marshal ref="castor"/>
+            <to uri="mock:result"/>			
+        </route>
+
+        <route>
+            <from uri="direct:marshal"/>
+            <marshal ref="castor"/>
+        </route>
+
+    </camelContext>   
+
+
+</beans>

Propchange: camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-castor/src/test/resources/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Fri Sep 25 11:10:07 2009
@@ -36,6 +36,7 @@
     <module>camel-bindy</module>
     <module>camel-cometd</module>
     <module>camel-cache</module>
+    <module>camel-castor</module>
     <module>camel-csv</module>
     <module>camel-cxf</module>
     <module>camel-flatpack</module>

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=818818&r1=818817&r2=818818&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Fri Sep 25 11:10:07 2009
@@ -183,6 +183,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-castor</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-cometd</artifactId>
         <version>${project.version}</version>
       </dependency>