[jboss-cvs] JBossAS SVN: r59664 - in trunk/embedded: src/main/java/org/jboss/embedded and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 15 22:28:15 EST 2007


Author: bill.burke at jboss.com
Date: 2007-01-15 22:28:08 -0500 (Mon, 15 Jan 2007)
New Revision: 59664

Added:
   trunk/embedded/src/main/java/org/jboss/embedded/DeploymentScanner.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoader.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoaderMBean.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernel.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernelMBean.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/LocalOnlyUserTransaction.java
   trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java
Removed:
   trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java
   trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java
   trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java
   trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java
   trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java
   trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java
Modified:
   trunk/embedded/build.xml
   trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
   trunk/embedded/src/main/java/org/jboss/embedded/junit/ClasspathBasedTestServices.java
   trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
   trunk/embedded/src/main/resources/javase/conf/jboss-service.xml
   trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java
   trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java
   trunk/embedded/src/test/java/org/jboss/embedded/test/jndibootstrap/unit/BootstrapTestCase.java
Log:
some refactorings

Modified: trunk/embedded/build.xml
===================================================================
--- trunk/embedded/build.xml	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/build.xml	2007-01-16 03:28:08 UTC (rev 59664)
@@ -130,6 +130,7 @@
          <path refid="jboss.jmx.classpath"/>
          <path refid="jboss.iiop.classpath"/>
          <path refid="jboss.test.classpath"/>
+         <path refid="jboss.ejb3.classpath"/>
       </path>
 
       <!-- ===== -->

Modified: trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -31,6 +31,7 @@
 import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
 import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
 import org.jboss.virtual.VirtualFile;
+import org.jboss.logging.Logger;
 
 import java.net.URL;
 import java.io.IOException;
@@ -44,6 +45,8 @@
  */
 public class Bootstrap
 {
+   private static final Logger log = Logger.getLogger(Bootstrap.class);
+
    public static final String BOOTSTRAP_RESOURCE_PATH="jboss.embedded.bootstrap.resource.path";
    public static final String BOOTSTRAP_RESOURCE_FILE="conf/bootstrap-beans.xml";
 
@@ -51,6 +54,7 @@
    private ClassLoader loader = Thread.currentThread().getContextClassLoader();
    private MainDeployer mainDeployer;
    private boolean started;
+   private boolean ignoreShutdownErrors;
 
 
 
@@ -79,6 +83,16 @@
    }
 
 
