Repository: servicemix Updated Branches: refs/heads/servicemix-5.0.x 368288bd8 -> 27b5f39ed
SM-2269 ActiveMQ quick start doesn't work due to the missing activemq component Project: http://git-wip-us.apache.org/repos/asf/servicemix/repo Commit: http://git-wip-us.apache.org/repos/asf/servicemix/commit/27b5f39e Tree: http://git-wip-us.apache.org/repos/asf/servicemix/tree/27b5f39e Diff: http://git-wip-us.apache.org/repos/asf/servicemix/diff/27b5f39e Branch: refs/heads/servicemix-5.0.x Commit: 27b5f39ed5a727f4f54da28916bba1c8767aec95 Parents: 368288b Author: Krzysztof Sobkowiak <[email protected]> Authored: Fri May 2 17:13:24 2014 +0200 Committer: Krzysztof Sobkowiak <[email protected]> Committed: Fri May 2 17:13:24 2014 +0200 ---------------------------------------------------------------------- activemq/activemq-camel/pom.xml | 65 ++++++++++++++++++++ .../activemq/camel/ActiveMQComponent.java | 38 ++++++++++++ .../camel/ActiveMQComponentResolver.java | 54 ++++++++++++++++ .../OSGI-INF/blueprint/activemq-camel.xml | 47 ++++++++++++++ activemq/activemq-service/pom.xml | 10 ++- activemq/pom.xml | 3 +- .../etc/org.apache.karaf.features.cfg | 2 +- .../src/main/filtered-resources/features.xml | 3 +- .../resources/OSGI-INF/blueprint/blueprint.xml | 2 + parent/pom.xml | 5 ++ 10 files changed, 225 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/activemq-camel/pom.xml ---------------------------------------------------------------------- diff --git a/activemq/activemq-camel/pom.xml b/activemq/activemq-camel/pom.xml new file mode 100644 index 0000000..995d0d3 --- /dev/null +++ b/activemq/activemq-camel/pom.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <!-- + 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. + --> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>activemq</artifactId> + <groupId>org.apache.servicemix</groupId> + <version>5.0.1-SNAPSHOT</version> + </parent> + + + <groupId>org.apache.servicemix.activemq</groupId> + <artifactId>org.apache.servicemix.activemq.camel</artifactId> + <packaging>bundle</packaging> + <name>Apache ServiceMix :: ActiveMQ :: Camel</name> + + <dependencies> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-osgi</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <configuration> + <instructions> + <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> + <Import-Package> + org.apache.camel.spi; provide:=true, + * + </Import-Package> + <Export-Package>!*</Export-Package> + <Bundle-Description>${project.description}</Bundle-Description> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponent.java ---------------------------------------------------------------------- diff --git a/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponent.java b/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponent.java new file mode 100644 index 0000000..66a51ff --- /dev/null +++ b/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponent.java @@ -0,0 +1,38 @@ +/** + * 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.servicemix.activemq.camel; + +import javax.jms.ConnectionFactory; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.jms.JmsConfiguration; + +/** + * A Camel component for ServiceMix which uses the + * {@link org.apache.activemq.ActiveMQConnectionFactory} service for connecting to the correct + * broker. + */ +public class ActiveMQComponent extends org.apache.activemq.camel.component.ActiveMQComponent { + + public static final String NAME = "activemq"; + + public ActiveMQComponent(CamelContext camelContext, ConnectionFactory connectionFactory) { + super(camelContext); + setConfiguration(new JmsConfiguration(connectionFactory)); + } + +} http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponentResolver.java ---------------------------------------------------------------------- diff --git a/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponentResolver.java b/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponentResolver.java new file mode 100644 index 0000000..52a60b5 --- /dev/null +++ b/activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponentResolver.java @@ -0,0 +1,54 @@ +/** + * 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.servicemix.activemq.camel; + +import javax.jms.ConnectionFactory; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.spi.ComponentResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A {@link org.apache.camel.spi.ComponentResolver} for the {@link org.apache.servicemix.activemq.camel.ActiveMQComponent} + */ +public class ActiveMQComponentResolver implements ComponentResolver { + + Logger LOGGER = LoggerFactory.getLogger(ActiveMQComponentResolver.class); + + private ConnectionFactory connectionFactory; + + public Component resolveComponent(String name, CamelContext camelContext) + throws Exception { + if (name.equals(ActiveMQComponent.NAME)) { + LOGGER.info("Creating an instance of the ActiveMQComponent (" + name + ":)"); + return new ActiveMQComponent(camelContext, connectionFactory); + } + return null; + } + + + public ConnectionFactory getConnectionFactory() { + return connectionFactory; + } + + public void setConnectionFactory(ConnectionFactory connectionFactory) { + this.connectionFactory = connectionFactory; + } + +} http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/activemq-camel/src/main/resources/OSGI-INF/blueprint/activemq-camel.xml ---------------------------------------------------------------------- diff --git a/activemq/activemq-camel/src/main/resources/OSGI-INF/blueprint/activemq-camel.xml b/activemq/activemq-camel/src/main/resources/OSGI-INF/blueprint/activemq-camel.xml new file mode 100644 index 0000000..9b2c6b1 --- /dev/null +++ b/activemq/activemq-camel/src/main/resources/OSGI-INF/blueprint/activemq-camel.xml @@ -0,0 +1,47 @@ +<?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. +--> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" + xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"> + + <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/> + + <cm:property-placeholder persistent-id="org.apache.activemq.server-default" update-strategy="reload"> + <cm:default-properties> + <cm:property name="broker-name" value="amq-broker"/> + </cm:default-properties> + </cm:property-placeholder> + + <reference id="pooledConnectionFactory" interface="javax.jms.ConnectionFactory" + filter="(transacted=false)"/> + + <!-- + Register the org.apache.camel.spi.ComponentResolver for the activemq component + --> + + <bean id="activeMQComponentResolver" + class="org.apache.servicemix.activemq.camel.ActiveMQComponentResolver"> + <property name="connectionFactory" ref="pooledConnectionFactory"/> + </bean> + + <service ref="activeMQComponentResolver" interface="org.apache.camel.spi.ComponentResolver" ranking="10"> + <service-properties> + <entry key="component" value="activemq"/> + </service-properties> + </service> +</blueprint> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/activemq-service/pom.xml ---------------------------------------------------------------------- diff --git a/activemq/activemq-service/pom.xml b/activemq/activemq-service/pom.xml index 5ba2930..741e2cd 100644 --- a/activemq/activemq-service/pom.xml +++ b/activemq/activemq-service/pom.xml @@ -27,10 +27,18 @@ </parent> <groupId>org.apache.servicemix.activemq</groupId> - <artifactId>activemq-service</artifactId> + <artifactId>org.apache.servicemix.activemq.service</artifactId> <packaging>bundle</packaging> <name>Apache ServiceMix :: ActiveMQ :: Service</name> + <dependencies> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-osgi</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + <build> <plugins> <plugin> http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/activemq/pom.xml ---------------------------------------------------------------------- diff --git a/activemq/pom.xml b/activemq/pom.xml index 33e498a..658341b 100644 --- a/activemq/pom.xml +++ b/activemq/pom.xml @@ -34,6 +34,7 @@ <modules> <module>activemq-service</module> + <module>activemq-camel</module> </modules> -</project> \ No newline at end of file +</project> http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/assembly/src/main/filtered-resources/etc/org.apache.karaf.features.cfg ---------------------------------------------------------------------- diff --git a/assembly/src/main/filtered-resources/etc/org.apache.karaf.features.cfg b/assembly/src/main/filtered-resources/etc/org.apache.karaf.features.cfg index 29d4ebd..9221e70 100644 --- a/assembly/src/main/filtered-resources/etc/org.apache.karaf.features.cfg +++ b/assembly/src/main/filtered-resources/etc/org.apache.karaf.features.cfg @@ -27,7 +27,7 @@ featuresRepositories=mvn:org.apache.karaf.assemblies.features/standard/${karaf.v # # Comma separated list of features to install at startup # -featuresBoot=config,eventadmin,activemq-broker-noweb,activemq-service,jaxrs-api,camel,camel-jms,camel-cxf,camel-blueprint,war +featuresBoot=config,eventadmin,activemq-broker-noweb,jaxrs-api,camel,camel-jms,camel-cxf,camel-blueprint,activemq-service,war # # Defines if the boot features are started in asynchronous mode (in a dedicated thread) http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/assembly/src/main/filtered-resources/features.xml ---------------------------------------------------------------------- diff --git a/assembly/src/main/filtered-resources/features.xml b/assembly/src/main/filtered-resources/features.xml index 11aa128..852f446 100644 --- a/assembly/src/main/filtered-resources/features.xml +++ b/assembly/src/main/filtered-resources/features.xml @@ -36,7 +36,8 @@ <feature name="activemq-service" version="${version}" resolver="(obr)" start-level="50"> <feature version="${activemq.version}">activemq-broker-noweb</feature> - <bundle>mvn:org.apache.servicemix.activemq/activemq-service/${version}</bundle> + <bundle>mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.service/${version}</bundle> + <bundle>mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.camel/${version}</bundle> </feature> <!-- Activiti support --> http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml index ce57943..4c55b71 100644 --- a/examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -36,10 +36,12 @@ </camelContext> <!-- use CF from ActiveMQ blueprint service running in container --> + <!-- <reference id="connectionFactory" interface="javax.jms.ConnectionFactory" /> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="connectionFactory" ref="connectionFactory" /> </bean> + --> <cm:property-placeholder persistent-id="org.apache.servicemix.examples"> <cm:default-properties> http://git-wip-us.apache.org/repos/asf/servicemix/blob/27b5f39e/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index b5bc697..e784673 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -103,6 +103,11 @@ <artifactId>activemq-broker</artifactId> <version>${activemq.version}</version> </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-osgi</artifactId> + <version>${activemq.version}</version> + </dependency> <!-- Activiti--> <dependency> <groupId>org.activiti</groupId>
