servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r794321 - in /servicemix/smx3/trunk/samples/clients: ./ jmx/ jmx/src/ jmx/src/main/ jmx/src/main/java/ jmx/src/main/java/org/ jmx/src/main/java/org/apache/ jmx/src/main/java/org/apache/servicemix/ jmx/src/main/java/org/apache/servicemix/sam...
Date Wed, 15 Jul 2009 16:31:05 GMT
Author: jbonofre
Date: Wed Jul 15 16:31:04 2009
New Revision: 794321

URL: http://svn.apache.org/viewvc?rev=794321&view=rev
Log:
SM-1865: add a JMX client sample.

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

Added: servicemix/smx3/trunk/samples/clients/jmx/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/README.txt?rev=794321&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/README.txt (added)
+++ servicemix/smx3/trunk/samples/clients/jmx/README.txt Wed Jul 15 16:31:04 2009
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+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

Propchange: servicemix/smx3/trunk/samples/clients/jmx/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/smx3/trunk/samples/clients/jmx/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/pom.xml?rev=794321&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/pom.xml (added)
+++ servicemix/smx3/trunk/samples/clients/jmx/pom.xml Wed Jul 15 16:31:04 2009
@@ -0,0 +1,69 @@
+<?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/maven-v4_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.servicemix.samples</groupId>
+        <artifactId>clients</artifactId>
+        <version>3.3.2-SNAPSHOT</version>
+    </parent>
+    
+    <groupId>org.apache.servicemix.samples.clients</groupId>
+    <artifactId>jmx</artifactId>
+    <name>ServiceMix :: Samples :: Clients :: JMX Client</name>
+    <packaging>jar</packaging>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-core</artifactId>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <index>true</index>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+         
+</project>
\ No newline at end of file

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

Added: 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=794321&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
(added)
+++ servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
Wed Jul 15 16:31:04 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.samples.clients.jmx;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.servicemix.jbi.management.ManagementContext;
+
+/**
+ * <p>
+ * A simple JMX client to connect to a local ServiceMix instance and monitor it.
+ * </p>
+ * 
+ * @author jbonofre
+ */
+public class Client {
+    
+    /**
+     * <p>
+     * Main method to connect to ServiceMix and retrieve the list of service assemblies.
+     * </p>
+     * 
+     * @param args main arguments.
+     * @throws Exception in case of error.
+     */
+    public static void main(String[] args) throws Exception {
+        // create the JMX service URL.
+        JMXServiceURL jmxServiceUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:"
+ ManagementContext.DEFAULT_CONNECTOR_PORT + ManagementContext.DEFAULT_CONNECTOR_PATH);
+        // get the JMX connector.
+        String[] credentials = new String[] { "smx", "smx" };
+        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.
+        // close the JMX connection.
+        jmxConnector.close();
+    }
+
+}

Propchange: servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/smx3/trunk/samples/clients/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/pom.xml?rev=794321&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/pom.xml (added)
+++ servicemix/smx3/trunk/samples/clients/pom.xml Wed Jul 15 16:31:04 2009
@@ -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/maven-v4_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.servicemix</groupId>
+        <artifactId>samples</artifactId>
+        <version>3.3.2-SNAPSHOT</version>
+    </parent>         
+    
+    <groupId>org.apache.servicemix.samples</groupId>
+    <artifactId>clients</artifactId>
+    <name>ServiceMix :: Samples :: Clients</name>
+    <packaging>pom</packaging>
+    
+    <modules>
+        <module>jmx</module>
+    </modules>
+         
+</project>         
\ No newline at end of file

Propchange: servicemix/smx3/trunk/samples/clients/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message