Author: chirino
Date: Fri May 2 09:31:33 2008
New Revision: 652807
URL: http://svn.apache.org/viewvc?rev=652807&view=rev
Log:
added the rest of the amq commands
Modified:
servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/resources/META-INF/spring/servicemix-activemq.xml
Modified:
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=652807&r1=652806&r2=652807&view=diff
==============================================================================
---
servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
(original)
+++
servicemix/smx4/kernel/trunk/gshell/gshell-activemq/src/main/java/org/apache/servicemix/kernel/gshell/activemq/AdministrationCommand.java
Fri May 2 09:31:33 2008
@@ -16,6 +16,7 @@
*/
package org.apache.servicemix.kernel.gshell.activemq;
+import java.util.ArrayList;
import java.util.Arrays;
import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
@@ -40,10 +41,29 @@
context2.setFormatter(new
CommandShellOutputFormatter(context.getIO().outputStream));
try {
command.setCommandContext(context2);
- command.execute(Arrays.asList(args));
+ command.execute(new
ArrayList<String>(Arrays.asList(args)));
} catch (Throwable e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ 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 SUCCESS;
}
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=652807&r1=652806&r2=652807&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
Fri May 2 09:31:33 2008
@@ -50,10 +50,9 @@
</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="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">
@@ -62,7 +61,53 @@
<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>
+
</beans>
\ No newline at end of file