+   public boolean isIgnoreShutdownErrors()
+   {
+      return ignoreShutdownErrors;
+   }
+
+   public void setIgnoreShutdownErrors(boolean ignoreShutdownErrors)
+   {
+      this.ignoreShutdownErrors = ignoreShutdownErrors;
+   }
+
    public boolean isStarted()
    {
       return started;
@@ -186,7 +200,15 @@
 
    public void shutdown()
    {
-      mainDeployer.shutdown();
+      try
+      {
+         mainDeployer.shutdown();
+      }
+      catch (Exception e)
+      {
+         if (!ignoreShutdownErrors) throw new RuntimeException(e);
+         else log.error("Failed to shutdown Bootstrap", e);
+      }
    }
 
    public void deploy(URL url) throws DeploymentException

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,109 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.logging.Logger;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-/**
- * Bean so that you can create a DeploymentGroup from the Microcontainer
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class DeploymentGroupBean extends DeploymentGroup
-{
-   private static final Logger log = Logger.getLogger(DeploymentGroupBean.class);
-
-   private List<URL> urls;
-   private List<String> resources;
-   private List<String> multiple;
-   private List<String> dirs;
-
-   public void setUrls(List<URL> urls) throws DeploymentException
-   {
-      this.urls = urls;
-   }
-
-
-   public void setResources(List<String> resources) throws DeploymentException, NullPointerException
-   {
-      this.resources = resources;
-   }
-
-
-   public void setMultipleResources(List<String> resources) throws DeploymentException, IOException
-   {
-      this.multiple = resources;
-   }
-
-
-   public void setDirectoriesByResource(List<String> resources) throws DeploymentException, IOException
-   {
-      dirs = resources;
-   }
-
-   public void start() throws Exception
-   {
-      try
-      {
-         if (urls != null) addUrls(urls);
-         if (resources != null)
-         {
-            for (String resource : resources)
-            {
-               addResource(resource);
-            }
-         }
-         if (multiple != null)
-         {
-            for (String resource : multiple)
-            {
-               addMultipleResources(resource);
-            }
-         }
-         if (dirs != null)
-         {
-            for (String resource : dirs)
-            {
-               addDirectoryByResource(resource, true);
-            }
-         }
-         mainDeployer.process();
-      }
-      catch (Exception ex)
-      {
-         log.error("Failed to deploy", ex);
-         throw ex;
-      }
-   }
-
-   public void stop() throws DeploymentException
-   {
-      undeploy();
-   }
-
-}

Copied: trunk/embedded/src/main/java/org/jboss/embedded/DeploymentScanner.java (from rev 59649, trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/DeploymentGroupBean.java	2007-01-15 18:11:19 UTC (rev 59649)
+++ trunk/embedded/src/main/java/org/jboss/embedded/DeploymentScanner.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,109 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.logging.Logger;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * Bean so that you can create a DeploymentGroup from the Microcontainer
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeploymentScanner extends DeploymentGroup
+{
+   private static final Logger log = Logger.getLogger(DeploymentScanner.class);
+
+   private List<URL> urls;
+   private List<String> resources;
+   private List<String> multiple;
+   private List<String> dirs;
+
+   public void setUrls(List<URL> urls) throws DeploymentException
+   {
+      this.urls = urls;
+   }
+
+
+   public void setResources(List<String> resources) throws DeploymentException, NullPointerException
+   {
+      this.resources = resources;
+   }
+
+
+   public void setMultipleResources(List<String> resources) throws DeploymentException, IOException
+   {
+      this.multiple = resources;
+   }
+
+
+   public void setDirectoriesByResource(List<String> resources) throws DeploymentException, IOException
+   {
+      dirs = resources;
+   }
+
+   public void start() throws Exception
+   {
+      try
+      {
+         if (urls != null) addUrls(urls);
+         if (resources != null)
+         {
+            for (String resource : resources)
+            {
+               addResource(resource);
+            }
+         }
+         if (multiple != null)
+         {
+            for (String resource : multiple)
+            {
+               addMultipleResources(resource);
+            }
+         }
+         if (dirs != null)
+         {
+            for (String resource : dirs)
+            {
+               addDirectoryByResource(resource, true);
+            }
+         }
+         mainDeployer.process();
+      }
+      catch (Exception ex)
+      {
+         log.error("Failed to deploy", ex);
+         throw ex;
+      }
+   }
+
+   public void stop() throws DeploymentException
+   {
+      undeploy();
+   }
+
+}

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,36 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class JMXClassLoader extends ClassLoader implements JMXClassLoaderMBean
-{
-   public JMXClassLoader(ClassLoader parent)
-   {
-      super(parent);
-   }
-}

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public interface JMXClassLoaderMBean
-{
-}

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,369 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-import org.jboss.kernel.Kernel;
-import org.jboss.mx.server.MBeanServerBuilderImpl;
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.system.ServiceController;
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.deployers.ServiceDeployer;
-import org.jboss.system.server.ServerConfigImpl;
-import org.jboss.system.server.ServerConfigImplMBean;
-import org.jboss.system.server.ServerImplMBean;
-import org.jboss.util.JBossObject;
-
-import javax.management.JMRuntimeException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerBuilder;
-import javax.management.MBeanServerDelegate;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import java.util.Date;
-import java.util.Properties;
-
-/**
- * A pojo that creates a legacy jmx kernel ala the jboss-4.x server bootstrap.
- * This is used to support the SARDeployer and mbean integration.
- *
- * @author Scott.Stark at jboss.org
- * @author bill at jboss.org
- * @version $Revision:$
- */
-public class JMXKernel extends JBossObject implements JMXKernelMBean, NotificationEmitter
-{
-   /**
-    * The JMX MBeanServer which will serve as our communication bus.
-    */
-   private MBeanServer mbeanServer;
-   private MBeanServerBuilder builder = new MBeanServerBuilderImpl();
-   private ServiceController controller;
-   private Kernel kernel;
-   private ServerConfig serverConfig;
-   private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
-   private boolean started;
-
-   public ServiceControllerMBean getServiceController()
-   {
-      return this.controller;
-   }
-
-   public MBeanServer getMbeanServer()
-   {
-      return mbeanServer;
-   }
-
-   public void setKernel(Kernel kernel)
-   {
-      this.kernel = kernel;
-   }
-
-
-   public void setBuilder(MBeanServerBuilder builder)
-   {
-      this.builder = builder;
-   }
-
-
-   public ServerConfig getServerConfig()
-   {
-      return serverConfig;
-   }
-
-   public void setServerConfig(ServerConfig serverConfig)
-   {
-      this.serverConfig = serverConfig;
-   }
-
-   /**
-    * We don't want to override platforms default mechanism for creating MBeanServer so lets just do it ourselves
-    *
-    * @param domain
-    * @return
-    */
-   private MBeanServer createMBeanServer(String domain)
-   {
-      final MBeanServerDelegate delegate =
-              builder.newMBeanServerDelegate();
-      if (delegate == null)
-      {
-         final String msg =
-                 "MBeanServerBuilder.newMBeanServerDelegate() " +
-                         "returned null";
-         throw new JMRuntimeException(msg);
-      }
-      final MBeanServer mbeanServer =
-              builder.newMBeanServer(domain, null, delegate);
-      if (mbeanServer == null)
-      {
-         final String msg =
-                 "MBeanServerBuilder.newMBeanServer() returned null";
-         throw new JMRuntimeException(msg);
-      }
-      return mbeanServer;
-
-   }
-
-   public static void setupUrlHandlers()
-   {
-      String pkgs = System.getProperty("java.protocol.handler.pkgs");
-      if (pkgs == null || pkgs.trim().length() == 0)
-      {
-         pkgs = "org.jboss.net.protocol";
-         System.setProperty("java.protocol.handler.pkgs", pkgs);
-      }
-      else if (!pkgs.contains("org.jboss.net.protocol"))
-      {
-         pkgs += "|org.jboss.net.protocol";
-         System.setProperty("java.protocol.handler.pkgs", pkgs);
-      }
-      //Field field = URL.class.getDeclaredField("")
-      //URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
-
-   }
-
-   public void start() throws Exception
-   {
-      setupUrlHandlers();
-      mbeanServer = createMBeanServer("jboss");
-      MBeanServerLocator.setJBoss(mbeanServer);
-
-      mbeanServer.registerMBean(new JMXClassLoader(Thread.currentThread().getContextClassLoader()), ServiceDeployer.DEFAULT_CLASSLOADER_OBJECT_NAME);
-
-      controller = new ServiceController();
-      controller.setKernel(kernel);
-      controller.setMBeanServer(mbeanServer);
-      mbeanServer.registerMBean(controller, new ObjectName("jboss.system:service=ServiceController"));
-      // Register mbeanServer components
-      mbeanServer.registerMBean(this, ServerImplMBean.OBJECT_NAME);
-      mbeanServer.registerMBean(new ServerConfigImpl(serverConfig), ServerConfigImplMBean.OBJECT_NAME);
-      started = true;
-   }
-
-   /**
-    * Stop the mbeans
-    *
-    * @throws IllegalStateException - if not started.
-    */
-   public void stop() throws IllegalStateException
-   {
-      if (log.isTraceEnabled())
-         log.trace("stop caller:", new Throwable("Here"));
-
-      if (!started)
-         throw new IllegalStateException("Server not started");
-
-      log.debug("Shutting down all services");
-      shutdownServices();
-
-      // Make sure all mbeans are unregistered
-      removeMBeans();
-   }
-
-   /**
-    * The <code>shutdownServices</code> method calls the one and only
-    * ServiceController to shut down all the mbeans registered with it.
-    */
-   protected void shutdownServices()
-   {
-      try
-      {
-         // get the deployed objects from ServiceController
-         controller.shutdown();
-      }
-      catch (Exception e)
-      {
-         Throwable t = JMXExceptionDecoder.decode(e);
-         log.error("Failed to shutdown services", t);
-      }
-   }
-
-   /**
-    * The <code>removeMBeans</code> method uses the mbean mbeanServer to unregister
-    * all the mbeans registered here.
-    */
-   protected void removeMBeans()
-   {
-      try
-      {
-         mbeanServer.unregisterMBean(ServiceControllerMBean.OBJECT_NAME);
-      }
-      catch (Exception e)
-      {
-         Throwable t = JMXExceptionDecoder.decode(e);
-         log.error("Failed to unregister mbeans", t);
-      }
-   }
-
-
-   public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
-   {
-      broadcasterSupport.addNotificationListener(listener, filter, handback);
-   }
-
-   public void removeNotificationListener(NotificationListener listener)
-           throws ListenerNotFoundException
-   {
-      broadcasterSupport.removeNotificationListener(listener);
-   }
-
-   public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
-           throws ListenerNotFoundException
-   {
-      broadcasterSupport.removeNotificationListener(listener, filter, handback);
-   }
-
-   public MBeanNotificationInfo[] getNotificationInfo()
-   {
-      return broadcasterSupport.getNotificationInfo();
-   }
-
-   public void sendNotification(Notification notification)
-   {
-      broadcasterSupport.sendNotification(notification);
-   }
-
-
-   public void runGarbageCollector()
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void runFinalization()
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void traceMethodCalls(Boolean flag)
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void traceInstructions(Boolean flag)
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public Date getStartDate()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getVersion()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getVersionName()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getBuildNumber()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getBuildJVM()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getBuildOS()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getBuildID()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public String getBuildDate()
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public boolean isInShutdown()
-   {
-      return false;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void init(Properties props) throws IllegalStateException, Exception
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public ServerConfig getConfig() throws IllegalStateException
-   {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public boolean isStarted()
-   {
-      return false;  //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void shutdown() throws IllegalStateException
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void exit(int exitcode)
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void exit()
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void halt(int exitcode)
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   public void halt()
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-
-   public String getSpecificationVersion()
-   {
-      return serverConfig.getSpecificationVersion();
-   }
-
-
-   public String getVersionNumber()
-   {
-      return "";
-   }
-}

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-import org.jboss.system.server.ServerImplMBean;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public interface JMXKernelMBean extends ServerImplMBean
-{
-}

Deleted: trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -1,250 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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.embedded;
-
-import org.jboss.system.server.BaseServerConfig;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class ServerConfig implements org.jboss.system.server.ServerConfig
-{
-   protected BaseServerConfig config;
-   protected Properties props;
-
-   public void start() throws Exception
-   {
-      props = new Properties(System.getProperties());
-
-      String homeDir = System.getProperty(HOME_DIR);
-
-      // if HOME_DIR property is null, then try to figure it out
-      if (homeDir == null)
-      {
-
-         String path = System.getProperty(Bootstrap.BOOTSTRAP_RESOURCE_PATH);
-         if (path == null) throw new Exception("${jboss.embedded.bootstrap.resource.path} is null");
-
-
-         path += Bootstrap.BOOTSTRAP_RESOURCE_FILE;
-
-         URL url = Thread.currentThread().getContextClassLoader().getResource(path);
-         if (url.toString().startsWith("file:"))
-         {
-            initializeByFile(path);
-         }
-         else
-         {
-            // we do not know the protocol
-            initializeByUnknown();
-         }
-      }
-      else
-      {
-         props.put(SERVER_HOME_DIR, homeDir);
-      }
-      config = new BaseServerConfig(props);
-      config.initURLs();
-
-      // create tmp and data directories
-
-      if (!config.getServerTempDir().exists())
-      {
-         config.getServerTempDir().mkdir();
-      }
-      if (!config.getServerDataDir().exists())
-      {
-         config.getServerDataDir().mkdir();
-      }
-   }
-
-   protected void initializeByFile(String path) throws Exception
-   {
-      URL homeDirUrl = DeploymentGroupBean.getDirFromResource(Thread.currentThread().getContextClassLoader(), path + "/..");
-      File homeDir = new File(homeDirUrl.toURI());
-      props.put(HOME_DIR, homeDir.toString());
-      props.put(SERVER_HOME_DIR, homeDir.toString());
-   }
-
-   /**
-    * Creates base JBoss Embedded directory structure under java.io.tmpdir
-    *
-    * @throws Exception
-    */
-   protected void initializeByUnknown() throws Exception
-   {
-      String temp = System.getProperty("java.io.tmpdir");
-      File fp = new File(temp, "embedded-jboss");
-      if (!fp.exists())
-      {
-         fp.mkdir();
-      }
-      props.put(HOME_DIR, fp.toString());
-      props.put(SERVER_HOME_DIR, fp.toString());
-   }
-
-
-   public void initURLs()
-           throws MalformedURLException
-   {
-      config.initURLs();
-   }
-
-   public File getHomeDir()
-   {
-      return config.getHomeDir();
-   }
-
-   public URL getHomeURL()
-   {
-      return config.getHomeURL();
-   }
-
-   public URL getLibraryURL()
-   {
-      return config.getLibraryURL();
-   }
-
-   public URL getPatchURL()
-   {
-      return config.getPatchURL();
-   }
-
-   public String getServerName()
-   {
-      return config.getServerName();
-   }
-
-   public File getServerBaseDir()
-   {
-      return config.getServerBaseDir();
-   }
-
-   public File getServerHomeDir()
-   {
-      return config.getServerHomeDir();
-   }
-
-   public File getServerLogDir()
-   {
-      return config.getServerLogDir();
-   }
-
-   public File getServerTempDir()
-   {
-      return config.getServerTempDir();
-   }
-
-   public File getServerDataDir()
-   {
-      return config.getServerDataDir();
-   }
-
-   public File getServerNativeDir()
-   {
-      return config.getServerNativeDir();
-   }
-
-   public File getServerTempDeployDir()
-   {
-      return config.getServerTempDeployDir();
-   }
-
-   public URL getServerBaseURL()
-   {
-      return config.getServerBaseURL();
-   }
-
-   public URL getServerHomeURL()
-   {
-      return config.getServerHomeURL();
-   }
-
-   public URL getServerLibraryURL()
-   {
-      return config.getServerLibraryURL();
-   }
-
-   public URL getServerConfigURL()
-   {
-      return config.getServerConfigURL();
-   }
-
-   public boolean getPlatformMBeanServer()
-   {
-      return config.getPlatformMBeanServer();
-   }
-
-   public void setExitOnShutdown(boolean flag)
-   {
-      config.setExitOnShutdown(flag);
-   }
-
-   public boolean getExitOnShutdown()
-   {
-      return config.getExitOnShutdown();
-   }
-
-   public void setBlockingShutdown(boolean flag)
-   {
-      config.setBlockingShutdown(flag);
-   }
-
-   public boolean getBlockingShutdown()
-   {
-      return config.getBlockingShutdown();
-   }
-
-   public void setRequireJBossURLStreamHandlerFactory(boolean flag)
-   {
-      config.setRequireJBossURLStreamHandlerFactory(flag);
-   }
-
-   public boolean getRequireJBossURLStreamHandlerFactory()
-   {
-      return config.getRequireJBossURLStreamHandlerFactory();
-   }
-
-   public void setRootDeploymentFilename(String filename)
-   {
-      config.setRootDeploymentFilename(filename);
-   }
-
-   public String getRootDeploymentFilename()
-   {
-      return config.getRootDeploymentFilename();
-   }
-
-
-   public String getSpecificationVersion()
-   {
-      return config.getSpecificationVersion();
-   }
-}
\ No newline at end of file

Copied: trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoader.java (from rev 59649, trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java	2007-01-15 18:11:19 UTC (rev 59649)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoader.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JMXClassLoader extends ClassLoader implements JMXClassLoaderMBean
+{
+   public JMXClassLoader(ClassLoader parent)
+   {
+      super(parent);
+   }
+}

Copied: trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoaderMBean.java (from rev 59649, trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java	2007-01-15 18:11:19 UTC (rev 59649)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXClassLoaderMBean.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JMXClassLoaderMBean
+{
+}

Copied: trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernel.java (from rev 59656, trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java	2007-01-15 21:10:52 UTC (rev 59656)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernel.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,369 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.mx.server.MBeanServerBuilderImpl;
+import org.jboss.mx.util.JMXExceptionDecoder;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.system.ServiceController;
+import org.jboss.system.ServiceControllerMBean;
+import org.jboss.system.deployers.ServiceDeployer;
+import org.jboss.system.server.ServerConfigImpl;
+import org.jboss.system.server.ServerConfigImplMBean;
+import org.jboss.system.server.ServerImplMBean;
+import org.jboss.util.JBossObject;
+
+import javax.management.JMRuntimeException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerBuilder;
+import javax.management.MBeanServerDelegate;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * A pojo that creates a legacy jmx kernel ala the jboss-4.x server bootstrap.
+ * This is used to support the SARDeployer and mbean integration.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author bill at jboss.org
+ * @version $Revision:$
+ */
+public class JMXKernel extends JBossObject implements JMXKernelMBean, NotificationEmitter
+{
+   /**
+    * The JMX MBeanServer which will serve as our communication bus.
+    */
+   private MBeanServer mbeanServer;
+   private MBeanServerBuilder builder = new MBeanServerBuilderImpl();
+   private ServiceController controller;
+   private Kernel kernel;
+   private ServerConfig serverConfig;
+   private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
+   private boolean started;
+
+   public ServiceControllerMBean getServiceController()
+   {
+      return this.controller;
+   }
+
+   public MBeanServer getMbeanServer()
+   {
+      return mbeanServer;
+   }
+
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+
+
+   public void setBuilder(MBeanServerBuilder builder)
+   {
+      this.builder = builder;
+   }
+
+
+   public ServerConfig getServerConfig()
+   {
+      return serverConfig;
+   }
+
+   public void setServerConfig(ServerConfig serverConfig)
+   {
+      this.serverConfig = serverConfig;
+   }
+
+   /**
+    * We don't want to override platforms default mechanism for creating MBeanServer so lets just do it ourselves
+    *
+    * @param domain
+    * @return
+    */
+   private MBeanServer createMBeanServer(String domain)
+   {
+      final MBeanServerDelegate delegate =
+              builder.newMBeanServerDelegate();
+      if (delegate == null)
+      {
+         final String msg =
+                 "MBeanServerBuilder.newMBeanServerDelegate() " +
+                         "returned null";
+         throw new JMRuntimeException(msg);
+      }
+      final MBeanServer mbeanServer =
+              builder.newMBeanServer(domain, null, delegate);
+      if (mbeanServer == null)
+      {
+         final String msg =
+                 "MBeanServerBuilder.newMBeanServer() returned null";
+         throw new JMRuntimeException(msg);
+      }
+      return mbeanServer;
+
+   }
+
+   public static void setupUrlHandlers()
+   {
+      String pkgs = System.getProperty("java.protocol.handler.pkgs");
+      if (pkgs == null || pkgs.trim().length() == 0)
+      {
+         pkgs = "org.jboss.net.protocol";
+         System.setProperty("java.protocol.handler.pkgs", pkgs);
+      }
+      else if (!pkgs.contains("org.jboss.net.protocol"))
+      {
+         pkgs += "|org.jboss.net.protocol";
+         System.setProperty("java.protocol.handler.pkgs", pkgs);
+      }
+      //Field field = URL.class.getDeclaredField("")
+      //URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
+
+   }
+
+   public void start() throws Exception
+   {
+      setupUrlHandlers();
+      mbeanServer = createMBeanServer("jboss");
+      MBeanServerLocator.setJBoss(mbeanServer);
+
+      mbeanServer.registerMBean(new JMXClassLoader(Thread.currentThread().getContextClassLoader()), ServiceDeployer.DEFAULT_CLASSLOADER_OBJECT_NAME);
+
+      controller = new ServiceController();
+      controller.setKernel(kernel);
+      controller.setMBeanServer(mbeanServer);
+      mbeanServer.registerMBean(controller, new ObjectName("jboss.system:service=ServiceController"));
+      // Register mbeanServer components
+      mbeanServer.registerMBean(this, ServerImplMBean.OBJECT_NAME);
+      mbeanServer.registerMBean(new ServerConfigImpl(serverConfig), ServerConfigImplMBean.OBJECT_NAME);
+      started = true;
+   }
+
+   /**
+    * Stop the mbeans
+    *
+    * @throws IllegalStateException - if not started.
+    */
+   public void stop() throws IllegalStateException
+   {
+      if (log.isTraceEnabled())
+         log.trace("stop caller:", new Throwable("Here"));
+
+      if (!started)
+         throw new IllegalStateException("Server not started");
+
+      log.debug("Shutting down all services");
+      shutdownServices();
+
+      // Make sure all mbeans are unregistered
+      removeMBeans();
+   }
+
+   /**
+    * The <code>shutdownServices</code> method calls the one and only
+    * ServiceController to shut down all the mbeans registered with it.
+    */
+   protected void shutdownServices()
+   {
+      try
+      {
+         // get the deployed objects from ServiceController
+         controller.shutdown();
+      }
+      catch (Exception e)
+      {
+         Throwable t = JMXExceptionDecoder.decode(e);
+         log.error("Failed to shutdown services", t);
+      }
+   }
+
+   /**
+    * The <code>removeMBeans</code> method uses the mbean mbeanServer to unregister
+    * all the mbeans registered here.
+    */
+   protected void removeMBeans()
+   {
+      try
+      {
+         mbeanServer.unregisterMBean(ServiceControllerMBean.OBJECT_NAME);
+      }
+      catch (Exception e)
+      {
+         Throwable t = JMXExceptionDecoder.decode(e);
+         log.error("Failed to unregister mbeans", t);
+      }
+   }
+
+
+   public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+   {
+      broadcasterSupport.addNotificationListener(listener, filter, handback);
+   }
+
+   public void removeNotificationListener(NotificationListener listener)
+           throws ListenerNotFoundException
+   {
+      broadcasterSupport.removeNotificationListener(listener);
+   }
+
+   public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+           throws ListenerNotFoundException
+   {
+      broadcasterSupport.removeNotificationListener(listener, filter, handback);
+   }
+
+   public MBeanNotificationInfo[] getNotificationInfo()
+   {
+      return broadcasterSupport.getNotificationInfo();
+   }
+
+   public void sendNotification(Notification notification)
+   {
+      broadcasterSupport.sendNotification(notification);
+   }
+
+
+   public void runGarbageCollector()
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void runFinalization()
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void traceMethodCalls(Boolean flag)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void traceInstructions(Boolean flag)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public Date getStartDate()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getVersion()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getVersionName()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getBuildNumber()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getBuildJVM()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getBuildOS()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getBuildID()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String getBuildDate()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public boolean isInShutdown()
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void init(Properties props) throws IllegalStateException, Exception
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public ServerConfig getConfig() throws IllegalStateException
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public boolean isStarted()
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void shutdown() throws IllegalStateException
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void exit(int exitcode)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void exit()
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void halt(int exitcode)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void halt()
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+
+   public String getSpecificationVersion()
+   {
+      return serverConfig.getSpecificationVersion();
+   }
+
+
+   public String getVersionNumber()
+   {
+      return "";
+   }
+}

Copied: trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernelMBean.java (from rev 59649, trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java	2007-01-15 18:11:19 UTC (rev 59649)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/JMXKernelMBean.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+import org.jboss.system.server.ServerImplMBean;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JMXKernelMBean extends ServerImplMBean
+{
+}

Added: trunk/embedded/src/main/java/org/jboss/embedded/adapters/LocalOnlyUserTransaction.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/adapters/LocalOnlyUserTransaction.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/LocalOnlyUserTransaction.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,139 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+import org.jboss.logging.Logger;
+import org.jboss.ejb3.tx.TxUtil;
+
+import javax.transaction.UserTransaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.RollbackException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ * Simple, local-only UserTransaction adapter
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 40050 $
+ */
+public final class LocalOnlyUserTransaction implements UserTransaction, java.io.Externalizable
+{
+   protected static Logger log = Logger.getLogger(LocalOnlyUserTransaction.class);
+
+   /**
+    * Timeout value in seconds for new transactions started
+    * by this bean instance.
+    */
+   private TransactionManager tm;
+
+   public LocalOnlyUserTransaction()
+   {
+   }
+
+   public void start()
+   {
+      if (log.isDebugEnabled())
+         log.debug("new UserTx: " + this);
+      this.tm = TxUtil.getTransactionManager();
+   }
+
+   public void stop()
+   {
+      this.tm = null;
+   }
+
+   public void begin()
+           throws NotSupportedException, SystemException
+   {
+      // Start the transaction
+      tm.begin();
+
+      Transaction tx = tm.getTransaction();
+      if (log.isDebugEnabled())
+         log.debug("UserTx begin: " + tx);
+
+   }
+
+   public void commit()
+           throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
+                  SecurityException, IllegalStateException, SystemException
+   {
+      Transaction tx = tm.getTransaction();
+      if (log.isDebugEnabled())
+         log.debug("UserTx commit: " + tx);
+
+      tm.commit();
+   }
+
+   public void rollback()
+           throws IllegalStateException, SecurityException, SystemException
+   {
+      Transaction tx = tm.getTransaction();
+      if (log.isDebugEnabled())
+         log.debug("UserTx rollback: " + tx);
+      tm.rollback();
+   }
+
+   public void setRollbackOnly()
+           throws IllegalStateException, SystemException
+   {
+      Transaction tx = tm.getTransaction();
+      if (log.isDebugEnabled())
+         log.debug("UserTx setRollbackOnly: " + tx);
+
+      tm.setRollbackOnly();
+   }
+
+   public int getStatus()
+           throws SystemException
+   {
+      return tm.getStatus();
+   }
+
+   /**
+    * Set the transaction timeout value for new transactions
+    * started by this instance.
+    */
+   public void setTransactionTimeout(int seconds)
+           throws SystemException
+   {
+      tm.setTransactionTimeout(seconds);
+   }
+
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      this.tm = TxUtil.getTransactionManager();
+   }
+
+}

Copied: trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java (from rev 59656, trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java)
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java	2007-01-15 21:10:52 UTC (rev 59656)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -0,0 +1,252 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.embedded.adapters;
+
+import org.jboss.system.server.BaseServerConfig;
+import org.jboss.embedded.Bootstrap;
+import org.jboss.embedded.DeploymentScanner;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServerConfig implements org.jboss.system.server.ServerConfig
+{
+   protected BaseServerConfig config;
+   protected Properties props;
+
+   public void start() throws Exception
+   {
+      props = new Properties(System.getProperties());
+
+      String homeDir = System.getProperty(HOME_DIR);
+
+      // if HOME_DIR property is null, then try to figure it out
+      if (homeDir == null)
+      {
+
+         String path = System.getProperty(Bootstrap.BOOTSTRAP_RESOURCE_PATH);
+         if (path == null) throw new Exception("${jboss.embedded.bootstrap.resource.path} is null");
+
+
+         path += Bootstrap.BOOTSTRAP_RESOURCE_FILE;
+
+         URL url = Thread.currentThread().getContextClassLoader().getResource(path);
+         if (url.toString().startsWith("file:"))
+         {
+            initializeByFile(path);
+         }
+         else
+         {
+            // we do not know the protocol
+            initializeByUnknown();
+         }
+      }
+      else
+      {
+         props.put(SERVER_HOME_DIR, homeDir);
+      }
+      config = new BaseServerConfig(props);
+      config.initURLs();
+
+      // create tmp and data directories
+
+      if (!config.getServerTempDir().exists())
+      {
+         config.getServerTempDir().mkdir();
+      }
+      if (!config.getServerDataDir().exists())
+      {
+         config.getServerDataDir().mkdir();
+      }
+   }
+
+   protected void initializeByFile(String path) throws Exception
+   {
+      URL homeDirUrl = DeploymentScanner.getDirFromResource(Thread.currentThread().getContextClassLoader(), path + "/..");
+      File homeDir = new File(homeDirUrl.toURI());
+      props.put(HOME_DIR, homeDir.toString());
+      props.put(SERVER_HOME_DIR, homeDir.toString());
+   }
+
+   /**
+    * Creates base JBoss Embedded directory structure under java.io.tmpdir
+    *
+    * @throws Exception
+    */
+   protected void initializeByUnknown() throws Exception
+   {
+      String temp = System.getProperty("java.io.tmpdir");
+      File fp = new File(temp, "embedded-jboss");
+      if (!fp.exists())
+      {
+         fp.mkdir();
+      }
+      props.put(HOME_DIR, fp.toString());
+      props.put(SERVER_HOME_DIR, fp.toString());
+   }
+
+
+   public void initURLs()
+           throws MalformedURLException
+   {
+      config.initURLs();
+   }
+
+   public File getHomeDir()
+   {
+      return config.getHomeDir();
+   }
+
+   public URL getHomeURL()
+   {
+      return config.getHomeURL();
+   }
+
+   public URL getLibraryURL()
+   {
+      return config.getLibraryURL();
+   }
+
+   public URL getPatchURL()
+   {
+      return config.getPatchURL();
+   }
+
+   public String getServerName()
+   {
+      return config.getServerName();
+   }
+
+   public File getServerBaseDir()
+   {
+      return config.getServerBaseDir();
+   }
+
+   public File getServerHomeDir()
+   {
+      return config.getServerHomeDir();
+   }
+
+   public File getServerLogDir()
+   {
+      return config.getServerLogDir();
+   }
+
+   public File getServerTempDir()
+   {
+      return config.getServerTempDir();
+   }
+
+   public File getServerDataDir()
+   {
+      return config.getServerDataDir();
+   }
+
+   public File getServerNativeDir()
+   {
+      return config.getServerNativeDir();
+   }
+
+   public File getServerTempDeployDir()
+   {
+      return config.getServerTempDeployDir();
+   }
+
+   public URL getServerBaseURL()
+   {
+      return config.getServerBaseURL();
+   }
+
+   public URL getServerHomeURL()
+   {
+      return config.getServerHomeURL();
+   }
+
+   public URL getServerLibraryURL()
+   {
+      return config.getServerLibraryURL();
+   }
+
+   public URL getServerConfigURL()
+   {
+      return config.getServerConfigURL();
+   }
+
+   public boolean getPlatformMBeanServer()
+   {
+      return config.getPlatformMBeanServer();
+   }
+
+   public void setExitOnShutdown(boolean flag)
+   {
+      config.setExitOnShutdown(flag);
+   }
+
+   public boolean getExitOnShutdown()
+   {
+      return config.getExitOnShutdown();
+   }
+
+   public void setBlockingShutdown(boolean flag)
+   {
+      config.setBlockingShutdown(flag);
+   }
+
+   public boolean getBlockingShutdown()
+   {
+      return config.getBlockingShutdown();
+   }
+
+   public void setRequireJBossURLStreamHandlerFactory(boolean flag)
+   {
+      config.setRequireJBossURLStreamHandlerFactory(flag);
+   }
+
+   public boolean getRequireJBossURLStreamHandlerFactory()
+   {
+      return config.getRequireJBossURLStreamHandlerFactory();
+   }
+
+   public void setRootDeploymentFilename(String filename)
+   {
+      config.setRootDeploymentFilename(filename);
+   }
+
+   public String getRootDeploymentFilename()
+   {
+      return config.getRootDeploymentFilename();
+   }
+
+
+   public String getSpecificationVersion()
+   {
+      return config.getSpecificationVersion();
+   }
+}
\ No newline at end of file

Modified: trunk/embedded/src/main/java/org/jboss/embedded/junit/ClasspathBasedTestServices.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/junit/ClasspathBasedTestServices.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/java/org/jboss/embedded/junit/ClasspathBasedTestServices.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -23,13 +23,10 @@
 
 import org.jboss.test.JBossTestServices;
 import org.jboss.embedded.Bootstrap;
-import org.jboss.embedded.JMXKernel;
+import org.jboss.embedded.adapters.JMXKernel;
 
 import javax.management.MBeanServerConnection;
-import javax.management.MBeanServer;
 import java.net.URL;
-import java.net.MalformedURLException;
-import java.io.File;
 
 /**
  * comment

Modified: trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml	2007-01-16 03:28:08 UTC (rev 59664)
@@ -16,10 +16,10 @@
       </property>
    </bean>
 
-   <bean name="ServerConfig" class="org.jboss.embedded.ServerConfig"/>
+   <bean name="ServerConfig" class="org.jboss.embedded.adapters.ServerConfig"/>
 
    <!-- The legacy JMX kernel -->
-   <bean name="JMXKernel" class="org.jboss.embedded.JMXKernel">
+   <bean name="JMXKernel" class="org.jboss.embedded.adapters.JMXKernel">
       <property name="kernel">
          <inject bean="jboss.kernel:service=Kernel"/>
       </property>
@@ -139,7 +139,7 @@
         setup deployers
         setup deploy/ directory
      -->
-   <bean name="ResourcesToDeploy" class="org.jboss.embedded.DeploymentGroupBean">
+   <bean name="ResourcesToDeploy" class="org.jboss.embedded.DeploymentScanner">
       <property name="filter"><inject bean="DeploymentFilter"/></property>
       <property name="mainDeployer">
          <inject bean="MainDeployer"/>
@@ -154,7 +154,16 @@
       </property>
    </bean>
 
-   <bean name="ResourcesToDeploy2" class="org.jboss.embedded.DeploymentGroupBean">
+   <bean name="UserTransaction" class="org.jboss.embedded.adapters.LocalOnlyUserTransaction"/>
+
+   <bean name="UserTransactionBinding" class="org.jboss.naming.JndiBinder">
+      <property name="target"><inject bean="UserTransaction"/></property>
+      <property name="bindTo">UserTransaction</property>
+      <property name="serializable">false</property>
+   </bean>
+
+
+   <bean name="ResourcesToDeploy2" class="org.jboss.embedded.DeploymentScanner">
       <property name="filter"><inject bean="DeploymentFilter"/></property>
       <property name="mainDeployer">
          <inject bean="MainDeployer"/>
@@ -168,7 +177,7 @@
          </list>
       </property>
    </bean>
-   <bean name="ResourcesToDeploy3" class="org.jboss.embedded.DeploymentGroupBean">
+   <bean name="ResourcesToDeploy3" class="org.jboss.embedded.DeploymentScanner">
       <property name="filter"><inject bean="DeploymentFilter"/></property>
       <property name="mainDeployer">
          <inject bean="MainDeployer"/>

Modified: trunk/embedded/src/main/resources/javase/conf/jboss-service.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/jboss-service.xml	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/main/resources/javase/conf/jboss-service.xml	2007-01-16 03:28:08 UTC (rev 59664)
@@ -95,7 +95,7 @@
       name="jboss:service=TransactionManager">
       <attribute name="TransactionTimeout">300</attribute>
    </mbean>
-   
+
    <mbean code="org.jboss.util.threadpool.BasicThreadPool"
           name="jboss.jca:service=WorkManagerThreadPool">
       <!-- The name that appears in thread names -->

Modified: trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -26,8 +26,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import org.jboss.embedded.Bootstrap;
-import org.jboss.embedded.JMXKernel;
-import org.jboss.naming.JNDIViewMBean;
+import org.jboss.embedded.adapters.JMXKernel;
 import org.jboss.deployers.spi.DeploymentException;
 
 import javax.naming.InitialContext;

Modified: trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -26,9 +26,8 @@
 import junit.framework.TestSuite;
 import junit.extensions.TestSetup;
 import org.jboss.embedded.Bootstrap;
-import org.jboss.embedded.JMXKernel;
+import org.jboss.embedded.adapters.JMXKernel;
 import org.jboss.embedded.DeploymentGroup;
-import org.jboss.embedded.test.bootstrap.unit.BootstrapTestCase;
 import org.jboss.embedded.test.ejb.DAO;
 import org.jboss.embedded.test.ejb.Customer;
 import org.jboss.deployers.spi.DeploymentException;
@@ -40,8 +39,6 @@
 import javax.management.ReflectionException;
 import javax.management.MalformedObjectNameException;
 import javax.naming.InitialContext;
-import javax.sql.DataSource;
-import java.sql.Connection;
 
 /**
  * Comment

Modified: trunk/embedded/src/test/java/org/jboss/embedded/test/jndibootstrap/unit/BootstrapTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/jndibootstrap/unit/BootstrapTestCase.java	2007-01-15 23:11:23 UTC (rev 59663)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/jndibootstrap/unit/BootstrapTestCase.java	2007-01-16 03:28:08 UTC (rev 59664)
@@ -25,7 +25,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.jboss.embedded.Bootstrap;
-import org.jboss.embedded.JMXKernel;
+import org.jboss.embedded.adapters.JMXKernel;
 import org.jboss.embedded.jndi.KernelInitializingContextFactory;
 
 import javax.naming.InitialContext;




More information about the jboss-cvs-commits mailing list