[jboss-cvs] JBoss Messaging SVN: r5340 - in trunk: src/main/org/jboss/messaging/integration and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 12 07:50:47 EST 2008


Author: ataylor
Date: 2008-11-12 07:50:47 -0500 (Wed, 12 Nov 2008)
New Revision: 5340

Added:
   trunk/src/main/org/jboss/messaging/integration/bootstrap/
   trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java
Removed:
   trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
Modified:
   trunk/build-messaging.xml
   trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java
Log:
moved bootstrap code into integration layer

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2008-11-12 12:17:43 UTC (rev 5339)
+++ trunk/build-messaging.xml	2008-11-12 12:50:47 UTC (rev 5340)
@@ -470,7 +470,7 @@
          <src>
             <pathelement path="${src.main.dir}"/>
          </src>
-         <include name="org/jboss/messaging/microcontainer/**/*.java"/>
+         <include name="org/jboss/messaging/integration/bootstrap/**/*.java"/>
          <classpath refid="bootstrap.compilation.classpath"/>
       </javac>
    </target>
@@ -1093,7 +1093,7 @@
    <!--server-->
 
    <target name="runServer" depends="jar">
-      <java classname="org.jboss.messaging.microcontainer.JBMBootstrapServer" fork="true">
+      <java classname="org.jboss.messaging.integration.bootstrap.JBMBootstrapServer" fork="true">
          <jvmarg value="-XX:+UseParallelGC"/>
          <jvmarg value="-Xms512M"/>
          <jvmarg value="-Xmx2048M"/>
@@ -1111,7 +1111,7 @@
    </target>
 
    <target name="debugServer" depends="jar">
-      <java classname="org.jboss.messaging.microcontainer.JBMBootstrapServer" fork="true">
+      <java classname="org.jboss.messaging.integration.bootstrap.JBMBootstrapServer" fork="true">
          <jvmarg value="-XX:+UseParallelGC"/>
          <jvmarg value="-Xms512M"/>
          <jvmarg value="-Xmx2048M"/>

Copied: trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java (from rev 5339, trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java	2008-11-12 12:50:47 UTC (rev 5340)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.integration.bootstrap;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Properties;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.spi.config.KernelConfig;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * This is the method in which the JBM server can be deployed externall outside of jBoss. Alternatively a user can embed
+ * by using the same code as in main
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMBootstrapServer extends BasicBootstrap
+{
+   private static Logger log = Logger.getLogger(JBMBootstrapServer.class);
+   /**
+    * The deployer
+    */
+   protected BeanXMLDeployer deployer;
+   /**
+    * The deployments
+    */
+   protected List<KernelDeployment> deployments = new CopyOnWriteArrayList<KernelDeployment>();
+   /**
+    * The arguments
+    */
+   protected String[] args;
+   
+   private Properties properties;
+
+   /**
+    * Bootstrap the kernel from the command line
+    *
+    * @param args the command line arguments
+    * @throws Exception for any error
+    */
+   public static void main(final String[] args) throws Exception
+   {
+      log.info("Starting server");
+
+      JBMBootstrapServer bootstrap = new JBMBootstrapServer(args);
+      
+      bootstrap.run();
+   }
+
+   public void run()
+   {
+      super.run();
+      log.info("JBM Server Started");
+   }
+
+   /**
+    * JBoss 1.0.0 final
+    * Standalone
+    * Create a new bootstrap
+    *
+    * @param args the arguments
+    * @throws Exception for any error
+    */
+   public JBMBootstrapServer(String[] args) throws Exception
+   {
+      super();
+      this.args = args;
+   }
+
+   public JBMBootstrapServer(final String[] args, KernelConfig kernelConfig) throws Exception
+   {
+      super(kernelConfig);
+      //System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
+      //System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+      this.args = args;
+   }
+   
+   public void bootstrap() throws Throwable
+   {
+      super.bootstrap();
+      deployer = new BeanXMLDeployer(getKernel());
+      Runtime.getRuntime().addShutdownHook(new Shutdown());
+
+      for (String arg : args)
+      {
+         deploy(arg);
+      }
+
+      deployer.validate();
+   }
+   
+   /**
+    * Undeploy a deployment
+    *
+    * @param deployment the deployment
+    */
+   public void undeploy(final KernelDeployment deployment) throws Throwable
+   {
+      log.debug("Undeploying " + deployment.getName());
+      deployments.remove(deployment);
+      try
+      {
+         deployer.undeploy(deployment);
+         log.debug("Undeployed " + deployment.getName());
+      }
+      catch (Throwable t)
+      {
+         log.warn("Error during undeployment: " + deployment.getName(), t);
+      }
+   }
+
+   public KernelDeployment deploy(final String arg) throws Throwable
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      URL url = cl.getResource(arg);
+      if (url == null)
+      {
+         url = cl.getResource("META-INF/" + arg);
+      }
+      //try the system classpath
+      if(url == null)
+      {
+         url = getClass().getClassLoader().getResource(arg);
+      }
+      if (url == null)
+      {
+         throw new RuntimeException("Unable to find resource:" + arg);
+      }
+      return deploy(url);
+   }
+   
+   /**
+    * Deploys a XML on the container
+    * 
+    */
+   public KernelDeployment deploy(final String name, final String xml) throws Throwable
+   {
+      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+      PrintStream printOut = new PrintStream(byteOut);
+      printOut.print(xml);
+      printOut.flush();
+      ByteArrayInputStream is = new ByteArrayInputStream(byteOut.toByteArray());
+    
+      KernelDeployment deployment = deployer.deploy(name, is);
+      
+      deployments.add(deployment);
+      
+      return deployment;
+   }
+
+   
+   
+   /**
+    * Deploy a url
+    *
+    * @param url the deployment url
+    * @throws Throwable for any error
+    */
+   protected KernelDeployment deploy(final URL url) throws Throwable
+   {
+      log.debug("Deploying " + url);
+      KernelDeployment deployment = deployer.deploy(url);
+      deployments.add(deployment);
+      log.debug("Deployed " + url);
+      return deployment;
+   }
+
+   public void shutDown()
+   {
+      log.info("Shutting down");
+      ListIterator<KernelDeployment> iterator = deployments.listIterator(deployments.size());
+      while (iterator.hasPrevious())
+      {
+         KernelDeployment deployment = (KernelDeployment) iterator.previous();
+         try {undeploy(deployment);} catch (Throwable ignored){}
+      }
+   }
+
+   protected Properties getConfigProperties()
+   {
+      return properties;
+   }
+
+   public void setProperties(Properties props)
+   {
+      properties = props;
+   }
+   
+   
+   protected class Shutdown extends Thread
+   {
+      public void run()
+      {
+         JBMBootstrapServer.this.shutDown();
+      }
+   }
+}
+
+

