camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1154743 [2/3] - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/ camel-core/src/main/java/org/apache/camel/component/validator/ camel-core/src/main/java/org/apache/camel/component/xslt/ camel-core/src/main/java/org/apa...
Date Sun, 07 Aug 2011 18:24:05 GMT
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltReferenceParameterTest.java Sun Aug  7 18:24:01 2011
@@ -0,0 +1,90 @@
+/**
+ * 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.component.xslt;
+
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.TestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.builder.xml.XsltBuilder;
+import org.apache.camel.converter.jaxp.XmlConverter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.impl.ProcessorEndpoint;
+import org.apache.camel.util.jndi.JndiContext;
+
+/**
+ *
+ */
+public class XsltReferenceParameterTest extends TestSupport {
+
+    private static final String TEST_URI_1 =
+        "xslt:org/apache/camel/component/xslt/transform.xsl?converter=#testConverter&transformerFactory=#testTransformerFactory";
+    private static final String TEST_URI_2 =
+        "xslt:org/apache/camel/component/xslt/transform.xsl?converter=testConverter&transformerFactory=testTransformerFactory";
+
+    private TestConverter testConverter;
+    private TransformerFactory testTransformerFactory;
+
+    private XsltBuilder builder1;
+    private XsltBuilder builder2;
+
+    public void setUp() throws Exception {
+        JndiRegistry registry = new JndiRegistry(new JndiContext());
+        RouteBuilder builder = createRouteBuilder();
+        CamelContext context = new DefaultCamelContext(registry);
+
+        testConverter = new TestConverter();
+        testTransformerFactory = TransformerFactory.newInstance();
+
+        registry.bind("testConverter", testConverter);
+        registry.bind("testTransformerFactory", testTransformerFactory);
+
+        ProcessorEndpoint pep1 = (ProcessorEndpoint)context.getEndpoint(TEST_URI_1);
+        ProcessorEndpoint pep2 = (ProcessorEndpoint)context.getEndpoint(TEST_URI_2);
+
+        builder1 = (XsltBuilder)pep1.getProcessor();
+        builder2 = (XsltBuilder)pep2.getProcessor();
+
+        context.addRoutes(builder);
+        context.start();
+    }
+
+    public void testConverterReference() {
+        assertSame(testConverter, builder1.getConverter());
+        assertSame(testConverter, builder2.getConverter());
+    }
+
+    public void testTransformerFactoryReference() {
+        assertSame(testTransformerFactory, builder1.getConverter().getTransformerFactory());
+        assertSame(testTransformerFactory, builder2.getConverter().getTransformerFactory());
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:a").to(TEST_URI_1);
+                from("direct:b").to(TEST_URI_2);
+            }
+        };
+    }
+
+    private static class TestConverter extends XmlConverter {
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java Sun Aug  7 18:24:01 2011
@@ -0,0 +1,40 @@
+/**
+ * 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.component.xslt;
+
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class XsltRouteFileTest extends XsltRouteTest {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("xslt:file:src/test/resources/org/apache/camel/component/xslt/transform.xsl")
+                    .multicast()
+                        .beanRef("testBean")
+                        .to("mock:result");
+            }
+        };
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java Sun Aug  7 18:24:01 2011
@@ -0,0 +1,78 @@
+/**
+ * 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.component.xslt;
+
+import java.util.List;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ *
+ */
+public class XsltRouteTest extends ContextTestSupport {
+
+    public void testSendMessageAndHaveItTransformed() throws Exception {
+        MockEndpoint endpoint = getMockEndpoint("mock:result");
+        endpoint.expectedMessageCount(1);
+
+        template.sendBody("direct:start",
+                "<mail><subject>Hey</subject><body>Hello world!</body></mail>");
+
+        assertMockEndpointsSatisfied();
+
+        List<Exchange> list = endpoint.getReceivedExchanges();
+        Exchange exchange = list.get(0);
+        String xml = exchange.getIn().getBody(String.class);
+
+        assertNotNull("The transformed XML should not be null", xml);
+        assertTrue(xml.indexOf("transformed") > -1);
+        // the cheese tag is in the transform.xsl
+        assertTrue(xml.indexOf("cheese") > -1);
+        assertTrue(xml.indexOf("<subject>Hey</subject>") > -1);
+        assertTrue(xml.indexOf("<body>Hello world!</body>") > -1);
+
+        TestBean bean = context.getRegistry().lookup("testBean", TestBean.class);
+        assertNotNull(bean);
+        assertEquals("bean.subject", "Hey", bean.getSubject());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("xslt:org/apache/camel/component/xslt/transform.xsl")
+                    .multicast()
+                        .beanRef("testBean")
+                        .to("mock:result");
+            }
+        };
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("testBean", new TestBean());
+        return jndi;
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java Sun Aug  7 18:24:01 2011
@@ -0,0 +1,65 @@
+/**
+ * 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.component.xslt;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ *
+ */
+public class XsltTransformingExceptionTest extends ContextTestSupport {
+    private static final String GOOD_XML_STRING = "<name>Camel</name>";
+    private static final String BAD_XML_STRING = "<staff><programmer></programmer></staff>";
+
+    public void testXsltException() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(0);
+        try {
+            template.sendBody("direct:start", BAD_XML_STRING);
+            fail("Except a camel Execution exception here");
+        } catch (CamelExecutionException ex) {
+            assertTrue(ex.getCause() instanceof javax.xml.transform.TransformerException);
+            assertTrue(ex.getCause().getCause() instanceof IllegalArgumentException);
+        }
+        // we should not get any message from the result endpoint
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testXsltWithoutException() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().contains("Camel");
+        template.sendBody("direct:start", GOOD_XML_STRING);
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("xslt:org/apache/camel/component/xslt/transformCallEcho.xsl")
+                    .to("mock:result");
+            }
+        };
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java Sun Aug  7 18:24:01 2011
@@ -0,0 +1,133 @@
+/**
+ * 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.util;
+
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.TestSupport;
+import org.apache.camel.impl.DefaultCamelContext;
+
+/**
+ *
+ */
+public class ResourceHelperTest extends TestSupport {
+
+    public void testLoadFile() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "file:src/test/resources/log4j.properties");
+        assertNotNull(is);
+
+        String text = context.getTypeConverter().convertTo(String.class, is);
+        assertNotNull(text);
+        assertTrue(text.contains("log4j"));
+        is.close();
+
+        context.stop();
+    }
+
+    public void testLoadClasspath() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "classpath:log4j.properties");
+        assertNotNull(is);
+
+        String text = context.getTypeConverter().convertTo(String.class, is);
+        assertNotNull(text);
+        assertTrue(text.contains("log4j"));
+        is.close();
+
+        context.stop();
+    }
+
+    public void testLoadClasspathDefault() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "log4j.properties");
+        assertNotNull(is);
+
+        String text = context.getTypeConverter().convertTo(String.class, is);
+        assertNotNull(text);
+        assertTrue(text.contains("log4j"));
+        is.close();
+
+        context.stop();
+    }
+
+    public void testLoadFileNotFound() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        try {
+            ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "file:src/test/resources/notfound.txt");
+            fail("Should not find file");
+        } catch (FileNotFoundException e) {
+            assertEquals("src/test/resources/notfound.txt (No such file or directory)", e.getMessage());
+        }
+
+        context.stop();
+    }
+
+    public void testLoadClasspathNotFound() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        try {
+            ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "classpath:notfound.txt");
+            fail("Should not find file");
+        } catch (FileNotFoundException e) {
+            assertEquals("Cannot find resource in classpath for URI: notfound.txt", e.getMessage());
+        }
+
+        context.stop();
+    }
+
+    public void testLoadFileAsUrl() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "file:src/test/resources/log4j.properties");
+        assertNotNull(url);
+
+        String text = context.getTypeConverter().convertTo(String.class, url);
+        assertNotNull(text);
+        assertTrue(text.contains("log4j"));
+
+        context.stop();
+    }
+
+    public void testLoadClasspathAsUrl() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.start();
+
+        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "classpath:log4j.properties");
+        assertNotNull(url);
+
+        String text = context.getTypeConverter().convertTo(String.class, url);
+        assertNotNull(text);
+        assertTrue(text.contains("log4j"));
+
+        context.stop();
+    }
+
+}

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/staff_other_template.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/staff_other_template.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/staff_other_template.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/staff_other_template.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+    <xsl:template match="age">
+        AGE:
+        <span style="color:yellow;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/schema.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/schema.xsd?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/schema.xsd (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/schema.xsd Sun Aug  7 18:24:01 2011
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+    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.
+-->
+<xs:schema elementFormDefault="qualified" version="1.0"
+           targetNamespace="http://foo.com/bar"
+           xmlns:tns="http://foo.com/bar"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+
+  <xs:element name="mail">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="subject" type="xs:string"/>
+        <xs:element name="body" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+</xs:schema>
+

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/example.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/example.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/example.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/example.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,26 @@
+<?xml version = "1.0"?>
+<!--
+  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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:template match="/">
+    <goodbye>
+      <xsl:value-of select="/hello"/>
+    </goodbye>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/invalid.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/invalid.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/invalid.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/invalid.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    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.
+
+-->
+<xsl:stylesheet
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+  xmlns:xs='http://www.w3.org/2001/XMLSchema'
+  version='1.0'>
+
+  <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
+
+
+  <xsl:template match="/">
+    <transformed>
+
+      <!-- adjust-dateTime-to-timezone not known to the XSLT parser,
+           will cause it raise an exception but no error logged by
+           camel and deployment will proceed instead of failing.
+      -->
+      <xsl:value-of select="adjust-dateTime-to-timezone(xs:dateTime($datetimemod), xs:dayTimeDuration('-PT6H'))" />
+
+      <xsl:copy>
+        <xsl:copy-of select="attribute::*"/>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </transformed>
+  </xsl:template>
+
+  <xsl:template match="node() | @*">
+    <xsl:copy>
+      <xsl:apply-templates select="node() | @*"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:include href="file:src/test/resources/org/apache/camel/component/xslt/staff_template.xsl"/>
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_classpath.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_classpath.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_classpath.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_classpath.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:include href="classpath:org/apache/camel/component/xslt/staff_template.xsl"/>
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:include href="staff_template.xsl"/>
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative_other.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative_other.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative_other.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_include_relative_other.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:include href="../staff_other_template.xsl"/>
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+    <xsl:template match="name">
+        <span style="font-size=22px;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="dob">
+        DOB:
+        <span style="color:blue;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="age">
+        AGE:
+        <span style="color:green;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transform.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transform.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transform.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transform.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<xsl:stylesheet
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+  version='1.0'>
+
+  <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
+
+  <xsl:template match="/">
+    <transformed subject="{/mail/subject}">
+      <cheese>
+        <xsl:apply-templates select="*|@*"/>
+      </cheese>
+    </transformed>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:copy-of select="attribute::*"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transformCallEcho.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transformCallEcho.xsl?rev=1154743&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transformCallEcho.xsl (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/xslt/transformCallEcho.xsl Sun Aug  7 18:24:01 2011
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<xsl:stylesheet
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+  version='1.0'
+  xmlns:echo="xalan://org.apache.camel.component.xslt.MyEcho"
+   exclude-result-prefixes="echo">
+
+  <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
+
+  <xsl:template match="/">
+    <transformed>
+      <cheese>
+        <xsl:value-of select="echo:echoString(string(name))"></xsl:value-of>
+      </cheese>
+    </transformed>
+  </xsl:template>
+
+</xsl:stylesheet>

Modified: camel/trunk/components/camel-flatpack/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/pom.xml (original)
+++ camel/trunk/components/camel-flatpack/pom.xml Sun Aug  7 18:24:01 2011
@@ -41,10 +41,6 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
-    </dependency>
     <!-- Using the servicemix wrapped one as the centrl mvn repo doesn't have one -->
     <dependency>
       <groupId>org.apache.servicemix.bundles</groupId>

Modified: camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DelimitedEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DelimitedEndpoint.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DelimitedEndpoint.java (original)
+++ camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DelimitedEndpoint.java Sun Aug  7 18:24:01 2011
@@ -17,14 +17,18 @@
 package org.apache.camel.component.flatpack;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 
 import net.sf.flatpack.Parser;
+import org.apache.camel.Component;
 import org.apache.camel.Exchange;
 import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.converter.IOConverter;
 import org.apache.camel.util.ExchangeHelper;
-import org.springframework.core.io.Resource;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
 
 /**
  * @version 
@@ -34,17 +38,22 @@ public class DelimitedEndpoint extends F
     private char textQualifier = '"';
     private boolean ignoreFirstRecord = true;
 
-    public DelimitedEndpoint(String uri, Resource resource) {
-        super(uri, resource);
+    public DelimitedEndpoint() {
+        super();
+    }
+
+    public DelimitedEndpoint(String endpointUri, Component component, String resourceUri) {
+        super(endpointUri, component, resourceUri);
     }
 
     public Parser createParser(Exchange exchange) throws InvalidPayloadException, IOException {
         Reader bodyReader = ExchangeHelper.getMandatoryInBody(exchange, Reader.class);
-        Resource resource = getResource();
-        if (resource == null) {
+        if (ObjectHelper.isEmpty(getDefinition())) {
             return getParserFactory().newDelimitedParser(bodyReader, delimiter, textQualifier);
         } else {
-            return getParserFactory().newDelimitedParser(new InputStreamReader(resource.getInputStream()), bodyReader, delimiter, textQualifier, ignoreFirstRecord);
+            InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), definition);
+            InputStreamReader reader = new InputStreamReader(is, IOConverter.getCharsetName(exchange));
+            return getParserFactory().newDelimitedParser(reader, bodyReader, delimiter, textQualifier, ignoreFirstRecord);
         }
     }
 

Modified: camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FixedLengthEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FixedLengthEndpoint.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FixedLengthEndpoint.java (original)
+++ camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FixedLengthEndpoint.java Sun Aug  7 18:24:01 2011
@@ -17,6 +17,7 @@
 package org.apache.camel.component.flatpack;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 
@@ -24,6 +25,7 @@ import net.sf.flatpack.DataSet;
 import net.sf.flatpack.DefaultParserFactory;
 import net.sf.flatpack.Parser;
 import net.sf.flatpack.ParserFactory;
+import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.InvalidPayloadException;
@@ -35,8 +37,7 @@ import org.apache.camel.processor.loadba
 import org.apache.camel.processor.loadbalancer.LoadBalancerConsumer;
 import org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer;
 import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.springframework.core.io.Resource;
+import org.apache.camel.util.ResourceHelper;
 
 /**
  * A <a href="http://flatpack.sourceforge.net/">Flatpack Endpoint</a>
@@ -45,14 +46,17 @@ import org.springframework.core.io.Resou
  * @version 
  */
 public class FixedLengthEndpoint extends DefaultPollingEndpoint {
-    private final Resource resource;
+    protected String definition;
     private LoadBalancer loadBalancer = new RoundRobinLoadBalancer();
     private ParserFactory parserFactory = DefaultParserFactory.getInstance();
     private boolean splitRows = true;
 
-    public FixedLengthEndpoint(String uri, Resource resource) {
-        super(uri);
-        this.resource = resource;
+    public FixedLengthEndpoint() {
+    }
+
+    public FixedLengthEndpoint(String endpointUri, Component component, String definition) {
+        super(endpointUri, component);
+        this.definition = definition;
     }
 
     public boolean isSingleton() {
@@ -81,21 +85,21 @@ public class FixedLengthEndpoint extends
     }
 
     public Parser createParser(Exchange exchange) throws InvalidPayloadException, IOException {
-        Resource resource = getResource();
-        ObjectHelper.notNull(resource, "resource");
         Reader bodyReader = ExchangeHelper.getMandatoryInBody(exchange, Reader.class);
-        return createParser(resource, bodyReader);
+        return createParser(getDefinition(), bodyReader);
     }
 
-    protected Parser createParser(Resource resource, Reader bodyReader) throws IOException {
-        return getParserFactory().newFixedLengthParser(new InputStreamReader(resource.getInputStream()), bodyReader);
+    protected Parser createParser(String resourceUri, Reader bodyReader) throws IOException {
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), resourceUri);
+        InputStreamReader reader = new InputStreamReader(is);
+        return getParserFactory().newFixedLengthParser(reader, bodyReader);
     }
 
     // Properties
     //-------------------------------------------------------------------------
 
-    public Resource getResource() {
-        return resource;
+    public String getDefinition() {
+        return definition;
     }
 
     public ParserFactory getParserFactory() {

Modified: camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackComponent.java (original)
+++ camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackComponent.java Sun Aug  7 18:24:01 2011
@@ -19,9 +19,7 @@ package org.apache.camel.component.flatp
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.ResourceBasedComponent;
-import org.apache.camel.util.ObjectHelper;
-import org.springframework.core.io.Resource;
+import org.apache.camel.impl.DefaultComponent;
 
 /**
  * A <a href="http://flatpack.sourceforge.net/">Flatpack Component</a>
@@ -29,7 +27,7 @@ import org.springframework.core.io.Resou
  *
  * @version 
  */
-public class FlatpackComponent extends ResourceBasedComponent {
+public class FlatpackComponent extends DefaultComponent {
 
     public static final String HEADER_ID = "header";
     public static final String TRAILER_ID = "trailer";
@@ -46,20 +44,13 @@ public class FlatpackComponent extends R
             // to differentiate different named delimited endpoints
             remaining = "";
         }
-        Resource resource = null;
-        if (fixed) {
-            resource = resolveMandatoryResource(remaining);
-        } else {
-            if (ObjectHelper.isNotEmpty(remaining)) {
-                resource = getResourceLoader().getResource(remaining);
-            }
-        }
-        log.debug("{} using flatpack map resource: {}", this, resource);
+
+        String resourceUri = remaining;
         FixedLengthEndpoint answer;
         if (fixed) {
-            answer = new FixedLengthEndpoint(uri, resource);
+            answer = new FixedLengthEndpoint(uri, this, resourceUri);
         } else {
-            answer = new DelimitedEndpoint(uri, resource);
+            answer = new DelimitedEndpoint(uri, this, resourceUri);
         }
         answer.setCamelContext(getCamelContext());
         setProperties(answer, parameters);

Modified: camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackDataFormat.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackDataFormat.java (original)
+++ camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackDataFormat.java Sun Aug  7 18:24:01 2011
@@ -37,10 +37,10 @@ import org.apache.camel.Exchange;
 import org.apache.camel.converter.IOConverter;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
 import org.jdom.JDOMException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.core.io.Resource;
 
 /**
  * Flatpack DataFormat.
@@ -60,8 +60,8 @@ public class FlatpackDataFormat implemen
     private char delimiter = ',';
     private char textQualifier = '"';
     private boolean ignoreFirstRecord = true;
-    private Resource definition;
     private boolean fixed;
+    private String definition;
 
     @SuppressWarnings("unchecked")
     public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
@@ -110,6 +110,14 @@ public class FlatpackDataFormat implemen
     // Properties
     //-------------------------------------------------------------------------
 
+    public String getDefinition() {
+        return definition;
+    }
+
+    public void setDefinition(String definition) {
+        this.definition = definition;
+    }
+
     public boolean isFixed() {
         return fixed;
     }
@@ -142,14 +150,6 @@ public class FlatpackDataFormat implemen
         this.textQualifier = textQualifier;
     }
 
-    public Resource getDefinition() {
-        return definition;
-    }
-
-    public void setDefinition(Resource definition) {
-        this.definition = definition;
-    }
-
     public ParserFactory getParserFactory() {
         return parserFactory;
     }
@@ -163,39 +163,41 @@ public class FlatpackDataFormat implemen
 
     protected Parser createParser(Exchange exchange, Reader bodyReader) throws IOException {
         if (isFixed()) {
-            Resource resource = getDefinition();
-            ObjectHelper.notNull(resource, "resource");
-            return getParserFactory().newFixedLengthParser(new InputStreamReader(resource.getInputStream(), IOConverter.getCharsetName(exchange)), bodyReader);
+            InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext().getClassResolver(), getDefinition());
+            InputStreamReader reader = new InputStreamReader(is, IOConverter.getCharsetName(exchange));
+            return getParserFactory().newFixedLengthParser(reader, bodyReader);
         } else {
-            Resource resource = getDefinition();
-            if (resource == null) {
+            if (ObjectHelper.isEmpty(getDefinition())) {
                 return getParserFactory().newDelimitedParser(bodyReader, delimiter, textQualifier);
             } else {
-                return getParserFactory().newDelimitedParser(new InputStreamReader(resource.getInputStream(), IOConverter.getCharsetName(exchange)), 
-                                                             bodyReader, delimiter, textQualifier, ignoreFirstRecord);
+                InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext().getClassResolver(), getDefinition());
+                InputStreamReader reader = new InputStreamReader(is, IOConverter.getCharsetName(exchange));
+                return getParserFactory().newDelimitedParser(reader, bodyReader, delimiter, textQualifier, ignoreFirstRecord);
             }
         }
     }
 
     private Writer createWriter(Exchange exchange, Map<String, Object> firstRow, OutputStream stream) throws JDOMException, IOException {
         if (isFixed()) {
-            Resource resource = getDefinition();
-            ObjectHelper.notNull(resource, "resource");
-            FixedWriterFactory factory = new FixedWriterFactory(new InputStreamReader(resource.getInputStream(), IOConverter.getCharsetName(exchange)));
+            InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext().getClassResolver(), getDefinition());
+            InputStreamReader reader = new InputStreamReader(is, IOConverter.getCharsetName(exchange));
+            FixedWriterFactory factory = new FixedWriterFactory(reader);
             return factory.createWriter(new OutputStreamWriter(stream, IOConverter.getCharsetName(exchange)));
         } else {
-            Resource resource = getDefinition();
-            if (resource == null) {
+            if (getDefinition() == null) {
                 DelimiterWriterFactory factory = new DelimiterWriterFactory(delimiter, textQualifier);
-                // add coulmns from the keys in the data map as the columns must be known
+                // add columns from the keys in the data map as the columns must be known
                 for (String key : firstRow.keySet()) {
                     factory.addColumnTitle(key);
                 }
                 return factory.createWriter(new OutputStreamWriter(stream, IOConverter.getCharsetName(exchange)));
             } else {
-                DelimiterWriterFactory factory = new DelimiterWriterFactory(new InputStreamReader(resource.getInputStream(), IOConverter.getCharsetName(exchange)), delimiter, textQualifier);
+                InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext().getClassResolver(), getDefinition());
+                InputStreamReader reader = new InputStreamReader(is, IOConverter.getCharsetName(exchange));
+                DelimiterWriterFactory factory = new DelimiterWriterFactory(reader, delimiter, textQualifier);
                 return factory.createWriter(new OutputStreamWriter(stream, IOConverter.getCharsetName(exchange)));
             }
         }
     }
+
 }

Modified: camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedWithNoDescriptorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedWithNoDescriptorTest.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedWithNoDescriptorTest.java (original)
+++ camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedWithNoDescriptorTest.java Sun Aug  7 18:24:01 2011
@@ -33,6 +33,7 @@ import org.springframework.test.context.
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
 /**
  * @version 
  */

Modified: camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackDelimitedDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackDelimitedDataFormatTest.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackDelimitedDataFormatTest.java (original)
+++ camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackDelimitedDataFormatTest.java Sun Aug  7 18:24:01 2011
@@ -28,7 +28,6 @@ import org.apache.camel.converter.IOConv
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.CastUtils;
 import org.junit.Test;
-import org.springframework.core.io.ClassPathResource;
 
 /**
  * Unit test for delimited DataFormat.
@@ -108,7 +107,7 @@ public class FlatpackDelimitedDataFormat
         return new RouteBuilder() {
             public void configure() throws Exception {
                 FlatpackDataFormat df = new FlatpackDataFormat();
-                df.setDefinition(new ClassPathResource("INVENTORY-Delimited.pzmap.xml"));
+                df.setDefinition("INVENTORY-Delimited.pzmap.xml");
 
                 from("direct:unmarshal").unmarshal(df).to("mock:unmarshal");
 

Modified: camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthDataFormatTest.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthDataFormatTest.java (original)
+++ camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthDataFormatTest.java Sun Aug  7 18:24:01 2011
@@ -28,7 +28,6 @@ import org.apache.camel.converter.IOConv
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.CastUtils;
 import org.junit.Test;
-import org.springframework.core.io.ClassPathResource;
 
 /**
  * Unit test for fixed length DataFormat.
@@ -81,7 +80,7 @@ public class FlatpackFixedLengthDataForm
         return new RouteBuilder() {
             public void configure() throws Exception {
                 FlatpackDataFormat df = new FlatpackDataFormat();
-                df.setDefinition(new ClassPathResource("PEOPLE-FixedLength.pzmap.xml"));
+                df.setDefinition("PEOPLE-FixedLength.pzmap.xml");
                 df.setFixed(true);
                 df.setIgnoreFirstRecord(false);
 

Modified: camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthWithHeaderAndTrailerDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthWithHeaderAndTrailerDataFormatTest.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthWithHeaderAndTrailerDataFormatTest.java (original)
+++ camel/trunk/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FlatpackFixedLengthWithHeaderAndTrailerDataFormatTest.java Sun Aug  7 18:24:01 2011
@@ -25,7 +25,6 @@ import org.apache.camel.converter.IOConv
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.CastUtils;
 import org.junit.Test;
-import org.springframework.core.io.ClassPathResource;
 
 /**
  * Unit test for fixed length DataFormat.
@@ -71,7 +70,7 @@ public class FlatpackFixedLengthWithHead
         return new RouteBuilder() {
             public void configure() throws Exception {
                 FlatpackDataFormat df = new FlatpackDataFormat();
-                df.setDefinition(new ClassPathResource("PEOPLE-HeaderAndTrailer.pzmap.xml"));
+                df.setDefinition("PEOPLE-HeaderAndTrailer.pzmap.xml");
                 df.setFixed(true);
 
                 from("direct:unmarshal").unmarshal(df).to("mock:unmarshal");

Modified: camel/trunk/components/camel-flatpack/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-flatpack/src/test/resources/log4j.properties?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-flatpack/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-flatpack/src/test/resources/log4j.properties Sun Aug  7 18:24:01 2011
@@ -21,7 +21,7 @@
 log4j.rootLogger=INFO, out
 
 log4j.logger.org.springframework=WARN
-log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender

Modified: camel/trunk/components/camel-freemarker/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-freemarker/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-freemarker/pom.xml (original)
+++ camel/trunk/components/camel-freemarker/pom.xml Sun Aug  7 18:24:01 2011
@@ -42,10 +42,6 @@
             <artifactId>camel-core</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-spring</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.freemarker</groupId>
             <artifactId>freemarker</artifactId>
             <version>${freemarker-version}</version>

Modified: camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java (original)
+++ camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java Sun Aug  7 18:24:01 2011
@@ -23,13 +23,14 @@ import freemarker.cache.NullCacheStorage
 import freemarker.cache.URLTemplateLoader;
 import freemarker.template.Configuration;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.ResourceBasedComponent;
+import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
 
 /**
  * Freemarker component.
  */
-public class FreemarkerComponent extends ResourceBasedComponent {
+public class FreemarkerComponent extends DefaultComponent {
 
     private Configuration configuration;
     private Configuration noCacheConfiguration;
@@ -60,7 +61,13 @@ public class FreemarkerComponent extends
             configuration.setTemplateLoader(new URLTemplateLoader() {
                 @Override
                 protected URL getURL(String name) {
-                    return getResourceLoader().getClassLoader().getResource(name);
+                    try {
+                        return ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), name);
+                    } catch (Exception e) {
+                        // freemarker prefers to ask for locale first (eg xxx_en_GB, xxX_en), and then fallback without locale
+                        // so we should return null to signal the resource could not be found
+                        return null;
+                    }
                 }
             });
         }

Modified: camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerEndpoint.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerEndpoint.java (original)
+++ camel/trunk/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerEndpoint.java Sun Aug  7 18:24:01 2011
@@ -44,7 +44,7 @@ public class FreemarkerEndpoint extends 
     }
 
     public FreemarkerEndpoint(String uri, Component component, String resourceUri) {
-        super(uri, component, resourceUri, null);
+        super(uri, component, resourceUri);
     }
 
     @Override

Modified: camel/trunk/components/camel-ibatis/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ibatis/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-ibatis/pom.xml (original)
+++ camel/trunk/components/camel-ibatis/pom.xml Sun Aug  7 18:24:01 2011
@@ -42,14 +42,6 @@
       <artifactId>camel-core</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.ibatis</groupId>
       <artifactId>ibatis-sqlmap</artifactId>
       <version>2.3.4.726</version>
@@ -66,7 +58,6 @@
       <artifactId>hsqldb</artifactId>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
@@ -82,6 +73,7 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+
   </dependencies>
 
 </project>

Modified: camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java (original)
+++ camel/trunk/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisComponent.java Sun Aug  7 18:24:01 2011
@@ -18,13 +18,12 @@ package org.apache.camel.component.ibati
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.Map;
 
 import com.ibatis.sqlmap.client.SqlMapClient;
 import com.ibatis.sqlmap.client.SqlMapClientBuilder;
-import org.apache.camel.component.ResourceBasedComponent;
-import org.springframework.core.io.Resource;
+import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.ResourceHelper;
 
 /**
  * An <a href="http://camel.apache.org/ibatis.html>iBatis Component</a>
@@ -58,7 +57,7 @@ import org.springframework.core.io.Resou
  * @see IBatisProducer
  * @see IBatisConsumer
  */
-public class IBatisComponent extends ResourceBasedComponent {
+public class IBatisComponent extends DefaultComponent {
     private static final String DEFAULT_CONFIG_URI = "classpath:SqlMapConfig.xml";
     private SqlMapClient sqlMapClient;
     private String sqlMapConfig = DEFAULT_CONFIG_URI;
@@ -82,9 +81,8 @@ public class IBatisComponent extends Res
     }
 
     private SqlMapClient createSqlMapClient() throws IOException {
-        Resource resource = resolveMandatoryResource(sqlMapConfig);
-        InputStream is = resource.getInputStream();
-        return SqlMapClientBuilder.buildSqlMapClient(new InputStreamReader(is));
+        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), sqlMapConfig);
+        return SqlMapClientBuilder.buildSqlMapClient(is);
     }
 
     // Properties

Modified: camel/trunk/components/camel-jing/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jing/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-jing/pom.xml (original)
+++ camel/trunk/components/camel-jing/pom.xml Sun Aug  7 18:24:01 2011
@@ -39,7 +39,7 @@
 
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-spring</artifactId>
+            <artifactId>camel-core</artifactId>
         </dependency>
 
         <dependency>

Modified: camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingComponent.java (original)
+++ camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingComponent.java Sun Aug  7 18:24:01 2011
@@ -19,9 +19,8 @@ package org.apache.camel.component.valid
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.ResourceBasedComponent;
+import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.impl.ProcessorEndpoint;
-import org.springframework.core.io.Resource;
 
 /**
  * A component for validating XML payloads using the
@@ -29,12 +28,11 @@ import org.springframework.core.io.Resou
  *
  * @version 
  */
-public class JingComponent extends ResourceBasedComponent {
+public class JingComponent extends DefaultComponent {
+
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        JingValidator validator = new JingValidator();
-        Resource resource = resolveMandatoryResource(remaining);
-        validator.setSchemaResource(resource);
-        log.debug("{} using schema resource: {}", this, resource);
+        JingValidator validator = new JingValidator(getCamelContext());
+        validator.setResourceUri(remaining);
         configureValidator(validator, uri, remaining, parameters);
         return new ProcessorEndpoint(uri, this, validator);
     }

Modified: camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingValidator.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingValidator.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingValidator.java (original)
+++ camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/JingValidator.java Sun Aug  7 18:24:01 2011
@@ -18,7 +18,6 @@ package org.apache.camel.component.valid
 
 import java.io.IOException;
 import java.io.InputStream;
-
 import javax.xml.XMLConstants;
 import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXSource;
@@ -36,15 +35,14 @@ import com.thaiopensource.validate.Valid
 import com.thaiopensource.validate.Validator;
 import com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.validation.DefaultValidationErrorHandler;
 import org.apache.camel.util.ExchangeHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.core.io.Resource;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
 
 /**
  * A validator which uses the <a
@@ -54,14 +52,18 @@ import org.springframework.core.io.Resou
  * @version 
  */
 public class JingValidator implements Processor {
-    //private static final transient Logger LOG = LoggerFactory.getLogger(JingValidator.class);
+    private final CamelContext camelContext;
     private Schema schema;
     private SchemaFactory schemaFactory;
     private String schemaNamespace = XMLConstants.RELAXNG_NS_URI;
-    private Resource schemaResource;
+    private String resourceUri;
     private InputSource inputSource;
     private boolean compactSyntax;
 
+    public JingValidator(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
     public void process(Exchange exchange) throws Exception {
         Jaxp11XMLReaderCreator xmlCreator = new Jaxp11XMLReaderCreator();
         DefaultValidationErrorHandler errorHandler = new DefaultValidationErrorHandler();
@@ -94,6 +96,15 @@ public class JingValidator implements Pr
     // Properties
     // -------------------------------------------------------------------------
 
+
+    public String getResourceUri() {
+        return resourceUri;
+    }
+
+    public void setResourceUri(String resourceUri) {
+        this.resourceUri = resourceUri;
+    }
+
     public Schema getSchema() throws IOException, IncorrectSchemaException, SAXException {
         if (schema == null) {
             SchemaFactory factory = getSchemaFactory();
@@ -108,16 +119,9 @@ public class JingValidator implements Pr
 
     public InputSource getInputSource() throws IOException {
         if (inputSource == null) {
-            Resource resource = getSchemaResource();
-            if (resource == null) {
-                throw new IllegalArgumentException("No schemaResource or inputSource specified");
-            } else {
-                InputStream inputStream = resource.getInputStream();
-                if (inputStream == null) {
-                    throw new IllegalArgumentException("No inputStream available for: " + resource);
-                }
-                inputSource = new InputSource(inputStream);
-            }
+            ObjectHelper.notEmpty(resourceUri, "resourceUri", this);
+            InputStream inputStream = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext.getClassResolver(), resourceUri);
+            inputSource = new InputSource(inputStream);
         }
         return inputSource;
     }
@@ -139,14 +143,6 @@ public class JingValidator implements Pr
         this.schemaFactory = schemaFactory;
     }
 
-    public Resource getSchemaResource() {
-        return schemaResource;
-    }
-
-    public void setSchemaResource(Resource schemaResource) {
-        this.schemaResource = schemaResource;
-    }
-
     public String getSchemaNamespace() {
         return schemaNamespace;
     }

Modified: camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/RelaxNGCompactSyntaxComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/RelaxNGCompactSyntaxComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/RelaxNGCompactSyntaxComponent.java (original)
+++ camel/trunk/components/camel-jing/src/main/java/org/apache/camel/component/validator/jing/RelaxNGCompactSyntaxComponent.java Sun Aug  7 18:24:01 2011
@@ -26,6 +26,7 @@ import java.util.Map;
  * @version 
  */
 public class RelaxNGCompactSyntaxComponent extends JingComponent {
+
     protected void configureValidator(JingValidator validator, String uri, String remaining, Map<String, Object> parameters) throws Exception {
         validator.setCompactSyntax(true);
         super.configureValidator(validator, uri, remaining, parameters);

Modified: camel/trunk/components/camel-msv/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-msv/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-msv/pom.xml (original)
+++ camel/trunk/components/camel-msv/pom.xml Sun Aug  7 18:24:01 2011
@@ -47,7 +47,7 @@
 
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
+      <artifactId>camel-core</artifactId>
     </dependency>
     <dependency>
       <groupId>org.iso_relax.verifier.jaxp.validation</groupId>

Modified: camel/trunk/components/camel-msv/src/main/java/org/apache/camel/component/validator/msv/MsvComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-msv/src/main/java/org/apache/camel/component/validator/msv/MsvComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-msv/src/main/java/org/apache/camel/component/validator/msv/MsvComponent.java (original)
+++ camel/trunk/components/camel-msv/src/main/java/org/apache/camel/component/validator/msv/MsvComponent.java Sun Aug  7 18:24:01 2011
@@ -17,12 +17,10 @@
 package org.apache.camel.component.validator.msv;
 
 import java.util.Map;
-
 import javax.xml.XMLConstants;
 
-import org.apache.camel.component.validator.SpringValidator;
 import org.apache.camel.component.validator.ValidatorComponent;
-
+import org.apache.camel.processor.validation.ValidatingProcessor;
 import org.iso_relax.verifier.VerifierConfigurationException;
 import org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl;
 
@@ -46,7 +44,8 @@ public class MsvComponent extends Valida
         this.schemaFactory = schemaFactory;
     }
 
-    protected void configureValidator(SpringValidator validator, String uri, String remaining, Map<String, Object> parameters) throws Exception {
+    @Override
+    protected void configureValidator(ValidatingProcessor validator, String uri, String remaining, Map<String, Object> parameters) throws Exception {
         validator.setSchemaLanguage(XMLConstants.RELAXNG_NS_URI);
         validator.setSchemaFactory(getSchemaFactory());
         // must use Dom for Msv to work

Modified: camel/trunk/components/camel-saxon/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-saxon/pom.xml?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-saxon/pom.xml (original)
+++ camel/trunk/components/camel-saxon/pom.xml Sun Aug  7 18:24:01 2011
@@ -48,7 +48,7 @@
 
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
+      <artifactId>camel-core</artifactId>
     </dependency>
 
     <dependency>

Modified: camel/trunk/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java?rev=1154743&r1=1154742&r2=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java (original)
+++ camel/trunk/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java Sun Aug  7 18:24:01 2011
@@ -21,22 +21,27 @@ import java.util.Map;
 
 import net.sf.saxon.query.ModuleURIResolver;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.ResourceBasedComponent;
+import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.impl.ProcessorEndpoint;
-import org.springframework.core.io.Resource;
+import org.apache.camel.util.ResourceHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * An <a href="http://camel.apache.org/xquery.html">XQuery Component</a>
  * for performing transforming messages
  */
-public class XQueryComponent extends ResourceBasedComponent {
+public class XQueryComponent extends DefaultComponent {
 
+    private static final transient Logger LOG = LoggerFactory.getLogger(XQueryComponent.class);
     private ModuleURIResolver moduleURIResolver = new XQueryModuleURIResolver(this);
 
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        Resource resource = resolveMandatoryResource(remaining);
-        log.debug("{} using schema resource: {}", this, resource);
-        XQueryBuilder xslt = XQueryBuilder.xquery(resource.getURL());
+        String resourceUri = remaining;
+        URL url = resolveModuleResource(resourceUri);
+        LOG.debug("{} using schema resource: {}", this, resourceUri);
+
+        XQueryBuilder xslt = XQueryBuilder.xquery(url);
         xslt.setModuleURIResolver(getModuleURIResolver());
         configureXslt(xslt, uri, remaining, parameters);
         return new ProcessorEndpoint(uri, this, xslt);
@@ -47,7 +52,7 @@ public class XQueryComponent extends Res
     }
 
     public URL resolveModuleResource(String uri) throws Exception {
-        return resolveMandatoryResource(uri).getURL();
+        return ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), uri);
     }
 
     public ModuleURIResolver getModuleURIResolver() {

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java (from r1154680, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/ValidatorRouteTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/ValidatorRouteTest.java&r1=1154680&r2=1154743&rev=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/ValidatorRouteTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java Sun Aug  7 18:24:01 2011
@@ -16,53 +16,17 @@
  */
 package org.apache.camel.component.validator;
 
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.SpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.camel.CamelContext;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
  * @version 
  */
-public class ValidatorRouteTest extends SpringTestSupport {
-    protected MockEndpoint validEndpoint;
-    protected MockEndpoint finallyEndpoint;
-    protected MockEndpoint invalidEndpoint;
-
-    public void testValidMessage() throws Exception {
-        validEndpoint.expectedMessageCount(1);
-        finallyEndpoint.expectedMessageCount(1);
-
-        template.sendBody("direct:start",
-                "<mail xmlns='http://foo.com/bar'><subject>Hey</subject><body>Hello world!</body></mail>");
-
-        MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
-    }
-
-    public void testInvalidMessage() throws Exception {
-        invalidEndpoint.expectedMessageCount(1);
-        finallyEndpoint.expectedMessageCount(1);
-
-        template.sendBody("direct:start",
-                "<mail xmlns='http://foo.com/bar'><body>Hello world!</body></mail>");
+public class SpringValidatorRouteTest extends ValidatorRouteTest {
 
-        MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
+   protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/component/validator/camelContext.xml");
     }
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        validEndpoint = resolveMandatoryEndpoint("mock:valid", MockEndpoint.class);
-        invalidEndpoint = resolveMandatoryEndpoint("mock:invalid", MockEndpoint.class);
-        finallyEndpoint = resolveMandatoryEndpoint("mock:finally", MockEndpoint.class);
-    }
-
-    protected int getExpectedRouteCount() {
-        return 0;
-    }
-
-    protected AbstractXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/component/validator/camelContext.xml");
-    }
 }

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/validator/SpringValidatorRouteTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java (from r1154680, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java&r1=1154680&r2=1154743&rev=1154743&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltRouteFileTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java Sun Aug  7 18:24:01 2011
@@ -16,15 +16,16 @@
  */
 package org.apache.camel.component.xslt;
 
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.camel.CamelContext;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
- * @version 
+ * @version
  */
-public class XsltRouteFileTest extends XsltRouteTest {
+public class SpringXsltRouteFileTest extends XsltRouteFileTest {
 
-    protected AbstractXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/component/xslt/XsltRouteFileTest.xml");
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/component/xslt/SpringXsltRouteFileTest.xml");
     }
 }

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/SpringXsltRouteFileTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message