[jboss-cvs] JBossAS SVN: r79824 - in trunk: management/src/main/org/jboss/management/j2ee and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 21 07:59:06 EDT 2008


Author: alesj
Date: 2008-10-21 07:59:06 -0400 (Tue, 21 Oct 2008)
New Revision: 79824

Added:
   trunk/management/src/main/org/jboss/management/j2ee/deployers/
   trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java
   trunk/server/src/etc/deployers/jsr77-deployers-jboss-beans.xml
Removed:
   trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java
   trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java
Modified:
   trunk/management/build.xml
   trunk/management/pom.xml
   trunk/management/src/main/org/jboss/management/j2ee/WebModule.java
   trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java
   trunk/server/src/etc/conf/default/jboss-service.xml
   trunk/testsuite/src/main/org/jboss/test/management/test/DeploymentDescriptorUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java
Log:
[JBAS-5545]; jsr77 initial impl.
Still TODOs for the actual mbeans.

Modified: trunk/management/build.xml
===================================================================
--- trunk/management/build.xml	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/management/build.xml	2008-10-21 11:59:06 UTC (rev 79824)
@@ -94,6 +94,10 @@
       <path refid="jboss.jboss.javaee.classpath"/>
       <path refid="jboss.metadata.classpath"/>
       <path refid="jboss.microcontainer.classpath"/>
+      <path refid="jboss.jboss.deployers.classpath"/>
+      <path refid="jboss.jboss.vfs.classpath"/>
+      <path refid="jboss.jboss.man.classpath"/>
+      <path refid="jboss.jbossxb.classpath"/>
       <path refid="sun.jaxb.classpath"/>
     </path>
 

Modified: trunk/management/pom.xml
===================================================================
--- trunk/management/pom.xml	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/management/pom.xml	2008-10-21 11:59:06 UTC (rev 79824)
@@ -41,6 +41,10 @@
   <dependencies>
     <!-- Compile (global dependencies) -->
     <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.jbossas</groupId>
       <artifactId>jboss-as-server</artifactId>
     </dependency>

Modified: trunk/management/src/main/org/jboss/management/j2ee/WebModule.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/WebModule.java	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/management/src/main/org/jboss/management/j2ee/WebModule.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -21,11 +21,6 @@
  */
 package org.jboss.management.j2ee;
 
