You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/12/17 18:57:19 UTC
[1/2] [KARAF-2569] Add new enterprise jms feature
Updated Branches:
refs/heads/master d75f6f0d5 -> bde7577f9
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java
----------------------------------------------------------------------
diff --git a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java
new file mode 100644
index 0000000..223169c
--- /dev/null
+++ b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java
@@ -0,0 +1,418 @@
+/*
+ * 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.karaf.jms.internal;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.advisory.DestinationSource;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.pool.PooledConnection;
+import org.apache.karaf.jms.JmsMessage;
+import org.apache.karaf.jms.JmsService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+import javax.jms.*;
+import java.io.*;
+import java.lang.IllegalStateException;
+import java.util.*;
+
+/**
+ * Default implementation of the JMS Service.
+ */
+public class JmsServiceImpl implements JmsService {
+
+ private BundleContext bundleContext;
+
+ @Override
+ public void create(String name, String type, String url) throws Exception {
+ if (!type.equalsIgnoreCase("activemq") && !type.equalsIgnoreCase("webspheremq")) {
+ throw new IllegalArgumentException("JMS connection factory type not known");
+ }
+
+ File karafBase = new File(System.getProperty("karaf.base"));
+ File deployFolder = new File(karafBase, "deploy");
+ File outFile = new File(deployFolder, "connectionfactory-" + name + ".xml");
+
+ if (type.equalsIgnoreCase("activemq")) {
+ // activemq
+ HashMap<String, String> properties = new HashMap<String, String>();
+ properties.put("${name}", name);
+ properties.put("${url}", url);
+ copyDataSourceFile(outFile, "connectionfactory-activemq.xml", properties);
+ } else {
+ // webspheremq
+ String[] splitted = url.split("/");
+ if (splitted.length != 4) {
+ throw new IllegalStateException("WebsphereMQ URI should be in the following format: host/port/queuemanager/channel");
+ }
+ HashMap<String, String> properties = new HashMap<String, String>();
+ properties.put("${name}", name);
+ properties.put("${host}", splitted[0]);
+ properties.put("${port}", splitted[1]);
+ properties.put("${queuemanager}", splitted[2]);
+ properties.put("${channel}", splitted[3]);
+ copyDataSourceFile(outFile, "connectionfactory-webspheremq.xml", properties);
+ }
+ }
+
+ @Override
+ public void delete(String name) throws Exception {
+ File karafBase = new File(System.getProperty("karaf.base"));
+ File deployFolder = new File(karafBase, "deploy");
+ File connectionFactoryFile = new File(deployFolder, "connectionfactory-" + name + ".xml");
+ if (!connectionFactoryFile.exists()) {
+ throw new IllegalStateException("The JMS connection factory file " + connectionFactoryFile.getPath() + " doesn't exist");
+ }
+ connectionFactoryFile.delete();
+ }
+
+ @Override
+ public List<String> connectionFactories() throws Exception {
+ List<String> connectionFactories = new ArrayList<String>();
+ ServiceReference[] references = bundleContext.getServiceReferences(ConnectionFactory.class.getName(), null);
+ if (references != null) {
+ for (ServiceReference reference : references) {
+ if (reference.getProperty("osgi.jndi.service.name") != null) {
+ connectionFactories.add((String) reference.getProperty("osgi.jndi.service.name"));
+ } else if (reference.getProperty("name") != null) {
+ connectionFactories.add((String) reference.getProperty("name"));
+ } else {
+ connectionFactories.add(reference.getProperty(Constants.SERVICE_ID).toString());
+ }
+ }
+ }
+ return connectionFactories;
+ }
+
+ @Override
+ public Map<String, String> info(String connectionFactory) throws Exception {
+ Map<String, String> map = new HashMap<String, String>();
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ ConnectionMetaData metaData = connection.getMetaData();
+ map.put("product", metaData.getJMSProviderName());
+ map.put("version", metaData.getProviderVersion());
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return map;
+ }
+
+ @Override
+ public int count(String connectionFactory, String destination) throws Exception {
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ Session session = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(session.createQueue(destination));
+ Enumeration<Message> enumeration = browser.getEnumeration();
+ int count = 0;
+ while (enumeration.hasMoreElements()) {
+ enumeration.nextElement();
+ count++;
+ }
+ browser.close();
+ return count;
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ }
+
+ @Override
+ public List<String> queues(String connectionFactory) throws Exception {
+ List<String> queues = new ArrayList<String>();
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ if (connection instanceof PooledConnection) {
+ connection = ((PooledConnection) connection).getConnection();
+ }
+ if (connection instanceof ActiveMQConnection) {
+ DestinationSource destinationSource = ((ActiveMQConnection) connection).getDestinationSource();
+ Set<ActiveMQQueue> activeMQQueues = destinationSource.getQueues();
+ for (ActiveMQQueue activeMQQueue : activeMQQueues) {
+ queues.add(activeMQQueue.getQueueName());
+ }
+ }
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return queues;
+ }
+
+ @Override
+ public List<String> topics(String connectionFactory) throws Exception {
+ List<String> topics = new ArrayList<String>();
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ if (connection instanceof PooledConnection) {
+ connection = ((PooledConnection) connection).getConnection();
+ }
+ if (connection instanceof ActiveMQConnection) {
+ DestinationSource destinationSource = ((ActiveMQConnection) connection).getDestinationSource();
+ Set<ActiveMQTopic> activeMQTopics = destinationSource.getTopics();
+ for (ActiveMQTopic activeMQTopic : activeMQTopics) {
+ topics.add(activeMQTopic.getTopicName());
+ }
+ }
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return topics;
+ }
+
+ @Override
+ public List<JmsMessage> browse(String connectionFactory, String queue, String filter) throws Exception {
+ List<JmsMessage> messages = new ArrayList<JmsMessage>();
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ Session session = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(session.createQueue(queue), filter);
+ Enumeration<Message> enumeration = browser.getEnumeration();
+ while (enumeration.hasMoreElements()) {
+ Message message = enumeration.nextElement();
+ messages.add(new JmsMessage(message));
+ }
+ browser.close();
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return messages;
+ }
+
+ @Override
+ public void send(String connectionFactory, String queue, String body, String replyTo) throws Exception {
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ Session session = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Message message = session.createTextMessage(body);
+ if (replyTo != null) {
+ message.setJMSReplyTo(session.createQueue(replyTo));
+ }
+ MessageProducer producer = session.createProducer(session.createQueue(queue));
+ producer.send(message);
+ producer.close();
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ }
+
+ @Override
+ public int consume(String connectionFactory, String queue, String selector) throws Exception {
+ int count = 0;
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ Session session = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(session.createQueue(queue), selector);
+ Message message;
+ do {
+ message = consumer.receiveNoWait();
+ if (message != null) {
+ count++;
+ }
+ } while (message != null);
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return count;
+ }
+
+ @Override
+ public int move(String connectionFactory, String sourceQueue, String targetQueue, String selector) throws Exception {
+ int count = 0;
+ ServiceReference reference = this.lookupConnectionFactory(connectionFactory);
+ Connection connection = null;
+ Session session = null;
+ try {
+ ConnectionFactory cf = (ConnectionFactory) bundleContext.getService(reference);
+ connection = cf.createConnection();
+ session = connection.createSession(true, Session.SESSION_TRANSACTED);
+ MessageConsumer consumer = session.createConsumer(session.createQueue(sourceQueue), selector);
+ Message message;
+ do {
+ message = consumer.receiveNoWait();
+ if (message != null) {
+ MessageProducer producer = session.createProducer(session.createQueue(targetQueue));
+ producer.send(message);
+ count++;
+ }
+ } while (message != null);
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ if (reference != null) {
+ bundleContext.ungetService(reference);
+ }
+ }
+ return count;
+ }
+
+ private ServiceReference lookupConnectionFactory(String name) throws Exception {
+ ServiceReference[] references = bundleContext.getServiceReferences(ConnectionFactory.class.getName(), "(|(osgi.jndi.service.name=" + name + ")(name=" + name + ")(service.id=" + name + "))");
+ if (references == null || references.length == 0) {
+ throw new IllegalArgumentException("No JMS connection factory found for " + name);
+ }
+ if (references.length > 1) {
+ throw new IllegalArgumentException("Multiple JMS connection factories found for " + name);
+ }
+ return references[0];
+ }
+
+ private void copyDataSourceFile(File outFile, String resource, HashMap<String, String> properties) throws Exception {
+ if (!outFile.exists()) {
+ InputStream is = JmsServiceImpl.class.getResourceAsStream(resource);
+ if (is == null) {
+ throw new IllegalArgumentException("Resource " + resource + " doesn't exist");
+ }
+ try {
+ // read it line at a time so that we can use the platform line ending when we write it out
+ PrintStream out = new PrintStream(new FileOutputStream(outFile));
+ try {
+ Scanner scanner = new Scanner(is);
+ while (scanner.hasNextLine()) {
+ String line = scanner.nextLine();
+ line = filter(line, properties);
+ out.println(line);
+ }
+ } finally {
+ safeClose(out);
+ }
+ } finally {
+ safeClose(is);
+ }
+ } else {
+ throw new IllegalArgumentException("File " + outFile.getPath() + " already exists. Remove it if you wish to recreate it.");
+ }
+ }
+
+ private void safeClose(InputStream is) throws IOException {
+ if (is == null)
+ return;
+ try {
+ is.close();
+ } catch (Throwable ignore) {
+ // nothing to do
+ }
+ }
+
+ private void safeClose(OutputStream is) throws IOException {
+ if (is == null)
+ return;
+ try {
+ is.close();
+ } catch (Throwable ignore) {
+ // nothing to do
+ }
+ }
+
+ private String filter(String line, HashMap<String, String> props) {
+ for (Map.Entry<String, String> i : props.entrySet()) {
+ int p1 = line.indexOf(i.getKey());
+ if (p1 >= 0) {
+ String l1 = line.substring(0, p1);
+ String l2 = line.substring(p1 + i.getKey().length());
+ line = l1 + i.getValue() + l2;
+ }
+ }
+ return line;
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/resources/OSGI-INF/blueprint/jms-core.xml
----------------------------------------------------------------------
diff --git a/jms/core/src/main/resources/OSGI-INF/blueprint/jms-core.xml b/jms/core/src/main/resources/OSGI-INF/blueprint/jms-core.xml
new file mode 100644
index 0000000..7dd8070
--- /dev/null
+++ b/jms/core/src/main/resources/OSGI-INF/blueprint/jms-core.xml
@@ -0,0 +1,41 @@
+<?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:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
+ default-activation="lazy">
+
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
+
+ <bean id="jmsService" class="org.apache.karaf.jms.internal.JmsServiceImpl">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </bean>
+
+ <service ref="jmsService" interface="org.apache.karaf.jms.JmsService" />
+
+ <!-- Management -->
+ <bean id="jmsMBeanImpl" class="org.apache.karaf.jms.internal.JmsMBeanImpl">
+ <property name="jmsService" ref="jmsService"/>
+ </bean>
+
+ <service ref="jmsMBeanImpl" auto-export="interfaces">
+ <service-properties>
+ <entry key="jmx.objectname" value="org.apache.karaf:type=jms,name=$[karaf.name]"/>
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/jms/core/src/main/resources/OSGI-INF/bundle.info b/jms/core/src/main/resources/OSGI-INF/bundle.info
new file mode 100644
index 0000000..1aeb646
--- /dev/null
+++ b/jms/core/src/main/resources/OSGI-INF/bundle.info
@@ -0,0 +1,18 @@
+h1. Synopsis
+
+${project.name}
+
+${project.description}
+
+Maven URL:
+[mvn:${project.groupId}/${project.artifactId}/${project.version}]
+
+h1. Description
+
+This bundle is the core implementation of the JMS service support.
+
+The JMS service allows you to create connection factories, and send/browse/consume messages.
+
+h1. See also
+
+JMS - section of the Karaf User Guide
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionFactory-webspheremq.xml
----------------------------------------------------------------------
diff --git a/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionFactory-webspheremq.xml b/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionFactory-webspheremq.xml
new file mode 100644
index 0000000..68d04d6
--- /dev/null
+++ b/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionFactory-webspheremq.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
+ <property name="transportType" value="1" />
+ <property name="hostName" value="${hostname}" />
+ <property name="port" value="${port}" />
+ <property name="queueManager" value="${queuemanager}" />
+ <property name="channel" value="${channel}" />
+ <property name="useConnectionPooling" value="true" />
+ </bean>
+
+ <service ref="wmqConnectionFactory" interface="javax.jms.ConnectionFactory">
+ <service-properties>
+ <entry key="name" value="${name}"/>
+ <entry key="osgi.jndi.service.name" value="/jms/${name}"/>
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionfactory-activemq.xml
----------------------------------------------------------------------
diff --git a/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionfactory-activemq.xml b/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionfactory-activemq.xml
new file mode 100644
index 0000000..a0b170c
--- /dev/null
+++ b/jms/core/src/main/resources/org.apache.karaf.jms.internal/connectionfactory-activemq.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="${url}" />
+ </bean>
+
+ <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
+ <property name="maxConnections" value="8" />
+ <property name="connectionFactory" ref="activemqConnectionFactory" />
+ </bean>
+
+ <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
+ <property name="transactionManager" ref="transactionManager" />
+ <property name="connectionFactory" ref="activemqConnectionFactory" />
+ <property name="resourceName" value="activemq.localhost" />
+ </bean>
+
+ <reference id="transactionManager" interface="javax.transaction.TransactionManager" />
+
+ <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
+ <service-properties>
+ <entry key="name" value="${name}" />
+ <entry key="osgi.jndi.service.name" value="/jms/${name}" />
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/pom.xml
----------------------------------------------------------------------
diff --git a/jms/pom.xml b/jms/pom.xml
new file mode 100644
index 0000000..70d9167
--- /dev/null
+++ b/jms/pom.xml
@@ -0,0 +1,41 @@
+<?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>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>karaf</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>jms</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Karaf :: JMS</name>
+
+ <modules>
+ <module>core</module>
+ <module>command</module>
+ </modules>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b734f03..66615b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,6 +64,7 @@
<module>obr</module>
<module>jndi</module>
<module>jdbc</module>
+ <module>jms</module>
<module>tooling</module>
<module>assemblies</module>
<module>demos</module>
@@ -402,6 +403,17 @@
</dependency>
<dependency>
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>org.apache.karaf.jms.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>org.apache.karaf.jms.command</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.karaf.jndi</groupId>
<artifactId>org.apache.karaf.jndi.core</artifactId>
<version>${project.version}</version>
[2/2] git commit: [KARAF-2569] Add new enterprise jms feature
Posted by jb...@apache.org.
[KARAF-2569] Add new enterprise jms feature
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/bde7577f
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/bde7577f
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/bde7577f
Branch: refs/heads/master
Commit: bde7577f9154960ad74ef397ddac0c9a9a11d75e
Parents: d75f6f0
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Dec 17 18:56:54 2013 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Dec 17 18:56:54 2013 +0100
----------------------------------------------------------------------
.../enterprise/src/main/feature/feature.xml | 7 +
.../src/main/resources/OSGI-INF/bundle.info | 4 +-
jdbc/core/pom.xml | 2 +-
jms/command/NOTICE | 71 ++++
jms/command/pom.xml | 85 ++++
.../apache/karaf/jms/command/BrowseCommand.java | 110 +++++
.../jms/command/ConnectionFactoriesCommand.java | 42 ++
.../karaf/jms/command/ConsumeCommand.java | 42 ++
.../apache/karaf/jms/command/CountCommand.java | 43 ++
.../apache/karaf/jms/command/CreateCommand.java | 40 ++
.../apache/karaf/jms/command/DeleteCommand.java | 33 ++
.../apache/karaf/jms/command/InfoCommand.java | 46 ++
.../karaf/jms/command/JmsCommandSupport.java | 36 ++
.../apache/karaf/jms/command/MoveCommand.java | 43 ++
.../apache/karaf/jms/command/QueuesCommand.java | 43 ++
.../apache/karaf/jms/command/SendCommand.java | 43 ++
.../apache/karaf/jms/command/TopicsCommand.java | 43 ++
.../ConnectionFactoriesCompleter.java | 53 +++
.../OSGI-INF/blueprint/jms-command.xml | 120 ++++++
.../src/main/resources/OSGI-INF/bundle.info | 29 ++
jms/core/NOTICE | 71 ++++
jms/core/pom.xml | 96 +++++
.../java/org/apache/karaf/jms/JmsMBean.java | 137 ++++++
.../java/org/apache/karaf/jms/JmsMessage.java | 156 +++++++
.../java/org/apache/karaf/jms/JmsService.java | 135 ++++++
.../apache/karaf/jms/internal/JmsMBeanImpl.java | 155 +++++++
.../karaf/jms/internal/JmsServiceImpl.java | 418 +++++++++++++++++++
.../resources/OSGI-INF/blueprint/jms-core.xml | 41 ++
.../src/main/resources/OSGI-INF/bundle.info | 18 +
.../connectionFactory-webspheremq.xml | 20 +
.../connectionfactory-activemq.xml | 28 ++
jms/pom.xml | 41 ++
pom.xml | 12 +
33 files changed, 2260 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/assemblies/features/enterprise/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/enterprise/src/main/feature/feature.xml b/assemblies/features/enterprise/src/main/feature/feature.xml
index c087b5d..73eec93 100644
--- a/assemblies/features/enterprise/src/main/feature/feature.xml
+++ b/assemblies/features/enterprise/src/main/feature/feature.xml
@@ -68,6 +68,13 @@
<bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.command/${project.version}</bundle>
</feature>
+ <feature name='jms' description='JMS service and commands' version='${project.version}' resolver='(obr)'>
+ <details>JMS support provinding service, commands, and MBean.</details>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${geronimo.jms-spec.version}</bundle>
+ <bundle>mvn:org.apache.karaf.jms/org.apache.karaf.jms.core/${project.version}</bundle>
+ <bundle>mvn:org.apache.karaf.jms/org.apache.karaf.jms.command/${project.version}</bundle>
+ </feature>
+
<feature name='application-without-isolation' description='Provide EBA archive support' version='${aries.application.version}'>
<details>Support of the Aries EBA archives</details>
<!-- pre-requisites-->
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jdbc/command/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/jdbc/command/src/main/resources/OSGI-INF/bundle.info b/jdbc/command/src/main/resources/OSGI-INF/bundle.info
index 588c127..f4d4790 100644
--- a/jdbc/command/src/main/resources/OSGI-INF/bundle.info
+++ b/jdbc/command/src/main/resources/OSGI-INF/bundle.info
@@ -13,8 +13,8 @@ This bundle provides the shell commands to manipulate the JDBC service.
The following commands are available:
-* jdbc:datasource-create
-* jdbc:datasource-delete
+* jdbc:create
+* jdbc:delete
* jdbc:datasources
* jdbc:command
* jdbc:query
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jdbc/core/pom.xml
----------------------------------------------------------------------
diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml
index 701cf3d..7e98677 100644
--- a/jdbc/core/pom.xml
+++ b/jdbc/core/pom.xml
@@ -31,7 +31,7 @@
<artifactId>org.apache.karaf.jdbc.core</artifactId>
<packaging>bundle</packaging>
<name>Apache Karaf :: JDBC :: Core</name>
- <description>This bundle provides core implement of the JDBC management service.</description>
+ <description>This bundle provides core implementation of the JDBC service.</description>
<properties>
<appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/NOTICE
----------------------------------------------------------------------
diff --git a/jms/command/NOTICE b/jms/command/NOTICE
new file mode 100644
index 0000000..de8d101
--- /dev/null
+++ b/jms/command/NOTICE
@@ -0,0 +1,71 @@
+Apache Karaf
+Copyright 2010-2013 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/pom.xml
----------------------------------------------------------------------
diff --git a/jms/command/pom.xml b/jms/command/pom.xml
new file mode 100644
index 0000000..d799a8d
--- /dev/null
+++ b/jms/command/pom.xml
@@ -0,0 +1,85 @@
+<?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>
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.karaf.jms.command</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Karaf :: JMS :: Command</name>
+ <description>This bundle provides shell commands to manipulate the JMS server.</description>
+
+ <properties>
+ <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>org.apache.karaf.jms.core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.table</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.info</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Export-Package>!*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/BrowseCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/BrowseCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/BrowseCommand.java
new file mode 100644
index 0000000..8c51378
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/BrowseCommand.java
@@ -0,0 +1,110 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.jms.JmsMessage;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.List;
+
+@Command(scope = "jms", name = "browse", description = "Browse a JMS queue")
+public class BrowseCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ @Argument(index = 1, name = "queue", description = "The JMS queue to browse", required = true, multiValued = false)
+ String queue;
+
+ @Option(name = "-s", aliases = { "--selector" }, description = "The selector to select the messages to browse", required = false, multiValued = false)
+ String selector;
+
+ @Option(name = "-v", aliases = { "--verbose" }, description = "Display JMS message headers and properties", required = false, multiValued = false)
+ boolean verbose = false;
+
+ public Object doExecute() throws Exception {
+
+ ShellTable table = new ShellTable();
+ table.column("Message ID");
+ table.column("Content").maxSize(80);
+ table.column("Charset");
+ table.column("Type");
+ table.column("Correlation ID");
+ table.column("Delivery Mode");
+ table.column("Destination");
+ table.column("Expiration");
+ table.column("Priority");
+ table.column("Redelivered");
+ table.column("ReplyTo");
+ table.column("Timestamp");
+ if (verbose) {
+ table.column("Headers");
+ table.column("Properties");
+ }
+
+ List<JmsMessage> messages = getJmsService().browse(connectionFactory, queue, selector);
+ for (JmsMessage message : messages) {
+ if (verbose) {
+ StringBuilder headers = new StringBuilder();
+ for (String header : message.getHeaders().keySet()) {
+ headers.append(header).append("=").append(message.getHeaders().get(header)).append("\n");
+ }
+ StringBuilder properties = new StringBuilder();
+ for (String property : message.getProperties().keySet()) {
+ properties.append(property).append("=").append(message.getProperties().get(property)).append("\n");
+ }
+ table.addRow().addContent(
+ message.getMessageId(),
+ message.getContent(),
+ message.getCharset(),
+ message.getType(),
+ message.getCorrelationID(),
+ message.getDeliveryMode(),
+ message.getDestination(),
+ message.getExpiration(),
+ message.getPriority(),
+ message.isRedelivered(),
+ message.getReplyTo(),
+ message.getTimestamp(),
+ headers.toString(),
+ properties.toString());
+ } else {
+ table.addRow().addContent(
+ message.getMessageId(),
+ message.getContent(),
+ message.getCharset(),
+ message.getType(),
+ message.getCorrelationID(),
+ message.getDeliveryMode(),
+ message.getDestination(),
+ message.getExpiration(),
+ message.getPriority(),
+ message.isRedelivered(),
+ message.getReplyTo(),
+ message.getTimestamp());
+ }
+ }
+
+ table.print(System.out);
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/ConnectionFactoriesCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/ConnectionFactoriesCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/ConnectionFactoriesCommand.java
new file mode 100644
index 0000000..8142449
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/ConnectionFactoriesCommand.java
@@ -0,0 +1,42 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.List;
+
+@Command(scope = "jms", name = "connectionfactories", description = "List the JMS connection factories")
+public class ConnectionFactoriesCommand extends JmsCommandSupport {
+
+ public Object doExecute() throws Exception {
+
+ ShellTable table = new ShellTable();
+ table.column("JMS Connection Factory");
+
+ List<String> connectionFactories = getJmsService().connectionFactories();
+ for (String connectionFactory : connectionFactories) {
+ table.addRow().addContent(connectionFactory);
+ }
+
+ table.print(System.out);
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/ConsumeCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/ConsumeCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/ConsumeCommand.java
new file mode 100644
index 0000000..f3f4bd4
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/ConsumeCommand.java
@@ -0,0 +1,42 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "jms", name = "consume", description = "Consume messages from a JMS queue.")
+public class ConsumeCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ @Argument(index = 1, name = "queue", description = "The JMS queue where to consume messages", required = true, multiValued = false)
+ String queue;
+
+ @Option(name = "-s", aliases = { "--selector" }, description = "The selector to use to select the messages to consume", required = false, multiValued = false)
+ String selector;
+
+ public Object doExecute() throws Exception {
+
+ System.out.println(getJmsService().consume(connectionFactory, queue, selector) + " message(s) consumed");
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/CountCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/CountCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/CountCommand.java
new file mode 100644
index 0000000..1904b7e
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/CountCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+@Command(scope = "jms", name = "count", description = "Count the number of messages on a JMS queue.")
+public class CountCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ @Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
+ String queue;
+
+ public Object doExecute() throws Exception {
+ ShellTable table = new ShellTable();
+
+ table.column("Messages Count");
+
+ table.addRow().addContent(getJmsService().count(connectionFactory, queue));
+
+ table.print(System.out);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/CreateCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/CreateCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/CreateCommand.java
new file mode 100644
index 0000000..62f19de
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/CreateCommand.java
@@ -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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "jms", name = "create", description = "Create a JMS connection factory.")
+public class CreateCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "name", description = "The JMS connection factory name", required = true, multiValued = false)
+ String name;
+
+ @Option(name = "-t", aliases = { "--type" }, description = "The JMS connection factory type (ActiveMQ or WebsphereMQ)", required = true, multiValued = false)
+ String type;
+
+ @Option(name = "-u", aliases = { "--url" }, description = "The JMS URL. NB: for WebsphereMQ type, the URL is hostname/port/queuemanager/channel", required = true, multiValued = false)
+ String url;
+
+ public Object doExecute() throws Exception {
+ getJmsService().create(name, type, url);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/DeleteCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/DeleteCommand.java
new file mode 100644
index 0000000..b9d1656
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/DeleteCommand.java
@@ -0,0 +1,33 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+
+@Command(scope = "jms", name = "delete", description = "Delete a JMS connection factory")
+public class DeleteCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "name", description = "The JMS connection factory name", required = true, multiValued = false)
+ String name;
+
+ public Object doExecute() throws Exception {
+ getJmsService().delete(name);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/InfoCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/InfoCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/InfoCommand.java
new file mode 100644
index 0000000..69b13ba
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/InfoCommand.java
@@ -0,0 +1,46 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.Map;
+
+@Command(scope = "jms", name = "info", description = "Provides details about a JMS connection factory.")
+public class InfoCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ public Object doExecute() throws Exception {
+ ShellTable table = new ShellTable();
+ table.column("Property");
+ table.column("Value");
+
+ Map<String, String> info = getJmsService().info(connectionFactory);
+ for (String key : info.keySet()) {
+ table.addRow().addContent(key, info.get(key));
+ }
+
+ table.print(System.out);
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/JmsCommandSupport.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/JmsCommandSupport.java b/jms/command/src/main/java/org/apache/karaf/jms/command/JmsCommandSupport.java
new file mode 100644
index 0000000..7d8eb11
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/JmsCommandSupport.java
@@ -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.
+ */
+package org.apache.karaf.jms.command;
+
+import org.apache.karaf.jms.JmsService;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+
+public abstract class JmsCommandSupport extends OsgiCommandSupport {
+
+ private JmsService jmsService;
+
+ public abstract Object doExecute() throws Exception;
+
+ public JmsService getJmsService() {
+ return jmsService;
+ }
+
+ public void setJmsService(JmsService jmsService) {
+ this.jmsService = jmsService;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/MoveCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/MoveCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/MoveCommand.java
new file mode 100644
index 0000000..e8a3530
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/MoveCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "jms", name = "move", description = "Move messages from one JMS queue to another one.")
+public class MoveCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ @Argument(index = 1, name = "source", description = "The source JMS queue", required = true, multiValued = false)
+ String source;
+
+ @Argument(index = 2, name = "destination", description = "The destination JMS queue", required = true, multiValued = false)
+ String destination;
+
+ @Option(name = "-s", aliases = { "--selector" }, description = "Selector to move only some messages", required = false, multiValued = false)
+ String selector;
+
+ public Object doExecute() throws Exception {
+ System.out.println(getJmsService().move(connectionFactory, source, destination, selector) + " message(s) moved");
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/QueuesCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/QueuesCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/QueuesCommand.java
new file mode 100644
index 0000000..254616c
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/QueuesCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+@Command(scope = "jms", name = "queues", description = "List the JMS queues.")
+public class QueuesCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description= "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ public Object doExecute() throws Exception {
+ ShellTable table = new ShellTable();
+
+ table.column("JMS Queues");
+
+ for (String queue : getJmsService().queues(connectionFactory)) {
+ table.addRow().addContent(queue);
+ }
+
+ table.print(System.out);
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/SendCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/SendCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/SendCommand.java
new file mode 100644
index 0000000..995c907
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/SendCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "jms", name = "send", description = "Send a message to ")
+public class SendCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ @Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
+ String queue;
+
+ @Argument(index = 2, name = "message", description = "The JMS message content", required = true, multiValued = false)
+ String message;
+
+ @Option(name = "-r", aliases = { "--replyTo" }, description = "Set the message ReplyTo", required = false, multiValued = false)
+ String replyTo;
+
+ public Object doExecute() throws Exception {
+ getJmsService().send(connectionFactory, queue, message, replyTo);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/TopicsCommand.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/TopicsCommand.java b/jms/command/src/main/java/org/apache/karaf/jms/command/TopicsCommand.java
new file mode 100644
index 0000000..de8707d
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/TopicsCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.karaf.jms.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+@Command(scope = "jms", name = "topics", description = "List the JMS topics.")
+public class TopicsCommand extends JmsCommandSupport {
+
+ @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
+ String connectionFactory;
+
+ public Object doExecute() throws Exception {
+ ShellTable table = new ShellTable();
+
+ table.column("JMS Topics");
+
+ for (String topic : getJmsService().topics(connectionFactory)) {
+ table.addRow().addContent(topic);
+ }
+
+ table.print(System.out);
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/java/org/apache/karaf/jms/command/completers/ConnectionFactoriesCompleter.java
----------------------------------------------------------------------
diff --git a/jms/command/src/main/java/org/apache/karaf/jms/command/completers/ConnectionFactoriesCompleter.java b/jms/command/src/main/java/org/apache/karaf/jms/command/completers/ConnectionFactoriesCompleter.java
new file mode 100644
index 0000000..d88c230
--- /dev/null
+++ b/jms/command/src/main/java/org/apache/karaf/jms/command/completers/ConnectionFactoriesCompleter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.karaf.jms.command.completers;
+
+import org.apache.karaf.jms.JmsService;
+import org.apache.karaf.shell.console.Completer;
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+
+import java.util.List;
+
+/**
+ * Completer on the JMS connection factories.
+ */
+public class ConnectionFactoriesCompleter implements Completer {
+
+ private JmsService jmsService;
+
+ @Override
+ public int complete(String buffer, int cursor, List<String> candidates) {
+ StringsCompleter delegate = new StringsCompleter();
+ try {
+ for (String connectionFactory : jmsService.connectionFactories()) {
+ delegate.getStrings().add(connectionFactory);
+ }
+ } catch (Exception e) {
+ // nothing to do
+ }
+ return delegate.complete(buffer, cursor, candidates);
+ }
+
+ public JmsService getJmsService() {
+ return jmsService;
+ }
+
+ public void setJmsService(JmsService jmsService) {
+ this.jmsService = jmsService;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/resources/OSGI-INF/blueprint/jms-command.xml
----------------------------------------------------------------------
diff --git a/jms/command/src/main/resources/OSGI-INF/blueprint/jms-command.xml b/jms/command/src/main/resources/OSGI-INF/blueprint/jms-command.xml
new file mode 100644
index 0000000..afa6c00
--- /dev/null
+++ b/jms/command/src/main/resources/OSGI-INF/blueprint/jms-command.xml
@@ -0,0 +1,120 @@
+<?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" default-activation="lazy">
+
+ <reference id="jmsService" interface="org.apache.karaf.jms.JmsService"/>
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="org.apache.karaf.jms.command.BrowseCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.ConnectionFactoriesCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.ConsumeCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.CountCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.CreateCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.DeleteCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.InfoCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.MoveCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.QueuesCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.SendCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ <command>
+ <action class="org.apache.karaf.jms.command.TopicsCommand">
+ <property name="jmsService" ref="jmsService"/>
+ </action>
+ <completers>
+ <ref component-id="connectionFactoriesCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ </command-bundle>
+
+ <bean id="connectionFactoriesCompleter" class="org.apache.karaf.jms.command.completers.ConnectionFactoriesCompleter">
+ <property name="jmsService" ref="jmsService"/>
+ </bean>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/command/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/jms/command/src/main/resources/OSGI-INF/bundle.info b/jms/command/src/main/resources/OSGI-INF/bundle.info
new file mode 100644
index 0000000..8b83f13
--- /dev/null
+++ b/jms/command/src/main/resources/OSGI-INF/bundle.info
@@ -0,0 +1,29 @@
+h1. Synopsis
+
+${project.name}
+
+${project.description}
+
+Maven URL:
+[mvn:${project.groupId}/${project.artifactId}/${project.version}]
+
+h1. Description
+
+This bundle provides the shell commands to manipulate the JMS service.
+
+The following commands are available:
+
+* jms:create
+* jms:delete
+* jms:connectionfactories
+* jms:info
+* jms:count
+* jms:queues
+* jms:topics
+* jms:send
+* jms:consume
+* jms:move
+
+h1. See also
+
+JMS - section of the Karaf User Guide
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/NOTICE
----------------------------------------------------------------------
diff --git a/jms/core/NOTICE b/jms/core/NOTICE
new file mode 100644
index 0000000..de8d101
--- /dev/null
+++ b/jms/core/NOTICE
@@ -0,0 +1,71 @@
+Apache Karaf
+Copyright 2010-2013 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/pom.xml
----------------------------------------------------------------------
diff --git a/jms/core/pom.xml b/jms/core/pom.xml
new file mode 100644
index 0000000..1ae2f18
--- /dev/null
+++ b/jms/core/pom.xml
@@ -0,0 +1,96 @@
+<?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>
+ <groupId>org.apache.karaf.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.karaf.jms.core</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Karaf :: JMS :: Core</name>
+ <description>This bundle provides core implementation of the JMS service.</description>
+
+ <properties>
+ <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-pool</artifactId>
+ <version>5.9.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.info</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.karaf.jms
+ </Export-Package>
+ <Import-Package>
+ org.apache.activemq*;resolution:=optional
+ </Import-Package>
+ <Private-Package>
+ org.apache.karaf.jms.internal
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/java/org/apache/karaf/jms/JmsMBean.java
----------------------------------------------------------------------
diff --git a/jms/core/src/main/java/org/apache/karaf/jms/JmsMBean.java b/jms/core/src/main/java/org/apache/karaf/jms/JmsMBean.java
new file mode 100644
index 0000000..de91fc8
--- /dev/null
+++ b/jms/core/src/main/java/org/apache/karaf/jms/JmsMBean.java
@@ -0,0 +1,137 @@
+/*
+ * 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.karaf.jms;
+
+import javax.management.MBeanException;
+import javax.management.openmbean.TabularData;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JMS MBean.
+ */
+public interface JmsMBean {
+
+ /**
+ * List the JMS connection factories.
+ *
+ * @return the list of the JMS connection factories name.
+ * @throws MBeanException
+ */
+ List<String> getConnectionfactories() throws MBeanException;
+
+ /**
+ * Create a JMS connection factory.
+ *
+ * @param name the JMS connection factory name.
+ * @param type the JMS connection factory type (ActiveMQ or WebsphereMQ).
+ * @param url the JMS connection factory URL. NB: when type is WebsphereMQ, the URL has the format host/port/queuemanager/channel.
+ * @throws MBeanException
+ */
+ void create(String name, String type, String url) throws MBeanException;
+
+ /**
+ * Delete a JMS connection factory.
+ *
+ * @param name the JMS connection factory name.
+ * @throws MBeanException
+ */
+ void delete(String name) throws MBeanException;
+
+ /**
+ * Get details about a JMS connection factory.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return a map (property/value) containing details.
+ * @throws MBeanException
+ */
+ Map<String, String> info(String connectionFactory) throws MBeanException;
+
+ /**
+ * Count the messages on a given JMS queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the JMS queue name.
+ * @return
+ * @throws MBeanException
+ */
+ int count(String connectionFactory, String queue) throws MBeanException;
+
+ /**
+ * List the JMS queues.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return the list of JMS queues.
+ * @throws MBeanException
+ */
+ List<String> queues(String connectionFactory) throws MBeanException;
+
+ /**
+ * List the JMS topics.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return the list of JMS topics.
+ * @throws MBeanException
+ */
+ List<String> topics(String connectionFactory) throws MBeanException;
+
+ /**
+ * Browse the messages in a JMS queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the JMS queue name.
+ * @param selector a selector to use to browse only certain messages.
+ * @return a tabular data with messages details.
+ * @throws MBeanException
+ */
+ TabularData browse(String connectionFactory, String queue, String selector) throws MBeanException;
+
+ /**
+ * Send a JMS message to given queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the JMS queue name.
+ * @param content the message content.
+ * @param replyTo the message ReplyTo.
+ * @throws MBeanException
+ */
+ void send(String connectionFactory, String queue, String content, String replyTo) throws MBeanException;
+
+ /**
+ * Consume JMS messages from a given queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the JMS queue name.
+ * @param selector a selector to use to consume only certain messages.
+ * @return the number of messages consumed.
+ * @throws MBeanException
+ */
+ int consume(String connectionFactory, String queue, String selector) throws MBeanException;
+
+ /**
+ * Move JMS messages from one queue to another.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param source the source JMS queue name.
+ * @param destination the destination JMS queue name.
+ * @param selector a selector to move only certain messages.
+ * @return the number of messages moved.
+ * @throws MBeanException
+ */
+ int move(String connectionFactory, String source, String destination, String selector) throws MBeanException;
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/java/org/apache/karaf/jms/JmsMessage.java
----------------------------------------------------------------------
diff --git a/jms/core/src/main/java/org/apache/karaf/jms/JmsMessage.java b/jms/core/src/main/java/org/apache/karaf/jms/JmsMessage.java
new file mode 100644
index 0000000..065ac51
--- /dev/null
+++ b/jms/core/src/main/java/org/apache/karaf/jms/JmsMessage.java
@@ -0,0 +1,156 @@
+/*
+ * 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.karaf.jms;
+
+import javax.jms.*;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Describe a JMS message is more human readable way.
+ */
+public class JmsMessage {
+
+ private Map<String, Object> headers = new HashMap<String, Object>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
+ private String content;
+ private String charset = "UTF-8";
+ private String correlationID;
+ private int deliveryMode;
+ private String destination;
+ private long expiration;
+ private String messageId;
+ private int priority;
+ private boolean redelivered;
+ private String replyTo;
+ private long timestamp;
+ private String type;
+
+ public JmsMessage(Message message) {
+ try {
+ initFromMessage(message);
+ } catch (JMSException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public void initFromMessage(Message message) throws JMSException {
+ @SuppressWarnings("unchecked")
+ Enumeration<String> names = message.getPropertyNames();
+ while (names.hasMoreElements()) {
+ String key = names.nextElement();
+ Object value = message.getObjectProperty(key);
+ properties.put(key, value);
+ }
+
+ correlationID = message.getJMSCorrelationID();
+ deliveryMode = message.getJMSDeliveryMode();
+ Destination destinationDest = message.getJMSDestination();
+ if (destinationDest != null) {
+ destination = destinationDest.toString();
+ }
+ expiration = message.getJMSExpiration();
+ messageId = message.getJMSMessageID();
+ priority = message.getJMSPriority();
+ redelivered = message.getJMSRedelivered();
+ Destination replyToDest = message.getJMSReplyTo();
+ if (replyToDest != null) {
+ replyTo = replyToDest.toString();
+ }
+ timestamp = message.getJMSTimestamp();
+ type = message.getJMSType();
+ content = getMessageContent(message);
+ }
+
+
+ private String getMessageContent(Message message) throws JMSException {
+ if (message instanceof TextMessage) {
+ return ((TextMessage) message).getText();
+ } else if (message instanceof BytesMessage) {
+ BytesMessage bMessage = (BytesMessage) message;
+ long length = bMessage.getBodyLength();
+ byte[] content = new byte[(int) length];
+ bMessage.readBytes(content);
+ try {
+ return new String(content, charset);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+ return "";
+ }
+
+ public Map<String, Object> getHeaders() {
+ return headers;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public String getCharset() {
+ return charset;
+ }
+
+ public String getCorrelationID() {
+ return correlationID;
+ }
+
+ public int getDeliveryMode() {
+ return deliveryMode;
+ }
+
+ public String getDestination() {
+ return destination;
+ }
+
+ public long getExpiration() {
+ return expiration;
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public boolean isRedelivered() {
+ return redelivered;
+ }
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/java/org/apache/karaf/jms/JmsService.java
----------------------------------------------------------------------
diff --git a/jms/core/src/main/java/org/apache/karaf/jms/JmsService.java b/jms/core/src/main/java/org/apache/karaf/jms/JmsService.java
new file mode 100644
index 0000000..92d046d
--- /dev/null
+++ b/jms/core/src/main/java/org/apache/karaf/jms/JmsService.java
@@ -0,0 +1,135 @@
+/*
+ * 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.karaf.jms;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JMS Service.
+ */
+public interface JmsService {
+
+ /**
+ * List the JMS connection factories.
+ *
+ * @return the list of JMS connection factory names.
+ * @throws Exception
+ */
+ List<String> connectionFactories() throws Exception;
+
+ /**
+ * Create a new JMS connection factory.
+ *
+ * @param name the JMS connection factory name.
+ * @param type the JMS connection factory type (ActiveMQ, WebsphereMQ, ...).
+ * @param url the JMS URL to use.
+ * @throws Exception
+ */
+ void create(String name, String type, String url) throws Exception;
+
+ /**
+ * Delete a JMS connection factory.
+ *
+ * @param name the JMS connection factory name.
+ * @throws Exception
+ */
+ void delete(String name) throws Exception;
+
+ /**
+ * Get details about a given JMS connection factory.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return a map (property/value) containing details.
+ * @throws Exception
+ */
+ Map<String, String> info(String connectionFactory) throws Exception;
+
+ /**
+ * Count the number of messages in a JMS queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the queue name.
+ * @return the number of messages in a JMS queue.
+ * @throws Exception
+ */
+ int count(String connectionFactory, String queue) throws Exception;
+
+ /**
+ * List the queues.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return the list of queues.
+ * @throws Exception
+ */
+ List<String> queues(String connectionFactory) throws Exception;
+
+ /**
+ * List the topics.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @return the list of topics.
+ * @throws Exception
+ */
+ List<String> topics(String connectionFactory) throws Exception;
+
+ /**
+ * Browse a destination.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the queue name.
+ * @param selector the selector.
+ * @return the list of messages.
+ * @throws Exception
+ */
+ List<JmsMessage> browse(String connectionFactory, String queue, String selector) throws Exception;
+
+ /**
+ * Send a message on the given queue.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the queue name.
+ * @param body the message body.
+ * @param replyTo the message replyTo header.
+ * @throws Exception
+ */
+ void send(String connectionFactory, String queue, String body, String replyTo) throws Exception;
+
+ /**
+ * Consume messages from a given destination.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param queue the queue name.
+ * @param selector the messages selector.
+ * @return the number of messages consumed.
+ * @throws Exception
+ */
+ int consume(String connectionFactory, String queue, String selector) throws Exception;
+
+ /**
+ * Move messages from a destination to another.
+ *
+ * @param connectionFactory the JMS connection factory name.
+ * @param sourceQueue the source queue.
+ * @param targetQueue the target queue.
+ * @param selector the messages selector on the source queue.
+ * @return the number of messages moved.
+ * @throws Exception
+ */
+ int move(String connectionFactory, String sourceQueue, String targetQueue, String selector) throws Exception;
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/bde7577f/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java
----------------------------------------------------------------------
diff --git a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java
new file mode 100644
index 0000000..a49b7a0
--- /dev/null
+++ b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java
@@ -0,0 +1,155 @@
+/*
+ * 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.karaf.jms.internal;
+
+import org.apache.karaf.jms.JmsMBean;
+import org.apache.karaf.jms.JmsMessage;
+import org.apache.karaf.jms.JmsService;
+
+import javax.management.MBeanException;
+import javax.management.openmbean.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Default implementation of the JMS MBean.
+ */
+public class JmsMBeanImpl implements JmsMBean {
+
+ private JmsService jmsService;
+
+ @Override
+ public List<String> getConnectionfactories() throws MBeanException {
+ try {
+ return jmsService.connectionFactories();
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public void create(String name, String type, String url) throws MBeanException {
+ try {
+ jmsService.create(name, type, url);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public void delete(String name) throws MBeanException {
+ try {
+ jmsService.delete(name);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public Map<String, String> info(String connectionFactory) throws MBeanException {
+ try {
+ return jmsService.info(connectionFactory);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public int count(String connectionFactory, String queue) throws MBeanException {
+ try {
+ return jmsService.count(connectionFactory, queue);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public List<String> queues(String connectionFactory) throws MBeanException {
+ try {
+ return jmsService.queues(connectionFactory);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public List<String> topics(String connectionFactory) throws MBeanException {
+ try {
+ return jmsService.topics(connectionFactory);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public void send(String connectionFactory, String queue, String content, String replyTo) throws MBeanException {
+ try {
+ jmsService.send(connectionFactory, queue, content, replyTo);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public int consume(String connectionFactory, String queue, String selector) throws MBeanException {
+ try {
+ return jmsService.consume(connectionFactory, queue, selector);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public int move(String connectionFactory, String source, String destination, String selector) throws MBeanException {
+ try {
+ return jmsService.move(connectionFactory, source, destination, selector);
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ @Override
+ public TabularData browse(String connectionFactory, String queue, String selector) throws MBeanException {
+ try {
+ CompositeType type = new CompositeType("message", "JMS Message",
+ new String[]{ "id", "content", "charset", "type", "correlation", "delivery", "destination", "expiration", "priority", "redelivered", "replyto", "timestamp" },
+ new String[]{ "Message ID", "Content", "Charset", "Type", "Correlation ID", "Delivery Mode", "Destination", "Expiration Date", "Priority", "Redelivered", "Reply-To", "Timestamp" },
+ new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.LONG, SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.STRING, SimpleType.LONG });
+ TabularType tableType = new TabularType("messages", "JMS Messages", type, new String[]{ "id" });
+ TabularData table = new TabularDataSupport(tableType);
+ for (JmsMessage message : getJmsService().browse(connectionFactory, queue, selector)) {
+ CompositeData data = new CompositeDataSupport(type,
+ new String[]{ "id", "content", "charset", "type", "correlation", "delivery", "destination", "expiration", "priority", "redelivered", "replyto", "timestamp" },
+ new Object[]{ message.getMessageId(), message.getContent(), message.getCharset(), message.getType(), message.getCorrelationID(), message.getDeliveryMode(), message.getDestination(), message.getExpiration(), message.getProperties(), message.isRedelivered(), message.getReplyTo(), message.getTimestamp() }
+ );
+ table.put(data);
+ }
+ return table;
+ } catch (Throwable t) {
+ throw new MBeanException(null, t.getMessage());
+ }
+ }
+
+ public JmsService getJmsService() {
+ return jmsService;
+ }
+
+ public void setJmsService(JmsService jmsService) {
+ this.jmsService = jmsService;
+ }
+
+}