[jboss-cvs] JBossAS SVN: r99545 - in trunk: component-matrix and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 18 12:51:40 EST 2010


Author: adrian at jboss.org
Date: 2010-01-18 12:51:38 -0500 (Mon, 18 Jan 2010)
New Revision: 99545

Removed:
   trunk/system-jmx/src/main/java/org/jboss/system/BarrierController.java
   trunk/system-jmx/src/main/java/org/jboss/system/BarrierControllerMBean.java
   trunk/system-jmx/src/main/java/org/jboss/system/ConfigurationException.java
   trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBean.java
   trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBeanSupport.java
   trunk/system-jmx/src/main/java/org/jboss/system/InvalidAttributeException.java
   trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBean.java
   trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBeanSupport.java
   trunk/system-jmx/src/main/java/org/jboss/system/MissingAttributeException.java
   trunk/system-jmx/src/main/java/org/jboss/system/NotificationFilterFactory.java
   trunk/system-jmx/src/main/java/org/jboss/system/SecurityActions.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceBinding.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceConfigurator.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceContext.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceController.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceControllerMBean.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceCreator.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceDynamicMBeanSupport.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceFactory.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceInstance.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBean.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanState.java
   trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanSupport.java
   trunk/system-jmx/src/main/java/org/jboss/system/deployers/
   trunk/system-jmx/src/main/java/org/jboss/system/filterfactory/
   trunk/system-jmx/src/main/java/org/jboss/system/metadata/
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ConfigureAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/CreateDestroyLifecycleAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/DescribeAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstallAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstantiateAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleDependencyItem.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleInfo.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/OnlyUnregisterAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContext.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextAction.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextActions.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceProxy.java
   trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/StartStopLifecycleAction.java
Modified:
   trunk/build/build.xml
   trunk/component-matrix/pom.xml
   trunk/server/src/etc/conf/all/bootstrap/deployers.xml
   trunk/server/src/etc/conf/all/bootstrap/jmx.xml
   trunk/system-jmx/pom.xml
   trunk/testsuite/build.xml
Log:
[JBAS-7630] - Update trunk to jmx-mc-int and deployers-jmx

Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/build/build.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -2100,6 +2100,7 @@
       <fileset refid="org.jboss.deployers:jboss-deployers-core:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-core-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-impl:jar"/>
+      <fileset refid="org.jboss.deployers:jboss-deployers-jmx:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-structure-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-vfs:jar"/>
@@ -2108,6 +2109,7 @@
       <fileset refid="org.jboss.kernel:jboss-aop-mc-int:jar"/>
       <fileset refid="org.jboss.kernel:jboss-dependency:jar"/>
       <fileset refid="org.jboss.kernel:jboss-kernel:jar"/>
+      <fileset refid="org.jboss.kernel:jboss-jmx-mc-int:jar"/>
       <fileset refid="javax.inject:javax.inject:jar"/>
       <fileset refid="org.jboss:jboss-vfs:jar"/>
       <fileset refid="org.osgi:osgi_R4_core:jar"/>

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/component-matrix/pom.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1829,6 +1829,12 @@
         <artifactId>jboss-deployers-vfs-spi</artifactId>
         <version>${version.org.jboss.deployers}</version>
       </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-jmx</artifactId>
+        <version>${version.org.jboss.deployers}</version>
+      </dependency>
 
       <dependency>
 	      <groupId>org.jboss.javaee</groupId>
@@ -2279,6 +2285,12 @@
       
       <dependency>
         <groupId>org.jboss.kernel</groupId>
+        <artifactId>jboss-jmx-mc-int</artifactId>
+        <version>${version.org.jboss.kernel}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.kernel</groupId>
         <artifactId>jboss-aop-mc-int</artifactId>
         <version>${version.org.jboss.kernel}</version>
         <exclusions>

Modified: trunk/server/src/etc/conf/all/bootstrap/deployers.xml
===================================================================
--- trunk/server/src/etc/conf/all/bootstrap/deployers.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/server/src/etc/conf/all/bootstrap/deployers.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -232,7 +232,9 @@
       <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
       <property name="controller"><inject bean="JMXKernel" property="serviceController"/></property>
    </bean>
-   <bean name="SARDeployer" class="org.jboss.system.deployers.SARDeployer"/>
+   <bean name="SARDeployer" class="org.jboss.system.deployers.SARDeployer">
+      <property name="defaultCodeBaseRoot">${jboss.server.home.url}</property>
+   </bean>
    <bean name="ServiceClassLoaderDeployer" class="org.jboss.system.deployers.ServiceClassLoaderDeployer"/>
    <bean name="ServiceDeploymentDeployer" class="org.jboss.system.deployers.ServiceDeploymentDeployer"/>
    <bean name="ServiceDeployer" class="org.jboss.system.deployers.ServiceDeployer">

Modified: trunk/server/src/etc/conf/all/bootstrap/jmx.xml
===================================================================
--- trunk/server/src/etc/conf/all/bootstrap/jmx.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/server/src/etc/conf/all/bootstrap/jmx.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -14,6 +14,8 @@
       <root>${jboss.lib.url}jboss-mbeanserver.jar</root>
       <root>${jboss.lib.url}jboss-jmx.jar</root>
       <root>${jboss.lib.url}jboss-system-jmx.jar</root>
+      <root>${jboss.lib.url}jboss-jmx-mc-int.jar</root>
+      <root>${jboss.lib.url}jboss-deployers-jmx.jar</root>
       <root>${jboss.lib.url}dom4j.jar</root>
    </classloader>
 

Modified: trunk/system-jmx/pom.xml
===================================================================
--- trunk/system-jmx/pom.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/pom.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -114,6 +114,14 @@
       <artifactId>jboss-kernel</artifactId>
     </dependency>      
     <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-jmx-mc-int</artifactId>
