mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4034 -first step on fixing features and creating a osgi service factory for the broker
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1435065 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f5d8a05ed7
commit
94f71ccf40
|
@ -170,6 +170,8 @@ public abstract class AbstractFeatureTest {
|
|||
// override the config.properties (to fix pax-exam bug)
|
||||
replaceConfigurationFile("etc/config.properties", new File(basedir+"/src/test/resources/org/apache/activemq/karaf/itest/config.properties")),
|
||||
replaceConfigurationFile("etc/custom.properties", new File(basedir+"/src/test/resources/org/apache/activemq/karaf/itest/custom.properties")),
|
||||
replaceConfigurationFile("etc/org.apache.activemq.server-default.cfg", new File(basedir+"/src/test/resources/org/apache/activemq/karaf/itest/org.apache.activemq.server-default.cfg")),
|
||||
replaceConfigurationFile("etc/activemq.xml", new File(basedir+"/src/test/resources/org/apache/activemq/karaf/itest/activemq.xml")),
|
||||
scanFeatures(getActiveMQKarafFeatureUrl(), f.toArray(new String[f.size()]))};
|
||||
|
||||
return options;
|
||||
|
|
|
@ -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.
|
||||
|
||||
-->
|
||||
|
||||
<beans
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
|
||||
|
||||
|
||||
<broker xmlns="http://activemq.apache.org/schema/core"
|
||||
brokerName="localhost"
|
||||
dataDirectory="data"
|
||||
start="false">
|
||||
|
||||
<destinationPolicy>
|
||||
<policyMap>
|
||||
<policyEntries>
|
||||
<policyEntry topic=">" producerFlowControl="true">
|
||||
<pendingMessageLimitStrategy>
|
||||
<constantPendingMessageLimitStrategy limit="1000"/>
|
||||
</pendingMessageLimitStrategy>
|
||||
</policyEntry>
|
||||
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
|
||||
</policyEntry>
|
||||
</policyEntries>
|
||||
</policyMap>
|
||||
</destinationPolicy>
|
||||
|
||||
<managementContext>
|
||||
<managementContext createConnector="false"/>
|
||||
</managementContext>
|
||||
|
||||
<persistenceAdapter>
|
||||
<kahaDB directory="data/kahadb"/>
|
||||
</persistenceAdapter>
|
||||
|
||||
<plugins>
|
||||
<jaasAuthenticationPlugin configuration="karaf" />
|
||||
</plugins>
|
||||
|
||||
<systemUsage>
|
||||
<systemUsage>
|
||||
<memoryUsage>
|
||||
<memoryUsage limit="64 mb"/>
|
||||
</memoryUsage>
|
||||
<storeUsage>
|
||||
<storeUsage limit="100 gb"/>
|
||||
</storeUsage>
|
||||
<tempUsage>
|
||||
<tempUsage limit="50 gb"/>
|
||||
</tempUsage>
|
||||
</systemUsage>
|
||||
</systemUsage>
|
||||
|
||||
<transportConnectors>
|
||||
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000"/>
|
||||
</transportConnectors>
|
||||
</broker>
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,3 @@
|
|||
broker-name=localhost
|
||||
data=${karaf.data}/localhost
|
||||
config=${karaf.base}/etc/activemq.xml
|
|
@ -170,7 +170,7 @@
|
|||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Export-Package>org.apache.activemq.karaf.commands;version=${project.version};-split-package:=merge-first</Export-Package>
|
||||
<Export-Package>org.apache.activemq.karaf*;version=${project.version};-split-package:=merge-first</Export-Package>
|
||||
<Import-Package>
|
||||
org.apache.felix.gogo.commands,
|
||||
*
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* 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.activemq.karaf;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.spring.Utils;
|
||||
import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.cm.ConfigurationException;
|
||||
import org.osgi.service.cm.ManagedServiceFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ActiveMQServiceFactory implements ManagedServiceFactory {
|
||||
|
||||
BundleContext bundleContext;
|
||||
HashMap<String, BrokerService> brokers = new HashMap<String, BrokerService>();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ActiveMQ Server Controller";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updated(String pid, Dictionary properties) throws ConfigurationException {
|
||||
String config = (String)properties.get("config");
|
||||
if (config == null) {
|
||||
throw new ConfigurationException("config", "Property must be set");
|
||||
}
|
||||
String name = (String)properties.get("broker-name");
|
||||
if (config == null) {
|
||||
throw new ConfigurationException("broker-name", "Property must be set");
|
||||
}
|
||||
try {
|
||||
Thread.currentThread().setContextClassLoader(BrokerService.class.getClassLoader());
|
||||
Resource resource = Utils.resourceFromString(config);
|
||||
ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext((resource)) {
|
||||
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
|
||||
reader.setValidating(false);
|
||||
}
|
||||
};
|
||||
|
||||
BrokerService broker = ctx.getBean(BrokerService.class);
|
||||
if (broker == null) {
|
||||
throw new ConfigurationException(null, "Broker not defined");
|
||||
}
|
||||
//TODO deal with multiple brokers
|
||||
|
||||
|
||||
broker.start();
|
||||
broker.waitUntilStarted();
|
||||
brokers.put(pid, broker);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException(null, "Cannot start the broker", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleted(String pid) {
|
||||
BrokerService broker = brokers.get(pid);
|
||||
if (broker == null) {
|
||||
//TODO LOG
|
||||
return;
|
||||
}
|
||||
try {
|
||||
broker.stop();
|
||||
broker.waitUntilStopped();
|
||||
} catch (Exception e) {
|
||||
//TODO LOG
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public BundleContext getBundleContext() {
|
||||
return bundleContext;
|
||||
}
|
||||
|
||||
public void setBundleContext(BundleContext bundleContext) {
|
||||
this.bundleContext = bundleContext;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
## ---------------------------------------------------------------------------
|
||||
## 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.
|
||||
## ---------------------------------------------------------------------------
|
||||
http\://activemq.org/config/1.0=activemq.xsd
|
||||
http\://activemq.org/config/1.0/1.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.2.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.2.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.5.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.6.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.7.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.9.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.10.0.xsd=activemq.xsd
|
|
@ -20,6 +20,16 @@
|
|||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
|
||||
xmlns:shell="http://karaf.apache.org/xmlns/shell/v1.0.0">
|
||||
|
||||
<bean id="activeMQServiceFactory" class="org.apache.activemq.karaf.ActiveMQServiceFactory">
|
||||
<property name="bundleContext" ref="blueprintBundleContext"/>
|
||||
</bean>
|
||||
|
||||
<service ref="activeMQServiceFactory" interface="org.osgi.service.cm.ManagedServiceFactory">
|
||||
<service-properties>
|
||||
<entry key="service.pid" value="org.apache.activemq.server"/>
|
||||
</service-properties>
|
||||
</service>
|
||||
|
||||
<shell:command-bundle>
|
||||
|
||||
<shell:command name="activemq/create-broker">
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
<bundle dependency="true">mvn:org.fusesource.hawtbuf/hawtbuf-proto/${hawtbuf-version}</bundle>
|
||||
<bundle dependency="true">mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version}</bundle>
|
||||
<bundle dependency="true">mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version}</bundle>
|
||||
<feature version="[3,4)">spring31</feature>
|
||||
<bundle dependency="true">mvn:org.apache.xbean/xbean-spring/${xbean-version}</bundle>
|
||||
<!--<bundle>mvn:org.apache.activemq/activemq-spring/${project.version}</bundle>-->
|
||||
<bundle>mvn:org.apache.activemq/activemq-karaf/${project.version}</bundle>
|
||||
</feature>
|
||||
|
||||
|
|
|
@ -95,10 +95,70 @@
|
|||
<artifactId>activemq-camel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-jaas</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-console</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-ra</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-spring</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.xbean</groupId>
|
||||
<artifactId>maven-xbean-plugin</artifactId>
|
||||
<version>3.12</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>${basedir}/../activemq-client/src/main/java</include>
|
||||
<include>${basedir}/../activemq-broker/src/main/java</include>
|
||||
<include>${basedir}/../activemq-leveldb-store/src/main/java</include>
|
||||
<include>${basedir}/../activemq-jdbc-store/src/main/java</include>
|
||||
<include>${basedir}/../activemq-amq-store/src/main/java</include>
|
||||
<include>${basedir}/../activemq-kahadb-store/src/main/java</include>
|
||||
<include>${basedir}/../activemq-mqtt/src/main/java</include>
|
||||
<include>${basedir}/../activemq-stomp/src/main/java</include>
|
||||
<include>${basedir}/../activemq-spring/src/main/java</include>
|
||||
</includes>
|
||||
<strictXsdOrder>false</strictXsdOrder>
|
||||
<namespace>http://activemq.apache.org/schema/core</namespace>
|
||||
<schema>${basedir}/target/classes/activemq.xsd</schema>
|
||||
<outputDir>${basedir}/target/classes</outputDir>
|
||||
<generateSpringSchemasFile>false</generateSpringSchemasFile>
|
||||
<excludedClasses>org.apache.activemq.broker.jmx.AnnotatedMBean,org.apache.activemq.broker.jmx.DestinationViewMBean</excludedClasses>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>mapping</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.qdox</groupId>
|
||||
<artifactId>qdox</artifactId>
|
||||
<version>1.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
## ---------------------------------------------------------------------------
|
||||
## 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.
|
||||
## ---------------------------------------------------------------------------
|
||||
http\://activemq.org/config/1.0=activemq.xsd
|
||||
http\://activemq.org/config/1.0/1.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.3.2.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.4.2.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.5.1.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.6.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.7.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.9.0.xsd=activemq.xsd
|
||||
http\://activemq.apache.org/schema/core/activemq-core-5.10.0.xsd=activemq.xsd
|
|
@ -26,26 +26,16 @@
|
|||
</parent>
|
||||
|
||||
<artifactId>activemq-spring</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ActiveMQ :: Spring</name>
|
||||
<description>ActiveMQ Spring Integration</description>
|
||||
|
||||
<properties>
|
||||
<activemq.osgi.import.pkg>
|
||||
<activemq.osgi.import>
|
||||
javax.transaction*;resolution:=optional,
|
||||
org.apache.geronimo.transaction.manager*;resolution:=optional,
|
||||
org.springframework*;resolution:=optional,
|
||||
*
|
||||
</activemq.osgi.import.pkg>
|
||||
<activemq.osgi.export>
|
||||
org.apache.activemq.store*;version=${project.version};-noimport:=;-split-package:=merge-last,
|
||||
org.apache.activemq.security*;version=${project.version};-noimport:=;-split-package:=merge-last,
|
||||
org.apache.activemq.network*;version=${project.version};-noimport:=;-split-package:=merge-last,
|
||||
org.apache.activemq.spring*;version=${project.version};-noimport:=;-split-package:=merge-last,
|
||||
org.apache.activemq.pool*;version=${project.version};-noimport:=;-split-package:=merge-last,
|
||||
org.apache.activemq.xbean*;version=${project.version};-noimport:=true;-split-package:=merge-last,
|
||||
org.apache.activemq.hooks*;version=${project.version};-noimport:=;-split-package:=merge-last
|
||||
org.apache.activemq.hooks.osgi*;version=${project.version};-noimport:=;-split-package:=merge-last
|
||||
</activemq.osgi.export>
|
||||
org.springframework*;resolution:=optional
|
||||
</activemq.osgi.import>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
Loading…
Reference in New Issue