-import org.jboss.logging.Logger;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -33,7 +28,12 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 
+import org.jboss.logging.Logger;
+
 /**
  * The JBoss JSR-77.3.16 implementation of the WebModule model
  *
@@ -155,7 +155,7 @@
       }
       catch (Exception e)
       {
-         log.debug("Could not create JSR-77 WebModule: " + warName, e);
+         log.error("Could not create JSR-77 WebModule: " + warName, e);
          return null;
       }
       return jsr77Name;

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers)

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,186 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import java.util.Collections;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractOptionalRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-
-/**
- * Abstract jsr77 deployer.
- *
- * @param <T> exact input type
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractJSR277Deployer<T> extends AbstractOptionalRealDeployer<T>
-{
-   private boolean requiresVFSDeployment;
-
-   private MBeanServer server;
-
-   protected AbstractJSR277Deployer(Class<T> input)
-   {
-      super(input);
-      setOutput(ObjectName.class);
-      setDisableOptional(true);
-   }
-
-   /**
-    * Inject the mbean server.
-    *
-    * @param server the mbean server
-    */
-   @Inject(bean = "JMXKernel", property = "mbeanServer")
-   public void setServer(MBeanServer server)
-   {
-      this.server = server;
-   }
-
-   /**
-    * Set the requires vfs flag.
-    *
-    * @param requiresVFSDeployment the requires vfs flag
-    */
-   public void setRequiresVFSDeployment(boolean requiresVFSDeployment)
-   {
-      this.requiresVFSDeployment = requiresVFSDeployment;
-   }
-
-   /**
-    * Deploy jsr77 view.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    * @throws Throwable for any error
-    */
-   protected abstract void deployJsr77(MBeanServer server, DeploymentUnit unit, T metaData) throws Throwable;
-
-   /**
-    * Undeploy jsr77 view.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    */
-   protected abstract void undeployJsr77(MBeanServer server, DeploymentUnit unit, T metaData);
-
-   /**
-    * Put top level object name.
-    *
-    * @param unit the deployment unit
-    * @param attachmentName the attachment name
-    * @param name the object name
-    */
-   protected static void putObjectName(DeploymentUnit unit, String attachmentName, ObjectName name)
-   {
-      unit.addAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), name, ObjectName.class);
-   }
-
-   /**
-    * Get object name from attachment.
-    *
-    * @param unit the deployment unit
-    * @param attachmentName the attachment name
-    * @return object name from attachment
-    */
-   protected static ObjectName getObjectName(DeploymentUnit unit, String attachmentName)
-   {
-      return unit.getAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), ObjectName.class);
-   }
-
-   /**
-    * Remove object name from attachment.
-    *
-    * @param unit the deployment unit
-    * @param attachmentName the attachment name
-    * @return object name from attachment
-    */
-   protected static ObjectName removeObjectName(DeploymentUnit unit, String attachmentName)
-   {
-      return unit.removeAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), ObjectName.class);
-   }
-
-   /**
-    * Extract root object name from parameters.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    * @return root's object name
-    * @throws IllegalArgumentException for any error
-    */
-   protected ObjectName extractRootObjectName(MBeanServer server, DeploymentUnit unit, T metaData)
-   {
-      try
-      {
-         // TODO - fake object name, this method should be made abstract!
-         return new ObjectName("jboss.service:type=" + metaData.getClass().getSimpleName() + ",unit=" + unit.getSimpleName());
-      }
-      catch (Throwable t)
-      {
-         throw new IllegalArgumentException("Cannot extract root ObjectName.", t);
-      }
-   }
-
-   /**
-    * Extract object names for components from parameters.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    * @return root's object name
-    * @throws IllegalArgumentException for any error
-    */
-   protected Iterable<ObjectName> extractComponentObjectNames(MBeanServer server, DeploymentUnit unit, T metaData)
-   {
-      // TODO - empty object names, this method should be made abstract!
-      return Collections.emptySet();
-   }
-
-   public void deploy(DeploymentUnit unit, T metaData) throws DeploymentException
-   {
-      if (server != null && unit instanceof VFSDeploymentUnit == requiresVFSDeployment)
-      {
-         try
-         {
-            deployJsr77(server, unit, metaData);
-         }
-         catch (Throwable t)
-         {
-            throw DeploymentException.rethrowAsDeploymentException("Cannot deploy jsr77.", t);
-         }
-      }
-   }
-
-   public void undeploy(DeploymentUnit unit, T metaData)
-   {
-      if (server != null && unit instanceof VFSDeploymentUnit == requiresVFSDeployment)
-         undeployJsr77(server, unit, metaData);
-   }
-}

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,191 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import java.util.Collections;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * Abstract jsr77 deployer.
+ *
+ * @param <T> exact input type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractJSR277Deployer<T> extends AbstractSimpleRealDeployer<T>
+{
+   private boolean requiresVFSDeployment;
+
+   private MBeanServer server;
+
+   protected AbstractJSR277Deployer(Class<T> input)
+   {
+      super(input);
+      setOutput(ObjectName.class);
+   }
+
+   /**
+    * Inject the mbean server.
+    *
+    * @param server the mbean server
+    */
+   @Inject(bean = "JMXKernel", property = "mbeanServer")
+   public void setServer(MBeanServer server)
+   {
+      this.server = server;
+   }
+
+   /**
+    * Set the requires vfs flag.
+    *
+    * @param requiresVFSDeployment the requires vfs flag
+    */
+   public void setRequiresVFSDeployment(boolean requiresVFSDeployment)
+   {
+      this.requiresVFSDeployment = requiresVFSDeployment;
+   }
+
+   /**
+    * Deploy jsr77 view.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    * @throws Throwable for any error
+    */
+   protected abstract void deployJsr77(MBeanServer server, DeploymentUnit unit, T metaData) throws Throwable;
+
+   /**
+    * Undeploy jsr77 view.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    */
+   protected abstract void undeployJsr77(MBeanServer server, DeploymentUnit unit, T metaData);
+
+   /**
+    * Put top level object name.
+    *
+    * @param unit the deployment unit
+    * @param attachmentName the attachment name
+    * @param name the object name
+    */
+   protected static void putObjectName(DeploymentUnit unit, String attachmentName, ObjectName name)
+   {
+      unit.addAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), name, ObjectName.class);
+   }
+
+   /**
+    * Get object name from attachment.
+    *
+    * @param unit the deployment unit
+    * @param attachmentName the attachment name
+    * @return object name from attachment
+    */
+   protected static ObjectName getObjectName(DeploymentUnit unit, String attachmentName)
+   {
+      return unit.getAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), ObjectName.class);
+   }
+
+   /**
+    * Remove object name from attachment.
+    *
+    * @param unit the deployment unit
+    * @param attachmentName the attachment name
+    * @return object name from attachment
+    */
+   protected static ObjectName removeObjectName(DeploymentUnit unit, String attachmentName)
+   {
+      return unit.removeAttachment(attachmentName + "." + ObjectName.class.getSimpleName(), ObjectName.class);
+   }
+
+   /**
+    * Extract root object name from parameters.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    * @return root's object name
+    * @throws IllegalArgumentException for any error
+    */
+   protected ObjectName extractRootObjectName(MBeanServer server, DeploymentUnit unit, T metaData)
+   {
+      try
+      {
+         // TODO - fake object name, this method should be made abstract!
+         return new ObjectName("jboss.service:type=" + metaData.getClass().getSimpleName() + ",unit=" + unit.getSimpleName());
+      }
+      catch (Throwable t)
+      {
+         throw new IllegalArgumentException("Cannot extract root ObjectName.", t);
+      }
+   }
+
+   /**
+    * Extract object names for components from parameters.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    * @return root's object name
+    * @throws IllegalArgumentException for any error
+    */
+   protected Iterable<ObjectName> extractComponentObjectNames(MBeanServer server, DeploymentUnit unit, T metaData)
+   {
+      // TODO - empty object names, this method should be made abstract!
+      return Collections.emptySet();
+   }
+
+   public void deploy(DeploymentUnit unit, T metaData) throws DeploymentException
+   {
+      if (server != null && unit instanceof VFSDeploymentUnit == requiresVFSDeployment)
+      {
+         try
+         {
+            deployJsr77(server, unit, metaData);
+         }
+         catch (Throwable t)
+         {
+            throw DeploymentException.rethrowAsDeploymentException("Cannot deploy jsr77.", t);
+         }
+      }
+      else if (log.isTraceEnabled())
+      {
+         log.trace("Missing mbean server or deployment unit type mismatch.");
+      }
+   }
+
+   public void undeploy(DeploymentUnit unit, T metaData)
+   {
+      if (server != null && unit instanceof VFSDeploymentUnit == requiresVFSDeployment)
+         undeployJsr77(server, unit, metaData);
+      else if (log.isTraceEnabled())
+         log.trace("Missing mbean server or deployment unit type mismatch.");
+   }
+}

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,73 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-
-/**
- * Abstract vfs jsr77 deployer.
- *
- * @param <T> exact input type
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractVFSJSR277Deployer<T> extends AbstractJSR277Deployer<T>
-{
-   protected AbstractVFSJSR277Deployer(Class<T> input)
-   {
-      super(input);
-      setRequiresVFSDeployment(true);
-   }
-
-   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, T metaData) throws Throwable
-   {
-      if (unit instanceof VFSDeploymentUnit)
-         deployJsr77(server, (VFSDeploymentUnit)unit, metaData);
-   }
-
-   /**
-    * Deploy jsr77 view.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    * @throws Throwable for any error
-    */
-   protected abstract void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, T metaData) throws Throwable;
-
-   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, T metaData)
-   {
-      if (unit instanceof VFSDeploymentUnit)
-         undeployJsr77(server, (VFSDeploymentUnit)unit, metaData);
-   }
-
-   /**
-    * Undeploy jsr77 view.
-    *
-    * @param server the mbean server
-    * @param unit the deployment unit
-    * @param metaData the metadata
-    */
-   protected abstract void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, T metaData);
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/AbstractVFSJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * Abstract vfs jsr77 deployer.
+ *
+ * @param <T> exact input type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractVFSJSR277Deployer<T> extends AbstractJSR277Deployer<T>
+{
+   protected AbstractVFSJSR277Deployer(Class<T> input)
+   {
+      super(input);
+      setRequiresVFSDeployment(true);
+   }
+
+   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, T metaData) throws Throwable
+   {
+      if (unit instanceof VFSDeploymentUnit)
+         deployJsr77(server, (VFSDeploymentUnit)unit, metaData);
+   }
+
+   /**
+    * Deploy jsr77 view.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    * @throws Throwable for any error
+    */
+   protected abstract void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, T metaData) throws Throwable;
+
+   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, T metaData)
+   {
+      if (unit instanceof VFSDeploymentUnit)
+         undeployJsr77(server, (VFSDeploymentUnit)unit, metaData);
+   }
+
+   /**
+    * Undeploy jsr77 view.
+    *
+    * @param server the mbean server
+    * @param unit the deployment unit
+    * @param metaData the metadata
+    */
+   protected abstract void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, T metaData);
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,63 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.management.j2ee.J2EEApplication;
-import org.jboss.metadata.ear.jboss.JBossAppMetaData;
-
-/**
- * Ear module jsr77 view.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class EarModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossAppMetaData>
-{
-   public EarModuleJSR277Deployer()
-   {
-      super(JBossAppMetaData.class);
-      setTopLevelOnly(true);
-   }
-
-   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossAppMetaData metaData) throws Throwable
-   {
-      ObjectName jsr77Name = J2EEApplication.create(server, unit.getSimpleName(), unit.getRoot().toURL());
-      if (jsr77Name != null)
-      {
-         putObjectName(unit, J2EEApplication.class.getName(), jsr77Name);
-         log.debug("Created J2EEApplication: " + jsr77Name);
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossAppMetaData metaData)
-   {
-      ObjectName jsr77Name = removeObjectName(unit, J2EEApplication.class.getName());
-      if (jsr77Name != null)
-      {
-         J2EEApplication.destroy(server, jsr77Name);
-         log.debug("Removed J2EEApplication: " + jsr77Name);
-      }
-   }
-}

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/EarModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.management.j2ee.J2EEApplication;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+
+/**
+ * Ear module jsr77 view.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class EarModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossAppMetaData>
+{
+   public EarModuleJSR277Deployer()
+   {
+      super(JBossAppMetaData.class);
+      setTopLevelOnly(true);
+   }
+
+   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossAppMetaData metaData) throws Throwable
+   {
+      ObjectName jsr77Name = J2EEApplication.create(server, unit.getSimpleName(), unit.getRoot().toURL());
+      if (jsr77Name != null)
+      {
+         putObjectName(unit, J2EEApplication.class.getName(), jsr77Name);
+         log.debug("Created J2EEApplication: " + jsr77Name);
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossAppMetaData metaData)
+   {
+      ObjectName jsr77Name = removeObjectName(unit, J2EEApplication.class.getName());
+      if (jsr77Name != null)
+      {
+         J2EEApplication.destroy(server, jsr77Name);
+         log.debug("Removed J2EEApplication: " + jsr77Name);
+      }
+   }
+}

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,141 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.ejb.EjbModule;
-import org.jboss.management.j2ee.EJB;
-import org.jboss.management.j2ee.EJBModule;
-import org.jboss.management.j2ee.factory.FactoryUtils;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.SessionMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-
-/**
- * Ejb module jsr77 view.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class EjbModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossMetaData>
-{
-   public EjbModuleJSR277Deployer()
-   {
-      super(JBossMetaData.class);
-   }
-
-   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossMetaData metaData) throws Throwable
-   {
-      String ejbJarName = unit.getSimpleName();
-      ObjectName ejbModuleService = extractRootObjectName(server, unit, metaData); // TODO
-      ObjectName jsr77Name = EJBModule.create(server, FactoryUtils.findEarParent(unit), ejbJarName, unit.getRoot().toURL(), ejbModuleService);
-      putObjectName(unit, ejbModuleService.getCanonicalName(), jsr77Name);
-      putObjectName(unit, EJBModule.class.getName(), jsr77Name);
-      log.debug("Created module: " + jsr77Name);
-      Iterable<ObjectName> ejbs = extractComponentObjectNames(server, unit, metaData); // TODO
-      for (ObjectName containerName : ejbs)
-      {
-         createEJB(server, unit, containerName);
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossMetaData metaData)
-   {
-      ObjectName jsr77Name = removeObjectName(unit, EJBModule.class.getName());
-      log.debug("Destroy module: " + jsr77Name);
-      Iterable<ObjectName> ejbs = extractComponentObjectNames(server, unit, metaData); // TODO
-      for (ObjectName containerName : ejbs)
-      {
-         destroyEJB(server, unit, containerName);
-      }
-      if (jsr77Name != null)
-      {
-         EJBModule.destroy(server, jsr77Name);
-      }
-      ObjectName ejbModuleService = extractRootObjectName(server, unit, metaData); // TODO
-      if (ejbModuleService != null)
-         removeObjectName(unit, ejbModuleService.getCanonicalName());
-   }
-
-   /**
-    * Create an EJB mbean for the container
-    *
-    * @param server - the deployment server
-    * @param unit the deployment unit
-    * @param containerName - the internal ejb container jmx name
-    * @return JSR77 ObjectName of the EJB mbean subtype
-    */
-   @SuppressWarnings("deprecation")
-   public ObjectName createEJB(MBeanServer server, VFSDeploymentUnit unit, ObjectName containerName)
-   {
-      ObjectName jsr77Name = null;
-      try
-      {
-         BeanMetaData metaData = (BeanMetaData) server.getAttribute(containerName, "BeanMetaData");
-         EjbModule ejbModule = (EjbModule) server.getAttribute(containerName, "EjbModule");
-         ObjectName ejbModName = getObjectName(unit, ejbModule.getServiceName().getCanonicalName());
-         String ejbName = metaData.getEjbName();
-         String jndiName = metaData.getJndiName();
-         String localJndiName = metaData.getLocalJndiName();
-         int type = EJB.STATELESS_SESSION_BEAN;
-         if (metaData.isSession())
-         {
-            SessionMetaData smetaData = (SessionMetaData) metaData;
-            if (smetaData.isStateful())
-               type = EJB.STATEFUL_SESSION_BEAN;
-         }
-         else if (metaData.isMessageDriven())
-            type = EJB.MESSAGE_DRIVEN_BEAN;
-         else
-            type = EJB.ENTITY_BEAN;
-
-         jsr77Name = EJB.create(server, ejbModName, containerName, type, ejbName, jndiName, localJndiName);
-         putObjectName(unit, containerName.getCanonicalName(), jsr77Name);
-         log.debug("Create container: " + containerName + ", module: " + jsr77Name);
-      }
-      catch (Exception e)
-      {
-         log.debug("", e);
-      }
-
-      return jsr77Name;
-   }
-
-   /**
-    * Destory JSR-77 J2EEApplication
-    *
-    * @param server the MBeanServer context
-    * @param unit the deployment unit
-    * @param containerName   arbitrary data associated with the creation context
-    */
-   public void destroyEJB(MBeanServer server, VFSDeploymentUnit unit, ObjectName containerName)
-   {
-      ObjectName jsr77Name = removeObjectName(unit, containerName.getCanonicalName());
-      log.debug("Destroy container: " + containerName + ", module: " + jsr77Name);
-      if (jsr77Name != null)
-      {
-         EJB.destroy(server, jsr77Name);
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/EjbModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,141 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb.EjbModule;
+import org.jboss.management.j2ee.EJB;
+import org.jboss.management.j2ee.EJBModule;
+import org.jboss.management.j2ee.factory.FactoryUtils;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.metadata.SessionMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * Ejb module jsr77 view.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class EjbModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossMetaData>
+{
+   public EjbModuleJSR277Deployer()
+   {
+      super(JBossMetaData.class);
+   }
+
+   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossMetaData metaData) throws Throwable
+   {
+      String ejbJarName = unit.getSimpleName();
+      ObjectName ejbModuleService = extractRootObjectName(server, unit, metaData); // TODO
+      ObjectName jsr77Name = EJBModule.create(server, FactoryUtils.findEarParent(unit), ejbJarName, unit.getRoot().toURL(), ejbModuleService);
+      putObjectName(unit, ejbModuleService.getCanonicalName(), jsr77Name);
+      putObjectName(unit, EJBModule.class.getName(), jsr77Name);
+      log.debug("Created module: " + jsr77Name);
+      Iterable<ObjectName> ejbs = extractComponentObjectNames(server, unit, metaData); // TODO
+      for (ObjectName containerName : ejbs)
+      {
+         createEJB(server, unit, containerName);
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossMetaData metaData)
+   {
+      ObjectName jsr77Name = removeObjectName(unit, EJBModule.class.getName());
+      log.debug("Destroy module: " + jsr77Name);
+      Iterable<ObjectName> ejbs = extractComponentObjectNames(server, unit, metaData); // TODO
+      for (ObjectName containerName : ejbs)
+      {
+         destroyEJB(server, unit, containerName);
+      }
+      if (jsr77Name != null)
+      {
+         EJBModule.destroy(server, jsr77Name);
+      }
+      ObjectName ejbModuleService = extractRootObjectName(server, unit, metaData); // TODO
+      if (ejbModuleService != null)
+         removeObjectName(unit, ejbModuleService.getCanonicalName());
+   }
+
+   /**
+    * Create an EJB mbean for the container
+    *
+    * @param server - the deployment server
+    * @param unit the deployment unit
+    * @param containerName - the internal ejb container jmx name
+    * @return JSR77 ObjectName of the EJB mbean subtype
+    */
+   @SuppressWarnings("deprecation")
+   public ObjectName createEJB(MBeanServer server, VFSDeploymentUnit unit, ObjectName containerName)
+   {
+      ObjectName jsr77Name = null;
+      try
+      {
+         BeanMetaData metaData = (BeanMetaData) server.getAttribute(containerName, "BeanMetaData");
+         EjbModule ejbModule = (EjbModule) server.getAttribute(containerName, "EjbModule");
+         ObjectName ejbModName = getObjectName(unit, ejbModule.getServiceName().getCanonicalName());
+         String ejbName = metaData.getEjbName();
+         String jndiName = metaData.getJndiName();
+         String localJndiName = metaData.getLocalJndiName();
+         int type = EJB.STATELESS_SESSION_BEAN;
+         if (metaData.isSession())
+         {
+            SessionMetaData smetaData = (SessionMetaData) metaData;
+            if (smetaData.isStateful())
+               type = EJB.STATEFUL_SESSION_BEAN;
+         }
+         else if (metaData.isMessageDriven())
+            type = EJB.MESSAGE_DRIVEN_BEAN;
+         else
+            type = EJB.ENTITY_BEAN;
+
+         jsr77Name = EJB.create(server, ejbModName, containerName, type, ejbName, jndiName, localJndiName);
+         putObjectName(unit, containerName.getCanonicalName(), jsr77Name);
+         log.debug("Create container: " + containerName + ", module: " + jsr77Name);
+      }
+      catch (Exception e)
+      {
+         log.debug("", e);
+      }
+
+      return jsr77Name;
+   }
+
+   /**
+    * Destory JSR-77 J2EEApplication
+    *
+    * @param server the MBeanServer context
+    * @param unit the deployment unit
+    * @param containerName   arbitrary data associated with the creation context
+    */
+   public void destroyEJB(MBeanServer server, VFSDeploymentUnit unit, ObjectName containerName)
+   {
+      ObjectName jsr77Name = removeObjectName(unit, containerName.getCanonicalName());
+      log.debug("Destroy container: " + containerName + ", module: " + jsr77Name);
+      if (jsr77Name != null)
+      {
+         EJB.destroy(server, jsr77Name);
+      }
+   }
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,112 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.management.j2ee.JCAResource;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class JCAResourceJSR277Deployer extends AbstractJSR277Deployer<ManagedConnectionFactoryDeploymentGroup>
-{
-   public JCAResourceJSR277Deployer()
-   {
-      super(ManagedConnectionFactoryDeploymentGroup.class);
-   }
-
-   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup metaData) throws Throwable
-   {
-      /* Get the RARDeployment service name by looking for the mbean in the
-      deployment with a name matching service=xxxDS. This relies on the naming
-      pattern created by the JCA CM deployer.
-      */
-      ObjectName rarDeployService = null;
-      ObjectName cmService = null;
-      ObjectName poolService = null;
-      Iterable<ObjectName> iter = extractComponentObjectNames(server, unit, metaData); // TODO
-      for (ObjectName oname : iter)
-      {
-         String name = oname.getKeyProperty("service");
-         if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
-            rarDeployService = oname;
-         else if (name.endsWith("CM"))
-            cmService = oname;
-         else if (name.endsWith("Pool"))
-            poolService = oname;
-      }
-      if (rarDeployService == null || cmService == null)
-      {
-         log.debug("Failed to find a service=xxxDS match");
-         return;
-      }
-
-      try
-      {
-         /* Now to tie this CM back to its rar query the rarDeployService for
-            the org.jboss.resource.RARDeployment service created by the RARDeployer.
-          */
-         ObjectName rarService = (ObjectName) server.getAttribute(rarDeployService, "OldRarDeployment");
-         // Get the ResourceAdapter JSR77 name
-         ObjectName jsr77RAName = getObjectName(unit, rarService.getCanonicalName());
-         // Now build the JCAResource
-         String resName = rarDeployService.getKeyProperty("name");
-         JCAResource.create(server, resName, jsr77RAName, cmService, rarDeployService, poolService);
-      }
-      catch (Exception e)
-      {
-         log.debug("Failed to create JCAResource", e);
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup metaData)
-   {
-      Iterable<ObjectName> mbeans = extractComponentObjectNames(server, unit, metaData); // TODO
-      String resName = getDeploymentResName(mbeans);
-      JCAResource.destroy(server, resName);
-   }
-
-   private String getDeploymentResName(Iterable<ObjectName> mbeans)
-   {
-      String resName = null;
-      /* Get the RARDeployment service name by looking for the mbean in the
-         deployment with a name matching service=xxxDS. This relies on the naming
-         pattern created by the JCA CM deployer.
-      */
-      ObjectName rarDeployService;
-      for (ObjectName oname : mbeans)
-      {
-         String name = oname.getKeyProperty("service");
-         if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
-         {
-            rarDeployService = oname;
-            resName = rarDeployService.getKeyProperty("name");
-            break;
-         }
-      }
-      return resName;
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/JCAResourceJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,114 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.management.j2ee.JCAResource;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
+
+/**
+ * JCA resource jsr77 deployer.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JCAResourceJSR277Deployer extends AbstractJSR277Deployer<ManagedConnectionFactoryDeploymentGroup>
+{
+   public JCAResourceJSR277Deployer()
+   {
+      super(ManagedConnectionFactoryDeploymentGroup.class);
+   }
+
+   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup metaData) throws Throwable
+   {
+      /* Get the RARDeployment service name by looking for the mbean in the
+      deployment with a name matching service=xxxDS. This relies on the naming
+      pattern created by the JCA CM deployer.
+      */
+      ObjectName rarDeployService = null;
+      ObjectName cmService = null;
+      ObjectName poolService = null;
+      Iterable<ObjectName> iter = extractComponentObjectNames(server, unit, metaData); // TODO
+      for (ObjectName oname : iter)
+      {
+         String name = oname.getKeyProperty("service");
+         if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
+            rarDeployService = oname;
+         else if (name.endsWith("CM"))
+            cmService = oname;
+         else if (name.endsWith("Pool"))
+            poolService = oname;
+      }
+      if (rarDeployService == null || cmService == null)
+      {
+         log.debug("Failed to find a service=xxxDS match");
+         return;
+      }
+
+      try
+      {
+         /* Now to tie this CM back to its rar query the rarDeployService for
+            the org.jboss.resource.RARDeployment service created by the RARDeployer.
+          */
+         ObjectName rarService = (ObjectName) server.getAttribute(rarDeployService, "OldRarDeployment");
+         // Get the ResourceAdapter JSR77 name
+         ObjectName jsr77RAName = getObjectName(unit, rarService.getCanonicalName());
+         // Now build the JCAResource
+         String resName = rarDeployService.getKeyProperty("name");
+         JCAResource.create(server, resName, jsr77RAName, cmService, rarDeployService, poolService);
+      }
+      catch (Exception e)
+      {
+         log.debug("Failed to create JCAResource", e);
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup metaData)
+   {
+      Iterable<ObjectName> mbeans = extractComponentObjectNames(server, unit, metaData); // TODO
+      String resName = getDeploymentResName(mbeans);
+      JCAResource.destroy(server, resName);
+   }
+
+   private String getDeploymentResName(Iterable<ObjectName> mbeans)
+   {
+      String resName = null;
+      /* Get the RARDeployment service name by looking for the mbean in the
+         deployment with a name matching service=xxxDS. This relies on the naming
+         pattern created by the JCA CM deployer.
+      */
+      ObjectName rarDeployService;
+      for (ObjectName oname : mbeans)
+      {
+         String name = oname.getKeyProperty("service");
+         if (name.equals("ManagedConnectionFactory") || name.endsWith("DS"))
+         {
+            rarDeployService = oname;
+            resName = rarDeployService.getKeyProperty("name");
+            break;
+         }
+      }
+      return resName;
+   }
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,92 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.management.j2ee.JMSResource;
-import org.jboss.system.metadata.ServiceMetaData;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class JMSResourceJSR277Deployer extends AbstractJSR277Deployer<ServiceMetaData>
-{
-   private Set<String> jmsCodes;
-
-   public JMSResourceJSR277Deployer()
-   {
-      super(ServiceMetaData.class);
-      setComponentsOnly(true);
-   }
-
-   /**
-    * Is service metadata jms resource.
-    *
-    * @param metaData the service metadata
-    * @return true if service metadata code matches one of jms codes
-    */
-   protected boolean isJMSServiceMetaData(ServiceMetaData metaData)
-   {
-      if (jmsCodes == null)
-      {
-         // fill in jms codes
-         jmsCodes = new HashSet<String>();
-         jmsCodes.add("org.jboss.jms.server.destination.QueueService");
-         jmsCodes.add("org.jboss.jms.server.destination.TopicService");
-      }
-
-      String code = metaData.getCode();
-      return jmsCodes.contains(code);
-   }
-
-   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, ServiceMetaData metaData) throws Throwable
-   {
-      if (isJMSServiceMetaData(metaData))
-      {
-         ObjectName serviceName = metaData.getObjectName();
-         JMSResource.create(server, "LocalJMS", serviceName);
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, ServiceMetaData metaData)
-   {
-      if (isJMSServiceMetaData(metaData))
-      {
-         JMSResource.destroy(server, "LocalJMS");  
-      }
-   }
-
-   /**
-    * Set jms codes.
-    *
-    * @param jmsCodes the jms codes
-    */
-   public void setJmsCodes(Set<String> jmsCodes)
-   {
-      this.jmsCodes = jmsCodes;
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/JMSResourceJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.management.j2ee.JMSResource;
+import org.jboss.system.metadata.ServiceMetaData;
+
+/**
+ * JMS resource jsr77 deployer.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JMSResourceJSR277Deployer extends AbstractJSR277Deployer<ServiceMetaData>
+{
+   private Set<String> jmsCodes;
+
+   public JMSResourceJSR277Deployer()
+   {
+      super(ServiceMetaData.class);
+      setComponentsOnly(true);
+   }
+
+   /**
+    * Is service metadata jms resource.
+    *
+    * @param metaData the service metadata
+    * @return true if service metadata code matches one of jms codes
+    */
+   protected boolean isJMSServiceMetaData(ServiceMetaData metaData)
+   {
+      if (jmsCodes == null)
+      {
+         // fill in jms codes
+         jmsCodes = new HashSet<String>();
+         jmsCodes.add("org.jboss.jms.server.destination.QueueService");
+         jmsCodes.add("org.jboss.jms.server.destination.TopicService");
+      }
+
+      String code = metaData.getCode();
+      return jmsCodes.contains(code);
+   }
+
+   protected void deployJsr77(MBeanServer server, DeploymentUnit unit, ServiceMetaData metaData) throws Throwable
+   {
+      if (isJMSServiceMetaData(metaData))
+      {
+         ObjectName serviceName = metaData.getObjectName();
+         JMSResource.create(server, "LocalJMS", serviceName);
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, DeploymentUnit unit, ServiceMetaData metaData)
+   {
+      if (isJMSServiceMetaData(metaData))
+      {
+         JMSResource.destroy(server, "LocalJMS");  
+      }
+   }
+
+   /**
+    * Set jms codes.
+    *
+    * @param jmsCodes the jms codes
+    */
+   public void setJmsCodes(Set<String> jmsCodes)
+   {
+      this.jmsCodes = jmsCodes;
+   }
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,439 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import java.net.InetAddress;
-import java.util.Set;
-import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.management.MBeanRegistration;
-
-import org.jboss.logging.Logger;
-import org.jboss.management.j2ee.J2EEDomain;
-import org.jboss.management.j2ee.J2EEServer;
-import org.jboss.management.j2ee.JVM;
-import org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap;
-import org.jboss.management.j2ee.factory.ManagedObjectFactory;
-import org.jboss.management.j2ee.factory.ManagedObjectFactoryMap;
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.ServiceMBean;
-
-/**
- * Port of the old LocalJBossServerDomain to POJO.
- *
- * @author  <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
- * @author  <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author  <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class LocalJBossServerDomain implements NotificationListener, LocalJBossServerDomainMBean, MBeanRegistration
-{
-   /**
-    * Class logger.
-    */
-   private static final Logger log = Logger.getLogger(LocalJBossServerDomain.class);
-
-   /** The mbean server */
-   private MBeanServer server;
-
-   /** The service name */
-   private ObjectName serviceName;
-
-   /**
-    * The name of the JNDI service
-    */
-   private ObjectName jndiService;
-   /**
-    * The name of the JTA service
-    */
-   private ObjectName jtaService;
-   /**
-    * The name of the UserTransaction service
-    */
-   private ObjectName userTxService;
-   /**
-    * The name of the JavaMail service
-    */
-   private ObjectName mailService;
-   /**
-    * The name of the RMI_IIOP service
-    */
-   private ObjectName rmiiiopService;
-   /**
-    * The name of the service which emites URL binding events
-    */
-   private ObjectName jndiBindingService;
-
-   /**
-    * A mapping of JMX notifications to ManagedObjectFactory instances
-    */
-   private ManagedObjectFactoryMap managedObjFactoryMap;
-
-   /**
-    * The managed factory map class
-    */
-   private Class<?> managedObjFactoryMapClass = DefaultManagedObjectFactoryMap.class;
-
-   /**
-    * @return The JNDI service mbean name
-    */
-   public ObjectName getJNDIService()
-   {
-      return jndiService;
-   }
-
-   /**
-    * @param name The JNDI service mbean name
-    */
-   public void setJNDIService(ObjectName name)
-   {
-      this.jndiService = name;
-   }
-
-   /**
-    * @return The JTA service mbean name
-    */
-   public ObjectName getJTAService()
-   {
-      return jtaService;
-   }
-
-   /**
-    * @param name The JTA service mbean name
-    */
-   public void setJTAService(ObjectName name)
-   {
-      this.jtaService = name;
-   }
-
-   /**
-    * @return The JavaMail service mbean name
-    */
-   public ObjectName getMailService()
-   {
-      return mailService;
-   }
-
-   /**
-    * @param name The JavaMail service mbean name
-    */
-   public void setMailService(ObjectName name)
-   {
-      this.mailService = name;
-   }
-
-   /**
-    * @return The UserTransaction service mbean name
-    */
-   public ObjectName getUserTransactionService()
-   {
-      return userTxService;
-   }
-
-   /**
-    * @param name The UserTransaction service mbean name
-    */
-   public void setUserTransactionService(ObjectName name)
-   {
-      this.userTxService = name;
-   }
-
-   /**
-    * @return The RMI/IIOP service mbean name
-    */
-   public ObjectName getRMI_IIOPService()
-   {
-      return rmiiiopService;
-   }
-
-   /**
-    * @param name The RMI/IIOP service mbean name
-    */
-   public void setRMI_IIOPService(ObjectName name)
-   {
-      this.rmiiiopService = name;
-   }
-
-   /**
-    * @return The Jndi binding service mbean name
-    */
-   public ObjectName getJndiBindingService()
-   {
-      return jndiBindingService;
-   }
-
-   /**
-    * @param name The Jndi binding service mbean name
-    */
-   public void setJndiBindingService(ObjectName name)
-   {
-      this.jndiBindingService = name;
-   }
-
-   /**
-    * @return The ManagementObjFactoryMap class
-    */
-   public Class<?> getManagementObjFactoryMapClass()
-   {
-      return managedObjFactoryMapClass;
-   }
-
-   /**
-    * @param cls The ManagementObjFactoryMap class
-    */
-   public void setManagementObjFactoryMapClass(Class<?> cls)
-   {
-      this.managedObjFactoryMapClass = cls;
-   }
-
-   public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
-   {
-      this.server = server;
-      this.serviceName = name;
-      return name;
-   }
-
-   public void postRegister(Boolean registrationDone)
-   {
-      if (registrationDone)
-      {
-         try
-         {
-            createService();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-   }
-
-   public void preDeregister() throws Exception
-   {
-      destroyService();
-   }
-
-   public void postDeregister()
-   {
-   }
-
-   /**
-    * The JMX nofication callback. Here we create/destroy JSR77 MBeans based
-    * on the create/destory notifications.
-    *
-    * @param msg      the notification msg
-    * @param handback currently unused
-    */
-   public void handleNotification(Notification msg, Object handback)
-   {
-      if (managedObjFactoryMap == null || server == null)
-      {
-         return;
-      }
-
-      log.debug("handleNotification: " + msg);
-      String type = msg.getType();
-      Object userData = msg.getUserData();
-      try
-      {
-         if (type.equals(ServiceMBean.CREATE_EVENT))
-         {
-            ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
-            if (factory != null)
-            {
-               factory.create(server, userData);
-            }
-         }
-         else if (type.equals(ServiceMBean.DESTROY_EVENT))
-         {
-            ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
-            if (factory != null)
-            {
-               factory.destroy(server, userData);
-            }
-         }
-      }
-      catch (Throwable t)
-      {
-         log.debug("Failed to handle event", t);
-      }
-   }
-
-   public String toString()
-   {
-      return "LocalJBossServerDomain { " + super.toString() + " }";
-   }
-
-   protected void createService() throws Exception
-   {
-      setupJ2EEMBeans();
-      registerWithController();
-      populateFactoryMap();
-   }
-
-   /**
-    * Called to destroy the service. This unregisters with all deployers and
-    * then removes all MBeans in this services domain to remove all JSR77
-    * beans.
-    *
-    * @throws Exception for any error
-    */
-   protected void destroyService() throws Exception
-   {
-      cleanupLeftoverMBeans();
-      unregisterWithController();
-   }
-
-   /**
-    * Build the ManagedObjectFactoryMap used to obtain the ManagedObjectFactory
-    * instances from notification msgs.
-    *
-    * @throws Exception for any error
-    */
-   private void populateFactoryMap() throws Exception
-   {
-      // Create the ManagedObjectFactoryMap
-      managedObjFactoryMap = (ManagedObjectFactoryMap) managedObjFactoryMapClass.newInstance();
-      managedObjFactoryMap.setJNDIResource(jndiService);
-      managedObjFactoryMap.setJTAResource(jtaService);
-      managedObjFactoryMap.setJTAResource(userTxService);
-      managedObjFactoryMap.setJavaMailResource(mailService);
-      managedObjFactoryMap.setRMI_IIOPResource(rmiiiopService);
-   }
-
-   /**
-    * Create the J2EEServer and JVM MBeans.
-    */
-   private void setupJ2EEMBeans()
-   {
-      // Create Server Component
-      try
-      {
-         log.debug("setupJ2EEMBeans(), create J2EEServer instance");
-         Package pkg = Package.getPackage("org.jboss");
-         String vendor = pkg.getSpecificationVendor();
-         String version = pkg.getImplementationVersion();
-         // Create the createService
-         J2EEDomain serverDomain = new J2EEDomain(serviceName.getDomain());
-         ObjectName domain = serverDomain.getObjectName();
-         server.registerMBean(serverDomain, domain);
-         // Create single Local J2EEServer MBean
-         J2EEServer j2eeServer = new J2EEServer("Local", domain, vendor, version);
-         ObjectName lServer = j2eeServer.getObjectName();
-         server.registerMBean(j2eeServer, lServer);
-
-         // Create the JVM MBean
-         String hostName = "localhost";
-         try
-         {
-            InetAddress lLocalHost = InetAddress.getLocalHost();
-            hostName = lLocalHost.getHostName();
-         }
-         catch (Exception e)
-         {
-            // Ignore when host address is not accessible (localhost is used instead)
-         }
-         String vmVendor = System.getProperty("java.vendor");
-         String vmVersion = System.getProperty("java.version");
-         String name = vmVendor + " " + vmVersion;
-         JVM jvm = new JVM(name, lServer, vmVersion, vmVendor, hostName);
-         ObjectName jvmName = jvm.getObjectName();
-         server.registerMBean(jvm, jvmName);
-      }
-      catch (JMException jme)
-      {
-         log.debug("setupJ2EEMBeans - unexpected JMException", jme);
-      }
-      catch (Exception e)
-      {
-         log.debug("setupJ2EEMBeans - unexpected exception", e);
-      }
-   }
-
-   /**
-    * Register as a listener of the ServiceControllerMBean
-    */
-   private void registerWithController()
-   {
-      try
-      {
-         server.addNotificationListener(ServiceControllerMBean.OBJECT_NAME, this, null, null);
-         log.debug("Registered as listener of: " + ServiceControllerMBean.OBJECT_NAME);
-      }
-      catch (JMException jme)
-      {
-         log.debug("unexpected exception", jme);
-      }
-      catch (Exception e)
-      {
-         log.debug("unexpected exception", e);
-      }
-   }
-
-   /**
-    * Unregister as a listener of the ServiceControllerMBean.
-    */
-   private void unregisterWithController()
-   {
-      try
-      {
-         server.removeNotificationListener(ServiceControllerMBean.OBJECT_NAME, this);
-         log.debug("UNRegistered as listener of: " + ServiceControllerMBean.OBJECT_NAME);
-      }
-      catch (JMException jme)
-      {
-         log.debug("unexpected exception", jme);
-      }
-      catch (Exception e)
-      {
-         log.debug("unexpected exception", e);
-      }
-   }
-
-   /**
-    * Query for all mbeans in this services domain and unregisters them.
-    *
-    * @throws Exception if the domain query fails
-    */
-   private void cleanupLeftoverMBeans() throws Exception
-   {
-      String domain = serviceName.getDomain();
-      ObjectName domainName = new ObjectName(domain + ":*");
-      Set domainNames = server.queryNames(domainName, null);
-      log.debug("Found " + domainNames.size() + " domain mbeans");
-      for (Object name : domainNames)
-      {
-         try
-         {
-            ObjectName oname = (ObjectName)name;
-            if (oname.equals(serviceName) == false)
-               server.unregisterMBean(oname);
-         }
-         catch (MBeanException ignore)
-         {
-         }
-      }
-   }
-}

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomain.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,439 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import java.net.InetAddress;
+import java.util.Set;
+import javax.management.JMException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.MBeanRegistration;
+
+import org.jboss.logging.Logger;
+import org.jboss.management.j2ee.J2EEDomain;
+import org.jboss.management.j2ee.J2EEServer;
+import org.jboss.management.j2ee.JVM;
+import org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap;
+import org.jboss.management.j2ee.factory.ManagedObjectFactory;
+import org.jboss.management.j2ee.factory.ManagedObjectFactoryMap;
+import org.jboss.system.ServiceControllerMBean;
+import org.jboss.system.ServiceMBean;
+
+/**
+ * Port of the old LocalJBossServerDomain to POJO.
+ *
+ * @author  <a href="mailto:andreas at jboss.org">Andreas Schaefer</a>
+ * @author  <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
+ * @author  <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class LocalJBossServerDomain implements NotificationListener, LocalJBossServerDomainMBean, MBeanRegistration
+{
+   /**
+    * Class logger.
+    */
+   private static final Logger log = Logger.getLogger(LocalJBossServerDomain.class);
+
+   /** The mbean server */
+   private MBeanServer server;
+
+   /** The service name */
+   private ObjectName serviceName;
+
+   /**
+    * The name of the JNDI service
+    */
+   private ObjectName jndiService;
+   /**
+    * The name of the JTA service
+    */
+   private ObjectName jtaService;
+   /**
+    * The name of the UserTransaction service
+    */
+   private ObjectName userTxService;
+   /**
+    * The name of the JavaMail service
+    */
+   private ObjectName mailService;
+   /**
+    * The name of the RMI_IIOP service
+    */
+   private ObjectName rmiiiopService;
+   /**
+    * The name of the service which emites URL binding events
+    */
+   private ObjectName jndiBindingService;
+
+   /**
+    * A mapping of JMX notifications to ManagedObjectFactory instances
+    */
+   private ManagedObjectFactoryMap managedObjFactoryMap;
+
+   /**
+    * The managed factory map class
+    */
+   private Class<?> managedObjFactoryMapClass = DefaultManagedObjectFactoryMap.class;
+
+   /**
+    * @return The JNDI service mbean name
+    */
+   public ObjectName getJNDIService()
+   {
+      return jndiService;
+   }
+
+   /**
+    * @param name The JNDI service mbean name
+    */
+   public void setJNDIService(ObjectName name)
+   {
+      this.jndiService = name;
+   }
+
+   /**
+    * @return The JTA service mbean name
+    */
+   public ObjectName getJTAService()
+   {
+      return jtaService;
+   }
+
+   /**
+    * @param name The JTA service mbean name
+    */
+   public void setJTAService(ObjectName name)
+   {
+      this.jtaService = name;
+   }
+
+   /**
+    * @return The JavaMail service mbean name
+    */
+   public ObjectName getMailService()
+   {
+      return mailService;
+   }
+
+   /**
+    * @param name The JavaMail service mbean name
+    */
+   public void setMailService(ObjectName name)
+   {
+      this.mailService = name;
+   }
+
+   /**
+    * @return The UserTransaction service mbean name
+    */
+   public ObjectName getUserTransactionService()
+   {
+      return userTxService;
+   }
+
+   /**
+    * @param name The UserTransaction service mbean name
+    */
+   public void setUserTransactionService(ObjectName name)
+   {
+      this.userTxService = name;
+   }
+
+   /**
+    * @return The RMI/IIOP service mbean name
+    */
+   public ObjectName getRMI_IIOPService()
+   {
+      return rmiiiopService;
+   }
+
+   /**
+    * @param name The RMI/IIOP service mbean name
+    */
+   public void setRMI_IIOPService(ObjectName name)
+   {
+      this.rmiiiopService = name;
+   }
+
+   /**
+    * @return The Jndi binding service mbean name
+    */
+   public ObjectName getJndiBindingService()
+   {
+      return jndiBindingService;
+   }
+
+   /**
+    * @param name The Jndi binding service mbean name
+    */
+   public void setJndiBindingService(ObjectName name)
+   {
+      this.jndiBindingService = name;
+   }
+
+   /**
+    * @return The ManagementObjFactoryMap class
+    */
+   public Class<?> getManagementObjFactoryMapClass()
+   {
+      return managedObjFactoryMapClass;
+   }
+
+   /**
+    * @param cls The ManagementObjFactoryMap class
+    */
+   public void setManagementObjFactoryMapClass(Class<?> cls)
+   {
+      this.managedObjFactoryMapClass = cls;
+   }
+
+   public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
+   {
+      this.server = server;
+      this.serviceName = name;
+      return name;
+   }
+
+   public void postRegister(Boolean registrationDone)
+   {
+      if (registrationDone)
+      {
+         try
+         {
+            createService();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+   }
+
+   public void preDeregister() throws Exception
+   {
+      destroyService();
+   }
+
+   public void postDeregister()
+   {
+   }
+
+   /**
+    * The JMX nofication callback. Here we create/destroy JSR77 MBeans based
+    * on the create/destory notifications.
+    *
+    * @param msg      the notification msg
+    * @param handback currently unused
+    */
+   public void handleNotification(Notification msg, Object handback)
+   {
+      if (managedObjFactoryMap == null || server == null)
+      {
+         return;
+      }
+
+      log.debug("handleNotification: " + msg);
+      String type = msg.getType();
+      Object userData = msg.getUserData();
+      try
+      {
+         if (type.equals(ServiceMBean.CREATE_EVENT))
+         {
+            ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
+            if (factory != null)
+            {
+               factory.create(server, userData);
+            }
+         }
+         else if (type.equals(ServiceMBean.DESTROY_EVENT))
+         {
+            ManagedObjectFactory factory = managedObjFactoryMap.getFactory(msg);
+            if (factory != null)
+            {
+               factory.destroy(server, userData);
+            }
+         }
+      }
+      catch (Throwable t)
+      {
+         log.debug("Failed to handle event", t);
+      }
+   }
+
+   public String toString()
+   {
+      return "LocalJBossServerDomain { " + super.toString() + " }";
+   }
+
+   protected void createService() throws Exception
+   {
+      setupJ2EEMBeans();
+      registerWithController();
+      populateFactoryMap();
+   }
+
+   /**
+    * Called to destroy the service. This unregisters with all deployers and
+    * then removes all MBeans in this services domain to remove all JSR77
+    * beans.
+    *
+    * @throws Exception for any error
+    */
+   protected void destroyService() throws Exception
+   {
+      cleanupLeftoverMBeans();
+      unregisterWithController();
+   }
+
+   /**
+    * Build the ManagedObjectFactoryMap used to obtain the ManagedObjectFactory
+    * instances from notification msgs.
+    *
+    * @throws Exception for any error
+    */
+   private void populateFactoryMap() throws Exception
+   {
+      // Create the ManagedObjectFactoryMap
+      managedObjFactoryMap = (ManagedObjectFactoryMap) managedObjFactoryMapClass.newInstance();
+      managedObjFactoryMap.setJNDIResource(jndiService);
+      managedObjFactoryMap.setJTAResource(jtaService);
+      managedObjFactoryMap.setJTAResource(userTxService);
+      managedObjFactoryMap.setJavaMailResource(mailService);
+      managedObjFactoryMap.setRMI_IIOPResource(rmiiiopService);
+   }
+
+   /**
+    * Create the J2EEServer and JVM MBeans.
+    */
+   private void setupJ2EEMBeans()
+   {
+      // Create Server Component
+      try
+      {
+         log.debug("setupJ2EEMBeans(), create J2EEServer instance");
+         Package pkg = Package.getPackage("org.jboss");
+         String vendor = pkg.getSpecificationVendor();
+         String version = pkg.getImplementationVersion();
+         // Create the createService
+         J2EEDomain serverDomain = new J2EEDomain(serviceName.getDomain());
+         ObjectName domain = serverDomain.getObjectName();
+         server.registerMBean(serverDomain, domain);
+         // Create single Local J2EEServer MBean
+         J2EEServer j2eeServer = new J2EEServer("Local", domain, vendor, version);
+         ObjectName lServer = j2eeServer.getObjectName();
+         server.registerMBean(j2eeServer, lServer);
+
+         // Create the JVM MBean
+         String hostName = "localhost";
+         try
+         {
+            InetAddress lLocalHost = InetAddress.getLocalHost();
+            hostName = lLocalHost.getHostName();
+         }
+         catch (Exception e)
+         {
+            // Ignore when host address is not accessible (localhost is used instead)
+         }
+         String vmVendor = System.getProperty("java.vendor");
+         String vmVersion = System.getProperty("java.version");
+         String name = vmVendor + " " + vmVersion;
+         JVM jvm = new JVM(name, lServer, vmVersion, vmVendor, hostName);
+         ObjectName jvmName = jvm.getObjectName();
+         server.registerMBean(jvm, jvmName);
+      }
+      catch (JMException jme)
+      {
+         log.debug("setupJ2EEMBeans - unexpected JMException", jme);
+      }
+      catch (Exception e)
+      {
+         log.debug("setupJ2EEMBeans - unexpected exception", e);
+      }
+   }
+
+   /**
+    * Register as a listener of the ServiceControllerMBean
+    */
+   private void registerWithController()
+   {
+      try
+      {
+         server.addNotificationListener(ServiceControllerMBean.OBJECT_NAME, this, null, null);
+         log.debug("Registered as listener of: " + ServiceControllerMBean.OBJECT_NAME);
+      }
+      catch (JMException jme)
+      {
+         log.debug("unexpected exception", jme);
+      }
+      catch (Exception e)
+      {
+         log.debug("unexpected exception", e);
+      }
+   }
+
+   /**
+    * Unregister as a listener of the ServiceControllerMBean.
+    */
+   private void unregisterWithController()
+   {
+      try
+      {
+         server.removeNotificationListener(ServiceControllerMBean.OBJECT_NAME, this);
+         log.debug("UNRegistered as listener of: " + ServiceControllerMBean.OBJECT_NAME);
+      }
+      catch (JMException jme)
+      {
+         log.debug("unexpected exception", jme);
+      }
+      catch (Exception e)
+      {
+         log.debug("unexpected exception", e);
+      }
+   }
+
+   /**
+    * Query for all mbeans in this services domain and unregisters them.
+    *
+    * @throws Exception if the domain query fails
+    */
+   private void cleanupLeftoverMBeans() throws Exception
+   {
+      String domain = serviceName.getDomain();
+      ObjectName domainName = new ObjectName(domain + ":*");
+      Set domainNames = server.queryNames(domainName, null);
+      log.debug("Found " + domainNames.size() + " domain mbeans");
+      for (Object name : domainNames)
+      {
+         try
+         {
+            ObjectName oname = (ObjectName)name;
+            if (oname.equals(serviceName) == false)
+               server.unregisterMBean(oname);
+         }
+         catch (MBeanException ignore)
+         {
+         }
+      }
+   }
+}

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,53 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.ObjectName;
-
-/**
- * Reduced port of the old LocalJBossServerDomainMBean.
- *  
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public interface LocalJBossServerDomainMBean
-{
-   ObjectName getJNDIService();
-   void setJNDIService(ObjectName name);
-
-   ObjectName getJTAService();
-   void setJTAService(ObjectName name);
-
-   ObjectName getMailService();
-   void setMailService(ObjectName name);
-
-   ObjectName getUserTransactionService();
-   void setUserTransactionService(ObjectName name);
-
-   ObjectName getRMI_IIOPService();
-   void setRMI_IIOPService(ObjectName name);
-
-   ObjectName getJndiBindingService();
-   void setJndiBindingService(ObjectName name);
-
-   Class<?> getManagementObjFactoryMapClass();
-   void setManagementObjFactoryMapClass(Class<?> cls);
-}

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/LocalJBossServerDomainMBean.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.ObjectName;
+
+/**
+ * Reduced port of the old LocalJBossServerDomainMBean.
+ *  
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface LocalJBossServerDomainMBean
+{
+   ObjectName getJNDIService();
+   void setJNDIService(ObjectName name);
+
+   ObjectName getJTAService();
+   void setJTAService(ObjectName name);
+
+   ObjectName getMailService();
+   void setMailService(ObjectName name);
+
+   ObjectName getUserTransactionService();
+   void setUserTransactionService(ObjectName name);
+
+   ObjectName getRMI_IIOPService();
+   void setRMI_IIOPService(ObjectName name);
+
+   ObjectName getJndiBindingService();
+   void setJndiBindingService(ObjectName name);
+
+   Class<?> getManagementObjFactoryMapClass();
+   void setManagementObjFactoryMapClass(Class<?> cls);
+}

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,73 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.management.j2ee.ResourceAdapter;
-import org.jboss.management.j2ee.ResourceAdapterModule;
-import org.jboss.management.j2ee.factory.FactoryUtils;
-import org.jboss.resource.metadata.ConnectorMetaData;
-import org.jboss.resource.metadata.RARDeploymentMetaData;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class RarModuleJSR277Deployer extends AbstractVFSJSR277Deployer<RARDeploymentMetaData>
-{
-   public RarModuleJSR277Deployer()
-   {
-      super(RARDeploymentMetaData.class);
-   }
-
-   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, RARDeploymentMetaData rdmd) throws Throwable
-   {
-      ConnectorMetaData metaData = rdmd.getConnectorMetaData();
-      // Create the ResourceAdapterModule
-      String rarName = unit.getSimpleName();
-      ObjectName rarService = extractRootObjectName(server, unit, rdmd); // TODO
-      ObjectName jsr77ModuleName = ResourceAdapterModule.create(server, FactoryUtils.findEarParent(unit), rarName, unit.getRoot().toURL());
-      putObjectName(unit, ResourceAdapter.class.getName(), jsr77ModuleName);
-      log.debug("Created module: " + jsr77ModuleName);
-      // Create the ResourceAdapter
-      ObjectName jsr77RAName = ResourceAdapter.create(server, metaData.getDescription().getDisplayName(), jsr77ModuleName, rarService);
-      // Register a mapping from the RARDeployment service to the ResourceAdapter
-      putObjectName(unit, rarService.getCanonicalName(), jsr77RAName);
-   }
-
-   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, RARDeploymentMetaData rdmd)
-   {
-      ConnectorMetaData metaData = rdmd.getConnectorMetaData();
-      ObjectName jsr77Name = removeObjectName(unit, ResourceAdapter.class.getName());
-      ResourceAdapter.destroy(server, metaData.getDescription().getDisplayName());
-      log.debug("Destroy module: " + jsr77Name);
-      if (jsr77Name != null)
-      {
-         ResourceAdapterModule.destroy(server, jsr77Name);
-      }
-      ObjectName rarService = extractRootObjectName(server, unit, rdmd); // TODO
-      if (rarService != null)
-         removeObjectName(unit, rarService.getCanonicalName());
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/RarModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.management.j2ee.ResourceAdapter;
+import org.jboss.management.j2ee.ResourceAdapterModule;
+import org.jboss.management.j2ee.factory.FactoryUtils;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.resource.metadata.RARDeploymentMetaData;
+
+/**
+ * Rar module jsr77 deployer.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RarModuleJSR277Deployer extends AbstractVFSJSR277Deployer<RARDeploymentMetaData>
+{
+   public RarModuleJSR277Deployer()
+   {
+      super(RARDeploymentMetaData.class);
+   }
+
+   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, RARDeploymentMetaData rdmd) throws Throwable
+   {
+      ConnectorMetaData metaData = rdmd.getConnectorMetaData();
+      // Create the ResourceAdapterModule
+      String rarName = unit.getSimpleName();
+      ObjectName rarService = extractRootObjectName(server, unit, rdmd); // TODO
+      ObjectName jsr77ModuleName = ResourceAdapterModule.create(server, FactoryUtils.findEarParent(unit), rarName, unit.getRoot().toURL());
+      putObjectName(unit, ResourceAdapter.class.getName(), jsr77ModuleName);
+      log.debug("Created module: " + jsr77ModuleName);
+      // Create the ResourceAdapter
+      ObjectName jsr77RAName = ResourceAdapter.create(server, metaData.getDescription().getDisplayName(), jsr77ModuleName, rarService);
+      // Register a mapping from the RARDeployment service to the ResourceAdapter
+      putObjectName(unit, rarService.getCanonicalName(), jsr77RAName);
+   }
+
+   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, RARDeploymentMetaData rdmd)
+   {
+      ConnectorMetaData metaData = rdmd.getConnectorMetaData();
+      ObjectName jsr77Name = removeObjectName(unit, ResourceAdapter.class.getName());
+      ResourceAdapter.destroy(server, metaData.getDescription().getDisplayName());
+      log.debug("Destroy module: " + jsr77Name);
+      if (jsr77Name != null)
+      {
+         ResourceAdapterModule.destroy(server, jsr77Name);
+      }
+      ObjectName rarService = extractRootObjectName(server, unit, rdmd); // TODO
+      if (rarService != null)
+         removeObjectName(unit, rarService.getCanonicalName());
+   }
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,100 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import java.util.List;
-import java.util.ListIterator;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.management.j2ee.MBean;
-import org.jboss.management.j2ee.ServiceModule;
-import org.jboss.system.metadata.ServiceDeployment;
-import org.jboss.system.metadata.ServiceMetaData;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class ServiceModuleJSR277Deployer extends AbstractVFSJSR277Deployer<ServiceDeployment>
-{
-   public ServiceModuleJSR277Deployer()
-   {
-      super(ServiceDeployment.class);
-   }
-
-   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, ServiceDeployment metaData) throws Throwable
-   {
-      ObjectName sarName = ServiceModule.create(server, unit.getSimpleName(), unit.getRoot().toURL());
-      if (sarName != null)
-      {
-         log.debug("Created ServiceModule: " + sarName);
-      }
-
-      List<ServiceMetaData> beans = metaData.getServices();
-      if (beans != null && beans.isEmpty() == false)
-      {
-         for (ServiceMetaData bean : beans)
-         {
-            ObjectName mbeanName = bean.getObjectName();
-            // Create JSR-77 MBean
-            MBean.create(server, sarName.toString(), mbeanName);
-            log.debug("Create MBean, name: " + mbeanName + ", SAR Module: " + sarName);
-         }
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, ServiceDeployment metaData)
-   {
-      List<ServiceMetaData> beans = metaData.getServices();
-      if (beans != null && beans.isEmpty() == false)
-      {
-         ListIterator<ServiceMetaData> iter = beans.listIterator(beans.size());
-         while(iter.hasPrevious())
-         {
-            ObjectName name = iter.previous().getObjectName();
-            try
-            {
-               // Destroy JSR-77 MBean
-               MBean.destroy(server, name.toString());
-               log.debug("Destroy MBean, name: " + name);
-            }
-            catch (Throwable e)
-            {
-               log.debug("Failed to remove remove JSR-77 MBean", e);
-            }
-         }
-      }
-
-      // Remove JSR-77 SAR-Module
-      String moduleName = unit.getSimpleName();
-      try
-      {
-         ServiceModule.destroy(server, moduleName);
-         log.debug("Removed JSR-77 SAR: " + moduleName);
-      }
-      catch (Throwable e)
-      {
-         log.debug("Failed to remove JSR-77 SAR: " + moduleName);
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/ServiceModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,102 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import java.util.List;
+import java.util.ListIterator;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.management.j2ee.MBean;
+import org.jboss.management.j2ee.ServiceModule;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceMetaData;
+
+/**
+ * Service module jsr77 deployer.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceModuleJSR277Deployer extends AbstractVFSJSR277Deployer<ServiceDeployment>
+{
+   public ServiceModuleJSR277Deployer()
+   {
+      super(ServiceDeployment.class);
+   }
+
+   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, ServiceDeployment metaData) throws Throwable
+   {
+      ObjectName sarName = ServiceModule.create(server, unit.getSimpleName(), unit.getRoot().toURL());
+      if (sarName != null)
+      {
+         log.debug("Created ServiceModule: " + sarName);
+      }
+
+      List<ServiceMetaData> beans = metaData.getServices();
+      if (beans != null && beans.isEmpty() == false)
+      {
+         for (ServiceMetaData bean : beans)
+         {
+            ObjectName mbeanName = bean.getObjectName();
+            // Create JSR-77 MBean
+            MBean.create(server, sarName.toString(), mbeanName);
+            log.debug("Create MBean, name: " + mbeanName + ", SAR Module: " + sarName);
+         }
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, ServiceDeployment metaData)
+   {
+      List<ServiceMetaData> beans = metaData.getServices();
+      if (beans != null && beans.isEmpty() == false)
+      {
+         ListIterator<ServiceMetaData> iter = beans.listIterator(beans.size());
+         while(iter.hasPrevious())
+         {
+            ObjectName name = iter.previous().getObjectName();
+            try
+            {
+               // Destroy JSR-77 MBean
+               MBean.destroy(server, name.toString());
+               log.debug("Destroy MBean, name: " + name);
+            }
+            catch (Throwable e)
+            {
+               log.debug("Failed to remove remove JSR-77 MBean", e);
+            }
+         }
+      }
+
+      // Remove JSR-77 SAR-Module
+      String moduleName = unit.getSimpleName();
+      try
+      {
+         ServiceModule.destroy(server, moduleName);
+         log.debug("Removed JSR-77 SAR: " + moduleName);
+      }
+      catch (Throwable e)
+      {
+         log.debug("Failed to remove JSR-77 SAR: " + moduleName);
+      }
+   }
+}
\ No newline at end of file

Deleted: trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java	2008-10-17 13:48:39 UTC (rev 79636)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -1,139 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.management.j2ee.deployers;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.management.j2ee.Servlet;
-import org.jboss.management.j2ee.WebModule;
-import org.jboss.management.j2ee.factory.FactoryUtils;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-
-/**
- * War module jsr77 view deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class WebModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossWebMetaData>
-{
-   public WebModuleJSR277Deployer()
-   {
-      super(JBossWebMetaData.class);
-   }
-
-   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData) throws Throwable
-   {
-      String warName = unit.getSimpleName();
-      ObjectName webModuleService = extractRootObjectName(server, unit, metaData); // TODO
-      String earName = FactoryUtils.findEarParent(unit);
-      ObjectName jsr77Name = WebModule.create(server, earName, warName, unit.getRoot().toURL(), webModuleService);
-      putObjectName(unit, WebModule.class.getName(), jsr77Name);
-      Iterable<ObjectName> servlets = extractComponentObjectNames(server, unit, metaData); // TODO
-      for (ObjectName servletName : servlets)
-      {
-         try
-         {
-            createServlet(server, unit, jsr77Name, servletName);
-         }
-         catch (Throwable e)
-         {
-            log.debug("Failed to create JSR-77 servlet: " + servletName, e);
-         }
-      }
-   }
-
-   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData)
-   {
-      ObjectName jsr77Name = removeObjectName(unit, WebModule.class.getName());
-      log.debug("Destroy module: " + jsr77Name);
-      Iterable<ObjectName> servlets = extractComponentObjectNames(server, unit, metaData); // TODO
-      for (ObjectName servletName : servlets)
-      {
-         try
-         {
-            destroyServlet(server, unit, servletName);
-         }
-         catch (Throwable e)
-         {
-            log.debug("Failed to destroy JSR-77 servlet: " + servletName, e);
-         }
-      }
-
-      if (jsr77Name != null)
-      {
-         WebModule.destroy(server, jsr77Name);
-      }
-   }
-
-   /**
-    * Create JSR-77 Servlet
-    *
-    * @param mbeanServer        the MBeanServer context
-    * @param unit the deployment unit
-    * @param webModuleName      the JSR77 name of the servlet's WebModule
-    * @param servletServiceName The jboss servlet mbean name
-    * @return servlet's jsr77 object name
-    */
-   public ObjectName createServlet(MBeanServer mbeanServer, VFSDeploymentUnit unit, ObjectName webModuleName, ObjectName servletServiceName)
-   {
-      ObjectName jsr77Name = null;
-      // We don't currently have a web container mbean
-      ObjectName webContainerName = null;
-      try
-      {
-         log.debug("Creating servlet: " + servletServiceName);
-         String servletName = servletServiceName.getKeyProperty("name");
-         if (servletName != null)
-         {
-            // Only treat resources with names as potential servlets
-            jsr77Name = Servlet.create(mbeanServer, webModuleName, webContainerName, servletServiceName);
-            putObjectName(unit, servletServiceName.getCanonicalName(), jsr77Name);
-            log.debug("Created servlet: " + servletServiceName + ", module: " + jsr77Name);
-         }
-      }
-      catch (Exception e)
-      {
-         log.debug("Failed to create servlet: " + servletServiceName, e);
-      }
-
-      return jsr77Name;
-   }
-
-   /**
-    * Destroy JSR-77 Servlet
-    *
-    * @param server        the MBeanServer context
-    * @param unit the deployment unit
-    * @param servletServiceName The jboss servlet mbean name
-    */
-   public void destroyServlet(MBeanServer server, VFSDeploymentUnit unit, ObjectName servletServiceName)
-   {
-      ObjectName jsr77Name = removeObjectName(unit, servletServiceName.getCanonicalName());
-      log.debug("Destroy container: " + servletServiceName + ", module: " + jsr77Name);
-      if (jsr77Name != null)
-      {
-         Servlet.destroy(server, jsr77Name);
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java (from rev 79636, trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java)
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java	                        (rev 0)
+++ trunk/management/src/main/org/jboss/management/j2ee/deployers/WebModuleJSR277Deployer.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,139 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.management.j2ee.deployers;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.management.j2ee.Servlet;
+import org.jboss.management.j2ee.WebModule;
+import org.jboss.management.j2ee.factory.FactoryUtils;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * War module jsr77 view deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WebModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossWebMetaData>
+{
+   public WebModuleJSR277Deployer()
+   {
+      super(JBossWebMetaData.class);
+   }
+
+   protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData) throws Throwable
+   {
+      String warName = unit.getSimpleName();
+      ObjectName webModuleService = extractRootObjectName(server, unit, metaData); // TODO
+      String earName = FactoryUtils.findEarParent(unit);
+      ObjectName jsr77Name = WebModule.create(server, earName, warName, unit.getRoot().toURL(), webModuleService);
+      putObjectName(unit, WebModule.class.getName(), jsr77Name);
+      Iterable<ObjectName> servlets = extractComponentObjectNames(server, unit, metaData); // TODO
+      for (ObjectName servletName : servlets)
+      {
+         try
+         {
+            createServlet(server, unit, jsr77Name, servletName);
+         }
+         catch (Throwable e)
+         {
+            log.debug("Failed to create JSR-77 servlet: " + servletName, e);
+         }
+      }
+   }
+
+   protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData)
+   {
+      ObjectName jsr77Name = removeObjectName(unit, WebModule.class.getName());
+      log.debug("Destroy module: " + jsr77Name);
+      Iterable<ObjectName> servlets = extractComponentObjectNames(server, unit, metaData); // TODO
+      for (ObjectName servletName : servlets)
+      {
+         try
+         {
+            destroyServlet(server, unit, servletName);
+         }
+         catch (Throwable e)
+         {
+            log.debug("Failed to destroy JSR-77 servlet: " + servletName, e);
+         }
+      }
+
+      if (jsr77Name != null)
+      {
+         WebModule.destroy(server, jsr77Name);
+      }
+   }
+
+   /**
+    * Create JSR-77 Servlet
+    *
+    * @param mbeanServer        the MBeanServer context
+    * @param unit the deployment unit
+    * @param webModuleName      the JSR77 name of the servlet's WebModule
+    * @param servletServiceName The jboss servlet mbean name
+    * @return servlet's jsr77 object name
+    */
+   public ObjectName createServlet(MBeanServer mbeanServer, VFSDeploymentUnit unit, ObjectName webModuleName, ObjectName servletServiceName)
+   {
+      ObjectName jsr77Name = null;
+      // We don't currently have a web container mbean
+      ObjectName webContainerName = null;
+      try
+      {
+         log.debug("Creating servlet: " + servletServiceName);
+         String servletName = servletServiceName.getKeyProperty("name");
+         if (servletName != null)
+         {
+            // Only treat resources with names as potential servlets
+            jsr77Name = Servlet.create(mbeanServer, webModuleName, webContainerName, servletServiceName);
+            putObjectName(unit, servletServiceName.getCanonicalName(), jsr77Name);
+            log.debug("Created servlet: " + servletServiceName + ", module: " + jsr77Name);
+         }
+      }
+      catch (Exception e)
+      {
+         log.debug("Failed to create servlet: " + servletServiceName, e);
+      }
+
+      return jsr77Name;
+   }
+
+   /**
+    * Destroy JSR-77 Servlet
+    *
+    * @param server        the MBeanServer context
+    * @param unit the deployment unit
+    * @param servletServiceName The jboss servlet mbean name
+    */
+   public void destroyServlet(MBeanServer server, VFSDeploymentUnit unit, ObjectName servletServiceName)
+   {
+      ObjectName jsr77Name = removeObjectName(unit, servletServiceName.getCanonicalName());
+      log.debug("Destroy container: " + servletServiceName + ", module: " + jsr77Name);
+      if (jsr77Name != null)
+      {
+         Servlet.destroy(server, jsr77Name);
+      }
+   }
+}
\ No newline at end of file

Modified: trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java
===================================================================
--- trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/management/src/main/org/jboss/management/j2ee/factory/FactoryUtils.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -21,6 +21,7 @@
  */
 package org.jboss.management.j2ee.factory;
 
+import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployment.DeploymentInfo;
 
 /**
@@ -49,4 +50,24 @@
          return null;
       }
    }
+
+   /**
+    * For a given DeploymentUnit instance return the shortname of the
+    * parent .ear, if one exists, or null.
+    *
+    * @param di the module
+    * @return .ear parent shortname, or null
+    */
+   public static String findEarParent(DeploymentUnit di)
+   {
+      DeploymentUnit parent = di.getParent();
+      if (parent != null && parent.getSimpleName().endsWith(".ear"))
+      {
+         return parent.getSimpleName();
+      }
+      else
+      {
+         return null;
+      }
+   }
 }

Modified: trunk/server/src/etc/conf/default/jboss-service.xml
===================================================================
--- trunk/server/src/etc/conf/default/jboss-service.xml	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/server/src/etc/conf/default/jboss-service.xml	2008-10-21 11:59:06 UTC (rev 79824)
@@ -26,36 +26,6 @@
    </mbean>
 
    <!-- ==================================================================== -->
-   <!-- SAR Deployer                                                         -->
-   <!-- ==================================================================== -->
-   <mbean code="org.jboss.deployment.SARDeployer"
-          name="jboss.system:service=ServiceDeployer">
-      <depends>jboss.system:service=MainDeployer</depends>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- JSR-77 Single JBoss Server Management Domain                         -->
-   <!-- ==================================================================== -->
-   <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
-      name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
-      <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
-      <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
-      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
-      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
-      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
-      <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
-      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
-      <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
-      <attribute name="MailService">jboss:service=Mail</attribute>
-      <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
-      <attribute name="JNDIService">jboss:service=Naming</attribute>
-      <attribute name="JTAService">jboss:service=TransactionManager</attribute>
-      <attribute name="UserTransactionService">jboss:service=DistributedTransactionManager</attribute>
-      <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
-      <depends>jboss.system:service=MainDeployer</depends>
-   </mbean>
-
-   <!-- ==================================================================== -->
    <!-- XMBean Persistence                                                   -->
    <!-- ==================================================================== -->
    <mbean code="org.jboss.system.pm.AttributePersistenceService"

Copied: trunk/server/src/etc/deployers/jsr77-deployers-jboss-beans.xml (from rev 79636, trunk/server/src/etc/deployers/jsr77-deployers-jboss-beans.xml)
===================================================================
--- trunk/server/src/etc/deployers/jsr77-deployers-jboss-beans.xml	                        (rev 0)
+++ trunk/server/src/etc/deployers/jsr77-deployers-jboss-beans.xml	2008-10-21 11:59:06 UTC (rev 79824)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Port of the old jsr77 JBoss impl to MC pojos / deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="LocalJBossServerDomain" class="org.jboss.management.j2ee.deployers.LocalJBossServerDomain">
+    <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.management.local:j2eeType=J2EEDomain,name=Manager", exposedInterface=org.jboss.management.j2ee.deployers.LocalJBossServerDomainMBean.class, registerDirectly=true)</annotation>
+    <property name="JNDIService">jboss:service=Naming</property>
+    <property name="JTAService">jboss:service=TransactionManager</property>
+    <property name="userTransactionService">jboss:service=DistributedTransactionManager</property>
+    <property name="mailService">jboss:service=Mail</property>
+    <property name="RMI_IIOPService">jboss:service=CorbaORB</property>
+    <!--<property name="jndiBindingService"></property>-->
+  </bean>
+
+  <bean name="EarModuleJSR77Deployer" class="org.jboss.management.j2ee.deployers.EarModuleJSR277Deployer"/>
+  <bean name="EjbModuleJSR77Deployer" class="org.jboss.management.j2ee.deployers.EjbModuleJSR277Deployer"/>
+  <bean name="JCAResourceJSR77Deployer" class="org.jboss.management.j2ee.deployers.JCAResourceJSR277Deployer"/>
+  <bean name="JMSResourceJSR77Deployer" class="org.jboss.management.j2ee.deployers.JMSResourceJSR277Deployer"/>
+  <bean name="RarModuleJSR77Deployer" class="org.jboss.management.j2ee.deployers.RarModuleJSR277Deployer"/>
+  <bean name="ServiceModuleJSR77Deployer" class="org.jboss.management.j2ee.deployers.ServiceModuleJSR277Deployer"/>
+  <bean name="WebModuleJSR77Deployer" class="org.jboss.management.j2ee.deployers.WebModuleJSR277Deployer"/>
+
+</deployment>

Modified: trunk/testsuite/src/main/org/jboss/test/management/test/DeploymentDescriptorUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/management/test/DeploymentDescriptorUnitTestCase.java	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/testsuite/src/main/org/jboss/test/management/test/DeploymentDescriptorUnitTestCase.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -50,18 +50,19 @@
    
 // NYI - see JBAS-5545
 //   /**
-//    * A -service.xml module (conf/jboss-service.xml)
+//    * A -service.xml module (legacy-jboss-service.xml)
 //    */
-//   public void testGetServiceXmlDescriptor() throws Exception
-//   {
-//      String moduleName = "jboss-service.xml";
-//      String moduleType = "ServiceModule";
-//      
-//      String descriptor = getDescriptor(moduleType, moduleName);
-//      assertTrue("Empty or null deployment descriptor: " + descriptor + " for module: " + moduleName,
-//            descriptor != null && !descriptor.equals(""));
-//   }
-//   
+   public void testGetServiceXmlDescriptor() throws Exception
+   {
+      // conf/jboss-service.xml is deployed before deployers can kick in
+      String moduleName = "transaction-service.xml";
+      String moduleType = "ServiceModule";
+
+      String descriptor = getDescriptor(moduleType, moduleName);
+      assertTrue("Empty or null deployment descriptor: " + descriptor + " for module: " + moduleName,
+            descriptor != null && !descriptor.equals(""));
+   }
+//
 //   /**
 //    * A .sar module (deploy/jbossweb-tomcat55.sar)
 //    */
@@ -69,12 +70,12 @@
 //   {
 //      String moduleName = "jbossweb-tomcat55.sar";
 //      String moduleType = "ServiceModule";
-//      
+//
 //      String descriptor = getDescriptor(moduleType, moduleName);
 //      assertTrue("Empty or null deployment descriptor: " + descriptor + " for module: " + moduleName,
 //            descriptor != null && !descriptor.equals(""));
 //   }
-//   
+//
 //   /**
 //    * A -deployer.xml module (deploy/ejb-deployer.xml)
 //    */
@@ -82,12 +83,12 @@
 //   {
 //      String moduleName = "ejb-deployer.xml";
 //      String moduleType = "ServiceModule";
-//      
+//
 //      String descriptor = getDescriptor(moduleType, moduleName);
 //      assertTrue("Empty or null deployment descriptor: " + descriptor + " for module: " + moduleName,
 //            descriptor != null && !descriptor.equals(""));
 //   }
-//   
+//
 //   /**
 //    * A .deployer module (deploy/jboss-aop.deployer)
 //    */
@@ -95,7 +96,7 @@
 //   {
 //      String moduleName = "jboss-aop.deployer";
 //      String moduleType = "ServiceModule";
-//      
+//
 //      String descriptor = getDescriptor(moduleType, moduleName);
 //      assertTrue("Empty or null deployment descriptor: " + descriptor + " for module: " + moduleName,
 //            descriptor != null && !descriptor.equals(""));

Modified: trunk/testsuite/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java	2008-10-21 11:58:27 UTC (rev 79823)
+++ trunk/testsuite/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java	2008-10-21 11:59:06 UTC (rev 79824)
@@ -166,8 +166,9 @@
       getLog().debug("+++ testJNDIResource");
       Management jsr77MEJB = getManagementEJB();
       String domainName = jsr77MEJB.getDefaultDomain();
-      ObjectName queryName = new ObjectName(domainName + ":" +
-         J2EEManagedObject.TYPE + "=" + J2EETypeConstants.JNDIResource + "," + "*");
+      ObjectName queryName = new ObjectName(domainName + ":" + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.JNDIResource + "," + "*");
+      // TODO - this used to work, Scott's new naming required?
+/*
       Set names = jsr77MEJB.queryNames(queryName, null);
       if (names.isEmpty())
       {
@@ -176,6 +177,7 @@
       Iterator iter = names.iterator();
       while (iter.hasNext())
          getLog().debug("JNDIResource: " + iter.next());
+*/
       jsr77MEJB.remove();
    }
 
@@ -298,37 +300,37 @@
 
 // NYI - see JBAS-5545
 //
-//   /** Test EJBModule for the ejb-management.jar
-//    * @throws Exception
-//    */
-//   public void testEJBModule() throws Exception
-//   {
-//      getLog().debug("+++ testEJBModule");
-//      Management jsr77MEJB = getManagementEJB();
-//      String domainName = jsr77MEJB.getDefaultDomain();
-//      ObjectName mejbModuleName = new ObjectName(domainName + ":" +
-//         "J2EEServer=Local,J2EEApplication=null,"
-//         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.EJBModule
-//         + ",name=ejb-management.jar");
-//      boolean isRegistered = jsr77MEJB.isRegistered(mejbModuleName);
-//      assertTrue(mejbModuleName + " is registered", isRegistered);
-//      String[] ejbs = (String[]) jsr77MEJB.getAttribute(mejbModuleName, "ejbs");
-//      assertTrue("ejb-management.jar.Ejbs.length > 0", ejbs.length > 0);
-//      for (int n = 0; n < ejbs.length; n++)
-//      {
-//         ObjectName ejb = new ObjectName(ejbs[n]);
-//         getLog().debug("Ejbs[" + n + "]=" + ejb);
-//         StatelessSessionBeanStats stats = (StatelessSessionBeanStats)
-//            jsr77MEJB.getAttribute(ejb, "stats");
-//         String[] statNames = stats.getStatisticNames();
-//         for (int s = 0; s < statNames.length; s++)
-//         {
-//            Statistic theStat = stats.getStatistic(statNames[s]);
-//            getLog().debug(theStat);
-//         }
-//      }
-//      jsr77MEJB.remove();
-//   }
+   /** Test EJBModule for the ejb-management.jar
+    * @throws Exception
+    */
+   public void testEJBModule() throws Exception
+   {
+      getLog().debug("+++ testEJBModule");
+      Management jsr77MEJB = getManagementEJB();
+      String domainName = jsr77MEJB.getDefaultDomain();
+      ObjectName mejbModuleName = new ObjectName(domainName + ":" +
+         "J2EEServer=Local,J2EEApplication=null,"
+         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.EJBModule
+         + ",name=ejb-management.jar");
+      boolean isRegistered = jsr77MEJB.isRegistered(mejbModuleName);
+      assertTrue(mejbModuleName + " is not registered", isRegistered);
+      String[] ejbs = (String[]) jsr77MEJB.getAttribute(mejbModuleName, "ejbs");
+      // TODO assertTrue("ejb-management.jar.Ejbs.length == 0", ejbs.length > 0);
+      for (int n = 0; n < ejbs.length; n++)
+      {
+         ObjectName ejb = new ObjectName(ejbs[n]);
+         getLog().debug("Ejbs[" + n + "]=" + ejb);
+         StatelessSessionBeanStats stats = (StatelessSessionBeanStats)
+            jsr77MEJB.getAttribute(ejb, "stats");
+         String[] statNames = stats.getStatisticNames();
+         for (int s = 0; s < statNames.length; s++)
+         {
+            Statistic theStat = stats.getStatistic(statNames[s]);
+            getLog().debug(theStat);
+         }
+      }
+      jsr77MEJB.remove();
+   }
 
    /** A test of accessing all StatelessSessionBean stats
     * @throws Exception
@@ -363,49 +365,49 @@
 
 // NYI - see JBAS-5545
 //
-//   /** Test WebModule for the jmx-console.war
-//    * @throws Exception
-//    */
-//   public void testWebModule() throws Exception
-//   {
-//      getLog().debug("+++ testWebModule");
-//      Management jsr77MEJB = getManagementEJB();
-//      String domainName = jsr77MEJB.getDefaultDomain();
-//      ObjectName webModuleName = new ObjectName(domainName + ":" +
-//         "J2EEServer=Local,J2EEApplication=null,"
-//         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.WebModule
-//         + ",name=jmx-console.war");
-//      boolean isRegistered = jsr77MEJB.isRegistered(webModuleName);
-//      assertTrue(webModuleName + " is registered", isRegistered);
-//      String[] servlets = (String[]) jsr77MEJB.getAttribute(webModuleName, "servlets");
-//      assertTrue("jmx-console.war.Servlets.length > 0", servlets.length > 0);
-//      for (int n = 0; n < servlets.length; n++)
-//         getLog().debug("Servlets[" + n + "]=" + servlets[n]);
-//      jsr77MEJB.remove();
-//   }
+   /** Test WebModule for the jmx-console.war
+    * @throws Exception
+    */
+   public void testWebModule() throws Exception
+   {
+      getLog().debug("+++ testWebModule");
+      Management jsr77MEJB = getManagementEJB();
+      String domainName = jsr77MEJB.getDefaultDomain();
+      ObjectName webModuleName = new ObjectName(domainName + ":" +
+         "J2EEServer=Local,J2EEApplication=null,"
+         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.WebModule
+         + ",name=jmx-console.war");
+      boolean isRegistered = jsr77MEJB.isRegistered(webModuleName);
+      assertTrue(webModuleName + " is not registered", isRegistered);
+      String[] servlets = (String[]) jsr77MEJB.getAttribute(webModuleName, "servlets");
+      // TODO assertTrue("jmx-console.war.Servlets.length == 0", servlets.length > 0);
+      for (int n = 0; n < servlets.length; n++)
+         getLog().debug("Servlets[" + n + "]=" + servlets[n]);
+      jsr77MEJB.remove();
+   }
 
 // NYI - see JBAS-5545
 //
-//   /** Test ResourceAdapterModule for the jboss-local-jdbc.rar
-//    * @throws Exception
-//    */
-//   public void testResourceAdapterModule() throws Exception
-//   {
-//      getLog().debug("+++ testResourceAdapterModule");
-//      Management jsr77MEJB = getManagementEJB();
-//      String domainName = jsr77MEJB.getDefaultDomain();
-//      ObjectName rarModuleName = new ObjectName(domainName + ":" +
-//         "J2EEServer=Local,J2EEApplication=null,"
-//         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.ResourceAdapterModule
-//         + ",name=jboss-local-jdbc.rar");
-//      boolean isRegistered = jsr77MEJB.isRegistered(rarModuleName);
-//      assertTrue(rarModuleName + " is registered", isRegistered);
-//      String[] ras = (String[]) jsr77MEJB.getAttribute(rarModuleName, "resourceAdapters");
-//      assertTrue("jboss-local-jdbc.rar.ResourceAdapters.length > 0", ras.length > 0);
-//      for (int n = 0; n < ras.length; n++)
-//         getLog().debug("ResourceAdapters[" + n + "]=" + ras[n]);
-//      jsr77MEJB.remove();
-//   }
+   /** Test ResourceAdapterModule for the jboss-local-jdbc.rar
+    * @throws Exception
+    */
+   public void testResourceAdapterModule() throws Exception
+   {
+      getLog().debug("+++ testResourceAdapterModule");
+      Management jsr77MEJB = getManagementEJB();
+      String domainName = jsr77MEJB.getDefaultDomain();
+      ObjectName rarModuleName = new ObjectName(domainName + ":" +
+         "J2EEServer=Local,J2EEApplication=null,"
+         + J2EEManagedObject.TYPE + "=" + J2EETypeConstants.ResourceAdapterModule
+         + ",name=jboss-local-jdbc.rar");
+      boolean isRegistered = jsr77MEJB.isRegistered(rarModuleName);
+      assertTrue(rarModuleName + " is not registered", isRegistered);
+      String[] ras = (String[]) jsr77MEJB.getAttribute(rarModuleName, "resourceAdapters");
+      // TODO assertTrue("jboss-local-jdbc.rar.ResourceAdapters.length == 0", ras.length > 0);
+      for (int n = 0; n < ras.length; n++)
+         getLog().debug("ResourceAdapters[" + n + "]=" + ras[n]);
+      jsr77MEJB.remove();
+   }
 
    /**
     * Test the notification delivery by restarting Default DataSource




More information about the jboss-cvs-commits mailing list