servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r795890 - in /servicemix/smx3/trunk/samples/clients/jmx: README.txt pom.xml src/main/assembly/ src/main/assembly/src.xml src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
Date Mon, 20 Jul 2009 16:10:36 GMT
Author: jbonofre
Date: Mon Jul 20 16:10:36 2009
New Revision: 795890

URL: http://svn.apache.org/viewvc?rev=795890&view=rev
Log:
Complete the JMX client sample including maven exec plugin usage and assembly.

Added:
    servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/
    servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml   (with props)
Modified:
    servicemix/smx3/trunk/samples/clients/jmx/README.txt
    servicemix/smx3/trunk/samples/clients/jmx/pom.xml
    servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java

Modified: servicemix/smx3/trunk/samples/clients/jmx/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/README.txt?rev=795890&r1=795889&r2=795890&view=diff
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/README.txt (original)
+++ servicemix/smx3/trunk/samples/clients/jmx/README.txt Mon Jul 20 16:10:36 2009
@@ -18,4 +18,14 @@
 Welcome to the ServiceMix JMX Client Example
 ============================================
 
-This example shows how to code a basic JMX client to connect to a remote ServiceMix instance.
\ No newline at end of file
+This example shows how to code a basic JMX client to connect to a remote ServiceMix instance.
+
+First start a ServiceMix server (if not already started) by running
+    bin/servicemix
+in the root dir of this distribution.
+
+To run this sample, launch the following commands:
+    mvn install exec:java
+    
+The list of components and service assemblies deployed into ServiceMix will be displayed
+on the standard output.    
\ No newline at end of file

Modified: servicemix/smx3/trunk/samples/clients/jmx/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/pom.xml?rev=795890&r1=795889&r2=795890&view=diff
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/pom.xml (original)
+++ servicemix/smx3/trunk/samples/clients/jmx/pom.xml Mon Jul 20 16:10:36 2009
@@ -45,6 +45,26 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.1</version>
+                <inherited>false</inherited>
+                <executions>
+                    <execution>
+                        <id>src</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/src.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <source>1.5</source>
@@ -63,6 +83,21 @@
                     </archive>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.1.1</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <mainClass>org.apache.servicemix.samples.clients.jmx.Client</mainClass>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
          

Added: servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml?rev=795890&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml (added)
+++ servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml Mon Jul 20 16:10:36
2009
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<assembly>
+  <id>src</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>zip</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <includes>
+        <include>README*</include>
+        <include>LICENSE*</include>
+        <include>NOTICE*</include>
+        <include>pom.xml</include>
+        <include>src/**/*</include>
+        <include>*/pom.xml</include>
+        <include>*/src/**/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file

Propchange: servicemix/smx3/trunk/samples/clients/jmx/src/main/assembly/src.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java?rev=795890&r1=795889&r2=795890&view=diff
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
(original)
+++ servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
Mon Jul 20 16:10:36 2009
@@ -19,10 +19,14 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
 import org.apache.servicemix.jbi.management.ManagementContext;
 
 /**
@@ -50,7 +54,19 @@
         Map<String, Object> environment = new HashMap<String, Object>();
         environment.put(JMXConnector.CREDENTIALS, credentials);
         JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl);
-        // TODO use Commons CLI to manage different SMX parameters.
+        
+        // get the AdminCommandsServiceMBean
+        ObjectName objectName = ManagementContext.getSystemObjectName(ManagementContext.DEFAULT_DOMAIN,
JBIContainer.DEFAULT_NAME, AdminCommandsServiceMBean.class);
+        AdminCommandsServiceMBean adminCommandsServiceMBean = (AdminCommandsServiceMBean)
MBeanServerInvocationHandler.newProxyInstance(jmxConnector.getMBeanServerConnection(), objectName,
AdminCommandsServiceMBean.class, true);
+        
+        // list components deployed into the SMX instance
+        System.out.println("Components available: ");
+        System.out.println(adminCommandsServiceMBean.listComponents(false, false, false,
null, null, null));
+        
+        // list service assemblies into the SMX instance
+        System.out.println("Service Assemblies available: ");
+        System.out.println(adminCommandsServiceMBean.listServiceAssemblies(null, null, null));
+        
         // close the JMX connection.
         jmxConnector.close();
     }



Mime
View raw message