Updated Branches: refs/heads/master 73184b220 -> f32c0edf8
CAMEL-6755: Fixed example to work as the OSGi pieces dont work. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f32c0edf Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f32c0edf Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f32c0edf Branch: refs/heads/master Commit: f32c0edf89ebb66ffe814ef9ee5ffed3167a0f93 Parents: 73184b2 Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Sep 18 16:12:07 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Sep 18 16:12:07 2013 +0200 ---------------------------------------------------------------------- .../camel-example-spring-javaconfig/pom.xml | 66 +------------------- .../spring/javaconfig/MyRouteConfig.java | 23 ++----- .../src/main/resources/features.xml | 42 ------------- 3 files changed, 7 insertions(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f32c0edf/examples/camel-example-spring-javaconfig/pom.xml ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-javaconfig/pom.xml b/examples/camel-example-spring-javaconfig/pom.xml index 1d082d9..6f803cb 100644 --- a/examples/camel-example-spring-javaconfig/pom.xml +++ b/examples/camel-example-spring-javaconfig/pom.xml @@ -25,20 +25,11 @@ </parent> <artifactId>camel-example-spring-javaconfig</artifactId> - <packaging>bundle</packaging> + <packaging>jar</packaging> <name>Camel :: Example :: Spring :: JavaConfig</name> <description>An example showing how to work with Camel and Spring Java Config</description> - <properties> - <camel.osgi.export>org.apache.camel.example.spring.*</camel.osgi.export> - <camel.osgi.import> - !org.apache.camel.example.spring.*, - org.springframework.osgi.*;version="[1.2,2)", - org.springframework.*;version="[3,4)", - org.apache.activemq.xbean,org.apache.activemq.broker,org.apache.activemq.pool - </camel.osgi.import> - <!-- avoid to import the bunch of spring related package --> - <camel.osgi.dynamic>*</camel.osgi.dynamic> + <properties> <junit-version>4.8.1</junit-version> </properties> @@ -70,35 +61,6 @@ <artifactId>activemq-client</artifactId> </dependency> - <!-- osgi --> - <!-- to run from command line using mvn camel:run --> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.osgi</groupId> - <artifactId>spring-osgi-core</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>org.springframework.aop</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>org.springframework.beans</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>org.springframework.context</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>org.springframework.core</artifactId> - </exclusion> - </exclusions> - </dependency> - <!-- logging --> <dependency> <groupId>org.slf4j</groupId> @@ -119,29 +81,7 @@ </dependencies> <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>attach-artifacts</id> - <phase>package</phase> - <goals> - <goal>attach-artifact</goal> - </goals> - <configuration> - <artifacts> - <artifact> - <file>target/classes/features.xml</file> - <type>xml</type> - <classifier>features</classifier> - </artifact> - </artifacts> - </configuration> - </execution> - </executions> - </plugin> + <plugins> <!-- START SNIPPET: example --> http://git-wip-us.apache.org/repos/asf/camel/blob/f32c0edf/examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java b/examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java index c9b0a5d..2480c7f 100644 --- a/examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java +++ b/examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java @@ -20,14 +20,12 @@ import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jms.JmsComponent; -import org.apache.camel.osgi.SpringCamelContextFactory; +import org.apache.camel.spring.SpringCamelContext; import org.apache.camel.spring.javaconfig.Main; import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration; -import org.osgi.framework.BundleContext; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.osgi.context.BundleContextAware; //START SNIPPET: RouteConfig /** @@ -36,9 +34,7 @@ import org.springframework.osgi.context.BundleContextAware; * @version */ @Configuration -public class MyRouteConfig extends SingleRouteCamelConfiguration implements InitializingBean, BundleContextAware { - - private BundleContext bundleContext; +public class MyRouteConfig extends SingleRouteCamelConfiguration implements InitializingBean { /** * Allow this route to be run as an application @@ -47,23 +43,12 @@ public class MyRouteConfig extends SingleRouteCamelConfiguration implements Init new Main().run(args); } - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(BundleContext bundleContext) { - this.bundleContext = bundleContext; - } - /** - * Returns the CamelContext which support OSGi + * Returns the CamelContext which support Spring */ @Override protected CamelContext createCamelContext() throws Exception { - SpringCamelContextFactory factory = new SpringCamelContextFactory(); - factory.setApplicationContext(getApplicationContext()); - factory.setBundleContext(getBundleContext()); - return factory.createContext(); + return new SpringCamelContext(getApplicationContext()); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/f32c0edf/examples/camel-example-spring-javaconfig/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-javaconfig/src/main/resources/features.xml b/examples/camel-example-spring-javaconfig/src/main/resources/features.xml deleted file mode 100644 index 59affd8..0000000 --- a/examples/camel-example-spring-javaconfig/src/main/resources/features.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?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. ---> -<features> - <repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features</repository> - <!-- NOTE the camel-example-spring-javaconfig feature need to install the spring 3.0.0 --> - - <feature name='activemq-feature' version='${project.version}'> - <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle> - <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle> - <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1</bundle> - <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0</bundle> - <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool/1.5.4_1</bundle> - <bundle>mvn:org.apache.xbean/xbean-spring/3.4.3</bundle> - <bundle>mvn:org.apache.activemq/kahadb/${activemq.version}</bundle> - <bundle>mvn:org.apache.activemq/activemq-core/${activemq.version}</bundle> - <bundle>mvn:org.apache.activemq/activemq-ra/${activemq.version}</bundle> - <bundle>mvn:org.apache.activemq/activemq-pool/${activemq.version}</bundle> - <bundle>mvn:org.apache.activemq/activemq-camel/${activemq.version}</bundle> - </feature> - - <feature name='camel-example-spring-javaconfig' version='${project.version}'> - <feature version="${project.version}">camel</feature> - <feature version="${project.version}">camel-jms</feature> - <bundle>mvn:org.apache.camel/camel-example-spring-javaconfig/${project.version}</bundle> - </feature> - -</features> \ No newline at end of file