Deleted: trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java	2008-11-12 12:17:43 UTC (rev 5339)
+++ trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java	2008-11-12 12:50:47 UTC (rev 5340)
@@ -1,227 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
-
-package org.jboss.messaging.microcontainer;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.net.URL;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Properties;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
-import org.jboss.kernel.spi.config.KernelConfig;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * This is the method in which the JBM server can be deployed externall outside of jBoss. Alternatively a user can embed
- * by using the same code as in main
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class JBMBootstrapServer extends BasicBootstrap
-{
-   private static Logger log = Logger.getLogger(JBMBootstrapServer.class);
-   /**
-    * The deployer
-    */
-   protected BeanXMLDeployer deployer;
-   /**
-    * The deployments
-    */
-   protected List<KernelDeployment> deployments = new CopyOnWriteArrayList<KernelDeployment>();
-   /**
-    * The arguments
-    */
-   protected String[] args;
-   
-   private Properties properties;
-
-   /**
-    * Bootstrap the kernel from the command line
-    *
-    * @param args the command line arguments
-    * @throws Exception for any error
-    */
-   public static void main(final String[] args) throws Exception
-   {
-      log.info("Starting server");
-
-      JBMBootstrapServer bootstrap = new JBMBootstrapServer(args);
-      
-      bootstrap.run();
-   }
-
-   public void run()
-   {
-      super.run();
-      log.info("JBM Server Started");
-   }
-
-   /**
-    * JBoss 1.0.0 final
-    * Standalone
-    * Create a new bootstrap
-    *
-    * @param args the arguments
-    * @throws Exception for any error
-    */
-   public JBMBootstrapServer(String[] args) throws Exception
-   {
-      super();
-      this.args = args;
-   }
-
-   public JBMBootstrapServer(final String[] args, KernelConfig kernelConfig) throws Exception
-   {
-      super(kernelConfig);
-      //System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
-      //System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
-      this.args = args;
-   }
-   
-   public void bootstrap() throws Throwable
-   {
-      super.bootstrap();
-      deployer = new BeanXMLDeployer(getKernel());
-      Runtime.getRuntime().addShutdownHook(new Shutdown());
-
-      for (String arg : args)
-      {
-         deploy(arg);
-      }
-
-      deployer.validate();
-   }
-   
-   /**
-    * Undeploy a deployment
-    *
-    * @param deployment the deployment
-    */
-   public void undeploy(final KernelDeployment deployment) throws Throwable
-   {
-      log.debug("Undeploying " + deployment.getName());
-      deployments.remove(deployment);
-      try
-      {
-         deployer.undeploy(deployment);
-         log.debug("Undeployed " + deployment.getName());
-      }
-      catch (Throwable t)
-      {
-         log.warn("Error during undeployment: " + deployment.getName(), t);
-      }
-   }
-
-   public KernelDeployment deploy(final String arg) throws Throwable
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      URL url = cl.getResource(arg);
-      if (url == null)
-      {
-         url = cl.getResource("META-INF/" + arg);
-      }
-      //try the system classpath
-      if(url == null)
-      {
-         url = getClass().getClassLoader().getResource(arg);
-      }
-      if (url == null)
-      {
-         throw new RuntimeException("Unable to find resource:" + arg);
-      }
-      return deploy(url);
-   }
-   
-   /**
-    * Deploys a XML on the container
-    * 
-    */
-   public KernelDeployment deploy(final String name, final String xml) throws Throwable
-   {
-      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-      PrintStream printOut = new PrintStream(byteOut);
-      printOut.print(xml);
-      printOut.flush();
-      ByteArrayInputStream is = new ByteArrayInputStream(byteOut.toByteArray());
-    
-      KernelDeployment deployment = deployer.deploy(name, is);
-      
-      deployments.add(deployment);
-      
-      return deployment;
-   }
-
-   
-   
-   /**
-    * Deploy a url
-    *
-    * @param url the deployment url
-    * @throws Throwable for any error
-    */
-   protected KernelDeployment deploy(final URL url) throws Throwable
-   {
-      log.debug("Deploying " + url);
-      KernelDeployment deployment = deployer.deploy(url);
-      deployments.add(deployment);
-      log.debug("Deployed " + url);
-      return deployment;
-   }
-
-   public void shutDown()
-   {
-      log.info("Shutting down");
-      ListIterator<KernelDeployment> iterator = deployments.listIterator(deployments.size());
-      while (iterator.hasPrevious())
-      {
-         KernelDeployment deployment = (KernelDeployment) iterator.previous();
-         try {undeploy(deployment);} catch (Throwable ignored){}
-      }
-   }
-
-   protected Properties getConfigProperties()
-   {
-      return properties;
-   }
-
-   public void setProperties(Properties props)
-   {
-      properties = props;
-   }
-   
-   
-   protected class Shutdown extends Thread
-   {
-      public void run()
-      {
-         JBMBootstrapServer.this.shutDown();
-      }
-   }
-}
-
-

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMBaseTestCase.java	2008-11-12 12:17:43 UTC (rev 5339)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMBaseTestCase.java	2008-11-12 12:50:47 UTC (rev 5340)
@@ -40,7 +40,7 @@
 import javax.transaction.TransactionManager;
 
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.microcontainer.JBMBootstrapServer;
+import org.jboss.messaging.integration.bootstrap.JBMBootstrapServer;
 import org.jboss.test.messaging.util.ProxyAssertSupport;
 import org.jboss.tm.TransactionManagerLocator;
 

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-11-12 12:17:43 UTC (rev 5339)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-11-12 12:50:47 UTC (rev 5340)
@@ -55,7 +55,7 @@
 import org.jboss.messaging.jms.server.management.SubscriptionInfo;
 import org.jboss.messaging.jms.server.management.TopicControlMBean;
 import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
-import org.jboss.messaging.microcontainer.JBMBootstrapServer;
+import org.jboss.messaging.integration.bootstrap.JBMBootstrapServer;
 import org.jboss.messaging.util.SimpleString;
 import org.jboss.test.messaging.tools.ConfigurationHelper;
 import org.jboss.test.messaging.tools.ServerManagement;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java	2008-11-12 12:17:43 UTC (rev 5339)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java	2008-11-12 12:50:47 UTC (rev 5340)
@@ -25,7 +25,7 @@
 
 import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.messaging.microcontainer.JBMBootstrapServer;
+import org.jboss.messaging.integration.bootstrap.JBMBootstrapServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**




More information about the jboss-cvs-commits mailing list