+    </dependency>      
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-jmx</artifactId>
+    </dependency>      
+    <dependency>
       <groupId>org.jboss.test</groupId>
       <artifactId>jboss-test</artifactId>
       <scope>test</scope>

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/BarrierController.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/BarrierController.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/BarrierController.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,431 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.Notification;
-import javax.management.ObjectName;
-
-/**
- * BarrierController service.
- * 
- * A service that controls the lifecycle of a secondary mbean
- * (the BarrierMbean) that can be used as a dependency for other
- * services.
- * 
- * Starting and stopping the barrier mbean (and as a result
- * all services depending on it) is performed by listening
- * for any kind of JMX notification. In particular we use
- * the handback object of a notification subscription to
- * qualify the start and stop signals.
- * 
- * Manual control of the barrier is also supported through
- * startBarrier()/stopBarrier() methods.
- * 
- * You may subclass BarrierController and override enableOnStartup()
- * to apply complex logic in deciding whether to initially start
- * the barrier (e.g. query some other mbean). 
- * 
- * @jmx:mbean
- *    extends="org.jboss.system.ListenerServiceMBean"
- *    name="jboss:service=BarrierController"
- * 
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class BarrierController extends ListenerServiceMBeanSupport
-   implements BarrierControllerMBean
-{
-   // Private Data --------------------------------------------------
-   
-   /** The ObjectName of the Barrier MBean */
-   private ObjectName barrierName;
-
-   /** The initial state of the barrier */
-   private Boolean enableOnStartup;
-   
-   /** The notification subscription handback string that starts the barrier */ 
-   private String startHandback;
-   
-   /** The notification subscription handback string that stops the barrier */
-   private String stopHandback;
-   
-   /** The dynamic subscriptions flag */
-   private Boolean dynamicSubscriptions;
-   
-   // Protected Data ------------------------------------------------
-
-   /** The controlled Barrier */
-   protected Barrier barrier;
-   
-   // Constructors --------------------------------------------------
-   
-   /**
-    * Default CTOR
-    */
-   public BarrierController()
-   {
-      // empty
-   }
-   
-   // Attributes ----------------------------------------------------
-   
-   /**
-    * The controlled barrier StateString.
-    * 
-    * @jmx.managed-attribute
-    */
-   public String getBarrierStateString()
-   {
-      return (barrier != null) ? barrier.getStateString() : null;
-   }
-   
-   /**
-    * The controlled barrier ObjectName.
-    * 
-    * @jmx.managed-attribute
-    */
-   public void setBarrierObjectName(ObjectName barrierName)
-   {
-      // set once
-      if (this.barrierName == null)
-      {
-         this.barrierName = barrierName;
-      }
-   }
-   
-   /**
-    * The controlled barrier ObjectName.
-    * 
-    * @jmx.managed-attribute
-    */
-   public ObjectName getBarrierObjectName()
-   {
-      return barrierName;
-   }
-
-
-   /**
-    * The initial state of the barrier.
-    * 
-    * If set, it overrides the internal call to enableOnStartup()
-    * which will never get called.
-    * 
-    * @jmx.managed-attribute
-    */
-   public void setBarrierEnabledOnStartup(Boolean enableOnStartup)
-   {
-      // set once
-      if (this.enableOnStartup == null)
-      {
-         this.enableOnStartup = enableOnStartup;
-      }
-   }
-
-   /**
-    * The initial state of the barrier.
-    * 
-    * Use the value set through setBarrierEnabledOnStartup()
-    * otherwise call the internal enableOnStartup() override
-    * to make a decision.
-    * 
-    * @jmx.managed-attribute
-    */
-   public Boolean getBarrierEnabledOnStartup()
-   {
-      if (enableOnStartup == null)
-      {
-         // setBarrierEnabledOnStartup() not called
-         // initialize through enableOnStartup()
-         enableOnStartup = enableOnStartup();
-      }
-      return enableOnStartup;
-   }
-   
-   /**
-    * The notification subscription handback string that starts the barrier.
-    * 
-    * @jmx.managed-attribute
-    */   
-   public void setStartBarrierHandback(String startHandback)
-   {
-      // set once
-      if (this.startHandback == null)
-      {
-         this.startHandback = startHandback;
-      }
-   }
-
-   /**
-    * The notification subscription handback string that starts the barrier.
-    * 
-    * @jmx.managed-attribute
-    */   
-   public String getStartBarrierHandback()
-   {
-      return startHandback;
-   }
-
-   /**
-    * The notification subscription handback string that stops the barrier.
-    * 
-    * @jmx.managed-attribute
-    */   
-   public void setStopBarrierHandback(String stopHandback)
-   {
-      // set once
-      if (this.stopHandback == null)
-      {
-         this.stopHandback = stopHandback;
-      }
-   }
-   
-   /**
-    * The notification subscription handback string that stops the barrier.
-    * 
-    * @jmx.managed-attribute
-    */   
-   public String getStopBarrierHandback()
-   {
-      return stopHandback;
-   }
-   
-   /**
-    * The ability to dynamically subscribe for notifications.
-    *
-    * @jmx.managed-attribute
-    */
-   public void setDynamicSubscriptions(Boolean dynamicSubscriptions)
-   {
-      // set once
-      if (this.dynamicSubscriptions == null)
-      {
-         this.dynamicSubscriptions = dynamicSubscriptions;
-      }
-   }
-   
-   /**
-    * The ability to dynamically subscribe for notifications.
-    *
-    * @jmx.managed-attribute
-    */   
-   public Boolean getDynamicSubscriptions()
-   {
-      if (dynamicSubscriptions == null)
-      {
-         dynamicSubscriptions = Boolean.TRUE;
-      }
-      return dynamicSubscriptions;
-   }
-   
-   // Override ------------------------------------------------------
-   
-   /**
-    * Override this method to apply complex logic whether
-    * to start the Barrier service upon startup or not.
-    * 
-    * This method will be only called once and only if
-    * setBarrierEnabledOnStartup(Boolean) has not been called.
-    * 
-    * The default implementation is to return false.
-    */
-   protected Boolean enableOnStartup()
-   {
-      return Boolean.FALSE;
-   }
-   
-   // Lifecycle -----------------------------------------------------
-   
-   protected void createService() throws Exception
-   {
-      // create the Barrier
-      barrier = new Barrier(getServiceName());
-      
-      initBarrier();
-   }
-   
-   /**
-    * Coordinates between createService() and postRegister(),
-    * registering the barrier when both the barrier is
-    * created and the mbeanserver is available
-    * 
-    * @throws Exception
-    */
-   private void initBarrier() throws Exception
-   {
-      if (barrier != null && getServer() != null)
-      {         
-         // register with the MBeanServer
-         getServer().registerMBean(barrier, barrierName);
-         
-         // implicitly call the ServiceController
-         barrier.create();
-         
-         // conditionally start the barrier
-         if (getBarrierEnabledOnStartup().booleanValue())
-         {
-            startBarrier();
-         }
-         // subscribe for notifications
-         subscribe(getDynamicSubscriptions().booleanValue());         
-      }
-   }
-   
-   protected void destroyService()
-   {
-      // unsubscribe for notifications
-      unsubscribe();
-
-      try
-      {
-         // implicitly call the ServiceController
-         barrier.destroy();
-      
-         // remove from MBeanServer
-         getServer().unregisterMBean(barrierName);
-      }
-      catch (Throwable e)
-      {
-         log.debug("Unexpected error during destroy", e);
-      }
-      
-      // cleanup
-      barrier = null;
-   }
-   
-   // ListenerServiceMBeanSupport -----------------------------------
-   
-   /**
-    * Base on the handback object the decision
-    * for starting/stopping the barrier
-    */ 
-   public void handleNotification2(Notification n, Object handback)
-   {
-      log.debug("Got notification: " + n);
-      
-      if (startHandback != null && startHandback.equals(handback))
-      {
-         log.debug("Saw '" + handback + "' handback, starting barrier");
-         startBarrier();
-      }
-      else if (stopHandback != null && stopHandback.equals(handback))
-      {
-         log.debug("Saw '" + handback + "' handback, stopping barrier");
-         stopBarrier();
-      }
-   }
-   
-   // Operations ----------------------------------------------------
-
-   /**
-    * Manually start the controlled barrier
-    * 
-    * @jmx:managed-operation
-    */
-   public void startBarrier()
-   {
-      try
-      {
-         // implicitly call the ServiceController
-         barrier.start();
-      }
-      catch (Throwable e)
-      {
-         log.warn("Failed to start barrier: " + barrierName, e);
-      }
-   }
-
-   /**
-    * Manually stop the controlled barrier
-    * 
-    * @jmx:managed-operation
-    */
-   public void stopBarrier()
-   {
-      try
-      {
-         // implicitly call the ServiceController
-         barrier.stop();
-      }
-      catch (Throwable e)
-      {
-         log.warn("Failed to stop barrier: " + barrierName, e);
-      }
-   }
-   
-   // Overrides ---------------------------------------------------
-   
-   @Override
-   public void postRegister(Boolean registrationDone)
-   {
-      super.postRegister(registrationDone);
-      
-      if (Boolean.TRUE.equals(registrationDone))
-      {
-         try
-         {
-            initBarrier();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-   }
-   
-   // Inner Class ---------------------------------------------------
-   
-   /**
-    * The controlled barrier MBean interface
-    */
-   public static interface BarrierMBean
-   {
-      /** We just want to expose those attributes */
-      ObjectName getBarrierController();
-      String getStateString();
-      int getState();
-      
-      /** Hook up with the ServiceController */
-      void jbossInternalLifecycle(String method) throws Exception;
-   }   
-
-   /**
-    * The controlled barrier MBean class
-    */
-   public static class Barrier extends ServiceMBeanSupport implements BarrierMBean
-   {
-      /** The parent Controller */
-      private ObjectName barrierController;
-      
-      /** CTOR */
-      public Barrier(ObjectName barrierController)
-      {
-         this.barrierController = barrierController;
-      }
-      
-      /** Accessor */
-      public ObjectName getBarrierController()
-      {
-         return barrierController;
-      }
-   }   
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/BarrierControllerMBean.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/BarrierControllerMBean.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/BarrierControllerMBean.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.ObjectName;
-
-/**
- * BarrierController service interface
- * 
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface BarrierControllerMBean extends ListenerServiceMBean
-{
-   // Attributes ----------------------------------------------------
-
-   /** The controlled barrier StateString */
-   String getBarrierStateString();
-   
-   /** The controlled barrier ObjectName */
-   void setBarrierObjectName(ObjectName barrierName);
-   ObjectName getBarrierObjectName();
-   
-   /** The initial state of the barrier */
-   void setBarrierEnabledOnStartup(Boolean enableOnStartup);
-   Boolean getBarrierEnabledOnStartup();
-   
-   /** The notification subscription handback string that starts the barrier */
-   void setStartBarrierHandback(String startHandback);
-   String getStartBarrierHandback();
-   
-   /** The notification subscription handback string that stops the barrier */
-   void setStopBarrierHandback(String stopHandback);
-   String getStopBarrierHandback();
-   
-   /** The ability to dynamically subscribe for notifications */
-   void setDynamicSubscriptions(Boolean dynamicSubscriptions);
-   Boolean getDynamicSubscriptions();
-   
-   // Operations ----------------------------------------------------
-   
-   /** Manually start the controlled barrier */
-   void startBarrier();
-   
-   /** Manually stop the controlled barrier */
-   void stopBarrier();
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ConfigurationException.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ConfigurationException.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ConfigurationException.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import org.jboss.util.NestedException;
-
-/**
- * Thrown to indicate a non-fatal configuration related problem.
- *
- * @author  <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version <tt>$Revision$</tt>
- */
-public class ConfigurationException
-   extends NestedException
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -1841403351768037738L;
-   
-   /**
-    * Rethrow a throwable as a configuration exception if it isn't already.
-    *
-    * @param message the message
-    * @param t the throwable
-    * @return never
-    * @throws ConfigurationException always
-    */
-   public static ConfigurationException rethrowAsConfigurationException(String message, Throwable t)
-      throws ConfigurationException
-   {
-      if (t instanceof ConfigurationException)
-         throw (ConfigurationException) t;
-      else
-         throw new ConfigurationException(message, t);
-   }
-
-   /**
-    * Construct a <tt>ConfigurationException</tt> with the specified detail 
-    * message.
-    *
-    * @param msg  Detail message.
-    */
-   public ConfigurationException(String msg) {
-      super(msg);
-   }
-
-   /**
-    * Construct a <tt>ConfigurationException</tt> with the specified detail 
-    * message and nested <tt>Throwable</tt>.
-    *
-    * @param msg     Detail message.
-    * @param nested  Nested <tt>Throwable</tt>.
-    */
-   public ConfigurationException(String msg, Throwable nested) {
-      super(msg, nested);
-   }
-
-   /**
-    * Construct a <tt>ConfigurationException</tt> with the specified
-    * nested <tt>Throwable</tt>.
-    *
-    * @param nested  Nested <tt>Throwable</tt>.
-    */
-   public ConfigurationException(Throwable nested) {
-      super(nested);
-   }
-
-   /**
-    * Construct a <tt>ConfigurationException</tt> with no detail.
-    */
-   public ConfigurationException() {
-      super();
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBean.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBean.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBean.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.List;
-
-/**
- * MBean interface for services that dynamically attach an
- * interceptor to a set of target Interceptable (X)MBeans.
- * 
- * @see InterceptorServiceMBeanSupport
- * @see org.jboss.mx.server.Interceptable
- * 
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public interface InterceptorServiceMBean extends ServiceMBean
-{
-   // Attributes ----------------------------------------------------
-   
-   /**
-    * The ObjectNames of the MBeans implementing the operations
-    * in the org.jboss.mx.server.Interceptable interface
-    */
-   void setInterceptables(List interceptables);
-   List getInterceptables();
-   
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBeanSupport.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/InterceptorServiceMBeanSupport.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,275 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.interceptor.AbstractInterceptor;
-import org.jboss.mx.interceptor.DynamicInterceptor;
-import org.jboss.mx.interceptor.Interceptor;
-import org.jboss.mx.server.Invocation;
-
-/**
- * Helper class that can be used for writing MBean Services
- * that dynamically hook-up an Interceptor to other (X)MBeans
- * that have been configured as Interceptable.
- * 
- * In a nutshell, call attach()/detach() from your
- * createService()/destroyService() or startService()/stopService()
- * pair methods to attach/detach an interceptor to the target mbean(s),
- * then override invoke() to do something with the invocations.
- * 
- * You may also provide your own Interceptor, in which case
- * you should call attach(Interceptor).
- * 
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public abstract class InterceptorServiceMBeanSupport extends ServiceMBeanSupport
-   implements InterceptorServiceMBean
-{
-   // Private Data --------------------------------------------------
-   
-   /** The Interceptables to attach to */
-   private List interceptables;
-   
-   /** The attached interceptor */
-   private Interceptor interceptor;
-   
-   // Constructors -------------------------------------------------
-    
-   /**
-    * Constructs an <tt>InterceptorServiceMBeanSupport</tt>.
-    */
-   public InterceptorServiceMBeanSupport()
-   {
-        super();
-   }
-
-   /**
-    * Constructs an <tt>InterceptorServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param type   The class type to determine Logger name from.
-    */
-   public InterceptorServiceMBeanSupport(final Class type)
-   {
-      super(type);
-   }
-   
-   /**
-    * Constructs an <tt>InterceptorServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param category   The logger category name.
-    */
-   public InterceptorServiceMBeanSupport(final String category)
-   {
-      super(category);
-   }
-
-   /**
-    * Constructs an <tt>InterceptorServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param log   The logger to use.
-    */
-   public InterceptorServiceMBeanSupport(final Logger log)
-   {
-      super(log);
-   }    
-    
-   // InterceptorServiceMBean ---------------------------------------
-   
-   public void setInterceptables(List interceptables)
-   {
-      // copy
-      if (interceptables != null)
-      {
-         this.interceptables = new ArrayList(interceptables);
-      }
-   }
-   
-   public List getInterceptables()
-   {
-      // return a copy
-      if (interceptables != null)
-      {
-         return new ArrayList(interceptables);
-      }
-      return null;
-   }
-   
-   // Protected API -------------------------------------------------
-   
-   /**
-    * Add our interceptor to the target Interceptables.
-    * 
-    * Override invoke(Invocation) to handle the calls.
-    * 
-    * @throws Exception thrown on any interceptor registration error
-    */
-   protected void attach() throws Exception
-   {
-      if (interceptor == null)
-      {
-         attach(new XMBeanInterceptor());
-      }
-   }
-
-   /**
-    * Add the provided interceptor to the target Interceptables.
-    * 
-    * @param interceptor the interceptor to add
-    * @throws Exception thrown on any interceptor registration error
-    */
-   protected void attach(Interceptor interceptor) throws Exception
-   {
-      if (interceptor == null)
-      {
-         throw new IllegalArgumentException("Null interceptor");
-      }
-      
-      // check we haven't attached already
-      if (this.interceptor != null)
-      {
-         throw new IllegalStateException("Interceptor already attached");
-      }
-      
-      log.debug("Attaching interceptor: " + interceptor.getName());
-      
-      // remember the interceptor
-      this.interceptor = interceptor;
-      
-      // add the interceptor to the Interceptables; an exception
-      // will be thrown if any of them is not Interceptable,
-      // in which case detach() should be called.
-      if (interceptables != null)
-      {
-         Object[] params = new Object[] { interceptor };
-         String[] signature = new String[] { Interceptor.class.getName() };
-         
-         for (Iterator i = interceptables.iterator(); i.hasNext(); )
-         {
-            ObjectName target = (ObjectName)i.next();
-            super.server.invoke(target,
-               DynamicInterceptor.ADD_INTERCEPTOR,
-               params,
-               signature);
-            
-            log.debug("Interceptor attached to: '" + target + "'");
-         }
-      }
-   }
-   
-   /**
-    * Remove the interceptor from the target Interceptables
-    */
-   protected void detach()
-   {
-      if (interceptor != null)
-      {
-         log.debug("Detaching interceptor: " + interceptor.getName());         
-         if (interceptables != null)
-         {
-            Object[] params = new Object[] { interceptor };
-            String[] signature = new String[] { Interceptor.class.getName() };
-            
-            for (Iterator i = interceptables.iterator(); i.hasNext(); )            
-            {
-               ObjectName target = (ObjectName)i.next();               
-               try
-               {
-                  super.server.invoke(target,
-                     DynamicInterceptor.REMOVE_INTERCEPTOR,
-                     params,
-                     signature);
-                  
-                  log.debug("Interceptor detached from: '" + target + "'");                  
-               }
-               catch (Exception e)
-               {
-                  log.debug("Caught exception while removing interceptor from '" +
-                        target + "'", e);
-               }
-            }
-         }
-         interceptor = null;
-      }
-   }
-   
-   /**
-    * Use this to forward the call
-    */
-   protected Object invokeNext(Invocation invocation) throws Throwable
-   {
-      // call the next in the interceptor chain,
-      // if nobody follows dispatch the call
-      Interceptor next = invocation.nextInterceptor();
-      if (next != null)
-      {
-         return next.invoke(invocation);
-      }
-      else
-      {
-         return invocation.dispatch();
-      }
-   }
-   
-   // Override ------------------------------------------------------
-   
-   /**
-    * Override
-    */
-   protected Object invoke(Invocation invocation) throws Throwable
-   {
-      return invokeNext(invocation);
-   }
-   
-   // Private Inner Class -------------------------------------------
-   
-   /**
-    * Simple Interceptor delegating to
-    * the invoke(Invocation) callback
-    */   
-   private class XMBeanInterceptor extends AbstractInterceptor
-   {
-      public XMBeanInterceptor()
-      {
-         super("XMBeanInterceptor('" + InterceptorServiceMBeanSupport.this.getServiceName() + "')");
-      }
-      
-      public Object invoke(Invocation invocation) throws Throwable
-      {
-         // delegate
-         return InterceptorServiceMBeanSupport.this.invoke(invocation);
-      }
-   }
-}    

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/InvalidAttributeException.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/InvalidAttributeException.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/InvalidAttributeException.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-/**
- * Thrown to indicate that a given attribute value is not valid.
- *
- * @author  <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version <tt>$Revision$</tt>
- */
-public class InvalidAttributeException
-   extends ConfigurationException
-{
-   /**
-    * Construct a <tt>InvalidAttributeException</tt> with the 
-    * specified detail message.
-    *
-    * @param name    The attribute name.
-    * @param msg     The detail message.
-    */
-   public InvalidAttributeException(final String name, final String msg) {
-      super(makeMessage(name, msg));
-   }
-
-   /**
-    * Construct a <tt>InvalidAttributeException</tt> with the specified detail 
-    * message and nested <tt>Throwable</tt>.
-    *
-    * @param name    The attribute name.
-    * @param msg     The detail message.
-    * @param nested  Nested <tt>Throwable</tt>.
-    */
-   public InvalidAttributeException(final String name, final String msg, final Throwable nested) 
-   {
-      super(makeMessage(name, msg), nested);
-   }
-
-   /**
-    * Make a execption message for the attribute name and detail message.
-    */
-   private static String makeMessage(final String name, final String msg) {
-      return "Invalid value for attribute '" + name + "': " + msg;
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBean.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBean.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBean.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-/**
- * An extension of the ServiceMBean interface that provides for
- * declarative JMX notification subscription handling.
- * <p>
- * The SubscriptionList attribute is used to specify the list
- * of MBeans/notifications that the listener service instance
- * will subscribe for.
- * <p>
- * The abstract class ListenerServiceMBeanSupport implements
- * this interface.
- *
- * @see ServiceMBean
- * @see ListenerServiceMBeanSupport
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public interface ListenerServiceMBean
-   extends ServiceMBean
-{
-   // Constants -----------------------------------------------------
-  
-   /** The XML subscription-list elements and attributes */
-   public static final String SL_ROOT_ELEMENT                = "subscription-list";
-   public static final String SL_MBEAN_ELEMENT               = "mbean";
-   public static final String SL_FILTER_ELEMENT              = "filter";
-   public static final String SL_NOTIFICATION_ELEMENT        = "notification";
-   public static final String SL_MBEAN_NAME_ATTRIBUTE        = "name";
-   public static final String SL_MBEAN_HANDBACK_ATTRIBUTE    = "handback";
-   public static final String SL_FILTER_FACTORY_ATTRIBUTE    = "factory";
-   public static final String SL_NOTIFICATION_TYPE_ATTRIBUTE = "type";
-   
-   // Public --------------------------------------------------------
-
-   /**
-    * Used to configure at start-up the JMX notification subscriptions.
-    *
-    * The configuration is done inline in the mbean descriptor. For example:
-    *
-    * <code>
-    * ...
-    * <attribute name="SubscriptionList">
-    *   <subscription-list>
-    *     <mbean name="jboss.system:*">
-    *       <notification type="org.jboss.system.ServiceMBean.start"/>
-    *       <notification type="org.jboss.system.ServiceMBean.stop"/>
-    *     </mbean>
-    *   </subscription-list>
-    * </attribute>
-    * ...
-    * </code>
-    *
-    * The filter mechanism has been extended to support specification
-    * of arbitrary filters, using filter factory plugins:
-    * 
-    * <code>
-    * ...
-    * <attribute name="SubscriptionList">
-    *   <subscription-list>
-    *     <mbean name="jboss.system:*">
-    *       <filter factory="NotificationFilterSupportFactory">
-    *         <enable type="org.jboss.system.ServiceMBean.start"/>
-    *         <enable type="org.jboss.system.ServiceMBean.stop"/>
-    *       </filter>
-    *     </mbean>
-    *     <mbean name="jboss.monitor:service=MemoryMonitor">
-    *       <filter factory="AttributeChangeNotificationFilterFactory">
-    *         <enable attribute-name="State"/>
-    *       </filter>
-    *     </mbean>        
-    *     <mbean name="JMImplementation:type=MBeanServerDelegate">
-    *       <filter factory="MBeanServerNotificationFilterFactory">
-    *         <enable type="JMX.mbean"/>
-    *         <enable object-name="jboss:type=Service,name=SystemProperties"/>
-    *       </filter>
-    *     </mbean>
-    *   </subscription-list>
-    * </attribute>
-    * ...
-    * </code>
-    * 
-    * 'factory' is the full class name of a class that implements the
-    * org.jboss.system.NotificationFilterFactory interface. If the
-    * class cannot be loaded, a second attempt is made to load the
-    * class from within the org.jboss.system.filterfactory package.
-    * 
-    * Three NotificationFilterFactories corresponding to the three
-    * "standard" jmx notification filters, have been pre-packaged.
-    * 
-    * Those are:
-    * 
-    * @see org.jboss.system.filterfactory.AttributeChangeNotificationFilterFactory
-    * @see org.jboss.system.filterfactory.MBeanServerNotificationFilterFactory
-    * @see org.jboss.system.filterfactory.NotificationFilterSupportFactory
-    *  
-    * See also jboss-subscription.dtd
-   **/
-   public void setSubscriptionList(org.w3c.dom.Element list);
-   
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBeanSupport.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ListenerServiceMBeanSupport.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,828 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerNotification;
-import javax.management.MalformedObjectNameException;
-import javax.management.Notification;
-import javax.management.NotificationFilter;
-import javax.management.NotificationFilterSupport;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.server.ServerConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * An abstract base class that provides for declarative JMX notification
- * subscription handling.
- * <p>
- * A JBoss service that is in addition a NotificationListener can
- * subclass ListenerServiceMBeanSupport instead of ServiceMBeanSupport
- * and specify at run-time, inline in the MBean descriptor using the
- * SubscriptionList attribute, the set of MBeans/notifications the
- * service wants to subscribe/receive.
- * <p>
- * Call subscribe(boolean dynamicSubscriptions) at anytime to register to
- * those MBeans and for those notifications that match the specified criteria.
- * Call unsubscribe() to unsubscribe for Notifications.
- * <p>
- * If true is passed to subscribe() the baseclass will monitor for
- * registration events from the MBeanServer and automatically subscribe
- * to new instances of MBeans that match the subscription criteria.
- * Monitoring for unsubscribe events in not necessary, since the MBeanServer
- * automatically removes subscriptions to unregistering MBeans.
- * <p>
- * An alternative subscribe(boolean dynamicSubscription, ObjectName listener)
- * can be used to specify a different MBean as the receiver of the
- * subscribed notifications. The specified MBean must be a NotificationListener.
- * <p>
- * To handle the incoming notifications override the handleNotification2()
- * method. The usual handleNotification() method should not be overriden,
- * since it is used to monitor the incoming notifications for registration
- * events coming from the MBeanServer, before delegating to
- * handleNotification2(), in order to implement dynamic subscriptions.
- *
- * @see ListenerServiceMBean
- * @see NotificationFilterFactory
- *
- * REVISIONS
- * =========
- * 14/03/05, dimitris
- * The filter mechanism has been extended to support specification
- * of arbitrary filters, using dynamic filter factory plugins
- * implementing the NotificationFilterFactory interface.
- * Three filter factories corresponding to the "standard" jmx
- * notification filters are supplied by default in package
- * org.jboss.system.filterfactory.
- * 
- * 19/10/04, dimitris
- * renamed inner class MBeanInfo to SubscriptionInfo and made public,
- * using NotificationFilter instead of NotificationFilterSupport and added new
- * subscribe(List subscriptionList, boolean dynamicSubscriptions, ObjectName listener)
- * to allow external programmatic specification of the subscription list.
- *  
- * 28/02/04, dimitris
- * explicit subscribe()/unsubscribe() replaced implicit start()/stop();
- * dynamic subscription behaviour can be enabled/disabled, plus it is
- * now possible to specify an external MBean as notification listener.
- * 
- * 02/02/04, dimitris
- * Initial version, that resulted by generalizing the notification
- * subscription mechanism of the snmp adapter.
- * 
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- *
- * @version $Revision$
-**/
-public abstract class ListenerServiceMBeanSupport
-   extends ServiceMBeanSupport
-   implements ListenerServiceMBean, NotificationListener
-{
-   // Private Data --------------------------------------------------
-     
-   /** The list of mbean subscriptions */
-   private List sublist; // if null, subscriptions not made
-   
-   /** The mbean subscription config in XML form */
-   private Element xmllist; // set through SubscriptionList attribute
-   
-   /** monitoring and registering to new MBeans, as they appear */
-   private boolean dynamicSubscriptions;
-   
-   /** the receiver of the notifications */
-   private ObjectName listener;
-   
-   /** Handback to identify our own MBeanServerDelegate subscription */
-   private Object myHandback;  
-   
-   /** Filter to receive only registration events */
-   private NotificationFilterSupport myFilter;   
-  
-   /** Has subscribe() been called and unsubscribe not been called? */
-   private boolean subscribed;
-   
-   // Constructors -------------------------------------------------
-    
-   /**
-    * Constructs a <tt>ListenerServiceMBeanSupport</tt>.
-   **/
-   public ListenerServiceMBeanSupport()
-   {
-        super();
-        init();
-   }
-
-   /**
-    * Constructs a <tt>ListenerServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param type   The class type to determine Logger name from.
-   **/
-   public ListenerServiceMBeanSupport(final Class type)
-   {
-      super(type);
-      init();
-   }
-   
-   /**
-    * Constructs a <tt>ListenerServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param category   The logger category name.
-   **/
-   public ListenerServiceMBeanSupport(final String category)
-   {
-      super(category);
-      init();
-   }
-
-   /**
-    * Constructs a <tt>ListenerServiceMBeanSupport</tt>.
-    *
-    * Pass-through to ServiceMBeanSupport.
-    *
-    * @param log   The logger to use.
-   **/
-   public ListenerServiceMBeanSupport(final Logger log)
-   {
-      super(log);
-      init();
-   }    
-    
-   // ListenerServiceMBean Implementation ---------------------------
-    
-   /**
-    * Used to configure the JMX notification subscriptions.
-    *
-    * The configuration is done inline in the mbean descriptor.
-    *
-    * See jboss-subscription.dtd
-   **/
-   public void setSubscriptionList(Element list)
-   {
-      // deep copy the provided Element for later use
-      // not sure if really necessary - play it safe
-      this.xmllist = (Element)list.cloneNode(true);
-   }
-   
-   // Public API ----------------------------------------------------
-
-   public List<SubscriptionInfo> getSubscriptions()
-   {
-      return sublist;
-   }
-
-   public void setSubscriptions(List<SubscriptionInfo> list)
-   {
-      this.sublist = list;
-   }
-   
-   /**
-    * Subscribes this MBean for JMX notifications.
-    *
-    * @param dynamicSubscriptions indicates whether to monitor and subscribe
-    *                             to new MBeans that match the specification.
-   **/
-   public void subscribe(boolean dynamicSubscriptions)
-      throws Exception
-   {
-      subscribe(dynamicSubscriptions, this.getServiceName());
-   }
-   
-   /**
-    * Subscribes a listener MBean for JMX notifications.
-    *
-    * @param dynamicSubscriptions indicates whether to monitor and subscribe
-    *                             to new MBeans that match the specification.
-    * @param listener the receiver of the notifications.
-   **/
-   public void subscribe(boolean dynamicSubscriptions, ObjectName listener)
-      throws Exception
-   {
-      // we need an xml subscription specification
-      if (this.xmllist != null && this.sublist == null)
-      {
-         // Parse the XML spec
-         log.debug("Parsing subscription specification");
-         List subscriptionList = parseXMLSubscriptionSpec(this.xmllist);
-         
-         subscribe(subscriptionList, dynamicSubscriptions, listener);
-      }
-      else if (this.sublist != null)
-      {
-         subscribe(sublist, dynamicSubscriptions, listener);
-      }
-      else
-         log.debug("Subscription specification not provided");      
-   }
-   
-   /**
-    * Subscribes a listener MBean for JMX notifications.
-    *
-    * @param subscriptionList the list containing SubscriptionInfo data.
-    * @param dynamicSubscriptions indicates whether to monitor and subscribe
-    *                             to new MBeans that match the specification.
-    * @param listener the receiver of the notifications.
-   **/
-   public void subscribe(List subscriptionList, boolean dynamicSubscriptions, ObjectName listener)
-      throws Exception
-   {
-      // return if already subscribed
-      if (subscribed)
-         return;
-
-      // we need an subscription specification
-      if (subscriptionList != null)
-      {
-         // store input  
-         this.sublist = subscriptionList;         
-         this.dynamicSubscriptions = dynamicSubscriptions;
-         this.listener = listener;         
-         
-         log.debug(this.sublist);
-            
-         log.debug("Subscribing for JMX notifications" +
-                  ", dynamic=" + dynamicSubscriptions +
-                  (this.getServiceName().equals(listener) ? "" :
-                  ", listener='" + listener + "'"));
-                  
-         bulkRegister();
-      
-         if (dynamicSubscriptions == true)
-         {
-            // Subscribe to MBeanServerDelegate MBean for registrations
-            getServer().addNotificationListener(
-               new ObjectName(ServerConstants.MBEAN_SERVER_DELEGATE),
-               this.getServiceName(),
-               this.myFilter,
-               this.myHandback
-            );
-            
-            log.debug("Subscribed to MBeanServerDelegate, too");
-         }
-         
-         subscribed = true;
-      }
-      else
-         log.debug("Subscription list not provided");
-   }
-
-   /**
-    * Unsubscribes for JMX notifications
-   **/
-   public void unsubscribe()
-   {
-      // return if not subscribed
-      if (!subscribed)
-         return;
-      
-      log.debug("Removing all JMX notification subscriptions");
-      bulkUnregister();
-      
-      if (this.dynamicSubscriptions == true)
-      {
-         // Unbscribe from MBeanServerDelegate MBean for registrations
-         try {
-            getServer().removeNotificationListener(
-               new ObjectName(ServerConstants.MBEAN_SERVER_DELEGATE),
-               this.getServiceName(),
-               this.myFilter,
-               this.myHandback
-            );             
-         
-            log.debug("Unsubscribed from MBeanServerDelegate, too");
-         }
-         catch (MalformedObjectNameException e) 
-         {
-            // shouldn't happen!
-            log.warn("Could not convert '" + ServerConstants.MBEAN_SERVER_DELEGATE
-                   + "' to ObjectName", e);
-         }
-         catch (InstanceNotFoundException e) 
-         {
-            // shouldn't happen
-            log.warn("Could not unsubscribe from non-existent MBeanServerDelegate!", e);
-         }
-         catch (ListenerNotFoundException e) 
-         {
-            // shouldn't happend
-            log.warn("Could not unsubscribe from MBeanServerDelegate", e);
-         }
-      }
-      // indicate we've unsubscribed
-      this.subscribed = false;
-   }
-   
-   // NotificationListener -----------------------------------------
-    
-   /**
-    * DO NOT OVERRIDE THIS!
-    *
-    * Handles dynamic subscriptions before delegating to
-    * handleNotification2()
-   **/
-   public void handleNotification(Notification notification, Object handback)
-   {
-      // check if the notification is for me!
-      if (this.dynamicSubscriptions == true && handback == this.myHandback) 
-      {
-         if (log.isTraceEnabled())
-            log.trace("It's for me: " + notification + ", handback:" + handback);
-         
-         String type = notification.getType();
-         ObjectName target = null;
-         try {
-            target = ((MBeanServerNotification)notification).getMBeanName();
-         }
-         catch (ClassCastException e) {
-            log.warn("MBeanServer sent unknown notification class type: " +
-                     notification.getClass().getName());
-            return;
-         }
-               
-         if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) 
-         {
-            // iterate over the subscription specification
-            Iterator i = this.sublist.iterator();
-      
-            while (i.hasNext()) 
-            {
-               SubscriptionInfo mbeanInfo = (SubscriptionInfo)i.next();
-         
-               ObjectName objectName = mbeanInfo.getObjectName();
-                  
-               try 
-               {
-                  if(objectName.apply(target)) 
-                  {
-                     log.debug("ObjectName: '" + target + "' matched '" + objectName + "'");
-                     
-                     // go for it!
-                     singleRegister(
-                        this.getServer(),
-                        target,
-                        this.listener,
-                        mbeanInfo.getFilter(),
-                        mbeanInfo.getHandback()
-                     );
-                  }
-               }
-               catch (Exception e) 
-               {
-                  // catch exceptions from apply()
-                  // shouldn't happen
-                  log.warn("Caught exception from ObjectName.apply("
-                         + target + ")", e);
-               }
-            }
-         }
-         else 
-         {
-            log.warn("Got unknown notification type from MBeanServerDelegate: "
-                   + type);
-         }
-      }
-      else // delegate to subclass
-         handleNotification2(notification, handback);
-   }
-
-   /**
-    * Override to add notification handling!
-   **/
-   public void handleNotification2(Notification notification, Object handback)
-   {
-      // empty!
-   }
-   
-   // Private Methods -----------------------------------------------
-
-   /**
-    * Initialises myself
-   **/
-   private void init()
-   {
-      // just pickup a unique object
-      this.myHandback = new Integer(Integer.MAX_VALUE);
-      
-      // allow only registration events
-      this.myFilter = new NotificationFilterSupport();
-      this.myFilter.enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
-   }
-
-   /**
-    * Subscribes for notifications to a single MBean
-   **/
-   private void singleRegister(
-      MBeanServer server, ObjectName target, ObjectName listener,
-      NotificationFilter filter, Object handback)
-   {
-      try
-      {
-         server.addNotificationListener(target, listener, filter, handback);
-               
-         logSubscription(target, listener, handback, filter);
-      }
-      catch (InstanceNotFoundException e) 
-      {
-         // ignore - mbean might not be registered
-         log.debug("Could not subscribe to: '" + target
-                    + "', target or listener MBean not registered");
-      }
-      catch (RuntimeException e) 
-      {
-         log.warn("Failed to subscribe to: '" + target 
-                + "', maybe not a notification broadcaster or: '" + listener
-                + "', maybe not a notification listener");
-      }      
-   }
-
-   /**
-    * Unsubscribes for notifications from a single MBean 
-   **/
-   private void singleUnregister(
-      MBeanServer server, ObjectName target, ObjectName listener,
-      NotificationFilter filter, Object handback)
-   {
-      try
-      {
-         // remove the matching subscription
-         server.removeNotificationListener(target, listener, filter, handback);
-         
-         log.debug("Unsubscribed from: '" + target + "'");
-      }
-      catch (InstanceNotFoundException e) 
-      {
-         // ignore - target mbean not present
-         log.debug("Could not unsubscribe from non-existent: '"
-                    + target + "'");
-      }
-      catch (ListenerNotFoundException e) 
-      {
-         // May happen if target is not a notification broadcaster
-         // and so we hadn't registered in the first place
-         log.debug("Could not unsubscribe from: '" + target + "'");
-      }
-      catch (RuntimeException e) 
-      {
-         // whatever
-         log.debug("Could not unsubscribe from: '" + target + "'");
-      }          
-   }
-   
-   /**
-    * Performs the notification subscriptions
-   **/
-   private void bulkRegister()
-   {
-      // iterate over the subscription specification
-      Iterator i = this.sublist.iterator();
-      
-      // find out my server
-      MBeanServer server = this.getServer();
-      
-      while (i.hasNext()) 
-      {
-         SubscriptionInfo mbeanInfo = (SubscriptionInfo)i.next();
-         
-         ObjectName objectName = mbeanInfo.getObjectName();
-         Object handback = mbeanInfo.getHandback();
-         NotificationFilter filter = mbeanInfo.getFilter();
-         
-         if (objectName.isPattern()) 
-         {
-            Set mset = server.queryNames(objectName, null);
-            
-            log.debug("ObjectName: '" + objectName + "' matched " + mset.size() + " MBean(s)");
-               
-            Iterator j = mset.iterator();
-            while (j.hasNext())
-               singleRegister(server, (ObjectName)j.next(), this.listener,
-                              filter, handback);
-         }
-         else
-            singleRegister(server, objectName, this.listener, filter, handback);
-      }
-   }
-   
-   /**
-    * Performs bulk unregistration
-   **/
-   private void bulkUnregister()
-   {
-      // iterate over the subscription specification
-      Iterator i = this.sublist.iterator();
-      
-      // find out my server
-      MBeanServer server = this.getServer();
-      
-      while (i.hasNext()) 
-      {
-         SubscriptionInfo mbeanInfo = (SubscriptionInfo)i.next();
-         
-         ObjectName objectName = mbeanInfo.getObjectName();
-         Object handback = mbeanInfo.getHandback();
-         NotificationFilter filter = mbeanInfo.getFilter();
-         
-         if (objectName.isPattern()) 
-         {
-            Set mset = server.queryNames(objectName, null);
-            
-            log.debug("ObjectName: '" + objectName + "' matched " + mset.size() + " MBean(s)");
-               
-            Iterator j = mset.iterator();
-            while (j.hasNext())
-               singleUnregister(server, (ObjectName)j.next(), this.listener,
-                                filter, handback);
-         }
-         else
-            singleUnregister(server, objectName, this.listener, filter, handback);
-      }      
-   }
-   
-   /**
-    * Logs subscription info
-   **/
-   private void logSubscription(
-      ObjectName objectName, ObjectName listener,
-      Object handback, NotificationFilter filter)
-   {
-      StringBuffer sbuf = new StringBuffer(100);
-         
-      sbuf.append("Subscribed to: { objectName='").append(objectName);
-      sbuf.append("', listener='").append(listener);
-      sbuf.append("', handback=").append(handback);
-      sbuf.append(", filter=");
-      sbuf.append(filter == null ? null : filter.toString());
-      sbuf.append(" }");
-         
-      log.debug(sbuf.toString());
-   }
-   
-   /**
-    * Encapsulte the factory and filter creation logic
-    */
-   private NotificationFilter createNotificationFilter(String factoryClass, Element filterConfig)
-      throws Exception
-   {
-      NotificationFilterFactory factory;
-      try
-      {
-         // try to load the factory Class
-         Class clazz = Thread.currentThread().getContextClassLoader().loadClass(factoryClass);
-         factory = (NotificationFilterFactory)clazz.newInstance();
-      }
-      catch (Exception e) // ClassNotFoundException, IllegalAccessException, InstantiationException
-      {
-         // factory class not found. Make a second try using
-         // the 'org.jboss.system.filterfactory.' package prefix
-         // for the "standard" filter factories provided with jboss.
-         // If that fails, too, rethrow the original exception.
-         try
-         {
-            factoryClass = "org.jboss.system.filterfactory." + factoryClass;
-            Class clazz = Thread.currentThread().getContextClassLoader().loadClass(factoryClass);
-            factory = (NotificationFilterFactory)clazz.newInstance();
-         }
-         catch (Exception inner)
-         {
-            throw e;
-         }
-      }
-      // delegate the filter creation/configuration to the factory
-      return factory.createNotificationFilter(filterConfig);
-   }
-   
-   /**
-    * Parses the XML subscription specification
-   **/
-   private ArrayList parseXMLSubscriptionSpec(Element root)
-       throws Exception
-   {
-      ArrayList slist = new ArrayList();
-      
-      // parse level 0 - subscription-list
-      if (!root.getNodeName().equals(SL_ROOT_ELEMENT))
-      {
-         throw new Exception("Expected '" + SL_ROOT_ELEMENT + "' element, "
-                    + "got: " + "'" + root.getNodeName() + "'");
-      }
-      else
-      {
-         NodeList rootlist = root.getChildNodes();
-            
-         for (int i = 0; i < rootlist.getLength(); i++) 
-         {
-            // Parse level 1 - look for mbeans
-            Node mbean = rootlist.item(i);
-                
-            if (mbean.getNodeName().equals(SL_MBEAN_ELEMENT)) 
-            {
-               // mbean found look for name & handback attrs
-               String name = null;
-               
-               if (((Element)mbean).hasAttribute(SL_MBEAN_NAME_ATTRIBUTE))
-               {
-                  name = ((Element)mbean).getAttribute(SL_MBEAN_NAME_ATTRIBUTE);
-               }
-               else
-               {
-                  throw new Exception("'" + SL_MBEAN_ELEMENT + "' element must have a '" 
-                                    + SL_MBEAN_NAME_ATTRIBUTE + "' attribute");
-               }
-
-               String handback = null;
-               if (((Element)mbean).hasAttribute(SL_MBEAN_HANDBACK_ATTRIBUTE))
-               {
-                  handback = ((Element)mbean).getAttribute(SL_MBEAN_HANDBACK_ATTRIBUTE);
-               }
-               
-               // try to convert name to the correct data type
-               // may throw MalformedObjectNameException
-               ObjectName objectName = new ObjectName(name);
-               
-               // Parse level 2 - see if we have a filter for this subscription
-               NotificationFilter filter = null;
-               
-               NodeList mbeanChildren = mbean.getChildNodes();
-
-               // check for filter spec, as a single mbean child node               
-               for (int j = 0; j < mbeanChildren.getLength(); j++)
-               {
-                  Node mbeanChildNode = mbeanChildren.item(j);
-                  
-                  // check if this is a 'filter' node
-                  if (mbeanChildNode.getNodeName().equals(SL_FILTER_ELEMENT))
-                  {
-                     // look for the 'factory' attribute
-                     String factory = null;
-                     if (((Element)mbeanChildNode).hasAttribute(SL_FILTER_FACTORY_ATTRIBUTE))
-                     {
-                        factory = ((Element)mbeanChildNode).getAttribute(SL_FILTER_FACTORY_ATTRIBUTE);
-                        
-                        // instantiate the factory and request the filter
-                        filter = createNotificationFilter(factory, (Element)mbeanChildNode);
-                        break;
-                     }
-                     else
-                     {
-                        throw new Exception("'" + SL_FILTER_ELEMENT + "' element must have a '"
-                              + SL_FILTER_FACTORY_ATTRIBUTE + "' attribute");
-                     }
-                  }
-               }
-               
-               if (filter == null)
-               {
-                  // if no filter has been set check for old-style
-                  // <notification type="..."/> construct that results
-                  // in a fixed NotificationFilterSupport filter
-
-                  // need to find out all notification types (if any)
-                  // in order to create the Notification filter
-                  ArrayList tmplist = new ArrayList(mbeanChildren.getLength());
-               
-                  for (int j = 0; j < mbeanChildren.getLength(); j++) 
-                  {
-                     Node mbeanChildNode = mbeanChildren.item(j);
-                  
-                     // check if this is a 'notification' element
-                     if (mbeanChildNode.getNodeName().equals(SL_NOTIFICATION_ELEMENT)) 
-                     {
-                        // look for 'type' attribute
-                        String type = null;
-                        if (((Element)mbeanChildNode).hasAttribute(SL_NOTIFICATION_TYPE_ATTRIBUTE)) 
-                        {
-                           type = ((Element)mbeanChildNode).getAttribute(SL_NOTIFICATION_TYPE_ATTRIBUTE);
-                           tmplist.add(type);
-                        }
-                        else
-                        {
-                           throw new Exception("'" + SL_NOTIFICATION_ELEMENT + "' element must have a '"
-                                 + SL_NOTIFICATION_TYPE_ATTRIBUTE + "' attribute");
-                        }
-                     }
-                  }
-                  // create the filter (if needed)
-                  if (tmplist.size() > 0) 
-                  {
-                     NotificationFilterSupport sfilter = new NotificationFilterSupport();
-                     for (int j = 0; j < tmplist.size(); j++)
-                     {
-                        sfilter.enableType((String)tmplist.get(j));
-                     }
-                     filter = sfilter;
-                  }                  
-               }
-               slist.add(new SubscriptionInfo(objectName, handback, filter));
-            }
-         }
-      }
-      return slist;
-   }
-    
-   // Inner Class ---------------------------------------------------
-   
-   /**
-    * Inner data holder class to store the parsed subscription specification.
-   **/
-   public static final class SubscriptionInfo
-   {
-      // Private Data -----------------------------------------------
-      
-      /** MBean notification broadcaster or pattern */
-      private ObjectName objectName;
-      
-      /** Optional handback object to identify a subscription */
-      private Object handback;
-      
-      /** Arbitrary NotificationFilter */
-      private NotificationFilter filter;
-      
-      // Constructor ------------------------------------------------
-      
-      /**
-       * Simple CTOR
-      **/
-      public SubscriptionInfo(ObjectName objectName, Object handback, NotificationFilter filter)
-      {
-         this.objectName = objectName;
-         this.handback = handback;
-         this.filter = filter;
-      }
-      
-      // Accessors --------------------------------------------------
-      /**
-       * Gets objectname
-      **/
-      public ObjectName getObjectName()
-      {
-         return this.objectName;
-      }
-      
-      /**
-       * Gets handback object
-      **/
-      public Object getHandback()
-      {
-         return this.handback;
-      }
-      
-      /**
-       * Gets notification filter
-      **/
-      public NotificationFilter getFilter()
-      {
-         return this.filter;
-      }
-      
-      /**
-       * Pretty prints
-      **/
-      public String toString()
-      {
-         StringBuffer sbuf = new StringBuffer(100);
-            
-         sbuf.append("SubscriptionInfo { objectName='").append(this.objectName);
-         sbuf.append("', handback=").append(this.handback);
-         sbuf.append(", filter=");
-         sbuf.append(this.filter == null ? null : this.filter.toString());
-         
-         sbuf.append(" }");
-         
-         return sbuf.toString();
-      }
-   }
-}    

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/MissingAttributeException.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/MissingAttributeException.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/MissingAttributeException.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-/**
- * Thrown to indicate that a required attribute has not been set.
- *
- * @author  <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version <tt>$Revision$</tt>
- */
-public class MissingAttributeException
-   extends ConfigurationException
-{
-   /**
-    * Construct a <tt>MissingAttributeException</tt> with the specified detail 
-    * message.
-    *
-    * @param name    The attribute name.
-    */
-   public MissingAttributeException(final String name) {
-      super(makeMessage(name));
-   }
-
-   /**
-    * Construct a <tt>MissingAttributeException</tt> with the specified detail 
-    * message and nested <tt>Throwable</tt>.
-    *
-    * @param name    The attribute name.
-    * @param nested  Nested <tt>Throwable</tt>.
-    */
-   public MissingAttributeException(final String name, final Throwable nested) {
-      super(makeMessage(name), nested);
-   }
-
-   /**
-    * Make a execption message for the attribute name.
-    */
-   private static String makeMessage(final String name) {
-      return "Missing attribute '" + name + "'";
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/NotificationFilterFactory.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/NotificationFilterFactory.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/NotificationFilterFactory.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.NotificationFilter;
-
-import org.w3c.dom.Element;
-
-/**
- * Abstracts NotificationFilter creation based on an arbritrary
- * xml element fragment. Used by ListenerServiceMBeanSupport
- * to enable NotificationFilterFactory plugins.
- * 
- * @see ListenerServiceMBeanSupport
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public interface NotificationFilterFactory
-{
-   /**
-    * Create a notification filter implementation and initialize
-    * it, using the passed xml element fragment.
-    * 
-    * @param filterConfig the xml fragment to use for configuring the filter
-    * @return an initialized NotificationFilter
-    * @throws Exception in case the xml fragment cannot be parsed properly
-    */
-   public NotificationFilter createNotificationFilter(Element filterConfig)
-      throws Exception;
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/SecurityActions.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/SecurityActions.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/SecurityActions.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * SecurityActions.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-class SecurityActions
-{
-   
-   private static ClassLoader setContextClassLoaderInternal(final ClassLoader classLoader)
-   {
-      ClassLoader result = Thread.currentThread().getContextClassLoader();
-      if (classLoader != null)
-         Thread.currentThread().setContextClassLoader(classLoader);
-      return result;
-   }
-   
-   static ClassLoader setContextClassLoader(final ClassLoader classLoader)
-   {
-      if (System.getSecurityManager() == null)
-      {
-         return setContextClassLoaderInternal(classLoader);
-      }
-      else
-      {
-         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
-         {
-             public ClassLoader run()
-             {
-                return setContextClassLoaderInternal(classLoader);
-             }
-         });
-      }
-   }
-
-   static void resetContextClassLoader(final ClassLoader classLoader)
-   {
-      if (System.getSecurityManager() == null)
-      {
-         Thread.currentThread().setContextClassLoader(classLoader);
-      }
-      else
-      {
-         AccessController.doPrivileged(new PrivilegedAction<Object>()
-         {
-             public Object run()
-             {
-                Thread.currentThread().setContextClassLoader(classLoader);
-                return null;
-             }
-         });
-      }
-   }
-
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceBinding.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceBinding.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceBinding.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.ObjectName;
-
-/**
- * A policy used by ServiceController to allow the override
- * of MBean attribute values at configuration time.
- *
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public interface ServiceBinding
-{
-   /**
-    * Possibly override the configuration of a service.
-    * 
-    * @param serviceName the JMX ObjectName of the service
-    * @exception Exception thrown on failure to override a configuration
-    */
-   void applyServiceConfig(ObjectName serviceName) throws Exception;
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceConfigurator.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceConfigurator.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceConfigurator.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,448 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.system.metadata.ServiceAttributeMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceMetaDataParser;
-import org.jboss.system.metadata.ServiceValueContext;
-import org.jboss.util.xml.DOMWriter;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Service configuration helper.
- * 
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class ServiceConfigurator
-{
-   /** The MBean server which this service is registered in. */
-   private final MBeanServer server;
-   
-   /** The parent service controller */
-   private final ServiceController serviceController;
-   
-   /** The ServiceCreator */
-   private final ServiceCreator serviceCreator;
-
-   /** Instance logger. */
-   private static final Logger log = Logger.getLogger(ServiceConfigurator.class);
-
-   /**
-    * Rethrow an error as an exception
-    * 
-    * @param context the context
-    * @param t the original throwable
-    * @return never
-    * @throws Exception always
-    */
-   public static Exception rethrow(String context, Throwable t) throws Exception
-   {
-      if (t instanceof Error)
-         throw (Error) t;
-      else if (t instanceof Exception)
-         throw (Exception) t;
-      throw new RuntimeException(context, t);
-   }
-
-   /**
-    * Configure an MBean
-    * 
-    * @param server the server
-    * @param controller the service controller
-    * @param objectName the object name
-    * @param classLoaderName the classloader object name
-    * @param attrs the attributes
-    * @throws Exception for any error
-    */
-   public static void configure(MBeanServer server, ServiceController controller, ObjectName objectName, ObjectName classLoaderName, Collection<ServiceAttributeMetaData> attrs) throws Exception
-   {
-      server = checkMBeanServer(server, controller);
-      ClassLoader cl = server.getClassLoader(classLoaderName);
-      configure(server, controller, objectName, cl, attrs);
-   }
-   
-   /**
-    * Configure an MBean
-    * 
-    * @param server the server
-    * @param controller the service controller
-    * @param objectName the object name
-    * @param cl the classloader
-    * @param attrs the attributes
-    * @throws Exception for any error
-    */
-   public static void configure(MBeanServer server, ServiceController controller, ObjectName objectName, ClassLoader cl, Collection<ServiceAttributeMetaData> attrs) throws Exception
-   {
-      ServiceValueContext valueContext = new ServiceValueContext(server, controller, cl);
-      server = checkMBeanServer(server, controller);
-      
-      HashMap<String, MBeanAttributeInfo> attributeMap = getAttributeMap(server, objectName);
-
-      for (ServiceAttributeMetaData attribute : attrs)
-      {
-         String attributeName = attribute.getName();
-         if (attributeName == null || attributeName.length() == 0)
-            throw new RuntimeException("No or empty attribute name for " + objectName);
-         MBeanAttributeInfo attributeInfo = attributeMap.get(attributeName);
-         if (attributeInfo == null)
-         {
-            throw new RuntimeException("No Attribute found with name: " + attributeName + " for " + objectName
-                  +", attributes: "+attributeMap.keySet());
-         }
-
-         valueContext.setAttributeInfo(attributeInfo);
-         Object value = null;
-         ClassLoader previous = SecurityActions.setContextClassLoader(cl);
-         try
-         {
-            value = attribute.getValue(valueContext);
-         }
-         finally
-         {
-            SecurityActions.resetContextClassLoader(previous);
-         }
-         try
-         {
-            if (log.isDebugEnabled())
-            {
-               Object outputValue = value;
-               if (attributeName.toLowerCase().indexOf("password") != -1)
-                  outputValue = "****";
-               log.debug(attributeName + " set to " + outputValue + " in " + objectName);
-            }
-            server.setAttribute(objectName, new Attribute(attributeName, value));
-         }
-         catch (Throwable t)
-         {
-            throw new RuntimeException("Exception setting attribute " + attributeName + " on mbean " + objectName, JMXExceptionDecoder.decode(t));
-         }
-      }
-   }
-
-   /**
-    * Check the server/controller parameters
-    * 
-    * @param server the server
-    * @param controller the controller
-    * @return the server
-    */
-   private static MBeanServer checkMBeanServer(MBeanServer server, ServiceController controller)
-   {
-      if (server != null)
-         return server;
-      
-      if (controller != null)
-         return controller.getMBeanServer();
-      
-      throw new IllegalArgumentException("Either the server or controller must be passed");
-   }
-
-   /**
-    * Get an attribute map for the MBean
-    * 
-    * @param server the server
-    * @param objectName the object name
-    * @return a map of attribute name to attribute info
-    * @throws Exception for any error
-    */
-   public static HashMap<String, MBeanAttributeInfo> getAttributeMap(MBeanServer server, ObjectName objectName) throws Exception
-   {
-      MBeanInfo info;
-      try
-      {
-         info = server.getMBeanInfo(objectName);
-      }
-      catch (InstanceNotFoundException e)
-      {
-         // The MBean is no longer available
-         throw new RuntimeException("Trying to configure nonexistent mbean: " + objectName);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Could not get mbeanInfo", JMXExceptionDecoder.decode(e));
-      }
-      if (info == null)
-         throw new RuntimeException("MBeanInfo is null for mbean: " + objectName);
-      MBeanAttributeInfo[] attributes = info.getAttributes();
-      HashMap<String, MBeanAttributeInfo> attributeMap = new HashMap<String, MBeanAttributeInfo>();
-      for (int i = 0; i < attributes.length; i++)
-      {
-         MBeanAttributeInfo attr = attributes[i];
-         attributeMap.put(attr.getName(), attr);
-      }
-      
-      return attributeMap;
-   }
-   
-   /**
-    * Constructor
-    * 
-    * @deprecated the service controller no longer uses the service configurator and vice-versa
-    * @param server the mbean server
-    * @param serviceController the servie controller
-    * @param serviceCreator the service creator
-    */
-   public ServiceConfigurator(MBeanServer server, ServiceController serviceController, ServiceCreator serviceCreator)
-   {
-      if (server == null)
-         throw new IllegalArgumentException("Null server");
-      if (serviceCreator == null)
-         throw new IllegalArgumentException("Null serverCreator");
-      
-      this.server = server;
-      this.serviceController = serviceController;
-      this.serviceCreator = serviceCreator;
-   }
-   
-   /**
-    * The <code>install</code> method iterates through the mbean tags in the
-    * supplied xml configuration and creates and configures the mbeans shown.
-    * The mbean configuration can be nested.
-    * 
-    * @deprecated the service controller no longer uses the service configurator and vice-versa
-    * @param config the xml <code>Element</code> containing the configuration of
-    * the mbeans to create and configure.
-    * @param loaderName the classloader's ObjectName
-    * @return a <code>List</code> of ObjectNames of created mbeans.
-    * @throws Exception if an error occurs
-    */
-   public List<ObjectName> install(Element config, ObjectName loaderName) throws Exception
-   {
-      // Parse the xml
-      ServiceMetaDataParser parser = new ServiceMetaDataParser(config);
-      List<ServiceMetaData> metaDatas = parser.parse();
-
-      // Track the registered object names
-      List<ObjectName> result = new ArrayList<ObjectName>(metaDatas.size());
-
-      // Go through each mbean in the passed xml
-      for (ServiceMetaData metaData : metaDatas)
-      {
-         ObjectName objectName = metaData.getObjectName();
-         Collection<ServiceAttributeMetaData> attrs = metaData.getAttributes();
-         // Install and configure the mbean
-         try
-         {
-            ServiceCreator.install(server, objectName, metaData, null);
-            result.add(objectName);
-            configure(server, null, objectName, loaderName, attrs);
-         }
-         catch (Throwable t)
-         {
-            // Something went wrong
-            for (ObjectName name : result)
-            {
-               try
-               {
-                  serviceCreator.remove(name);
-               }
-               catch (Exception e)
-               {
-                  log.error("Error removing mbean after failed deployment: " + name, e);
-               }
-            }
-            throw rethrow("Error during install", t);
-         }
-      }
-      return result;
-   }
-
-   /**
-    * Builds a string that consists of the configuration elements of the
-    * currently running MBeans registered in the server.
-    * 
-    * @todo replace with more sophisticated mbean persistence mechanism.
-    * @param server the MBeanServer
-    * @param serviceController the service controller
-    * @param objectNames the object names to retrieve
-    * @return the xml string
-    * @throws Exception Failed to construct configuration.
-    */
-   public static String getConfiguration(MBeanServer server, ServiceController serviceController, ObjectName[] objectNames) throws Exception
-   {
-      Writer out = new StringWriter();
-
-      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-      DocumentBuilder builder = factory.newDocumentBuilder();
-      Document doc = builder.newDocument();
-
-      Element serverElement = doc.createElement("server");
-
-      // Store attributes as XML
-      for (int j = 0; j < objectNames.length; j++)
-      {
-         Element mbeanElement = internalGetConfiguration(doc, server, serviceController, objectNames[j]);
-         serverElement.appendChild(mbeanElement);
-      }
-
-      doc.appendChild(serverElement);
-
-      // Write configuration
-      new DOMWriter(out).setPrettyprint(true).print(doc);
-
-      out.close();
-
-      // Return configuration
-      return out.toString();
-   }
-
-   private static Element internalGetConfiguration(Document doc, MBeanServer server, ServiceController serviceController, ObjectName name) throws Exception
-   {
-      Element mbeanElement = doc.createElement("mbean");
-      mbeanElement.setAttribute("name", name.toString());
-
-      MBeanInfo info = server.getMBeanInfo(name);
-      mbeanElement.setAttribute("code", info.getClassName());
-      MBeanAttributeInfo[] attributes = info.getAttributes();
-      boolean trace = log.isTraceEnabled();
-      for (int i = 0; i < attributes.length; i++)
-      {
-         if (trace)
-            log.trace("considering attribute: " + attributes[i]);
-         if (attributes[i].isReadable() && attributes[i].isWritable())
-         {
-            Element attributeElement = null;
-            if (attributes[i].getType().equals("javax.management.ObjectName"))
-            {
-               attributeElement = doc.createElement("depends");
-               attributeElement.setAttribute("optional-attribute-name", attributes[i].getName());
-            }
-            else
-            {
-               attributeElement = doc.createElement("attribute");
-               attributeElement.setAttribute("name", attributes[i].getName());
-            }
-            Object value = server.getAttribute(name, attributes[i].getName());
-
-            if (value != null)
-            {
-               if (value instanceof Element)
-               {
-                  attributeElement.appendChild(doc.importNode((Element) value, true));
-               }
-               else
-               {
-                  attributeElement.appendChild(doc.createTextNode(value.toString()));
-               }
-            }
-            mbeanElement.appendChild(attributeElement);
-         }
-      }
-
-      ServiceContext sc = serviceController.getServiceContext(name);
-      for (ServiceContext needs : sc.iDependOn)
-      {
-         Element dependsElement = doc.createElement("depends");
-         dependsElement.appendChild(doc.createTextNode(needs.objectName.toString()));
-         mbeanElement.appendChild(dependsElement);
-      }
-
-      return mbeanElement;
-   }
-
-   /**
-    * Builds a string that consists of the configuration elements of the
-    * currently running MBeans registered in the server.
-    * 
-    * TODO replace with more sophisticated mbean persistence mechanism.
-    * @param objectNames the object names
-    * @return the xml string
-    * @throws Exception Failed to construct configuration.
-    */
-   public String getConfiguration(ObjectName[] objectNames) throws Exception
-   {
-      return getConfiguration(server, serviceController, objectNames);
-   }
-
-   /**
-    * A utility method that transforms the contents of the argument element into
-    * a StringBuffer representation that can be reparsed.
-    * 
-    * [FIXME] This is not a general DOMUtils method because of its funny contract. It does not 
-    * support multiple child elements neither can it deal with text content.
-    * 
-    * @param element - the parent dom element whose contents are to be extracted as an xml document string. 
-    * @return the xml document string.
-    * @throws IOException for an error during IO
-    * @throws TransformerException for an erro during transformation
-    */
-   public static StringBuffer getElementContent(Element element) throws IOException, TransformerException
-   {
-      NodeList children = element.getChildNodes();
-      Element content = null;
-      for (int n = 0; n < children.getLength(); n++)
-      {
-         Node node = children.item(n);
-         if (node.getNodeType() == Node.ELEMENT_NODE)
-         {
-            content = (Element)node;
-            break;
-         }
-      }
-      if (content == null)
-         return null;
-
-      // Get a parsable representation of this elements content
-      DOMSource source = new DOMSource(content);
-      TransformerFactory tFactory = TransformerFactory.newInstance();
-      Transformer transformer = tFactory.newTransformer();
-      StringWriter sw = new StringWriter();
-      StreamResult result = new StreamResult(sw);
-      transformer.transform(source, result);
-      sw.close();
-      return sw.getBuffer();
-   }
-}
\ No newline at end of file

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceContext.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceContext.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceContext.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.management.ObjectName;
-
-/**
- * ServiceContext holds information for the Service
- *
- * @see Service
- * @see ServiceMBeanSupport
- * 
- * @author <a href="mailto:marc.fleury at jboss.org">marc fleury</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ServiceContext implements Serializable
-{
-   /** @since 4.0.2 */
-   private static final long serialVersionUID = 7461263042948325633L;
-
-   /** The possible string-fied states */
-   private static final String[] stateNames = {
-         "INSTALLED",
-         "CONFIGURED",
-         "CREATED",
-         "RUNNING",
-         "FAILED",
-         "STOPPED",
-         "DESTROYED",
-         "NOTYETINSTALLED"
-      };
-   
-   /** Valid service states */
-   public static final int INSTALLED = 0;
-   public static final int CONFIGURED = 1;
-   public static final int CREATED = 2;
-   public static final int RUNNING = 3;
-   public static final int FAILED = 4;
-   public static final int STOPPED = 5;
-   public static final int DESTROYED = 6;
-   public static final int NOTYETINSTALLED = 7;
-   
-   /** The name of the service **/
-   public ObjectName objectName;
-   
-   /** State of the service **/
-   public int state = NOTYETINSTALLED;
-   
-   /** Dependent beans **/
-   public List<ServiceContext> iDependOn = new LinkedList<ServiceContext>();
-   
-   /** Beans that depend on me **/
-   public List<ServiceContext> dependsOnMe = new LinkedList<ServiceContext>();
-   
-   /** The fancy proxy to my service calls **/
-   public transient Service proxy;
-
-   /** Cause for failure */
-   public Throwable problem;
-   
-   public String getStateString()
-   {
-      return getStateString(state);
-   }
-   
-   public static String getStateString(int stateInt)
-   {
-      return stateNames[stateInt];
-   }
-
-   public Throwable getProblem()
-   {
-      return problem;
-   }
-
-   public void setProblem(Throwable problem)
-   {
-      this.problem = problem;
-   }
-
-   public String toString()
-   {
-      StringBuffer sbuf = new StringBuffer(512);
-      
-      sbuf.append("ObjectName: ").append(objectName);
-      sbuf.append("\n  State: ").append(stateNames[state]);
-
-      if (state == FAILED && problem != null) 
-      {
-         sbuf.append("\n  Reason: ").append(problem.toString());
-      }
-      printList(sbuf, "\n  I Depend On:", iDependOn);
-      printList(sbuf, "\n  Depends On Me:", dependsOnMe);
-
-      // this magically makes *all* jmx-console outputs look better :)
-      sbuf.append("\n");
-      
-      return sbuf.toString();
-   }
-
-   @SuppressWarnings("unchecked")
-   private void printList(StringBuffer sbuf, String msg, List ctxs)
-   {
-      if (ctxs.size() > 0)
-      {
-         // only out stuff, if there are indeed dependencies
-         sbuf.append(msg);
-         for (Iterator i = ctxs.iterator(); i.hasNext(); )
-         {
-            ServiceContext sc = (ServiceContext) i.next();
-            sbuf.append("\n    ");
-            sbuf.append(sc.objectName);
-         }
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceController.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceController.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceController.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,751 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.ObjectName;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.logging.Logger;
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceMetaDataParser;
-import org.jboss.system.microcontainer.LifecycleDependencyItem;
-import org.jboss.system.microcontainer.ServiceControllerContext;
-import org.w3c.dom.Element;
-
-/**
- * This is the main Service Controller. A controller can deploy a service to a
- * jboss.system It installs by delegating, it configures by delegating<p>
- *
- * This class has been rewritten to delegate to the microcontainer's
- * generic controller. Like the original ServiceController, all state
- * transitions must be handled manually, e.g. driven by the deployer
- * invoking create, start, stop, etc.
- * That is with one exception; we register ourselves an automatic context.
- *
- * @see org.jboss.system.Service
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ServiceController extends JBossNotificationBroadcasterSupport
-   implements ServiceControllerMBean, MBeanRegistration
-{
-   /** The ObjectName of the default loader repository */
-   public static final ObjectName DEFAULT_LOADER_REPOSITORY = ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
-
-   /** The operation name for lifecycle */
-   public static final String JBOSS_INTERNAL_LIFECYCLE = "jbossInternalLifecycle";
-
-   /** The signature for lifecycle operations */
-   public static final String[] JBOSS_INTERNAL_LIFECYCLE_SIG = new String[] { String.class.getName() };
-
-   /** Class logger. */
-   private static final Logger log = Logger.getLogger(ServiceController.class);
-
-   /** The kernel */
-   protected Kernel kernel;
-
-   /** A callback to the JMX MBeanServer */
-   protected MBeanServer server;
-
-   /** The contexts */
-   protected Map<ObjectName, ServiceControllerContext> installed = new ConcurrentHashMap<ObjectName, ServiceControllerContext>(); 
-   
-   /** The contexts in installation order */
-   protected CopyOnWriteArrayList<ServiceControllerContext> installedOrder = new CopyOnWriteArrayList<ServiceControllerContext>();
-
-   /**
-    * Rethrow an error as an exception
-    * 
-    * @param context the context
-    * @param t the original throwable
-    * @return never
-    * @throws Exception always
-    */
-   public static Exception rethrow(String context, Throwable t) throws Exception
-   {
-      if (t instanceof Error)
-         throw (Error) t;
-      else if (t instanceof Exception)
-         throw (Exception) t;
-      throw new RuntimeException(context, t);
-   }
-   
-   /**
-    * Get exception that will expose stacktrace.
-    *
-    * @return the stracktrace exposing exception
-    */
-   protected Throwable getStackTrace()
-   {
-      //noinspection ThrowableInstanceNeverThrown
-      return new Throwable("STACKTRACE");
-   }
-
-   /**
-    * Get the MBeanServer
-    * 
-    * @return the server
-    */
-   public MBeanServer getMBeanServer()
-   {
-      return server;
-   }
-
-   /**
-    * Set the server.
-    * 
-    * @param server the server.
-    */
-   public void setMBeanServer(MBeanServer server)
-   {
-      this.server = server;
-   }
-
-   /**
-    * Get the kernel.
-    * 
-    * @return the kernel.
-    */
-   public Kernel getKernel()
-   {
-      return kernel;
-   }
-
-   /**
-    * Set the kernel.
-    * 
-    * @param kernel the kernel.
-    */
-   public void setKernel(Kernel kernel)
-   {
-      this.kernel = kernel;
-   }
-   
-   public List<ServiceContext> listDeployed()
-   {
-      // Retrieve the service context from all our installed contexts
-      ArrayList<ServiceContext> result = new ArrayList<ServiceContext>(installedOrder.size());
-      for (ServiceControllerContext context : installedOrder)
-         result.add(context.getServiceContext());
-      return result;
-   }
-
-   public List<ServiceContext> listIncompletelyDeployed()
-   {
-      // Retrieve the service contexts that are not deployed properly
-      ArrayList<ServiceContext> result = new ArrayList<ServiceContext>();
-      for (ServiceControllerContext context : installedOrder)
-      {
-         ServiceContext sc = context.getServiceContext();
-         if (sc.state != ServiceContext.CREATED &&
-             sc.state != ServiceContext.RUNNING &&
-             sc.state != ServiceContext.STOPPED &&
-             sc.state != ServiceContext.DESTROYED)
-         {
-            result.add(sc);
-         }
-      }
-      return result;
-   }
-
-   public List<ObjectName> listDeployedNames()
-   {
-      // Get all the object names from our installed contexts
-      ArrayList<ObjectName> result = new ArrayList<ObjectName>(installed.size());
-      for (ObjectName name : installed.keySet())
-         result.add(name);
-      return result;
-   }
-
-   public String listConfiguration(ObjectName[] objectNames) throws Exception
-   {
-      return ServiceConfigurator.getConfiguration(server, this, objectNames);
-   }
-
-   public List<ObjectName> install(List<ServiceMetaData> metaDatas, ObjectName loaderName) throws Exception
-   {
-      KernelController controller = kernel.getController();
-
-      // Track the registered mbeans both for returning the result
-      // and uninstalling in the event of an error
-      List<ObjectName> result = new ArrayList<ObjectName>(metaDatas.size());
-      List<ServiceControllerContext> contexts = new ArrayList<ServiceControllerContext>(metaDatas.size());
-
-      // Go through each mbean in the passed xml
-      for (ServiceMetaData metaData : metaDatas)
-      {
-         metaData.setClassLoaderName(loaderName);
-
-         // Install the context to the configured level
-         ServiceControllerContext context = new ServiceControllerContext(this, metaData);
-         try
-         {
-            doInstall(controller, context);
-            contexts.add(context);
-            doChange(controller, context, ControllerState.CONFIGURED, "configure");
-            result.add(context.getObjectName());
-         }
-         catch (Throwable t)
-         {
-            // Something went wrong
-            for (ServiceControllerContext ctx : contexts)
-               safelyRemoveAnyRegisteredContext(ctx);
-
-            throw rethrow("Error during install", t);
-         }
-      }
-      return result;
-   }
-
-   public ObjectName install(ServiceMetaData metaData, ObjectName loaderName) throws Exception
-   {
-      KernelController controller = kernel.getController();
-      metaData.setClassLoaderName(loaderName);
-      ObjectName name = metaData.getObjectName();
-      
-      // Install the context to the configured level
-      ServiceControllerContext context = new ServiceControllerContext(this, metaData);
-      try
-      {
-         doInstall(controller, context);
-         doChange(controller, context, ControllerState.CONFIGURED, "configure");
-         return context.getObjectName();
-      }
-      catch (Throwable t)
-      {
-         throw rethrow("Error during install " + name, t);
-      }
-   }
-
-   public List<ObjectName> install(Element config, ObjectName loaderName) throws Exception
-   {
-      // Parse the xml
-      ServiceMetaDataParser parser = new ServiceMetaDataParser(config);
-      List<ServiceMetaData> metaDatas = parser.parse();
-      return install(metaDatas, loaderName);
-   }
-   
-   /**
-    * Install an MBean without any meta data
-    * 
-    * @param name the object name
-    * @param object the mbean object
-    * @throws Exception for any error
-    */
-   public void install(ObjectName name, Object object) throws Exception
-   {
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      if (object == null)
-         throw new IllegalArgumentException("Null object");
-
-      KernelController controller = kernel.getController();
-
-      ServiceControllerContext context = new ServiceControllerContext(this, name, object); 
-      try
-      {
-         doInstall(controller, context);
-         doChange(controller, context, ControllerState.CONFIGURED, "configure");
-      }
-      catch (Throwable t)
-      {
-         // Something went wrong
-         safelyRemoveAnyRegisteredContext(context);
-
-         throw rethrow("Error during install", t);
-      }
-   }
-   
-   public void register(ObjectName serviceName) throws Exception
-   {
-      register(serviceName, null);
-   }
-
-   public void register(ObjectName serviceName, Collection<ObjectName> depends)  throws Exception
-   {
-      register(serviceName, depends, true);
-   }
-
-   /**
-    * Register the mbean against the microkernel with dependencies.
-    *
-    * @param serviceName the object name
-    * @param depends the dependencies
-    * @param includeLifecycle the includes lifecycle flag
-    * @throws Exception for any error
-    */
-   public void register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLifecycle)  throws Exception
-   {
-      register(serviceName, depends, includeLifecycle, null);
-   }
-
-   /**
-    * Register the mbean against the microkernel with dependencies.
-    *
-    * @param serviceName the object name
-    * @param depends the dependencies
-    * @param includeLifecycle the includes lifecycle flag
-    * @param target the target
-    * @throws Exception for any error
-    */
-   public void register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLifecycle, Object target)  throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to register null service: ", getStackTrace());
-         return;
-      }
-      
-      log.debug("Registering service " + serviceName);
-
-      // This is an already registered mbean
-      KernelController controller = kernel.getController();
-      ServiceControllerContext context = new ServiceControllerContext(this, serviceName, includeLifecycle, target);
-      if (depends != null)
-         addDependencies(context, depends);
-
-      // Install the context to the configured level
-      try
-      {
-         doInstall(controller, context);
-         doChange(controller, context, ControllerState.CONFIGURED, "configure");
-      }
-      catch (Throwable t)
-      {
-         // Something went wrong
-         safelyRemoveAnyRegisteredContext(context);
-         
-         throw rethrow("Error during register: " + serviceName, t);
-      }
-   }
-   
-   public void create(ObjectName serviceName) throws Exception
-   {
-      create(serviceName, null);
-   }
-
-   public void create(ObjectName serviceName, Collection<ObjectName> depends) throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to create null service: ", getStackTrace());
-         return;
-      }
-      
-      log.debug("Creating service " + serviceName);
-      
-      // Register if not already done so
-      ServiceControllerContext context = installed.get(serviceName);
-      if (context == null)
-      {
-         register(serviceName, depends);
-         context = installed.get(serviceName);
-      }
-      ServiceContext ctx = context.getServiceContext();
-
-      // If we are already created (can happen in dependencies) or failed just return
-      if (ctx.state == ServiceContext.CREATED
-            || ctx.state == ServiceContext.RUNNING
-            || ctx.state == ServiceContext.FAILED)
-      {
-         log.debug("Ignoring create request for service: " + ctx.objectName + " at state " + ctx.getStateString());
-         return;
-      }
-
-      // Request the mbean go to the created state
-      KernelController controller = kernel.getController();
-      try
-      {
-         doChange(controller, context, ControllerState.CREATE, "create");
-      }
-      catch (Throwable t)
-      {
-         log.warn("Problem creating service " + serviceName, t);
-      }
-   }
-   
-   public void start(ObjectName serviceName) throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to start null service: ", getStackTrace());
-         return;
-      }
-
-      log.debug("starting service " + serviceName);
-      
-      // Register if not already done so
-      ServiceControllerContext context = installed.get(serviceName);
-      if (context == null)
-      {
-         register(serviceName, null);
-         context = installed.get(serviceName);
-      }
-      ServiceContext ctx = context.getServiceContext();
-
-      // If we are already started (can happen in dependencies) just return
-      if (ctx.state == ServiceContext.RUNNING || ctx.state == ServiceContext.FAILED)
-      {
-         log.debug("Ignoring start request for service: " + ctx.objectName + " at state " + ctx.getStateString());
-         return;
-      }
-
-      // Request the mbean go to the fully installed state
-      KernelController controller = kernel.getController();
-      try
-      {
-         doChange(controller, context, ControllerState.INSTALLED, "start");
-      }
-      catch (Throwable t)
-      {
-         log.warn("Problem starting service " + serviceName, t);
-      }
-   }
-
-   public void restart(ObjectName serviceName) throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to restart null service: ", getStackTrace());
-         return;
-      }
-
-      log.debug("restarting service " + serviceName);
-      stop(serviceName);
-      start(serviceName);
-   }
-
-   public void stop(ObjectName serviceName) throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to stop null service: ", getStackTrace());
-         return;
-      }
-
-      log.debug("stopping service: " + serviceName);
-
-      ServiceControllerContext context = installed.get(serviceName);
-      if (context == null)
-      {
-         log.warn("Ignoring request to stop nonexistent service: " + serviceName);
-         return;
-      }
-
-      // If we are already stopped (can happen in dependencies) just return
-      ServiceContext ctx = context.getServiceContext();
-      if (ctx.state != ServiceContext.RUNNING)
-      {
-         log.debug("Ignoring stop request for service: " + ctx.objectName + " at state " + ctx.getStateString());
-         return;
-      }
-
-      // Request the mbean go back to the created state
-      KernelController controller = kernel.getController();
-      try
-      {
-         doChange(controller, context, ControllerState.CREATE, null);
-      }
-      catch (Throwable t)
-      {
-         log.warn("Problem stopping service " + serviceName, t);
-      }
-   }
-
-   public void destroy(ObjectName serviceName) throws Exception
-   {
-      if (serviceName == null)
-      {
-         log.warn("Ignoring request to destroy null service: ", getStackTrace());
-         return;
-      }
-
-      log.debug("destroying service: " + serviceName);
-
-      ServiceControllerContext context = installed.get(serviceName);
-      if (context == null)
-      {
-         log.warn("Ignoring request to destroy nonexistent service: " + serviceName);
-         return;
-      }
-
-      // If we are already destroyed (can happen in dependencies) just return
-      ServiceContext ctx = context.getServiceContext();
-      if (ctx.state == ServiceContext.DESTROYED || ctx.state == ServiceContext.NOTYETINSTALLED || ctx.state == ServiceContext.FAILED)
-      {
-         log.debug("Ignoring destroy request for service: " + ctx.objectName + " at state " + ctx.getStateString());
-         return;
-      }
-
-      // Request the mbean go the configured state
-      KernelController controller = kernel.getController();
-      try
-      {
-         doChange(controller, context, ControllerState.CONFIGURED, null);
-      }
-      catch (Throwable t)
-      {
-         log.warn("Problem stopping service " + serviceName, t);
-      }
-   }
-
-   public void remove(ObjectName objectName) throws Exception
-   {
-      if (objectName == null)
-      {
-         log.warn("Ignoring request to remove null service: ", getStackTrace());
-         return;
-      }
-
-      // Removal can be attempted twice, this is because ServiceMBeanSupport does a "double check" 
-      // to make sure the ServiceController is tidied up
-      // However, if the tidyup is done correctly, it invokes this method recursively:
-      // ServiceController::remove -> MBeanServer::unregisterMBean
-      // ServiceMBeanSupport::postDeregister -> ServiceController::remove
-      ServiceControllerContext context = installed.remove(objectName);
-      if (context == null)
-      {
-         log.trace("Ignoring request to remove nonexistent service: " + objectName);
-         return;
-      }
-      installedOrder.remove(context);
-      log.debug("removing service: " + objectName);
-
-      // Uninstall the context
-      safelyRemoveAnyRegisteredContext(context);
-   }
-
-   public ServiceContext getServiceContext(ObjectName serviceName)
-   {
-      ServiceControllerContext context = installed.get(serviceName);
-      if (context != null)
-         return context.getServiceContext();
-      return null;
-   }
-   
-   public void shutdown()
-   {
-      log.debug("Stopping " + installedOrder.size() + " services");
-
-      KernelController controller = kernel.getController();
-      
-      int serviceCounter = 0;
-
-      // Uninstall all the contexts we know about
-      ListIterator<ServiceControllerContext> iterator = installedOrder.listIterator(installedOrder.size());
-      while (iterator.hasPrevious())
-      {
-         ServiceControllerContext context = iterator.previous();
-         controller.uninstall(context.getName());
-         ++serviceCounter;
-      }
-      log.debug("Stopped " + serviceCounter + " services");
-      
-      // Shutdown ourselves
-      controller.uninstall(ServiceControllerMBean.OBJECT_NAME.getCanonicalName());
-   }
-
-   public ObjectName preRegister(MBeanServer server, ObjectName name)
-         throws Exception
-   {
-      this.server = server;
-
-      if( kernel == null )
-      {
-         // Bootstrap the microcontainer. 
-         BasicBootstrap bootstrap = new BasicBootstrap();
-         bootstrap.run();
-         kernel = bootstrap.getKernel();
-      }
-
-      log.debug("Controller MBean online");
-      return name == null ? OBJECT_NAME : name;
-   }
-
-   public void postRegister(Boolean registrationDone)
-   {
-      if (registrationDone == false)
-         log.fatal("Registration of ServiceController failed");
-      else
-      {
-         // Register the ServiceController as a running service
-         KernelController controller = kernel.getController();
-         ServiceControllerContext context = new ServiceControllerContext(this, ServiceControllerMBean.OBJECT_NAME);
-         context.setMode(ControllerMode.AUTOMATIC);
-         try
-         {
-            controller.install(context);
-         }
-         catch (Throwable t)
-         {
-            log.fatal("Error registering service controller", t);
-         }
-      }
-   }
-
-   public void preDeregister()
-         throws Exception
-   {
-   }
-
-   public void postDeregister()
-   {
-      installed.clear();
-      installedOrder.clear();
-      server = null;
-   }
-   
-   /**
-    * Install a context
-    * 
-    * @param controller the controller
-    * @param context the context
-    * @throws Throwable for any error
-    */
-   private void doInstall(KernelController controller, ServiceControllerContext context) throws Throwable
-   {
-      controller.install(context);
-      installed.put(context.getObjectName(), context);
-      installedOrder.add(context);
-   }
-   
-   /**
-    * Change a context
-    * 
-    * @param controller the controller
-    * @param context the context
-    * @param requiredState the require state
-    * @param logWait log the waiting dependencies
-    * @throws Throwable for any error
-    */
-   private void doChange(KernelController controller, ServiceControllerContext context, ControllerState requiredState, String logWait) throws Throwable
-   {
-      if (ControllerMode.ON_DEMAND.equals(context.getMode()) == false)
-      {
-         controller.change(context, requiredState);
-         ControllerState state = context.getState();
-         if (logWait != null && requiredState.equals(state) == false && state != ControllerState.ERROR)
-            log.debug("Waiting in " + logWait + " of " + context.getObjectName() + " on " + getUnresolvedDependencies(context, requiredState));
-      }
-   }
-
-   /**
-    * Sends outs controller notifications about service lifecycle events
-    * 
-    * @param type the notification type
-    * @param serviceName the service name
-    */
-   public void sendControllerNotification(String type, ObjectName serviceName)
-   {
-      Notification notification = new Notification(type, this, super.nextNotificationSequenceNumber());
-      notification.setUserData(serviceName);
-      sendNotification(notification);
-   }
-
-   /**
-    * Add the passed lifecycle dependencies to the context
-    * 
-    * @param context the context
-    * @param depends the dependencies
-    */
-   private void addDependencies(ServiceControllerContext context, Collection<ObjectName> depends)
-   {
-      DependencyInfo info = context.getDependencyInfo();
-      for (ObjectName other : depends)
-      {
-         info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.CREATE));
-         info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.START));
-      }
-   }
-
-   /**
-    * Get the unresolved dependencies
-    * 
-    * @param context the context
-    * @param state the state we want to move to
-    * @return the unresolved dependencies
-    */
-   private String getUnresolvedDependencies(ServiceControllerContext context, ControllerState state)
-   {
-      boolean first = true;
-      
-      StringBuilder builder = new StringBuilder();
-      for (DependencyItem item : context.getDependencyInfo().getUnresolvedDependencies(null))
-      {
-         if (item.isResolved() == false && item.getWhenRequired() == state)
-         {
-            if (first)
-               first = false;
-            else
-               builder.append(' ');
-            builder.append(item.getIDependOn());
-         }
-      }
-      return builder.toString();
-   }
-
-   /**
-    * Safely remove any potentially registered context (usually after an error)
-    * 
-    * @param ctx the context
-    */
-   private void safelyRemoveAnyRegisteredContext(ServiceControllerContext ctx)
-   {
-      // First the context must have a controller
-      Controller controller = ctx.getController();
-      if (controller != null)
-      {
-         // The name must be registered and it must be our context
-         Object name = ctx.getName();
-         ControllerContext registered = controller.getContext(name, null);
-         if (registered == ctx)
-            controller.uninstall(name);
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceControllerMBean.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceControllerMBean.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceControllerMBean.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,176 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
-import org.w3c.dom.Element;
-
-/**
- * ServiceController MBean interface.
- * 
- * @see org.jboss.system.Service
- */
-public interface ServiceControllerMBean
-{
-   /** The default ObjectName */
-   ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:service=ServiceController");
-   
-   /**
-    * Lists the ServiceContexts of deployed mbeans
-    * 
-    * @return the list of ServiceContexts for mbeans deployed through ServiceController.
-    */
-   List<ServiceContext> listDeployed();
-
-   /**
-    * The <code>listIncompletelyDeployed</code> method returns the
-    * service contexts for the mbeans whose status is not CREATED,
-    * RUNNING, STOPPED or DESTROYED. An MBean that has reached one
-    * of the above states has its dependencies resolved.
-    * 
-    * @return a List<ServiceContext>
-    */
-   List<ServiceContext> listIncompletelyDeployed();
-
-   /**
-    * lists ObjectNames of deployed mbeans deployed through
-    * serviceController.
-    * 
-    * @return a list of ObjectNames of deployed mbeans.
-    */
-   List<ObjectName> listDeployedNames();
-
-   /**
-    * Gets the Configuration attribute of the ServiceController object
-    * 
-    * @param objectNames Description of Parameter
-    * @return The Configuration value
-    * @throws Exception Description of Exception
-    */
-   String listConfiguration(ObjectName[] objectNames) throws Exception;
-
-   /**
-    * Deploy the beans; deploy means "instantiate and configure" so the MBean
-    * is created in the MBeanServer. You must call "create" and "start" separately
-    * on the MBean to affect the service lifecycle deploy doesn't bother with service
-    * lifecycle only MBean instanciation/registration/configuration.
-    * 
-    * @param config
-    * @param loaderName
-    * @return Description of the Returned Value
-    * @throws Exception for any error
-    */
-   List<ObjectName> install(Element config, ObjectName loaderName) throws Exception;
-
-   /**
-    * Register the mbean against the microkernel with no dependencies.
-    * 
-    * @see #register(ObjectName, java.util.Collection)
-    * @param serviceName the object name
-    * @throws Exception for any error
-    */
-   void register(ObjectName serviceName) throws Exception;
-
-   /**
-    * Register the mbean against the microkernel with dependencies.
-    * 
-    * @param serviceName the object name
-    * @param depends the dependencies
-    * @throws Exception for any error
-    */   
-   void register(ObjectName serviceName, Collection<ObjectName> depends) throws Exception;
-
-   /**
-    * Create a service
-    * 
-    * @param serviceName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void create(ObjectName serviceName) throws Exception;
-
-   /**
-    * Create a service with given dependencies
-    * 
-    * @param serviceName Description of Parameter
-    * @param depends the dependencies
-    * @throws Exception Description of Exception
-    */
-   void create(ObjectName serviceName, Collection<ObjectName> depends) throws Exception;
-
-   /**
-    * Starts the indicated service
-    * 
-    * @param serviceName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void start(ObjectName serviceName) throws Exception;
-
-   /**
-    * Stops and restarts the indicated service
-    * 
-    * @param serviceName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void restart(ObjectName serviceName) throws Exception;
-
-   /**
-    * Stop the indicated service
-    * 
-    * @param serviceName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void stop(ObjectName serviceName) throws Exception;
-
-   /**
-    * Destroy the indicated service
-    * 
-    * @param serviceName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void destroy(ObjectName serviceName) throws Exception;
-
-   /**
-    * This MBean is going bye bye
-    * 
-    * @param objectName Description of Parameter
-    * @throws Exception Description of Exception
-    */
-   void remove(ObjectName objectName) throws Exception;
-
-   /**
-    * Describe <code>shutdown</code> method here.
-    */
-   void shutdown();
-
-   /**
-    * Lookup the ServiceContext for the given serviceName
-    * 
-    * @param serviceName the service name
-    * @return the service context
-    */
-   ServiceContext getServiceContext(ObjectName serviceName);
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceCreator.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceCreator.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceCreator.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,407 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.StandardMBean;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.service.ServiceConstants;
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.metadata.ServiceConstructorMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceMetaDataParser;
-import org.w3c.dom.Element;
-
-/**
- * A helper class for the controller.
- *
- * @see Service
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ServiceCreator
-{
-   /** Instance logger. */
-   private static final Logger log = Logger.getLogger(ServiceCreator.class);
-   
-   /** The MBean Registry Object Name */
-   private static ObjectName MBEAN_REGISTRY = ObjectNameFactory.create(ServerConstants.MBEAN_REGISTRY);
-   
-   /** The server */
-   private MBeanServer server;
-
-   /**
-    * Rethrow an error as an exception
-    * 
-    * @param context the context
-    * @param t the original throwable
-    * @return never
-    * @throws Exception always
-    */
-   public static Exception rethrow(String context, Throwable t) throws Exception
-   {
-      if (t instanceof Error)
-         throw (Error) t;
-      else if (t instanceof Exception)
-         throw (Exception) t;
-      throw new RuntimeException(context, t);
-   }
-
-   /**
-    * Install an MBean
-    * 
-    * @todo expand the meta data to include a pre-instantiated object
-    * @param server the mbean server
-    * @param objectName the object name
-    * @param metaData the service metadata
-    * @param mbean any mbean instance
-    * @return the installed instance
-    * @throws Exception for any error
-    */
-   public static ServiceInstance install(MBeanServer server, ObjectName objectName, ServiceMetaData metaData, Object mbean) throws Exception
-   {
-      if (server == null)
-         throw new IllegalArgumentException("Null MBeanServer");
-      if (objectName == null)
-         throw new IllegalArgumentException("Null ObjectName");
-      if (metaData == null && mbean == null)
-         throw new IllegalArgumentException("Either metadata or an mbean object must be supplied");
-      
-      // Check for duplicate
-      if (server.isRegistered(objectName))
-         throw new RuntimeException("Trying to install an already registered mbean: " + objectName);
-
-      try
-      {
-         ServiceInstance result = null; 
-         
-         // No meta data just register directly
-         if (metaData == null)
-         {
-            ObjectInstance instance = server.registerMBean(mbean, objectName);
-            result = new ServiceInstance(instance, mbean);
-         }
-         else
-         {
-            String code = metaData.getCode();
-            if (code == null || code.trim().length() == 0)
-               throw new ConfigurationException("Missing or empty code for mbean " + objectName);
-            
-            String xmbeanDD = metaData.getXMBeanDD();
-            
-            // Not an XMBean
-            if (xmbeanDD == null)
-            {
-               String interfaceName = metaData.getInterfaceName();
-               if (interfaceName != null)
-                  result = installStandardMBean(server, objectName, metaData);
-               else
-                  result = installPlainMBean(server, objectName, metaData);
-            }
-            // Embedded XMBean Descriptor
-            else if (xmbeanDD.length() == 0)
-               result = installEmbeddedXMBean(server, objectName, metaData);
-            // Reference to external XMBean descriptor
-            else
-               result = installExternalXMBean(server, objectName, metaData);
-         }
-
-         log.debug("Created mbean: " + objectName);
-         return result;
-      }
-      catch (Throwable e)
-      {
-         Throwable newE = JMXExceptionDecoder.decode(e);
-
-         // didn't work, unregister in case the jmx agent is screwed.
-         try
-         {
-            server.unregisterMBean(objectName);
-         }
-         catch (Throwable ignore)
-         {
-         }
-
-         throw rethrow("Unable to createMBean for " + objectName, newE);
-      }
-   }
-
-   /**
-    * Install a StandardMBean
-    * 
-    * @param server the mbean server
-    * @param objectName the object name
-    * @param metadata the service metadata
-    * @return the installed instance
-    * @throws Exception for any error
-    */
-   private static ServiceInstance installStandardMBean(MBeanServer server, ObjectName objectName, ServiceMetaData metaData) throws Exception
-   {
-      ObjectName loaderName = metaData.getClassLoaderName();
-      ClassLoader loader = server.getClassLoader(loaderName);
-      String code = metaData.getCode();
-      ServiceConstructorMetaData constructor = metaData.getConstructor();
-      String interfaceName = metaData.getInterfaceName();
-
-      Class<?> intf = loader.loadClass(interfaceName);
-      log.debug("About to create bean resource: " + objectName + " with code: " + code + " and interface " + interfaceName);
-      Object resource = server.instantiate(code,
-                                           loaderName,
-                                           constructor.getParameters(loader),
-                                           constructor.getSignature());
-
-      log.debug("About to register StandardMBean : " + objectName);
-      ObjectInstance instance = server.createMBean(StandardMBean.class.getName(),
-                                                   objectName,
-                                                   loaderName,
-                                                   new Object[] { resource, intf },
-                                                   new String[] { Object.class.getName() , Class.class.getName() });
-      return new ServiceInstance(instance, resource);
-   }
-
-   /**
-    * Install a plain MBean
-    * 
-    * @param server the mbean server
-    * @param objectName the object name
-    * @param metadata the service metadata
-    * @return the installed instance
-    * @throws Exception for any error
-    */
-   private static ServiceInstance installPlainMBean(MBeanServer server, ObjectName objectName, ServiceMetaData metaData) throws Exception
-   {
-      ObjectName loaderName = metaData.getClassLoaderName();
-      ClassLoader loader = server.getClassLoader(loaderName);
-      String code = metaData.getCode();
-      ServiceConstructorMetaData constructor = metaData.getConstructor();
-      
-      // This is a standard or dynamic mbean
-      log.debug("About to create bean: " + objectName + " with code: " + code);
-      Object resource = null;
-      try
-      {
-         resource = server.instantiate(code,
-                                       loaderName,
-                                       constructor.getParameters(loader),
-                                       constructor.getSignature());
-      }
-      catch (ReflectionException e)
-      {
-         // This hack is for backwards compatibility on the error messages
-         Throwable t = e.getCause();
-         if (t instanceof ClassNotFoundException)
-            throw e;
-         throw new NotCompliantMBeanException("Error in constructor for " + code + " " + e.toString());
-      }
-
-      Map<String, Object> values = new HashMap<String, Object>();
-      values.put(ServerConstants.CLASSLOADER, loader);
-      ObjectInstance instance = (ObjectInstance) server.invoke(MBEAN_REGISTRY, "registerMBean", new Object[] { resource, objectName, values }, new String[] { Object.class.getName(), ObjectName.class.getName(), Map.class.getName() });
-      return new ServiceInstance(instance, resource);
-   }
-
-   /**
-    * Install an embedded XMBean
-    * 
-    * @param server the mbean server
-    * @param objectName the object name
-    * @param metadata the service metadata
-    * @return the installed instance
-    * @throws Exception for any error
-    */
-   private static ServiceInstance installEmbeddedXMBean(MBeanServer server, ObjectName objectName, ServiceMetaData metaData) throws Exception
-   {
-      ObjectName loaderName = metaData.getClassLoaderName();
-      ClassLoader loader = server.getClassLoader(loaderName);
-      String code = metaData.getCode();
-      ServiceConstructorMetaData constructor = metaData.getConstructor();
-
-      // This is an xmbean with an embedded mbean descriptor
-      log.debug("About to create xmbean object: " + objectName + " with code: " + code + " with embedded descriptor");
-      //xmbean: construct object first.
-      Object resource = server.instantiate(code, 
-                                           loaderName,
-                                           constructor.getParameters(loader), 
-                                           constructor.getSignature());
-
-      String xmbeanCode = metaData.getXMBeanCode();
-      Element mbeanDescriptor = metaData.getXMBeanDescriptor();
-      Object[] args = { resource, mbeanDescriptor, ServiceConstants.PUBLIC_JBOSSMX_XMBEAN_DTD_1_0 };
-      String[] sig = { Object.class.getName(), Element.class.getName(), String.class.getName() };
-      ObjectInstance instance = server.createMBean(xmbeanCode,
-                                                   objectName,
-                                                   loaderName,
-                                                   args,
-                                                   sig);
-      return new ServiceInstance(instance, resource);
-   }
-
-   /**
-    * Install an external XMBean
-    * 
-    * @param server the mbean server
-    * @param objectName the object name
-    * @param metadata the service metadata
-    * @return the installed instance
-    * @throws Exception for any error
-    */
-   private static ServiceInstance installExternalXMBean(MBeanServer server, ObjectName objectName, ServiceMetaData metaData) throws Exception
-   {
-      ObjectName loaderName = metaData.getClassLoaderName();
-      ClassLoader loader = server.getClassLoader(loaderName);
-      String code = metaData.getCode();
-      ServiceConstructorMetaData constructor = metaData.getConstructor();
-      String xmbeanDD = metaData.getXMBeanDD();
-      
-      // This is an xmbean with an external descriptor
-      log.debug("About to create xmbean object: " + objectName  + " with code: " + code + " with descriptor: " + xmbeanDD);
-      //xmbean: construct object first.
-      Object resource = server.instantiate(code, 
-                                           loaderName, 
-                                           constructor.getParameters(loader), 
-                                           constructor.getSignature());
-      // Try to find the dd first as a resource then as a URL
-      URL xmbeanddUrl = null;
-      try
-      {
-         xmbeanddUrl = resource.getClass().getClassLoader().getResource(xmbeanDD);
-      }
-      catch (Exception e)
-      {
-      }
-
-      if (xmbeanddUrl == null)
-         xmbeanddUrl = new URL(xmbeanDD);
-
-      String xmbeanCode = metaData.getXMBeanCode();
-
-      //now create the mbean
-      Object[] args = { resource, xmbeanddUrl };
-      String[] sig = { Object.class.getName(), URL.class.getName() };
-      ObjectInstance instance = server.createMBean(xmbeanCode,
-                                                   objectName,
-                                                   loaderName,
-                                                   args,
-                                                   sig);
-      return new ServiceInstance(instance, resource);
-   }
-
-   /**
-    * Uninstall an MBean
-    * 
-    * @param server the mbean server
-    * @param objectName the object name
-    */
-   public static void uninstall(MBeanServer server, ObjectName objectName)
-   {
-      if (server == null)
-         throw new IllegalArgumentException("Null MBeanServer");
-      if (objectName == null)
-         throw new IllegalArgumentException("Null ObjectName");
-      try
-      {
-         log.debug("Removing mbean from server: " + objectName);
-         server.unregisterMBean(objectName);
-      }
-      catch (Throwable t)
-      {
-         log.debug("Error unregistering mbean " + objectName, t);
-      }
-   }
-   
-   /**
-    * Create a new ServiceCreator
-    * 
-    * @deprecated This is no longer used and will be going away
-    * @param server the mbean server
-    */
-   public ServiceCreator(final MBeanServer server)
-   {
-      if (server == null)
-         throw new IllegalArgumentException("Null MBeanServer");
-      this.server = server;
-   }
-   
-   /**
-    * Clean shutdown
-    */
-   public void shutdown()
-   {
-      this.server = null;
-   } 
-   
-   /**
-    * Parses the given configuration document and creates MBean
-    * instances in the current MBean server.
-    *
-    * @deprecated This is no longer used and will be going away
-    * @param mbeanName the object name
-    * @param loaderName the classloader
-    * @param mbeanElement the config
-    * @return the created object instance
-    * @throws Exception for any error
-    */
-   public ObjectInstance install(ObjectName mbeanName, ObjectName loaderName, Element mbeanElement) throws Exception
-   {
-      if (mbeanName == null)
-         throw new IllegalArgumentException("Null mbeanName");
-      if (mbeanElement == null)
-         throw new IllegalArgumentException("Null mbean element");
-      
-      ServiceMetaDataParser parser = new ServiceMetaDataParser(mbeanElement);
-      List<ServiceMetaData> metaDatas = parser.parse();
-      if (metaDatas.isEmpty())
-         throw new RuntimeException("No mbeans found in passed configuration for " + mbeanName);
-      ServiceMetaData metaData = metaDatas.get(0);
-      metaData.setClassLoaderName(loaderName);
-      ServiceInstance instance = install(server, mbeanName, metaData, null);
-      return instance.getObjectInstance();
-   }
-   
-   /**
-    * Remove the installed object
-    * 
-    * @param name the object name
-    * @throws Exception for any error
-    */
-   public void remove(ObjectName name) throws Exception
-   {
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      uninstall(server, name);
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceDynamicMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceDynamicMBeanSupport.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceDynamicMBeanSupport.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,354 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.List;
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.DynamicMBean;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import javax.management.ReflectionException;
-
-import org.jboss.logging.Logger;
-
-/**
- * <description>
- *
- * @see <related>
- *
- * @author  <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision$
- *
- * <p><b>Revisions:</b>
- *
- * <p><b>6 janv. 2003 Sacha Labourey:</b>
- * <ul>
- * <li> First implementation </li>
- * </ul>
- */
-public class ServiceDynamicMBeanSupport 
-   extends ServiceMBeanSupport
-   implements DynamicMBean
-{
-
-  // Constants -----------------------------------------------------
-   
-   // Attributes ----------------------------------------------------
-   
-   // Static --------------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-   
-   public ServiceDynamicMBeanSupport()
-   {
-      super();
-   }
-
-   public ServiceDynamicMBeanSupport(Class type)
-   {
-      super(type);
-   }
-
-   public ServiceDynamicMBeanSupport(String category)
-   {
-      super(category);
-   }
-
-   public ServiceDynamicMBeanSupport(Logger log)
-   {
-      super(log);
-   }
-   
-   // Public --------------------------------------------------------
-
-   // DynamicMBean implementation -----------------------------------
-   
-   public Object getAttribute(String attribute)
-      throws AttributeNotFoundException, MBeanException, ReflectionException
-   {
-      // locally managed attributes!
-      //
-      if("State".equals(attribute))
-      {
-         return new Integer(getState());
-      }
-      if("StateString".equals(attribute))
-      {
-         return getStateString();
-      }
-      if("Name".equals(attribute))
-      {
-         return getName();
-      }
-      
-      // Wrapped attributes?
-      //
-      return getInternalAttribute (attribute);
-      
-   }
-
-   public Object invoke(String actionName, Object[] params, String[] signature)
-      throws MBeanException, ReflectionException
-   {
-      try 
-      {
-         if (ServiceController.JBOSS_INTERNAL_LIFECYCLE.equals(actionName))
-         {
-            jbossInternalLifecycle((String) params[0]); 
-            return null;
-         }
-         if (params == null || params.length == 0) 
-         {
-            if ("create".equals(actionName)) 
-            {
-               create(); return null;
-            }
-            else if ("start".equals(actionName)) 
-            {
-               start(); return null;
-            }
-            else if ("stop".equals(actionName)) 
-            {
-               stop(); return null;
-            }
-            else if ("destroy".equals(actionName)) 
-            {
-               destroy(); return null;
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         throw new MBeanException(e, "Exception in service lifecyle operation: " + actionName);
-      }         
-      
-      // If I am here, it means that the invocation has not been handled locally
-      //
-      try
-      {
-         return internalInvoke (actionName, params, signature);
-      }
-      catch (Exception e)
-      {
-         throw new MBeanException(e, 
-               "Exception invoking: " + actionName);
-      }         
-   }
-
-   public void setAttribute(Attribute attribute)
-      throws
-         AttributeNotFoundException,
-         InvalidAttributeValueException,
-         MBeanException,
-         ReflectionException
-   {
-      setInternalAttribute (attribute);
-   }
-
-   public AttributeList setAttributes(AttributeList attributes)
-   {
-      AttributeList list = new AttributeList();
-      if (attributes == null)
-         return list;
-      for (int i = 0; i < attributes.size(); ++i)
-      {
-         Attribute attribute = (Attribute) attributes.get(i);
-         try
-         {
-            setAttribute(attribute);
-            list.add(attribute);
-         }
-         catch (Throwable t)
-         {
-            log.debug("Error setting attribute " + attribute.getName(), t);
-         }
-      }
-      return list;
-   }
-
-   public AttributeList getAttributes(String[] attributes)
-   {
-      AttributeList list = new AttributeList();
-      if (attributes == null)
-         return list;
-      for (int i = 0; i < attributes.length; ++i)
-      {
-         try
-         {
-            Object value = getAttribute(attributes[i]);
-            list.add(new Attribute(attributes[i], value));
-         }
-         catch (Throwable t)
-         {
-            log.debug("Error getting attribute " + attributes[i], t);
-         }
-      }
-      return list;
-   }
-
-   public MBeanInfo getMBeanInfo()
-   {
-      MBeanParameterInfo[] noParams = new MBeanParameterInfo[] {};
-      
-      MBeanConstructorInfo[] ctorInfo = getInternalConstructorInfo();
-      
-      MBeanAttributeInfo[] attrs = getInternalAttributeInfo();
-      MBeanAttributeInfo[] attrInfo = new MBeanAttributeInfo[3 + attrs.length];
-      attrInfo[0] = new MBeanAttributeInfo("Name",
-            "java.lang.String",
-            "Return the service name",
-            true,
-            false,
-            false);
-      attrInfo[1] = new MBeanAttributeInfo("State",
-            "int",
-            "Return the service state",
-            true,
-            false,
-            false);
-      attrInfo[2] = new MBeanAttributeInfo("StateString",
-               "java.lang.String",
-               "Return the service's state as a String",
-               true,
-               false,
-               false);
-      System.arraycopy(attrs, 0, attrInfo, 3, attrs.length);
-      
-      MBeanParameterInfo[] jbossInternalLifecycleParms = new MBeanParameterInfo[1];
-      jbossInternalLifecycleParms[0] = new MBeanParameterInfo("method", String.class.getName(), "The lifecycle method");
-      
-      MBeanOperationInfo[] ops = getInternalOperationInfo();
-      MBeanOperationInfo[] opInfo = new MBeanOperationInfo[5 + ops.length];
-      opInfo[0] = new MBeanOperationInfo("create",
-                                "create service lifecycle operation",
-                                noParams,
-                                "void",
-                                MBeanOperationInfo.ACTION);
-         
-      opInfo[1] = new MBeanOperationInfo("start",
-                                "start service lifecycle operation",
-                                noParams,
-                                "void",
-                                MBeanOperationInfo.ACTION);
-         
-      opInfo[2] = new MBeanOperationInfo("stop",
-                                "stop service lifecycle operation",
-                                noParams,
-                                "void",
-                                MBeanOperationInfo.ACTION);
-         
-      opInfo[3] = new MBeanOperationInfo("destroy",
-                                "destroy service lifecycle operation",
-                                noParams,
-                                "void",
-                                MBeanOperationInfo.ACTION);                                
-                                
-      opInfo[4] = new MBeanOperationInfo(ServiceController.JBOSS_INTERNAL_LIFECYCLE,
-                                "Internal lifecycle (for internal use)",
-                                jbossInternalLifecycleParms,
-                                "void",
-                                MBeanOperationInfo.ACTION);                                
-
-      System.arraycopy(ops, 0, opInfo, 5, ops.length);
-      
-      MBeanNotificationInfo[] notifyInfo = getInternalNotificationInfo();
-      return new MBeanInfo(getClass().getName(), 
-                           getInternalDescription(),
-                           attrInfo, 
-                           ctorInfo, 
-                           opInfo, 
-                           notifyInfo);
-   }
-
-   // Y overrides ---------------------------------------------------
-   
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   protected String getInternalDescription()
-   {
-      return "DynamicMBean Service";
-   }
-   
-   protected MBeanConstructorInfo[] getInternalConstructorInfo()
-   {
-      return new MBeanConstructorInfo[0];
-   }
-   
-   protected MBeanAttributeInfo[] getInternalAttributeInfo()
-   {
-      return new MBeanAttributeInfo[0];
-   }
-   
-   protected MBeanOperationInfo[] getInternalOperationInfo()
-   {
-      return new MBeanOperationInfo[0];
-   }
-   
-   protected MBeanNotificationInfo[] getInternalNotificationInfo()
-   {
-      return new MBeanNotificationInfo[0];
-   }
-   
-   protected Object getInternalAttribute(String attribute)
-      throws AttributeNotFoundException, MBeanException, ReflectionException
-   {
-      throw new AttributeNotFoundException ("Attribute not found " + attribute);
-   }
-   
-   protected void setInternalAttribute(Attribute attribute)
-       throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
-   {
-      throw new AttributeNotFoundException ("Attribute not found " + attribute);
-   }
-
-   protected Object internalInvoke(String actionName, Object[] params, String[] signature)
-      throws MBeanException, ReflectionException
-   {
-      StringBuffer buffer = new StringBuffer();
-      buffer.append(actionName);
-      buffer.append('(');
-      for (int i = 0; i < signature.length; ++i)
-      {
-         buffer.append(signature[i]);
-         if (i < signature.length - 1)
-            buffer.append(", ");
-      }
-      buffer.append(')');
-      throw new MBeanException(new Exception("Operation not found " + buffer.toString()), "Operation not found " + actionName);
-   }
-   
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------
-   
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceFactory.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceFactory.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceFactory.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- * The ServiceFactory interface is used to obtain a Service
- * proxy instance for a named MBean.
- * 
- * @author <a href="mailto:Scott_Stark at displayscape.com">Scott Stark</a>.
- * @version $Revision$
- */
-public interface ServiceFactory
-{
-   /**
-    * Create a Service proxy instance for the MBean given by name.
-    * 
-    * @param server    The MBeanServer instance
-    * @param name      The name of the MBean that wishes to be managed by
-    *                  the JBoss ServiceControl service.
-    */
-   Service createService(MBeanServer server, ObjectName name);
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceInstance.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceInstance.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceInstance.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.ObjectInstance;
-
-/**
- * ServiceInstance.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ServiceInstance
-{
-   /** The object instance */
-   private ObjectInstance objectInstance;
-   
-   /** The object */
-   private Object resource;
-
-   /**
-    * Create a new ServiceInstance.
-    */
-   public ServiceInstance()
-   {
-   }
-
-   /**
-    * Create a new ServiceInstance.
-    * 
-    * @param objectInstance the object instance
-    * @param resource the object
-    */
-   public ServiceInstance(ObjectInstance objectInstance, Object resource)
-   {
-      this.objectInstance = objectInstance;
-      this.resource = resource;
-   }
-
-   /**
-    * Get the resource.
-    * 
-    * @return the resource.
-    */
-   public Object getResource()
-   {
-      return resource;
-   }
-
-   /**
-    * Get the objectInstance.
-    * 
-    * @return the objectInstance.
-    */
-   public ObjectInstance getObjectInstance()
-   {
-      return objectInstance;
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBean.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBean.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBean.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-/**
- * An interface describing a JBoss service MBean.
- *
- * @see Service
- * @see ServiceMBeanSupport
- * 
- * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Öberg</a>
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ServiceMBean
-   extends Service
-{
-   // Constants -----------------------------------------------------
-
-   /** ServiceController notification types corresponding to service lifecycle events */
-   public static final String CREATE_EVENT  = "org.jboss.system.ServiceMBean.create";
-   public static final String START_EVENT   = "org.jboss.system.ServiceMBean.start";
-   public static final String STOP_EVENT    = "org.jboss.system.ServiceMBean.stop";
-   public static final String DESTROY_EVENT = "org.jboss.system.ServiceMBean.destroy";
-
-   public static final String[] states = {
-      "Stopped", "Stopping", "Starting", "Started", "Failed",
-      "Destroyed", "Created", "Unregistered", "Registered"
-   };
-
-   /** The Service.stop has completed */
-   public static final int STOPPED  = 0;
-   /** The Service.stop has been invoked */
-   public static final int STOPPING = 1;
-   /** The Service.start has been invoked */
-   public static final int STARTING = 2;
-   /** The Service.start has completed */
-   public static final int STARTED  = 3;
-   /** There has been an error during some operation */
-   public static final int FAILED  = 4;
-   /** The Service.destroy has completed */
-   public static final int DESTROYED = 5;
-   /** The Service.create has completed */
-   public static final int CREATED = 6;
-   /** The MBean has been created but has not completed MBeanRegistration.postRegister */
-   public static final int UNREGISTERED = 7;
-   /** The MBean has been created and has completed MBeanRegistration.postRegister */
-   public static final int REGISTERED = 8;
-
-   // Public --------------------------------------------------------
-   
-   String getName();
-   int getState();
-   String getStateString();
-   
-   /** Detyped lifecycle invocation */
-   void jbossInternalLifecycle(String method) throws Exception;
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanState.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanState.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanState.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.util.state.State;
-import org.jboss.util.state.StateMachine;
-import org.jboss.util.state.Transition;
-
-/**
- * A final class that encapsulates the constants necessary
- * for creating StateMachines that follow the ServiceMBean
- * lifecycle model.
- * 
- * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public final class ServiceMBeanState
-{
-   // ServiceMBean States
-   public static final State STATE_UNREGISTERED = new State("Unregistered"); // Initial State
-   public static final State STATE_REGISTERED   = new State("Registered");
-   public static final State STATE_CREATED      = new State("Created");
-   public static final State STATE_STARTING     = new State("Starting");
-   public static final State STATE_STARTED      = new State("Started");
-   public static final State STATE_STOPPING     = new State("Stopping");
-   public static final State STATE_STOPPED      = new State("Stopped");
-   public static final State STATE_DESTROYED    = new State("Destroyed");
-   public static final State STATE_FAILED       = new State("Failed");
-   
-   // ServiceMBean State Transitions
-   public static final Transition TRANS_REGISTER    = new Transition("register", STATE_REGISTERED);
-   public static final Transition TRANS_CREATE      = new Transition("create", STATE_CREATED);
-   public static final Transition TRANS_START_BEGIN = new Transition("startBegin", STATE_STARTING);
-   public static final Transition TRANS_START_END   = new Transition("startEnd", STATE_STARTED);
-   public static final Transition TRANS_STOP_BEGIN  = new Transition("stopBegin", STATE_STOPPING);
-   public static final Transition TRANS_STOP_END    = new Transition("stopEnd", STATE_STOPPED);
-   public static final Transition TRANS_DESTROY     = new Transition("destroy", STATE_DESTROYED);
-   public static final Transition TRANS_UNREGISTER  = new Transition("unregister", STATE_UNREGISTERED);
-   public static final Transition TRANS_FAIL        = new Transition("fail", STATE_FAILED);
-
-   /** The possible set of States a ServiceMBean can be in */
-   public static final Set STATES = new HashSet(
-      Arrays.asList(new State[] {
-         STATE_UNREGISTERED,
-         STATE_REGISTERED,
-         STATE_CREATED,
-         STATE_STARTING,
-         STATE_STARTED,
-         STATE_STOPPING,
-         STATE_STOPPED,
-         STATE_DESTROYED,
-         STATE_FAILED
-      }));
-   
-   // Associate States with valid Transitions, or else, define explicitly
-   // the ServiceMBean lifecycle that drives the StateMachine
-   static
-   {
-      STATE_UNREGISTERED
-         .addTransition(TRANS_REGISTER)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_REGISTERED
-         .addTransition(TRANS_CREATE)
-         .addTransition(TRANS_UNREGISTER)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_CREATED
-         .addTransition(TRANS_START_BEGIN)
-         .addTransition(TRANS_DESTROY)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_STARTING
-         .addTransition(TRANS_START_END)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_STARTED  
-         .addTransition(TRANS_STOP_BEGIN)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_STOPPING
-         .addTransition(TRANS_STOP_END)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_STOPPED  
-         .addTransition(TRANS_START_BEGIN)
-         .addTransition(TRANS_DESTROY)
-         .addTransition(TRANS_FAIL);
-      
-      STATE_DESTROYED
-         .addTransition(TRANS_CREATE)
-         .addTransition(TRANS_UNREGISTER)
-         .addTransition(TRANS_FAIL);
-      
-      // STATE_FAILED - no transitions
-   }
-   
-   /**
-    * Create a new StateMachine that follows the ServiceMBean
-    * lifecycle, initialized to the STATE_UNREGISTERED state.
-    * 
-    * @param description A string description for this state machine, or null
-    * @return the StateMachine
-    */
-   public static StateMachine createStateMachine(String description)
-   {
-      return new StateMachine(STATES, STATE_UNREGISTERED, description);
-   }
-   
-   /**
-    * Dissallow instances of this class
-    */
-   private ServiceMBeanState()
-   {
-      // empty
-   }
-
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanSupport.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/ServiceMBeanSupport.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,597 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system;
-
-import javax.management.AttributeChangeNotification;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.jboss.beans.metadata.api.annotations.Create;
-import org.jboss.beans.metadata.api.annotations.Destroy;
-import org.jboss.beans.metadata.api.annotations.Start;
-import org.jboss.beans.metadata.api.annotations.Stop;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
-
-/**
- * An abstract base class JBoss services can subclass to implement a
- * service that conforms to the ServiceMBean interface. Subclasses must
- * override {@link #getName} method and should override 
- * {@link #startService}, and {@link #stopService} as approriate.
- *
- * @see ServiceMBean
- * 
- * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Öberg</a>
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version $Revision$
- */
-public class ServiceMBeanSupport
-   extends JBossNotificationBroadcasterSupport
-   implements ServiceMBean, MBeanRegistration, KernelControllerContextAware
-{
-   /** The signature for service controller operations */
-   public static final String[] SERVICE_CONTROLLER_SIG = new String[] { ObjectName.class.getName() };
-   
-   /**
-    * The instance logger for the service.  Not using a class logger
-    * because we want to dynamically obtain the logger name from
-    * concreate sub-classes.
-    */
-   protected Logger log;
-   
-   /** The MBeanServer which we have been register with. */
-   protected MBeanServer server;
-
-   /** The object name which we are registsred under. */
-   protected ObjectName serviceName;
-
-   /** The current state this service is in. */
-   private int state = UNREGISTERED;
-
-   /** For backwards compatibility */
-   private boolean isJBossInternalLifecycleExposed = false;
-
-   /** The controller context */
-   private KernelControllerContext controllerContext;
-   
-   /**
-    * Construct a <t>ServiceMBeanSupport</tt>.
-    *
-    * <p>Sets up logging.
-    */
-   public ServiceMBeanSupport()
-   {
-      // can not call this(Class) because we need to call getClass()
-      this.log = Logger.getLogger(getClass().getName());
-      log.trace("Constructing");
-   }
-
-   /**
-    * Construct a <t>ServiceMBeanSupport</tt>.
-    *
-    * <p>Sets up logging.
-    *
-    * @param type   The class type to determine category name from.
-    */
-   @SuppressWarnings("unchecked")
-   public ServiceMBeanSupport(final Class type)
-   {
-      this(type.getName());
-   }
-   
-   /**
-    * Construct a <t>ServiceMBeanSupport</tt>.
-    *
-    * <p>Sets up logging.
-    *
-    * @param category   The logger category name.
-    */
-   public ServiceMBeanSupport(final String category)
-   {
-      this(Logger.getLogger(category));
-   }
-
-   /**
-    * Construct a <t>ServiceMBeanSupport</tt>.
-    *
-    * @param log   The logger to use.
-    */
-   public ServiceMBeanSupport(final Logger log)
-   {
-      this.log = log;
-      log.trace("Constructing");
-   }
-   
-   public void setKernelControllerContext(KernelControllerContext controllerContext) throws Exception
-   {
-      this.controllerContext = controllerContext;
-   }
-
-   public void unsetKernelControllerContext(KernelControllerContext controllerContext) throws Exception
-   {
-      this.controllerContext = null;
-   }
-
-   /**
-    * Use the short class name as the default for the service name.
-    * 
-    * @return a description of the mbean
-    */
-   public String getName()
-   {
-      // TODO: Check if this gets called often, if so cache this or remove if not used
-      // use the logger so we can better be used as a delegate instead of sub-class
-      return org.jboss.util.Classes.stripPackageName(log.getName());
-   }
-   
-   public ObjectName getServiceName()
-   {
-      return serviceName;
-   }
-
-   public MBeanServer getServer()
-   {
-      return server;
-   }
-   
-   public int getState()
-   {
-      return state;
-   }
-   
-   public String getStateString()
-   {
-      return states[state];
-   }
-   
-   public Logger getLog()
-   {
-      return log;
-   }
-
-
-   ///////////////////////////////////////////////////////////////////////////
-   //                             State Mutators                            //
-   ///////////////////////////////////////////////////////////////////////////
-
-   @Create
-   public void pojoCreate() throws Exception
-   {
-      jbossInternalCreate();
-   }
-   
-   @Start
-   public void pojoStart() throws Exception
-   {
-      jbossInternalStart();
-   }
-
-   @Stop
-   public void pojoStop() throws Exception
-   {
-      jbossInternalStop();
-   }
-   
-   @Destroy
-   public void pojoDestroy() throws Exception
-   {
-      jbossInternalDestroy();
-   }
-
-   protected void pojoChange(ControllerState state)
-   {
-      Controller controller = controllerContext.getController();
-      try
-      {
-         controller.change(controllerContext, state);
-      }
-      catch (RuntimeException e)
-      {
-         throw e;
-      }
-      catch (Error e)
-      {
-         throw e;
-      }
-      catch (Throwable t)
-      {
-         throw new RuntimeException("Error changing state of " + controllerContext.getName() + " to " + state.getStateString(), t);
-      }
-   }
-   
-   public void create() throws Exception
-   {
-      if (controllerContext != null)
-         pojoChange(ControllerState.CREATE);
-      else if (serviceName != null && isJBossInternalLifecycleExposed)
-         server.invoke(ServiceController.OBJECT_NAME, "create", new Object[] { serviceName }, SERVICE_CONTROLLER_SIG);
-      else
-         jbossInternalCreate();
-   }
-   
-   public void start() throws Exception
-   {
-      if (controllerContext != null)
-         pojoChange(ControllerState.START);
-      else if (serviceName != null && isJBossInternalLifecycleExposed)
-         server.invoke(ServiceController.OBJECT_NAME, "start", new Object[] { serviceName }, SERVICE_CONTROLLER_SIG);
-      else
-         jbossInternalStart();
-   }
-   
-   public void stop()
-   {
-      try
-      {
-         if (controllerContext != null)
-            pojoChange(ControllerState.CREATE);
-         else if (serviceName != null && isJBossInternalLifecycleExposed)
-            server.invoke(ServiceController.OBJECT_NAME, "stop", new Object[] { serviceName }, SERVICE_CONTROLLER_SIG);
-         else
-            jbossInternalStop();
-      }
-      catch (Throwable t)
-      {
-         log.warn("Error in stop " + jbossInternalDescription(), t);
-      }
-   }
-   
-   public void destroy()
-   {
-      try
-      {
-         if (controllerContext != null)
-            pojoChange(ControllerState.CONFIGURED);
-         else if (serviceName != null && isJBossInternalLifecycleExposed)
-            server.invoke(ServiceController.OBJECT_NAME, "destroy", new Object[] { serviceName }, SERVICE_CONTROLLER_SIG);
-         else
-            jbossInternalDestroy();
-      }
-      catch (Throwable t)
-      {
-         log.warn("Error in destroy " + jbossInternalDescription(), t);
-      }
-   }
-   
-   protected String jbossInternalDescription()
-   {
-      if (serviceName != null)
-         return serviceName.toString();
-      else
-         return getName();
-   }
-   
-   public void jbossInternalLifecycle(String method) throws Exception
-   {
-      if (method == null)
-         throw new IllegalArgumentException("Null method name");
-      
-      if (method.equals("create"))
-         jbossInternalCreate();
-      else if (method.equals("start"))
-         jbossInternalStart();
-      else if (method.equals("stop"))
-         jbossInternalStop();
-      else if (method.equals("destroy"))
-         jbossInternalDestroy();
-      else
-         throw new IllegalArgumentException("Unknown lifecyle method " + method);
-   }
-   
-   protected void jbossInternalCreate() throws Exception
-   {
-      if (state == CREATED || state == STARTING || state == STARTED
-         || state == STOPPING || state == STOPPED)
-      {
-         log.debug("Ignoring create call; current state is " + getStateString());
-         return;
-      }
-      
-      log.debug("Creating " + jbossInternalDescription());
-      
-      try
-      {
-         createService();
-         state = CREATED;
-      }
-      catch (Exception e)
-      {
-         log.debug("Initialization failed " + jbossInternalDescription(), e);
-         throw e;
-      }
-      
-      log.debug("Created " + jbossInternalDescription());
-   }
-
-   protected void jbossInternalStart() throws Exception
-   {
-      if (state == STARTING || state == STARTED || state == STOPPING)
-      {
-         log.debug("Ignoring start call; current state is " + getStateString());
-         return;
-      }
-      
-      if (state != CREATED && state != STOPPED && state != FAILED)
-      {
-         log.debug("Start requested before create, calling create now");         
-         create();
-      }
-      
-      state = STARTING;
-      sendStateChangeNotification(STOPPED, STARTING, getName() + " starting", null);
-      log.debug("Starting " + jbossInternalDescription());
-
-      try
-      {
-         startService();
-      }
-      catch (Exception e)
-      {
-         state = FAILED;
-         sendStateChangeNotification(STARTING, FAILED, getName() + " failed", e);
-         log.debug("Starting failed " + jbossInternalDescription(), e);
-         throw e;
-      }
-
-      state = STARTED;
-      sendStateChangeNotification(STARTING, STARTED, getName() + " started", null);
-      log.debug("Started " + jbossInternalDescription());
-   }
-   
-   protected void jbossInternalStop()
-   {
-      if (state != STARTED)
-      {
-         log.debug("Ignoring stop call; current state is " + getStateString());
-         return;
-      }
-      
-      state = STOPPING;
-      sendStateChangeNotification(STARTED, STOPPING, getName() + " stopping", null);
-      log.debug("Stopping " + jbossInternalDescription());
-
-      try
-      {
-         stopService();
-      }
-      catch (Throwable e)
-      {
-         state = FAILED;
-         sendStateChangeNotification(STOPPING, FAILED, getName() + " failed", e);
-         log.warn("Stopping failed " + jbossInternalDescription(), e);
-         return;
-      }
-      
-      state = STOPPED;
-      sendStateChangeNotification(STOPPING, STOPPED, getName() + " stopped", null);
-      log.debug("Stopped " + jbossInternalDescription());
-   }
-
-   protected void jbossInternalDestroy()
-   {
-      if (state == DESTROYED)
-      {
-         log.debug("Ignoring destroy call; current state is " + getStateString());
-         return;
-      }
-      
-      if (state == STARTED)
-      {
-         log.debug("Destroy requested before stop, calling stop now");
-         stop();
-      }
-      
-      log.debug("Destroying " + jbossInternalDescription());
-      
-      try
-      {
-         destroyService();
-      }
-      catch (Throwable t)
-      {
-         log.warn("Destroying failed " + jbossInternalDescription(), t);
-      }
-      state = DESTROYED;
-      log.debug("Destroyed " + jbossInternalDescription());
-   }
-
-
-   ///////////////////////////////////////////////////////////////////////////
-   //                                JMX Hooks                              //
-   ///////////////////////////////////////////////////////////////////////////
-   
-   /**
-    * Callback method of {@link MBeanRegistration}
-    * before the MBean is registered at the JMX Agent.
-    * 
-    * <p>
-    * <b>Attention</b>: Always call this method when you overwrite it in a subclass
-    *                   because it saves the Object Name of the MBean.
-    *
-    * @param server    Reference to the JMX Agent this MBean is registered on
-    * @param name      Name specified by the creator of the MBean. Note that you can
-    *                  overwrite it when the given ObjectName is null otherwise the
-    *                  change is discarded (maybe a bug in JMX-RI).
-    * @return the ObjectName
-    * @throws Exception for any error
-    */
-   public ObjectName preRegister(MBeanServer server, ObjectName name)
-      throws Exception
-   {
-      this.server = server;
-
-      serviceName = getObjectName(server, name);
-      
-      return serviceName;
-   }
-   
-   public void postRegister(Boolean registrationDone)
-   {
-      if (!registrationDone.booleanValue())
-      {
-         log.info( "Registration is not done -> stop" );
-         stop();
-      }
-      else
-      {
-         state = REGISTERED;
-         // This is for backwards compatibility - see whether jbossInternalLifecycle is exposed
-         try
-         {
-            MBeanInfo info = server.getMBeanInfo(serviceName);
-            MBeanOperationInfo[] ops = info.getOperations();
-            for (int i = 0; i < ops.length; ++i)
-            {
-               if (ops[i] != null && ServiceController.JBOSS_INTERNAL_LIFECYCLE.equals(ops[i].getName()))
-               {
-                  isJBossInternalLifecycleExposed = true;
-                  break;
-               }
-            }
-         }
-         catch (Throwable t)
-         {
-            log.warn("Unexcepted error accessing MBeanInfo for " + serviceName, t);
-         }
-      }
-   }
-
-   public void preDeregister() throws Exception
-   {
-   }
-   
-   public void postDeregister()
-   {
-      server = null;
-      serviceName = null;
-      state = UNREGISTERED;
-   }
-
-   /**
-    * The <code>getNextNotificationSequenceNumber</code> method returns 
-    * the next sequence number for use in notifications.
-    *
-    * @return a <code>long</code> value
-    */
-   protected long getNextNotificationSequenceNumber()
-   {
-      return nextNotificationSequenceNumber();
-   }
-
-
-   ///////////////////////////////////////////////////////////////////////////
-   //                       Concrete Service Overrides                      //
-   ///////////////////////////////////////////////////////////////////////////
-
-   /**
-    * Sub-classes should override this method if they only need to set their
-    * object name during MBean pre-registration.
-    * 
-    * @param server the mbeanserver
-    * @param name the suggested name, maybe null
-    * @return the object name
-    * @throws MalformedObjectNameException for a bad object name
-    */
-   protected ObjectName getObjectName(MBeanServer server, ObjectName name)
-      throws MalformedObjectNameException
-   {
-      return name;
-   }
-
-   /**
-    * Sub-classes should override this method to provide
-    * custum 'create' logic.
-    *
-    * <p>This method is empty, and is provided for convenience
-    *    when concrete service classes do not need to perform
-    *    anything specific for this state change.
-    * 
-    * @throws Exception for any error
-    */
-   protected void createService() throws Exception {}
-   
-   /**
-    * Sub-classes should override this method to provide
-    * custum 'start' logic.
-    * 
-    * <p>This method is empty, and is provided for convenience
-    *    when concrete service classes do not need to perform
-    *    anything specific for this state change.
-    * 
-    * @throws Exception for any error
-    */
-   protected void startService() throws Exception {}
-   
-   /**
-    * Sub-classes should override this method to provide
-    * custum 'stop' logic.
-    * 
-    * <p>This method is empty, and is provided for convenience
-    *    when concrete service classes do not need to perform
-    *    anything specific for this state change.
-    * 
-    * @throws Exception for any error
-    */
-   protected void stopService() throws Exception {}
-   
-   /**
-    * Sub-classes should override this method to provide
-    * custum 'destroy' logic.
-    * 
-    * <p>This method is empty, and is provided for convenience
-    *    when concrete service classes do not need to perform
-    *    anything specific for this state change.
-    * 
-    * @throws Exception for any error
-    */
-   protected void destroyService() throws Exception {}
-   
-   // Private -------------------------------------------------------
-   
-   /**
-    * Helper for sending out state change notifications
-    */
-   private void sendStateChangeNotification(int oldState, int newState, String msg, Throwable t)
-   {
-      long now = System.currentTimeMillis();
-      
-      AttributeChangeNotification stateChangeNotification = new AttributeChangeNotification(
-         this,
-         getNextNotificationSequenceNumber(), now, msg,
-         "State", "java.lang.Integer",
-         new Integer(oldState), new Integer(newState)
-         );
-      stateChangeNotification.setUserData(t);
-      
-      sendNotification(stateChangeNotification);      
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ConfigureAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ConfigureAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ConfigureAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import java.util.List;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.system.ServiceBinding;
-import org.jboss.system.ServiceConfigurator;
-import org.jboss.system.ServiceContext;
-import org.jboss.system.ServiceController;
-import org.jboss.system.metadata.ServiceAttributeMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
-
-/**
- * ConfigureAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ConfigureAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-      ServiceController controller = context.getServiceController();
-      MBeanServer server = controller.getMBeanServer();
-      ObjectName objectName = context.getObjectName();
-
-      // Configure any attributes
-      ServiceMetaData metaData = context.getServiceMetaData();
-      if (metaData != null)
-      {
-         List<ServiceAttributeMetaData> attrs = metaData.getAttributes();
-         if (attrs.size() > 0)
-         {
-            ObjectName classLoaderName = metaData.getClassLoaderName(); 
-            ServiceConfigurator.configure(null, controller, objectName, classLoaderName, attrs);
-         }
-      }
-      
-      context.getServiceContext().state = ServiceContext.CONFIGURED;
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/CreateDestroyLifecycleAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/CreateDestroyLifecycleAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/CreateDestroyLifecycleAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import javax.management.ObjectName;
-
-import org.jboss.system.Service;
-import org.jboss.system.ServiceContext;
-import org.jboss.system.ServiceController;
-import org.jboss.system.ServiceMBean;
-
-/**
- * CreateDestroyLifecycleAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class CreateDestroyLifecycleAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-      Service service = context.getServiceProxy();
-      service.create();
-
-      context.getServiceContext().state = ServiceContext.CREATED;
-      
-      ObjectName objectName = context.getObjectName();
-      ServiceController serviceController = context.getServiceController();
-      serviceController.sendControllerNotification(ServiceMBean.CREATE_EVENT, objectName);            
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-      try
-      {
-         Service service = context.getServiceProxy();
-         service.destroy();
-
-         context.getServiceContext().state = ServiceContext.DESTROYED;
-
-         ObjectName objectName = context.getObjectName();
-         ServiceController serviceController = context.getServiceController();
-         serviceController.sendControllerNotification(ServiceMBean.DESTROY_EVENT, objectName);            
-      }
-      catch (Throwable t)
-      {
-         log.debug("Error during destroy for " + context.getObjectName(), t);
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/DescribeAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/DescribeAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/DescribeAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-/**
- * DescribeAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class DescribeAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstallAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstallAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstallAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-/**
- * InstallAction.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class InstallAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstantiateAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstantiateAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/InstantiateAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.system.ServiceCreator;
-import org.jboss.system.ServiceInstance;
-import org.jboss.system.metadata.ServiceMetaData;
-
-/**
- * InstantiateAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class InstantiateAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-      MBeanServer server = context.getServiceController().getMBeanServer();
-      ObjectName objectName = context.getObjectName();
-      ServiceMetaData metaData = context.getServiceMetaData();
-      Object mbean = context.getTarget();
-      ServiceInstance instance = ServiceCreator.install(server, objectName, metaData, mbean);
-      context.setTarget(instance.getResource());
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-      MBeanServer server = context.getServiceController().getMBeanServer();
-      ObjectName objectName = context.getObjectName();
-      ServiceCreator.uninstall(server, objectName);
-      ServiceMetaData metaData = context.getServiceMetaData();
-      if (metaData != null)
-         context.setTarget(null);
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleDependencyItem.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleDependencyItem.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleDependencyItem.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * A LifecycleDependencyItem.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class LifecycleDependencyItem extends AbstractDependencyItem
-{
-   /**
-    * Create a new LifecycleDependencyItem.
-    * 
-    * @param name the name
-    * @param dependency the dependency
-    * @param state the state
-    */
-   public LifecycleDependencyItem(Object name, Object dependency, ControllerState state)
-   {
-      super(name, dependency, state, state);
-   }
-}
\ No newline at end of file

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleInfo.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleInfo.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/LifecycleInfo.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,155 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanServer;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ControllerStateModel;
-import org.jboss.system.ServiceController;
-
-/**
- * Holds the needed kernel bus lifecycle invocation info.
- * Used by {@link ServiceControllerContext#lifecycleInvocation(String, Object[], String[])}
- * to make invocations on the MBean lifecycle methods.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class LifecycleInfo
-{
-   private ServiceControllerContext context;
-   private Map<String, StateInfo> lifecycleOps;
-
-   /**
-    * @param context the ServiceControllerContext
-    * @throws Throwable for any error
-    */
-   public LifecycleInfo(ServiceControllerContext context) throws Throwable
-   {
-      if (context == null)
-         throw new IllegalArgumentException("Null context");
-
-      this.context = context;
-      // build possible lifecycle ops
-      lifecycleOps = new HashMap<String, StateInfo>();
-      lifecycleOps.put("create", new StateInfo(false, true, ControllerState.CREATE));
-      lifecycleOps.put("start", new StateInfo(false, true, ControllerState.INSTALLED));
-      lifecycleOps.put("stop", new StateInfo(false, false, ControllerState.CREATE));
-      lifecycleOps.put("destroy", new StateInfo(false, false, ControllerState.CONFIGURED));
-
-      ServiceController controller = context.getServiceController();
-      MBeanServer server = controller.getMBeanServer();
-      if (server != null)
-      {
-         MBeanInfo info = server.getMBeanInfo(context.getObjectName());
-         MBeanOperationInfo[] ops = info.getOperations();
-         if (ops != null)
-         {
-            for (MBeanOperationInfo op : ops)
-            {
-               String name = op.getName();
-
-               StateInfo flag = lifecycleOps.get(name);
-               if (flag == null)
-               {
-                  continue;
-               }
-
-               // Validate that is a no-arg void return type method
-               if (op.getReturnType().equals("void") == false)
-               {
-                  continue;
-               }
-               if (op.getSignature().length != 0)
-               {
-                  continue;
-               }
-
-               flag.opExists = true;
-            }
-         }
-      }
-   }
-
-   /**
-    * Is this invocation a lifecycle invocation.
-    *
-    * Return state value to which this context should be moved
-    * or return current state if we're already past the lifecycle state
-    * or null if the invocation is actually not a lifecycle invocation.
-    *
-    * @param opName operation name
-    * @param signature method's parameter types / signatures
-    * @return state to which we should move this context, or null if this is not lifecycle invocation
-    * @throws Throwable for any error
-    */
-   public ControllerState lifecycleInvocation(String opName, String[] signature) throws Throwable
-   {
-      if (signature != null && signature.length > 0)
-         return null;
-
-      StateInfo flag = lifecycleOps.get(opName);
-      if (flag == null || flag.opExists == false)
-         return null;
-
-      Controller controller = context.getController();
-      ControllerStateModel model = controller.getStates();
-      ControllerState state = context.getState();
-      if (flag.installPhase)
-      {
-         if (model.isAfterState(flag.state, state))
-            return flag.state;
-         else
-            return state;
-      }
-      else
-      {
-         if (model.isBeforeState(flag.state, state))
-            return flag.state;
-         else
-            return state;
-      }
-   }
-
-   /**
-    * State info holder.
-    */
-   private class StateInfo
-   {
-      boolean opExists;
-      boolean installPhase;
-      ControllerState state;
-
-      private StateInfo(boolean opExists, boolean installPhase, ControllerState state)
-      {
-         this.opExists = opExists;
-         this.installPhase = installPhase;
-         this.state = state;
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/OnlyUnregisterAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/OnlyUnregisterAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/OnlyUnregisterAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.system.ServiceCreator;
-
-/**
- * Only unregister action
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class OnlyUnregisterAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-      MBeanServer server = context.getServiceController().getMBeanServer();
-      ObjectName objectName = context.getObjectName();
-      ServiceCreator.uninstall(server, objectName);
-      context.setTarget(null);
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContext.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContext.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContext.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,401 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Iterator;
-import javax.management.Attribute;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.dependency.plugins.AbstractControllerContext;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.dispatch.LifecycleDispatchContext;
-import org.jboss.system.Service;
-import org.jboss.system.ServiceContext;
-import org.jboss.system.ServiceController;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceMetaDataVisitor;
-import org.jboss.system.metadata.ServiceMetaDataVisitorNode;
-
-/**
- * ServiceControllerContext.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @version $Revision$
- */
-public class ServiceControllerContext extends AbstractControllerContext implements LifecycleDispatchContext
-{
-   /** The ObjectName */
-   private ObjectName objectName;
-   
-   /** The service controller */
-   private ServiceController serviceController;
-   
-   /** The meta data */
-   private ServiceMetaData serviceMetaData;
-   
-   /** The service context */
-   private ServiceContext serviceContext = new ServiceContext();
-
-   // Whether to include the lifecycle
-   private boolean includeLifecycle = true;
-
-   /** The lifecycle info */
-   private volatile LifecycleInfo lifecycleInfo;
-
-   /**
-    * Create a new ServiceControllerContext.
-    * 
-    * @param serviceController the service controller
-    * @param name the name of the context
-    */
-   public ServiceControllerContext(ServiceController serviceController, ObjectName name)
-   {
-      this(serviceController, name, true);
-   }
-   
-   /**
-    * Create a new ServiceControllerContext.
-    *
-    * @param serviceController the service controller
-    * @param name the name of the context
-    * @param includeLifecycle whether to include the lifecycle callouts
-    */
-   public ServiceControllerContext(ServiceController serviceController, ObjectName name, boolean includeLifecycle)
-   {
-      this(serviceController, name, includeLifecycle, null);
-   }
-
-   /**
-    * Create a new ServiceControllerContext.
-    *
-    * @param serviceController the service controller
-    * @param name the name of the context
-    * @param includeLifecycle whether to include the lifecycle callouts
-    * @param target the target
-    */
-   public ServiceControllerContext(ServiceController serviceController, ObjectName name, boolean includeLifecycle, Object target)
-   {
-      super(name.getCanonicalName(), ServiceControllerContextActions.getLifecycleOnly());
-      this.objectName = name;
-      serviceContext.objectName = objectName;
-      this.serviceController = serviceController;
-      setMode(ControllerMode.MANUAL);
-      this.includeLifecycle = includeLifecycle;
-      if (target != null)
-         setTarget(target);
-   }
-
-   /**
-    * Create a new ServiceControllerContext.
-    * 
-    * @param serviceController the service controller
-    * @param metaData the meta data
-    */
-   public ServiceControllerContext(ServiceController serviceController, ServiceMetaData metaData)
-   {
-      super(metaData.getObjectName().getCanonicalName(), ServiceControllerContextActions.getInstance());
-      this.objectName = metaData.getObjectName();
-      serviceContext.objectName = objectName;
-      this.serviceController = serviceController;
-      ControllerMode mode = metaData.getMode();
-      this.serviceMetaData = metaData;
-      if (mode == null)
-         setMode(ControllerMode.MANUAL);
-      else
-         setMode(mode);
-   }
-   
-   /**
-    * Create a new ServiceControllerContext.
-    * 
-    * @param serviceController the service controller
-    * @param name the name
-    * @param target the target
-    */
-   public ServiceControllerContext(ServiceController serviceController, ObjectName name, Object target)
-   {
-      super(name.getCanonicalName(), ServiceControllerContextActions.getInstance());
-      this.objectName = name;
-      serviceContext.objectName = objectName;
-      this.serviceController = serviceController;
-      setTarget(target);
-      setMode(ControllerMode.MANUAL);
-   }
-
-   private MBeanServer getMBeanServer()
-   {
-      MBeanServer server = serviceController.getMBeanServer();
-      if (server == null)
-      {
-         throw new IllegalStateException("MBeanServer not available.");
-      }
-      return server;
-   }
-
-   protected static String getAttributeName(String name)
-   {
-      if (name == null || name.length() == 0)
-         throw new IllegalArgumentException("Illegal name: " + name);
-
-      char firstCharacter = name.charAt(0);
-      if (Character.isLowerCase(firstCharacter))
-      {
-         String attributeName = String.valueOf(Character.toUpperCase(firstCharacter));
-         if (name.length() > 1)
-            attributeName += name.substring(1);
-         return attributeName;
-      }
-      return name;
-   }
-
-   public Object get(String name) throws Throwable
-   {
-      return getMBeanServer().getAttribute(objectName, getAttributeName(name));
-   }
-
-   public void set(String name, Object value) throws Throwable
-   {
-      Attribute attribute = new Attribute(getAttributeName(name), value);
-      getMBeanServer().setAttribute(objectName, attribute);
-   }
-
-   public Object invoke(String name, Object parameters[], String[] signature) throws Throwable
-   {
-      return getMBeanServer().invoke(objectName, name, parameters, signature);
-   }
-
-   public ClassLoader getClassLoader() throws Throwable
-   {
-      if (serviceMetaData != null)
-      {
-         return getMBeanServer().getClassLoader(serviceMetaData.getClassLoaderName());
-      }
-      else
-      {
-         return getMBeanServer().getClassLoaderFor(objectName);
-      }
-   }
-
-   public ControllerState lifecycleInvocation(String name, Object parameters[], String[] signature) throws Throwable
-   {
-      if (lifecycleInfo == null)
-         lifecycleInfo = new LifecycleInfo(this);
-
-      return lifecycleInfo.lifecycleInvocation(name, signature);
-   }
-
-   /**
-    * Get the ObjectName.
-    * 
-    * @return the ObjectName.
-    */
-   public ObjectName getObjectName()
-   {
-      return objectName;
-   }
-
-   /**
-    * Get the serviceMetaData.
-    * 
-    * @return the serviceMetaData.
-    */
-   public ServiceMetaData getServiceMetaData()
-   {
-      return serviceMetaData;
-   }
-
-   /**
-    * Set the serviceMetaData.
-    * 
-    * @param serviceMetaData the serviceMetaData.
-    */
-   public void setServiceMetaData(ServiceMetaData serviceMetaData)
-   {
-      this.serviceMetaData = serviceMetaData;
-   }
-
-   /**
-    * Get the serviceController.
-    * 
-    * @return the serviceController.
-    */
-   public ServiceController getServiceController()
-   {
-      return serviceController;
-   }
-   
-   /**
-    * Get the service proxy
-    * 
-    * @return the service proxy
-    * @throws Exception for any error
-    */
-   public Service getServiceProxy() throws Exception
-   {
-      if (serviceContext.proxy != null)
-         return serviceContext.proxy;
-      
-      MBeanServer server = serviceController.getMBeanServer();
-      if (server != null)
-         serviceContext.proxy = ServiceProxy.getServiceProxy(objectName, server, includeLifecycle);
-      
-      return serviceContext.proxy;
-   }
-   
-   /**
-    * Get the service context
-    * 
-    * @return the service context
-    */
-   public ServiceContext getServiceContext()
-   {
-      try
-      {
-         serviceContext.proxy = getServiceProxy();
-      }
-      catch (Exception ignored)
-      {
-      }
-      if (getError() != null)
-         serviceContext.setProblem(getError());
-      if (getState() == ControllerState.ERROR)
-         serviceContext.state = ServiceContext.FAILED;
-      return serviceContext;
-   }
-
-   // Overridden to update the service context with any failure
-   public void install(ControllerState fromState, ControllerState toState) throws Throwable
-   {
-      try
-      {
-         super.install(fromState, toState);
-      }
-      catch (Throwable t)
-      {
-         serviceContext.setProblem(t);
-         serviceContext.state = ServiceContext.FAILED;
-         throw t;
-      }
-   }
-
-   // Overridden to update the service context with the installed/not installed state
-   // i.e. of the ServiceController registration
-   // Not to be confused with the microcontainer's (fully) installed state
-   public void setController(Controller controller)
-   {
-      super.setController(controller);
-      if (controller != null)
-      {
-         preprocessMetaData();
-         serviceContext.state = ServiceContext.INSTALLED;
-      }
-      else
-         serviceContext.state = ServiceContext.NOTYETINSTALLED;
-   }
-
-   /**
-    * Preprocess the metadata for this context
-    */
-   protected void preprocessMetaData()
-   {
-      if (serviceMetaData == null)
-         return;
-      PreprocessMetaDataVisitor visitor = new PreprocessMetaDataVisitor();
-      AccessController.doPrivileged(visitor);
-   }
-   
-   /**
-    * A visitor for the metadata that looks for dependencies.
-    */
-   protected class PreprocessMetaDataVisitor implements ServiceMetaDataVisitor, PrivilegedAction<Object>
-   {
-      /** The current context for when the dependencies are required */ 
-      private ControllerState contextState = ControllerState.INSTANTIATED;
-      
-      /**
-       * Visit the bean metadata node, this is the starting point
-       */
-      public Object run()
-      {
-         serviceMetaData.visit(this);
-         return null;
-      }
-      
-      /**
-       * Visit a node
-       * 
-       * @param node the node
-       */
-      public void visit(ServiceMetaDataVisitorNode node)
-      {
-         boolean trace = log.isTraceEnabled();
-         if (trace)
-            log.trace("Visit node " + node);
-         
-         // Visit the children of this node
-         Iterator<? extends ServiceMetaDataVisitorNode> children = node.getChildren();
-         if (children != null)
-         {
-            ControllerState restoreState = contextState;
-            while (children.hasNext())
-            {
-               ServiceMetaDataVisitorNode child = children.next();
-               try
-               {
-                  child.visit(this);
-               }
-               finally
-               {
-                  contextState = restoreState;
-               }
-            }
-         }
-      }
-
-      public ServiceControllerContext getControllerContext()
-      {
-         return ServiceControllerContext.this;
-      }
-      
-      public ControllerState getContextState()
-      {
-         return contextState;
-      }
-      
-      public void addDependency(DependencyItem dependency)
-      {
-         getDependencyInfo().addIDependOn(dependency);
-      }
-
-      public void setContextState(ControllerState contextState)
-      {
-         this.contextState = contextState;
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import org.jboss.dependency.plugins.action.SimpleControllerContextAction;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.logging.Logger;
-
-/**
- * ServiceControllerContextAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @version $Revision$
- */
-public class ServiceControllerContextAction extends SimpleControllerContextAction<ServiceControllerContext>
-{
-   protected Logger log = Logger.getLogger(getClass());
-
-   protected ServiceControllerContext contextCast(ControllerContext context)
-   {
-      return ServiceControllerContext.class.cast(context);
-   }
-
-   protected boolean validateContext(ControllerContext context)
-   {
-      return (context instanceof ServiceControllerContext);
-   }
-
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextActions.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextActions.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceControllerContextActions.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.dependency.plugins.AbstractControllerContextActions;
-import org.jboss.dependency.plugins.action.ControllerContextAction;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * ServiceControllerContextActions.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class ServiceControllerContextActions extends AbstractControllerContextActions
-{
-   /** The single instance */
-   private static ServiceControllerContextActions instance;
-   /** The lifecycle instance */
-   private static ServiceControllerContextActions lifecycleOnly;
-
-   /**
-    * Get the instance
-    * 
-    * @return the actions
-    */
-   public static ServiceControllerContextActions getInstance()
-   {
-      if (instance == null)
-      {
-         Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
-         actions.put(ControllerState.DESCRIBED, new DescribeAction());
-         actions.put(ControllerState.INSTANTIATED, new InstantiateAction());
-         actions.put(ControllerState.CONFIGURED, new ConfigureAction());
-         actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction());
-         actions.put(ControllerState.START, new StartStopLifecycleAction());
-         actions.put(ControllerState.INSTALLED, new InstallAction());
-         instance = new ServiceControllerContextActions(actions);
-      }
-      return instance;
-   }
-
-   /**
-    * Get the instance
-    * 
-    * @return the actions
-    */
-   public static ServiceControllerContextActions getLifecycleOnly()
-   {
-      if (lifecycleOnly == null)
-      {
-         Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
-         actions.put(ControllerState.INSTANTIATED, new OnlyUnregisterAction());
-         actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction());
-         actions.put(ControllerState.START, new StartStopLifecycleAction());
-         lifecycleOnly = new ServiceControllerContextActions(actions);
-      }
-      return lifecycleOnly;
-   }
-
-   
-   /**
-    * Create a new ServiceControllerContextActions.
-    * 
-    * @param actions the actions
-    */
-   protected ServiceControllerContextActions(Map<ControllerState, ControllerContextAction> actions)
-   {
-      super(actions);
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceProxy.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceProxy.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/ServiceProxy.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,227 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.system.Service;
-import org.jboss.system.ServiceController;
-
-/**
- * An implementation of InvocationHandler used to proxy of the Service
- * interface for mbeans. It determines which of the start/stop
- * methods of the Service interface an mbean implements by inspecting its
- * MBeanOperationInfo values. Each Service interface method that has a
- * matching operation is forwarded to the mbean by invoking the method
- * through the MBeanServer object.<p>
- * 
- * This class is based on the old ServiceConfigurator
- * 
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @version $Revision$
- */
-public class ServiceProxy implements InvocationHandler
-{
-   /**
-    * A mapping from the Service interface method names to the corresponding
-    * index into the ServiceProxy.hasOp array.
-    */
-   private static Map<String, Integer> serviceOpMap = new HashMap<String, Integer>();
-
-   // A singleton proxy with no callouts
-   private static Service NO_LIFECYCLE_CALLOUT;
-
-   /**
-    * Initialize the service operation map.
-    */
-   static
-   {
-      serviceOpMap.put("create", 0);
-      serviceOpMap.put("start", 1);
-      serviceOpMap.put("destroy", 2);
-      serviceOpMap.put("stop", 3);
-      Class<?>[] interfaces = { Service.class };
-      NO_LIFECYCLE_CALLOUT = (Service) Proxy.newProxyInstance(Service.class.getClassLoader(), interfaces, NoLifecycleCallout.INSTANCE);
-   }
-
-   private boolean[] hasOp = {false, false, false, false};
-   private ObjectName objectName;
-   private MBeanServer server;
-
-   /** Whether we have the lifecycle method */
-   private boolean hasJBossInternalLifecycle;
-
-   /**
-    * Get the Service interface through which the mbean given by objectName will be managed.
-    *
-    * @param objectName the object name
-    * @param server the mbean server
-    * @return The Service value
-    * @throws Exception for any error
-    */
-   public static Service getServiceProxy(ObjectName objectName, MBeanServer server) throws Exception
-   {
-      return getServiceProxy(objectName, server, true);
-   }
-
-   /**
-    * Get the Service interface through which the mbean given by objectName will be managed.
-    *
-    * @param objectName the object name
-    * @param server the mbean server
-    * @param includeLifecycle include lifecycle
-    * @return The Service value
-    * @throws Exception for any error
-    */
-   public static Service getServiceProxy(ObjectName objectName, MBeanServer server, boolean includeLifecycle) throws Exception
-   {
-      if (includeLifecycle)
-      {
-         MBeanInfo info = server.getMBeanInfo(objectName);
-         MBeanOperationInfo[] opInfo = info.getOperations();
-         Class<?>[] interfaces = { Service.class };
-         InvocationHandler handler = new ServiceProxy(objectName, server, opInfo);
-         return (Service) Proxy.newProxyInstance(Service.class.getClassLoader(), interfaces, handler);
-      }
-      else
-      {
-         return NO_LIFECYCLE_CALLOUT;
-      }
-   }
-
-   /**
-    * Go through the opInfo array and for each operation that matches on of
-    * the Service interface methods set the corresponding hasOp array value
-    * to true.
-    *
-    * @param objectName the object name
-    * @param server the mbean server
-    * @param opInfo the MBean operation info
-    */
-   public ServiceProxy(ObjectName objectName, MBeanServer server, MBeanOperationInfo[] opInfo)
-   {
-      this.server = server;
-      this.objectName = objectName;
-
-      for (MBeanOperationInfo info : opInfo)
-      {
-         String name = info.getName();
-
-         if (name.equals(ServiceController.JBOSS_INTERNAL_LIFECYCLE))
-         {
-            hasJBossInternalLifecycle = true;
-            continue;
-         }
-
-         Integer opID = serviceOpMap.get(name);
-         if (opID == null)
-         {
-            continue;
-         }
-
-         // Validate that is a no-arg void return type method
-         if (info.getReturnType().equals("void") == false)
-         {
-            continue;
-         }
-         if (info.getSignature().length != 0)
-         {
-            continue;
-         }
-
-         hasOp[opID] = true;
-      }
-   }
-
-   /**
-    * Map the method name to a Service interface method index and if the
-    * corresponding hasOp array element is true, dispatch the method to the
-    * mbean we are proxying.
-    *
-    * @param proxy the proxy
-    * @param method the method
-    * @param args the args
-    * @return always null.
-    * @throws Throwable for any error
-    */
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      String name = method.getName();
-
-      if (hasJBossInternalLifecycle)
-      {
-         try
-         {
-            server.invoke(objectName, ServiceController.JBOSS_INTERNAL_LIFECYCLE, new Object[] { name }, ServiceController.JBOSS_INTERNAL_LIFECYCLE_SIG);
-            return null;
-         }
-         catch (Exception e)
-         {
-            throw JMXExceptionDecoder.decode(e);
-         }
-      }
-
-      Integer opID = serviceOpMap.get(name);
-
-      if (opID != null && hasOp[opID])
-      {
-         // deal with those pesky JMX exceptions
-         try
-         {
-            String[] sig = {};
-            server.invoke(objectName, name, args, sig);
-         }
-         catch (Exception e)
-         {
-            throw JMXExceptionDecoder.decode(e);
-         }
-      }
-
-      return null;
-   }
-
-   private static class NoLifecycleCallout implements InvocationHandler
-   {
-      private static NoLifecycleCallout INSTANCE = new NoLifecycleCallout();
-
-      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-      {
-         return null;
-      }
-   }
-}

Deleted: trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/StartStopLifecycleAction.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/StartStopLifecycleAction.java	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/system-jmx/src/main/java/org/jboss/system/microcontainer/StartStopLifecycleAction.java	2010-01-18 17:51:38 UTC (rev 99545)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.system.microcontainer;
-
-import javax.management.ObjectName;
-
-import org.jboss.system.Service;
-import org.jboss.system.ServiceContext;
-import org.jboss.system.ServiceController;
-import org.jboss.system.ServiceMBean;
-
-/**
- * StartStopLifecycleAction.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class StartStopLifecycleAction extends ServiceControllerContextAction
-{
-   public void installAction(ServiceControllerContext context) throws Throwable
-   {
-      Service service = context.getServiceProxy();
-      service.start();
-
-      context.getServiceContext().state = ServiceContext.RUNNING;
-
-      ObjectName objectName = context.getObjectName();
-      ServiceController serviceController = context.getServiceController();
-      serviceController.sendControllerNotification(ServiceMBean.START_EVENT, objectName);            
-   }
-
-   public void uninstallAction(ServiceControllerContext context)
-   {
-      try
-      {
-         Service service = context.getServiceProxy();
-         service.stop();
-
-         context.getServiceContext().state = ServiceContext.STOPPED;
-
-         ObjectName objectName = context.getObjectName();
-         ServiceController serviceController = context.getServiceController();
-         serviceController.sendControllerNotification(ServiceMBean.STOP_EVENT, objectName);            
-      }
-      catch (Throwable t)
-      {
-         log.debug("Error during stop for " + context.getObjectName(), t);
-      }
-   }
-}

Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml	2010-01-18 15:58:45 UTC (rev 99544)
+++ trunk/testsuite/build.xml	2010-01-18 17:51:38 UTC (rev 99545)
@@ -334,6 +334,7 @@
       <fileset refid="org.jboss.deployers:jboss-deployers-core:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-core-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-impl:jar"/>
+      <fileset refid="org.jboss.deployers:jboss-deployers-jmx:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-structure-spi:jar"/>
       <fileset refid="org.jboss.deployers:jboss-deployers-vfs-spi:jar"/>
@@ -344,6 +345,7 @@
       <fileset refid="org.jboss.kernel:jboss-aop-mc-int:jar"/>
       <fileset refid="org.jboss.kernel:jboss-dependency:jar"/>
       <fileset refid="org.jboss.kernel:jboss-kernel:jar"/>
+      <fileset refid="org.jboss.kernel:jboss-jmx-mc-int:jar"/>
 
    	  <!-- For classloader leak tests -->
       <fileset refid="jboss.profiler.jvmti:jboss-profiler-jvmti:jar"/>




More information about the jboss-cvs-commits mailing list