You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by cc...@apache.org on 2008/10/29 04:40:05 UTC
svn commit: r708762 - in
/servicemix/smx4/features/trunk/activemq/activemq-commands: ./
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: ccustine
Date: Tue Oct 28 20:40:05 2008
New Revision: 708762
URL: http://svn.apache.org/viewvc?rev=708762&view=rev
Log:
SMX4KNL-128 Updating ActiveMQ commands to gshell trunk
Added:
servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/CreateBrokerCommand.properties
servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/DestroyBrokerCommand.properties
Modified:
servicemix/smx4/features/trunk/activemq/activemq-commands/pom.xml
servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/META-INF/spring/servicemix-activemq.xml
Modified: servicemix/smx4/features/trunk/activemq/activemq-commands/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-commands/pom.xml?rev=708762&r1=708761&r2=708762&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-commands/pom.xml (original)
+++ servicemix/smx4/features/trunk/activemq/activemq-commands/pom.xml Tue Oct 28 20:40:05 2008
@@ -37,27 +37,18 @@
Provides the ActiveMQ commands
</description>
+ <properties>
+ <gshell.version>1.0-alpha-2-SNAPSHOT</gshell.version>
+ </properties>
+
<dependencies>
- <dependency>
- <groupId>org.apache.servicemix.kernel.gshell</groupId>
- <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
- <version>${servicemix.kernel.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.kernel.gshell</groupId>
+ <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+ <version>${servicemix.kernel.version}</version>
+ </dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${felix.osgi.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
- <version>${spring.osgi.version}</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${activemq.version}</version>
@@ -90,9 +81,14 @@
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
- <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>org.apache.servicemix.kernel.gshell.activemq*;version=${project.version};-split-package:=merge-first</Export-Package>
- <Import-Package>*</Import-Package>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Export-Package>org.apache.servicemix.kernel.gshell.activemq;version=${project.version};-split-package:=merge-first</Export-Package>
+ <Import-Package>
+ org.apache.geronimo.gshell.wisdom.command,
+ org.apache.servicemix.kernel.gshell.core,
+ org.apache.geronimo.gshell.wisdom.registry,
+ *
+ </Import-Package>
<Private-Package>!*</Private-Package>
<Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
</instructions>
Modified: servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java?rev=708762&r1=708761&r2=708762&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java (original)
+++ servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java Tue Oct 28 20:40:05 2008
@@ -22,66 +22,59 @@
import org.apache.activemq.console.command.Command;
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
+import org.apache.activemq.console.CommandContext;
import org.apache.geronimo.gshell.clp.Argument;
import org.apache.geronimo.gshell.command.Arguments;
-import org.apache.geronimo.gshell.command.CommandAction;
-import org.apache.geronimo.gshell.command.CommandContext;
-import org.apache.geronimo.gshell.io.IO;
+import org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport;
/**
* @version $Rev$ $Date$
*/
-public class AdministrationCommand implements CommandAction {
+public class AdministrationCommand extends OsgiCommandSupport {
private Command command;
@Argument(index=0, multiValued=true, required=true)
private Collection<String> arguments = null;
- /*
- * (non-Javadoc)
- * @see
- * org.apache.geronimo.gshell.command.CommandAction#execute(org.apache.geronimo
- * .gshell.command.CommandContext)
- */
- public Object execute(CommandContext context) throws Exception {
- final String[] args = Arguments.toStringArray(arguments.toArray());
- final IO io = context.getIo();
-
- org.apache.activemq.console.CommandContext context2 = new org.apache.activemq.console.CommandContext();
- context2.setFormatter(new CommandShellOutputFormatter(context.getIo().outputStream));
- Command currentCommand = command.getClass().newInstance();
-
- try {
- currentCommand.setCommandContext(context2);
- currentCommand.execute(new ArrayList<String>(Arrays.asList(args)));
- return Result.SUCCESS;
- } catch (Throwable e) {
- Throwable cur = e;
- while (cur.getCause() != null) {
- cur = cur.getCause();
- }
- if (cur instanceof java.net.ConnectException) {
- context2
- .print("\n"
- + "Could not connect to JMX server. This command requires that the remote JMX server be enabled.\n"
- + "This is typically done by adding the following JVM arguments: \n"
- + " -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false \n"
- + " -Dcom.sun.management.jmxremote.ssl=false \n" + "\n"
- + "The connection error was: " + cur + "\n");
- } else {
- if (e instanceof Exception) {
- throw (Exception)e;
- } else {
- throw new RuntimeException(e);
- }
+ protected Object doExecute() throws Exception {
+ final String[] args = Arguments.toStringArray(arguments.toArray());
+ CommandContext context2 = new CommandContext();
+ context2.setFormatter(new CommandShellOutputFormatter(io.outputStream));
+ Command currentCommand = command.getClass().newInstance();
+
+ try {
+ currentCommand.setCommandContext(context2);
+ currentCommand.execute(new ArrayList<String>(Arrays.asList(args)));
+ return Result.SUCCESS;
+ } catch (Throwable e) {
+ Throwable cur = e;
+ while (cur.getCause() != null) {
+ cur = cur.getCause();
+ }
+ if (cur instanceof java.net.ConnectException) {
+ context2
+ .print("\n"
+ + "Could not connect to JMX server. This command requires that the remote JMX server be enabled.\n"
+ + "This is typically done by adding the following JVM arguments: \n"
+ + " -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false \n"
+ + " -Dcom.sun.management.jmxremote.ssl=false \n" + "\n"
+ + "The connection error was: " + cur + "\n");
+ } else {
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ } else {
+ throw new RuntimeException(e);
}
+
}
- return Result.FAILURE;
}
+ return null;
+
+ }
- public Command getCommand() {
+ public Command getCommand() {
return command;
}
Modified: servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/META-INF/spring/servicemix-activemq.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/META-INF/spring/servicemix-activemq.xml?rev=708762&r1=708761&r2=708762&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/META-INF/spring/servicemix-activemq.xml (original)
+++ servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/META-INF/spring/servicemix-activemq.xml Tue Oct 28 20:40:05 2008
@@ -19,95 +19,54 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+ http://servicemix.apache.org/schema/servicemix-gshell
+ http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd
">
-
- <!-- wrapper commands -->
- <bean id="create-broker" class="org.apache.servicemix.kernel.gshell.activemq.CreateBrokerCommand" />
- <osgi:service ref="create-broker" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="activemq"/>
- <entry key="name" value="create-broker"/>
- </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>
-
- <bean id="list" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
- <property name="id" value="activemq:list"/>
- <property name="description" value="Lists all available brokers in the specified JMX context"/>
- <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>
-
- <bean id="query" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
- <property name="id" value="activemq:query"/>
- <property name="description" value="Display selected broker component's attributes and statistics"/>
- <property name="command"><bean class="org.apache.activemq.console.command.QueryCommand"/></property>
- </bean>
- <osgi:service ref="query" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="activemq"/>
- <entry key="name" value="query"/>
- </osgi:service-properties>
- </osgi:service>
-
- <bean id="browse" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
- <property name="id" value="activemq:browse"/>
- <property name="description" value="Display selected messages in a specified destination"/>
- <property name="command"><bean class="org.apache.activemq.console.command.AmqBrowseCommand"/></property>
- </bean>
- <osgi:service ref="browse" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="activemq"/>
- <entry key="name" value="browse"/>
- </osgi:service-properties>
- </osgi:service>
-
- <bean id="purge" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
- <property name="id" value="activemq:purge"/>
- <property name="description" value="Delete selected destination's messages that matches the message selector"/>
- <property name="command"><bean class="org.apache.activemq.console.command.PurgeCommand"/></property>
- </bean>
- <osgi:service ref="purge" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="activemq"/>
- <entry key="name" value="purge"/>
- </osgi:service-properties>
- </osgi:service>
-
- <bean id="bstat" class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
- <property name="id" value="activemq:bstat"/>
- <property name="description" value="Displays useful broker statistics"/>
- <property name="command"><bean class="org.apache.activemq.console.command.BstatCommand"/></property>
- </bean>
- <osgi:service ref="bstat" interface="org.apache.geronimo.gshell.command.Command">
- <osgi:service-properties>
- <entry key="shell" value="activemq"/>
- <entry key="name" value="bstat"/>
- </osgi:service-properties>
- </osgi:service>
-
+
+ <import resource="classpath:org/apache/servicemix/kernel/gshell/core/commands.xml" />
+
+ <gshell:command-bundle>
+ <gshell:command name="activemq/create-broker">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.CreateBrokerCommand" />
+ </gshell:command>
+
+ <gshell:command name="activemq/destroy-broker">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.DestroyBrokerCommand" />
+ </gshell:command>
+
+ <gshell:command name="activemq/list">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+ <property name="command"><bean class="org.apache.activemq.console.command.ListCommand"/></property>
+ </gshell:action>
+ </gshell:command>
+ <gshell:link name="activemq/ls" target="activemq/list"/>
+
+ <gshell:command name="activemq/query">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+ <property name="command"><bean class="org.apache.activemq.console.command.QueryCommand"/></property>
+ </gshell:action>
+ </gshell:command>
+
+ <gshell:command name="activemq/browse">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+ <property name="command"><bean class="org.apache.activemq.console.command.AmqBrowseCommand"/></property>
+ </gshell:action>
+ </gshell:command>
+ <gshell:command name="activemq/purge">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+ <property name="command"><bean class="org.apache.activemq.console.command.PurgeCommand"/></property>
+ </gshell:action>
+ </gshell:command>
+ <gshell:command name="activemq/bstat">
+ <gshell:action class="org.apache.servicemix.kernel.gshell.activemq.AdministrationCommand">
+ <property name="command"><bean class="org.apache.activemq.console.command.BstatCommand"/></property>
+ </gshell:action>
+ </gshell:command>
+
+ </gshell:command-bundle>
+
</beans>
\ No newline at end of file
Added: servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/CreateBrokerCommand.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/CreateBrokerCommand.properties?rev=708762&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/CreateBrokerCommand.properties (added)
+++ servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/CreateBrokerCommand.properties Tue Oct 28 20:40:05 2008
@@ -0,0 +1,27 @@
+##
+## 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.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Creates a broker instance.
+
+command.manual=\
+ TODO: date manual
\ No newline at end of file
Added: servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/DestroyBrokerCommand.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/DestroyBrokerCommand.properties?rev=708762&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/DestroyBrokerCommand.properties (added)
+++ servicemix/smx4/features/trunk/activemq/activemq-commands/src/main/resources/org/apache/servicemix/kernel/gshell/activemq/DestroyBrokerCommand.properties Tue Oct 28 20:40:05 2008
@@ -0,0 +1,27 @@
+##
+## 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.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Remove a broker instance.
+
+command.manual=\
+ TODO: date manual
\ No newline at end of file