Title: [1049] trunk/servicemix-gplan: Update geronimo plans
Revision
1049
Author
gnt
Date
2005-12-08 06:50:30 -0500 (Thu, 08 Dec 2005)

Log Message

Update geronimo plans
The servicemix-console can now be deployed in geronimo and manage SM inside Geronimo

Modified Paths

Added Paths

Property Changed

  • trunk/servicemix-gplan/

Diff

Added: trunk/servicemix-console/src/plan/plan.xml (1048 => 1049)

--- trunk/servicemix-console/src/plan/plan.xml	2005-12-08 02:37:14 UTC (rev 1048)
+++ trunk/servicemix-console/src/plan/plan.xml	2005-12-08 11:50:30 UTC (rev 1049)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.0"
+      configId="servicemix/servicemix-console/2.1-SNAPSHOT/car"
+    >
+  <dep:import xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.0">
+    <dep:groupId>geronimo</dep:groupId>
+    <dep:type>car</dep:type>
+    <dep:artifactId>j2ee-server</dep:artifactId>
+    <dep:version>1.0-SNAPSHOT</dep:version>
+  </dep:import>
+  <dep:dependency xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.0">
+    <dep:groupId>portlet-api</dep:groupId>
+    <dep:artifactId>portlet-api</dep:artifactId>
+    <dep:version>1.0</dep:version>
+  </dep:dependency>
+  <dep:dependency xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.0">
+    <dep:groupId>org.apache.pluto</dep:groupId>
+    <dep:artifactId>pluto</dep:artifactId>
+    <dep:version>1.0.1</dep:version>
+  </dep:dependency>
+    <context-root>/servicemix-console</context-root>
+    <context-priority-classloader>false</context-priority-classloader>
+</web-app>

Modified: trunk/servicemix-gbean/src/main/java/org/servicemix/gbean/ServiceMixGBean.java (1048 => 1049)

--- trunk/servicemix-gbean/src/main/java/org/servicemix/gbean/ServiceMixGBean.java	2005-12-08 02:37:14 UTC (rev 1048)
+++ trunk/servicemix-gbean/src/main/java/org/servicemix/gbean/ServiceMixGBean.java	2005-12-08 11:50:30 UTC (rev 1049)
@@ -1,5 +1,15 @@
 package org.servicemix.gbean;
 
+import java.io.IOException;
+
+import javax.jbi.JBIException;
+import javax.management.MBeanServer;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.resource.spi.work.WorkManager;
+import javax.transaction.TransactionManager;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -9,10 +19,6 @@
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 import org.servicemix.jbi.container.JBIContainer;
 
-import javax.jbi.JBIException;
-import javax.resource.spi.work.WorkManager;
-import javax.transaction.TransactionManager;
-
 public class ServiceMixGBean implements GBeanLifecycle, ServiceMixContainer {
 
     private Log log = LogFactory.getLog(getClass().getName());
@@ -23,6 +29,9 @@
     private TransactionContextManager transactionContextManager;
     private WorkManager workManager;
 
+    private JMXConnectorServer connectorServer;
+    private int namingPort = 1099;
+    
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -50,6 +59,9 @@
         this.directory = directory;
         this.transactionContextManager = transactionContextManager;
         this.workManager = workManager;
+        if (log.isDebugEnabled()) {
+            log.debug("ServiceMixGBean created");
+        }
     }
     
     /**
@@ -58,6 +70,9 @@
      * @throws Exception if the target failed to start; this will cause a transition to the failed state
      */
     public void doStart() throws Exception {
+        if (log.isDebugEnabled()) {
+            log.debug("ServiceMixGBean doStart");
+        }
         ClassLoader old = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(ServiceMixGBean.class.getClassLoader());
         try {
@@ -65,6 +80,13 @@
                 container = createContainer();
                 container.init();
                 container.start();
+                // Create a JMX Connector
+                JMXServiceURL url = "" JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + namingPort
+                        + "/" + JBIContainer.DEFAULT_NAME + "JMX");
+                // Create and start the RMIConnectorServer
+                MBeanServer server = container.getMBeanServer();
+                connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, server);
+                connectorServer.start();
             }
         } finally {
             Thread.currentThread().setContextClassLoader(old);
@@ -77,10 +99,17 @@
      * @throws Exception if the target failed to stop; this will cause a transition to the failed state
      */
     public void doStop() throws Exception {
-        if (container != null) {
-            JBIContainer temp = container;
+        if (log.isDebugEnabled()) {
+            log.debug("ServiceMixGBean doStop");
+        }
+        try {
+            if (container != null) {
+                container.shutDown();
+                connectorServer.stop();
+            }
+        } finally {
             container = null;
-            temp.shutDown();
+            connectorServer = null;
         }
     }
 
@@ -88,15 +117,26 @@
      * Fails the GBean.  This informs the GBean that it is about to transition to the failed state.
      */
     public void doFail() {
-        if (container != null) {
-            JBIContainer temp = container;
+        if (log.isDebugEnabled()) {
+            log.debug("ServiceMixGBean doFail");
+        }
+        try {
+            if (container != null) {
+                try {
+                    container.shutDown();
+                }
+                catch (JBIException e) {
+                    log.info("Caught while closing due to failure: " + e, e);
+                }
+                try {
+                    connectorServer.stop();
+                } catch (IOException e) {
+                    log.info("Caught while closing due to failure: " + e, e);
+                }
+            }
+        } finally {
             container = null;
-            try {
-                temp.shutDown();
-            }
-            catch (JBIException e) {
-                log.info("Caught while closing due to failure: " + e, e);
-            }
+            connectorServer = null;
         }
     }
 

Property changes: trunk/servicemix-gplan

Name: svn:ignore
   + target
.project
.classpath

Modified: trunk/servicemix-gplan/maven.xml (1048 => 1049)

--- trunk/servicemix-gplan/maven.xml	2005-12-08 02:37:14 UTC (rev 1048)
+++ trunk/servicemix-gplan/maven.xml	2005-12-08 11:50:30 UTC (rev 1049)
@@ -5,5 +5,9 @@
   <goal name="default" prereqs="car:install"/>
 
   <goal name="nightly" prereqs="clean, car:install, car:deploy"/>
+  
+  <goal name="distribute">
+    <attainGoal name="car:distribute"/>
+  </goal>
     
 </project>

Modified: trunk/servicemix-gplan/src/plan/plan.xml (1048 => 1049)

--- trunk/servicemix-gplan/src/plan/plan.xml	2005-12-08 02:37:14 UTC (rev 1048)
+++ trunk/servicemix-gplan/src/plan/plan.xml	2005-12-08 11:50:30 UTC (rev 1049)
@@ -14,8 +14,8 @@
     </gbean>
 
     <gbean name="ServiceMixJBIContainer" class="org.servicemix.gbean.ServiceMixGBean">
-        <attribute name="name">servicemix</attribute>
-        <attribute name="directory">var</attribute>
+        <attribute name="name">defaultJBI</attribute>
+        <attribute name="directory">var/sevicemix</attribute>
         <reference name="transactionContextManager">
         	<module>geronimo/j2ee-server/${geronimo_version}/car</module>
         	<type>TransactionContextManager</type>

Reply via email to