You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2008/05/01 20:42:53 UTC

svn commit: r652618 - in /servicemix/smx4/kernel/trunk/gshell/gshell-activemq: ./ src/main/java/org/apache/servicemix/kernel/gshell/activemq/ src/main/resources/META-INF/spring/ src/main/resources/org/apache/servicemix/kernel/gshell/activemq/

Author: chirino
Date: Thu May  1 11:42:52 2008
New Revision: 652618

URL: http://svn.apache.org/viewvc?rev=652618&view=rev
Log:
Starting to add support for running the normal amq commands via smx gshell

Added:
    servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java   (with props)
Modified:
    servicemix/smx4/kernel/trunk/gshell/gshell-activemq/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/broker.xml

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-activemq/pom.xml?rev=652618&r1=652617&r2=652618&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-activemq/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-activemq/pom.xml Thu May  1 11:42:52 2008
@@ -68,6 +68,12 @@
             <artifactId>activemq-optional</artifactId>
             <version>5.2-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-console</artifactId>
+            <version>5.2-SNAPSHOT</version>
+        </dependency>
         
     </dependencies>
 

Added: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java?rev=652618&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java Thu May  1 11:42:52 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.kernel.gshell.activemq;
+
+import java.util.Arrays;
+
+import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.common.Arguments;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class AdministrationCommand implements Command
+{
+
+	private String description;
+	private String id;
+	private org.apache.activemq.console.command.Command command;
+
+	public Object execute(CommandContext context, Object... objArgs) throws Exception {
+		String[] args = Arguments.toStringArray(objArgs);
+		org.apache.activemq.console.CommandContext context2 = new org.apache.activemq.console.CommandContext();
+		context2.setFormatter(new CommandShellOutputFormatter(context.getIO().outputStream));
+		try {
+			command.setCommandContext(context2);
+			command.execute(Arrays.asList(args));
+		} catch (Throwable e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return SUCCESS;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public org.apache.activemq.console.command.Command getCommand() {
+		return command;
+	}
+
+	public void setCommand(org.apache.activemq.console.command.Command command) {
+		this.command = command;
+	}
+	
+ 
+}

Propchange: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml?rev=652618&r1=652617&r2=652618&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml Thu May  1 11:42:52 2008
@@ -35,8 +35,6 @@
 	
     <!-- wrapper commands -->
     <bean id="create-broker" class="org.apache.servicemix.kernel.gshell.activemq.CreateBrokerCommand" />
-    <bean id="destroy-broker" class="org.apache.servicemix.kernel.gshell.activemq.DestroyBrokerCommand" />
-    
     <osgi:service ref="create-broker" interface="org.apache.geronimo.gshell.command.Command">
       <osgi:service-properties>
         <entry key="shell" value="activemq"/>
@@ -44,11 +42,27 @@
       </osgi:service-properties>
     </osgi:service>
 
+    <bean id="destroy-broker" class="org.apache.servicemix.kernel.gshell.activemq.DestroyBrokerCommand" />
     <osgi:service ref="destroy-broker" interface="org.apache.geronimo.gshell.command.Command">
       <osgi:service-properties>
         <entry key="shell" value="activemq"/>
       	<entry key="name" value="destroy-broker"/>
       </osgi:service-properties>
     </osgi:service>
+
+    <!-- This is a bit experimental still.. basically we are bridging to ActiveMQ commands implemented in the activemq-core bundle.     
+    <bean id="list" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+    	<property name="id" value="activemq:list"/>
+    	<property name="description" value="lists stuff"/>
+    	<property name="command"><bean class="org.apache.activemq.console.command.ListCommand"/></property>
+    </bean>
+    <osgi:service ref="list" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="activemq"/>
+      	<entry key="name" value="list"/>
+      </osgi:service-properties>
+    </osgi:service>     
+    -->
+
     
 </beans>
\ No newline at end of file

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/broker.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/broker.xml?rev=652618&r1=652617&r2=652618&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/broker.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/broker.xml Thu May  1 11:42:52 2008
@@ -25,7 +25,7 @@
     <!-- Allows us to use system properties as variables in this configuration file -->
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${servicemix.base}/data/activemq/localhost">
+    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="${name}" dataDirectory="${servicemix.base}/data/activemq/${name}">
 
         <!-- Destination specific policies using destination names or wildcards -->
         <destinationPolicy>
@@ -56,7 +56,7 @@
         </networkConnectors>
 
         <persistenceAdapter>
-            <amqPersistenceAdapter syncOnWrite="false" directory="${servicemix.base}/data/activemq/localhost" maxFileLength="20 mb"/>
+            <amqPersistenceAdapter syncOnWrite="false" directory="${servicemix.base}/data/activemq/${name}" maxFileLength="20 mb"/>
         </persistenceAdapter>
 
         <!-- Use the following if you wish to configure the journal with JDBC -->