https://issues.apache.org/jira/browse/AMQ-4034 - moving service factory to activemq-osgi module

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1436831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2013-01-22 10:39:23 +00:00
parent fd46439e7e
commit 33c564259c
4 changed files with 19 additions and 14 deletions

View File

@ -55,6 +55,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>

View File

@ -20,16 +20,6 @@
<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" destroy-method="destroy">
<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">

View File

@ -113,6 +113,18 @@
<groupId>${project.groupId}</groupId>
<artifactId>activemq-spring</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>4.2.0</version>
</dependency>
</dependencies>

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.karaf;
package org.apache.activemq.osgi;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.spring.Utils;
@ -27,10 +27,8 @@ import org.slf4j.LoggerFactory;
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 {
@ -51,9 +49,13 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
throw new ConfigurationException("config", "Property must be set");
}
String name = (String)properties.get("broker-name");
if (config == null) {
if (name == null) {
throw new ConfigurationException("broker-name", "Property must be set");
}
LOG.info("Starting broker " + name);
//TODO properties
try {
Thread.currentThread().setContextClassLoader(BrokerService.class.getClassLoader());
Resource resource = Utils.resourceFromString(config);