[Jboss-cvs] JBossAS SVN: r57003 - in branches/MC_VDF_WORK: build connector connector/src/main/org/jboss/resource connector/src/main/org/jboss/resource/deployers connector/src/main/org/jboss/resource/metadata connector/src/resources connector/src/resources/deployers connector/src/resources/jca-sar server/src/etc/conf/default system/src/main/org/jboss/profileservice/spi system/src/main/org/jboss/system/server system/src/main/org/jboss/system/server/profile/basic system/src/main/org/jboss/system/server/profileservice system/src/tests/org/jboss/test/profileservice/simple1 system-jmx/src/main/org/jboss/system/deployers system-jmx/src/main/org/jboss/system/metadata

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 20 08:00:55 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-20 08:00:16 -0400 (Wed, 20 Sep 2006)
New Revision: 57003

Added:
   branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/
   branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployer.java
   branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployment.java
   branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARParserDeployer.java
   branches/MC_VDF_WORK/connector/src/resources/deployers/
   branches/MC_VDF_WORK/connector/src/resources/deployers/jca-deployers-beans.xml
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceXSLDeployer.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeployment.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentClassPath.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentParser.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
Removed:
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java
Modified:
   branches/MC_VDF_WORK/build/build-distr.xml
   branches/MC_VDF_WORK/build/build.xml
   branches/MC_VDF_WORK/connector/.classpath
   branches/MC_VDF_WORK/connector/build.xml
   branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/metadata/ConnectorMetaData.java
   branches/MC_VDF_WORK/connector/src/resources/jca-sar/jbossjca-service.xml
   branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeploymentDeployer.java
   branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/profileservice/spi/Profile.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/ServerConfigUtil.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
   branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl.java
   branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl2.java
Log:
Split the bootstrap into three stages:
* bootstrap deployments (conf/jboss-service.xml)
* deployers (server/config/deployers)
* deployments (server/config/deploy)

Refactor the SAR deployer to externalise the ServiceDeployment parsing
and use the JAXPDeployer helper.

Add a ServiceXSLDeployer to replace the XSLSubDeployer

Implement JCA deployers using the new deployers
(incomplete but working implementation).
These are in deloyers/jca-deployers-beans.xml

Modified: branches/MC_VDF_WORK/build/build-distr.xml
===================================================================
--- branches/MC_VDF_WORK/build/build-distr.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/build/build-distr.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -578,6 +578,12 @@
     <property name="_module.output" override="true"
 	      value="${project.root}/${_module.name}/output"/>
 
+    <mkdir dir="${install.server}/all/deployers"/>
+    <copy todir="${install.server}/all/deployers" filtering="no">
+      <fileset dir="${_module.output}/resources/deployers">
+         <include name="jca-deployers-beans.xml"/>
+      </fileset>
+    </copy>
 
     <!-- Copy the generated deployment libraries -->
     <mkdir dir="${install.server}/all/deploy"/>

Modified: branches/MC_VDF_WORK/build/build.xml
===================================================================
--- branches/MC_VDF_WORK/build/build.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/build/build.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -272,6 +272,7 @@
     <property name="install.minimal" value="${install.server}/minimal"/>
     <property name="install.minimal.lib" value="${install.minimal}/lib"/>
     <property name="install.minimal.deploy" value="${install.minimal}/deploy"/>
+    <property name="install.minimal.deployers" value="${install.minimal}/deployers"/>
     <property name="install.minimal.conf" value="${install.minimal}/conf"/>
 
     <!-- Configuration for the nightly build and test job -->
@@ -793,6 +794,7 @@
 
     <!-- Build server/minimal manually -->
     <mkdir dir="${install.minimal.deploy}"/>
+    <mkdir dir="${install.minimal.deployers}"/>
     <copy todir="${install.minimal.conf}">
       <fileset dir="${install.default.conf}">
         <include name="jndi.properties" />

Modified: branches/MC_VDF_WORK/connector/.classpath
===================================================================
--- branches/MC_VDF_WORK/connector/.classpath	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/.classpath	2006-09-20 12:00:16 UTC (rev 57003)
@@ -4,9 +4,9 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="src" path="/system"/>
 	<classpathentry kind="src" path="/j2ee"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core-2.0.0.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi-2.0.0.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j-2.0.0.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core-2.0.0.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi-2.0.0.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j-2.0.0.jar"/>
 	<classpathentry kind="src" path="/server"/>
 	<classpathentry kind="src" path="/transaction"/>
 	<classpathentry kind="src" path="/security"/>
@@ -21,5 +21,7 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
+	<classpathentry sourcepath="/home/svn/JBossMC/jbossmc/container/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: branches/MC_VDF_WORK/connector/build.xml
===================================================================
--- branches/MC_VDF_WORK/connector/build.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/build.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -111,6 +111,8 @@
 
     <!-- Where source files live -->
     <property name="source.java" value="${module.source}/main"/>
+    <property name="javac.target" value="1.5"/>
+    <property name="javac.source" value="1.5"/>
     <property name="source.etc" value="${module.source}/etc"/>
     <property name="source.resources" value="${module.source}/resources"/>
 

Added: branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployer.java
===================================================================
--- branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,165 @@
+/*
+* 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.resource.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.deployers.plugins.deployers.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.system.metadata.ServiceAttributeMetaData;
+import org.jboss.system.metadata.ServiceConstructorMetaData;
+import org.jboss.system.metadata.ServiceInjectionValueMetaData;
+import org.jboss.system.metadata.ServiceMetaData;
+
+/**
+ * RARDeployer.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class RARDeployer extends AbstractSimpleRealDeployer<ConnectorMetaData>
+{
+   /** The work manager name */
+   private String workManagerName;
+   
+   /** The xa terminator name */
+   private String xaTerminatorName;
+   
+   /**
+    * Create a new RARDeployer.
+    */
+   public RARDeployer()
+   {
+      super(ConnectorMetaData.class);
+   }
+
+   public int getRelativeOrder()
+   {
+      return COMPONENT_DEPLOYER+1;
+   }
+
+   /**
+    * Get the workManagerName.
+    * 
+    * @return the workManagerName.
+    */
+   public String getWorkManagerName()
+   {
+      return workManagerName;
+   }
+
+   /**
+    * Set the workManagerName.
+    * 
+    * @param workManagerName the workManagerName.
+    */
+   public void setWorkManagerName(String workManagerName)
+   {
+      this.workManagerName = workManagerName;
+   }
+
+   /**
+    * Get the XATerminatorName.
+    * 
+    * @return the xaTerminatorName.
+    */
+   public String getXATerminatorName()
+   {
+      return xaTerminatorName;
+   }
+
+   /**
+    * Set the XATerminatorName.
+    * 
+    * @param xaTerminatorName the xaTerminatorName.
+    */
+   public void setXATerminatorName(String xaTerminatorName)
+   {
+      this.xaTerminatorName = xaTerminatorName;
+   }
+
+   protected String getObjectName(DeploymentUnit unit, ConnectorMetaData cmd)
+   {
+      // TODO this is a hack
+      DeploymentContext ctx = unit.getDeploymentContext();
+      String name = ctx.getRoot().getName();
+      ctx = ctx.getParent();
+      while (ctx != null)
+      {
+         name = ctx.getRoot().getName() + "#" + name;
+         ctx = ctx.getParent();
+      }
+      return "jboss.jca:service=RARDeployment,name='" + name + "'";
+   }
+   
+   public void deploy(DeploymentUnit unit, ConnectorMetaData cmd) throws DeploymentException
+   {
+      try
+      {
+         ServiceMetaData rarDeployment = new ServiceMetaData();
+         String name = getObjectName(unit, cmd);
+         ObjectName objectName = new ObjectName(name);
+         rarDeployment.setObjectName(objectName);
+         rarDeployment.setCode(RARDeployment.class.getName());
+         ServiceConstructorMetaData constructor = new ServiceConstructorMetaData();
+         constructor.setSignature(new String[] { ConnectorMetaData.class.getName() });
+         constructor.setParameters(new Object[] { cmd });
+         rarDeployment.setConstructor(constructor);
+         
+         List<ServiceAttributeMetaData> attributes = new ArrayList<ServiceAttributeMetaData>();
+         ServiceAttributeMetaData attribute = null;
+         if (workManagerName != null)
+         {
+            attribute = new ServiceAttributeMetaData();
+            attribute.setName("WorkManager");
+            attribute.setValue(new ServiceInjectionValueMetaData(workManagerName));
+            attributes.add(attribute);
+         }
+         if (xaTerminatorName != null)
+         {
+            attribute = new ServiceAttributeMetaData();
+            attribute.setName("XATerminator");
+            attribute.setValue(new ServiceInjectionValueMetaData(xaTerminatorName, "XATerminator"));
+            attributes.add(attribute);
+         }
+         if (attributes.isEmpty() == false)
+            rarDeployment.setAttributes(attributes);
+
+         // TODO component
+         unit.addAttachment(ServiceMetaData.class, rarDeployment);
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Error creating rar deployment " + unit.getName(), e);
+      }
+   }
+
+   public void undeploy(DeploymentUnit unit, ConnectorMetaData cmd)
+   {
+   }
+}

Added: branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployment.java
===================================================================
--- branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployment.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARDeployment.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,352 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.resource.deployers;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Timer;
+
+import javax.management.Attribute;
+import javax.management.AttributeNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import javax.management.ReflectionException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.UnavailableException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.resource.deployment.ActivationSpecFactory;
+import org.jboss.resource.deployment.ResourceAdapterFactory;
+import org.jboss.resource.metadata.ConfigPropertyMetaData;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.resource.metadata.DescriptionGroupMetaData;
+import org.jboss.resource.metadata.MessageListenerMetaData;
+import org.jboss.system.ServiceDynamicMBeanSupport;
+import org.jboss.system.server.ServerConfigUtil;
+
+/**
+ * A resource adapter deployment
+ *
+ * @author  <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 46109 $
+ */
+public class RARDeployment extends ServiceDynamicMBeanSupport implements BootstrapContext
+{
+   /** The RARDeploymentMetaData */
+   /* TODO protected RARDeploymentMetaData rdmd; */
+   
+   /** The ConnectorMetaData */
+   protected ConnectorMetaData cmd;
+   
+   /** The JBossRAMetaData */
+   /* TODO protected JBossRAMetaData ramd; */
+   
+   /** The resource adapter */
+   protected ResourceAdapter resourceAdapter;
+
+   /** The work manager */
+   private WorkManager workManager;
+
+   /** The xa terminator */
+   private XATerminator xaTerminator;
+   
+   /**
+    * Create a new RAR deployment
+    * 
+    * @param cmd the metadata
+    */
+   public RARDeployment(ConnectorMetaData cmd)
+   {
+      if (cmd == null)
+         throw new IllegalArgumentException("Null metadata");
+      this.cmd = cmd;
+      /* TODO this.ramd = rdmd.getRaXmlMetaData(); */
+      
+   }
+
+   public Timer createTimer() throws UnavailableException
+   {
+      return new Timer(true);
+   }
+
+   /**
+    * Get the workManager.
+    * 
+    * @return the workManager.
+    */
+   public WorkManager getWorkManager()
+   {
+      return workManager;
+   }
+
+   /**
+    * Set the workManager.
+    * 
+    * @param workManager the workManager.
+    */
+   public void setWorkManager(WorkManager workManager)
+   {
+      this.workManager = workManager;
+   }
+
+   /**
+    * Get the XATerminator.
+    * 
+    * @return the xaTerminator.
+    */
+   public XATerminator getXATerminator()
+   {
+      return xaTerminator;
+   }
+
+   /**
+    * Set the xXATerminator.
+    * 
+    * @param xaTerminator the XATerminator.
+    */
+   public void setXATerminator(XATerminator xaTerminator)
+   {
+      this.xaTerminator = xaTerminator;
+   }
+
+   protected void startService() throws Exception
+   {
+      URL url = cmd.getURL();
+      
+      if (cmd.getLicense().getRequired())
+      {
+         log.info ("Required license terms exist, view " + ServerConfigUtil.shortUrlFromServerHome(url.toString()));
+         log.debug("License terms full URL: " + url);
+      }
+      resourceAdapter = ResourceAdapterFactory.createResourceAdapter(cmd);
+      resourceAdapter.start(this);
+   }
+   
+   protected void stopService() throws Exception
+   {
+      resourceAdapter.stop();
+   }
+   
+   protected String getInternalDescription()
+   {
+      String description = null;
+      DescriptionGroupMetaData dgmd = cmd.getDescription();
+      if (dgmd != null)
+         description = dgmd.getDescription();
+      if (description == null)
+         description = "RAR Deployment " + cmd.getURL();
+      return description;
+   }
+
+   protected MBeanAttributeInfo[] getInternalAttributeInfo()
+   {
+      Collection properties = cmd.getProperties();
+      MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[13+properties.size()];
+      attrs[0] = new MBeanAttributeInfo("MetaData", ConnectorMetaData.class.getName(), "The meta data", true, false, false);
+      attrs[1] = new MBeanAttributeInfo("AuthenticationMechanism", String.class.getName(), "The authentication mechanism", true, false, false);
+      attrs[2] = new MBeanAttributeInfo("EISType", String.class.getName(), "The EIS type", true, false, false);
+      attrs[3] = new MBeanAttributeInfo("License", String.class.getName(), "The license", true, false, false);
+      attrs[4] = new MBeanAttributeInfo("RAClass", String.class.getName(), "The resource adapter class", true, false, false);
+      attrs[5] = new MBeanAttributeInfo("RAVersion", String.class.getName(), "The resource adapter version", true, false, false);
+      attrs[6] = new MBeanAttributeInfo("TransactionSupport", String.class.getName(), "The transaction support", true, false, false);
+      attrs[7] = new MBeanAttributeInfo("VendorName", String.class.getName(), "The vendor name", true, false, false);
+      attrs[8] = new MBeanAttributeInfo("Version", String.class.getName(), "The spec version", true, false, false);
+      attrs[9] = new MBeanAttributeInfo("ReauthenticationSupport", Boolean.TYPE.getName(), "Whether reauthentication support is supported", true, false, false);
+      attrs[10] = new MBeanAttributeInfo("ResourceAdapter", ResourceAdapter.class.getName(), "The resource adapter instance", true, false, false);
+      attrs[11] = new MBeanAttributeInfo("WorkManager", WorkManager.class.getName(), "The work manager", true, true, false);
+      attrs[12] = new MBeanAttributeInfo("XATerminator", XATerminator.class.getName(), "The xa terminator", true, true, false);
+      int n = 13;
+      for (Iterator i = properties.iterator(); i.hasNext();)
+      {
+         ConfigPropertyMetaData cpmd = (ConfigPropertyMetaData) i.next();
+         attrs[n++] = new MBeanAttributeInfo(cpmd.getName(), cpmd.getType(), cpmd.getDescription().getDescription(), true, false, false);
+      }
+      return attrs;
+   }
+   
+   protected Object getInternalAttribute(String attribute)
+      throws AttributeNotFoundException, MBeanException, ReflectionException
+   {
+      if ("MetaData".equals(attribute))
+         return cmd;
+      else if ("AuthenticationMechanism".equals(attribute))
+         return cmd.getAuthenticationMechanism().getAuthenticationMechansimType();
+      else if ("EISType".equals(attribute))
+         return cmd.getEISType();
+      else if ("License".equals(attribute))
+         return cmd.getLicense().getDescription().getDescription();
+      else if ("RAClass".equals(attribute))
+         return cmd.getRAClass();
+      else if ("RAVersion".equals(attribute))
+         return cmd.getRAVersion();
+      else if ("TransactionSupport".equals(attribute))
+         return cmd.getTransactionSupport();
+      else if ("VendorName".equals(attribute))
+         return cmd.getVendorName();
+      else if ("Version".equals(attribute))
+         return cmd.getVersion();
+      else if ("ReauthenticationSupport".equals(attribute))
+         return new Boolean(cmd.getReauthenticationSupport());
+      else if ("ResourceAdapter".equals(attribute))
+         return resourceAdapter;
+      else if ("WorkManager".equals(attribute))
+         return workManager;
+      else if ("XATerminator".equals(attribute))
+         return xaTerminator;
+      Object property = cmd.getProperty(attribute);
+      if (property != null)
+         return property;
+      
+      return super.getInternalAttribute(attribute);
+   }
+
+   protected void setInternalAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
+   {
+      String name = attribute.getName();
+      if ("WorkManager".equals(name))
+         this.workManager = (WorkManager) attribute.getValue();
+      else if ("XATerminator".equals(name))
+         this.xaTerminator = (XATerminator) attribute.getValue();
+      else
+         super.setInternalAttribute(attribute);
+   }
+
+   protected MBeanOperationInfo[] getInternalOperationInfo()
+   {
+      MBeanOperationInfo[] ops = new MBeanOperationInfo[3];
+
+      MBeanParameterInfo[] createActivationSpecParams = new MBeanParameterInfo[]
+      {
+         new MBeanParameterInfo("MessagingType", Class.class.getName(), "The type of the message listener"),
+         new MBeanParameterInfo("ActivationConfig", Collection.class.getName(), "A collection of activation config properties")
+      };
+      ops[0] = new MBeanOperationInfo("createActivationSpec", "Create an activation spec",
+            createActivationSpecParams, ActivationSpec.class.getName(), MBeanOperationInfo.ACTION);
+
+      MBeanParameterInfo[] activationParams = new MBeanParameterInfo[]
+      {
+         new MBeanParameterInfo("MessageEndpointFactory", MessageEndpointFactory.class.getName(), "The message endpoint factory"),
+         new MBeanParameterInfo("ActivationSpec", ActivationSpec.class.getName(), "The activation spec")
+      };
+      ops[1] = new MBeanOperationInfo("endpointActivation", "Active the endpoint",
+            activationParams, Void.class.getName(), MBeanOperationInfo.ACTION);
+      ops[2] = new MBeanOperationInfo("endpointDeactivation", "Deactive the endpoint",
+            activationParams, Void.class.getName(), MBeanOperationInfo.ACTION);
+
+      return ops;
+   }
+   
+   protected Object internalInvoke(String actionName, Object[] params, String[] signature) throws MBeanException,
+         ReflectionException
+   {
+      if ("createActivationSpec".equals(actionName))
+      {
+         if (params.length != 2)
+            throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
+         Class messagingType = (Class) params[0];
+         Collection activationConfig = (Collection) params[1];
+         return createActivationSpec(messagingType, activationConfig);
+      }
+      else if ("endpointActivation".equals(actionName))
+      {
+         if (params.length != 2)
+            throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
+         MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
+         ActivationSpec activationSpec = (ActivationSpec) params[1];
+         endpointActivation(messageEndpointFactory, activationSpec);
+         return null;
+      }
+      else if ("endpointDeactivation".equals(actionName))
+      {
+         if (params.length != 2)
+            throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
+         MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
+         ActivationSpec activationSpec = (ActivationSpec) params[1];
+         endpointDeactivation(messageEndpointFactory, activationSpec);
+         return null;
+      }
+      return super.internalInvoke(actionName, params, signature);
+   }
+
+   protected ActivationSpec createActivationSpec(Class messagingType, Collection activationConfig) throws MBeanException
+   {
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("CreateActivateSpec rar=" + getServiceName() + " messagingType=" + messagingType.getName() + " activationConfig=" + activationConfig);
+      
+      try
+      {
+         // Find the meta data
+         MessageListenerMetaData mlmd = cmd.getMessageListener(messagingType.getName());
+         if (mlmd == null)
+            throw new DeploymentException("MessagingType '" + messagingType.getName() + "' not found in resource deployment " + getServiceName());
+         
+         return ActivationSpecFactory.createActivationSpec(getServiceName(), messagingType.getName(), activationConfig, mlmd);
+      }
+      catch (Exception e)
+      {
+         throw new MBeanException(e, "Error in create activation spec " + getServiceName());
+      }
+   }
+
+   protected void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws MBeanException
+   {
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("EndpointActivation rar=" + getServiceName() + " messagingEndpointFactory=" + messageEndpointFactory + " activationSpec=" + activationSpec);
+
+      try
+      {
+         activationSpec.setResourceAdapter(resourceAdapter);
+         resourceAdapter.endpointActivation(messageEndpointFactory, activationSpec);
+      }
+      catch (Exception e)
+      {
+         throw new MBeanException(e, "Error in endpoint activation " + getServiceName());
+      }
+   }
+
+   protected void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws MBeanException
+   {
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("EndpointDeactivation rar=" + getServiceName() + " messagingEndpointFactory=" + messageEndpointFactory + " activationSpec=" + activationSpec);
+
+      try
+      {
+         resourceAdapter.endpointDeactivation(messageEndpointFactory, activationSpec);
+      }
+      catch (Exception e)
+      {
+         throw new MBeanException(e, "Error in endpoint deactivation " + getServiceName());
+      }
+   }
+}

Added: branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARParserDeployer.java
===================================================================
--- branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARParserDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/deployers/RARParserDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,62 @@
+/*
+* 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.resource.deployers;
+
+import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.resource.deployment.ResourceAdapterObjectModelFactory;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * RARParserDeployer.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class RARParserDeployer extends ObjectModelFactoryDeployer<ConnectorMetaData>
+{
+   /**
+    * Create a new RARParserDeployer.
+    */
+   public RARParserDeployer()
+   {
+      super(ConnectorMetaData.class);
+   }
+
+   protected ObjectModelFactory getObjectModelFactory()
+   {
+      return new ResourceAdapterObjectModelFactory();
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      createMetaData(unit, "ra.xml", null);
+   }
+
+   protected void init(DeploymentUnit unit, ConnectorMetaData cmd, VirtualFile file) throws Exception
+   {
+      cmd.setURL(file.toURL());
+   }
+}

Modified: branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/metadata/ConnectorMetaData.java
===================================================================
--- branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/metadata/ConnectorMetaData.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/main/org/jboss/resource/metadata/ConnectorMetaData.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -21,6 +21,7 @@
 */
 package org.jboss.resource.metadata;
 
+import java.net.URL;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -38,6 +39,9 @@
 {
    private static final long serialVersionUID = -3049391010669865389L;
 
+   /** The url TODO move to RARDeploymentMetaData */
+   private URL url;
+   
    /** The version */
    private String version = "1.0";
 
@@ -87,6 +91,26 @@
    }
 
    /**
+    * Get the url.
+    * 
+    * @return the url.
+    */
+   public URL getURL()
+   {
+      return url;
+   }
+
+   /**
+    * Set the url.
+    * 
+    * @param url the url.
+    */
+   public void setURL(URL url)
+   {
+      this.url = url;
+   }
+
+   /**
     * Get the connector version
     * 
     * @return the connector version

Added: branches/MC_VDF_WORK/connector/src/resources/deployers/jca-deployers-beans.xml
===================================================================
--- branches/MC_VDF_WORK/connector/src/resources/deployers/jca-deployers-beans.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/resources/deployers/jca-deployers-beans.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    JCA Deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!-- RAR Deployment -->
+   <bean name="RARParserDeployer" class="org.jboss.resource.deployers.RARParserDeployer">
+      <install bean="MainDeployer" method="addDeployer">
+         <parameter><this/></parameter>
+      </install>
+      <uninstall bean="MainDeployer" method="removeDeployer">
+         <parameter><this/></parameter>
+      </uninstall>
+   </bean>
+   <bean name="RARDeployer" class="org.jboss.resource.deployers.RARDeployer">
+      <property name="workManagerName">jboss.jca:service=WorkManager</property>
+      <property name="XATerminatorName">jboss:service=TransactionManager</property>
+      <install bean="MainDeployer" method="addDeployer">
+         <parameter><this/></parameter>
+      </install>
+      <uninstall bean="MainDeployer" method="removeDeployer">
+         <parameter><this/></parameter>
+      </uninstall>
+   </bean>
+
+   <!-- ConnectionFactory Deployment -->
+   <bean name="ConnectionFactoryDeployer" class="org.jboss.system.deployers.ServiceXSLDeployer">
+      <property name="suffix">-ds.xml</property>
+      <property name="XSLPath">stylesheets/ConnectionFactoryTemplate.xsl</property>
+      <install bean="MainDeployer" method="addDeployer">
+         <parameter><this/></parameter>
+      </install>
+      <uninstall bean="MainDeployer" method="removeDeployer">
+         <parameter><this/></parameter>
+      </uninstall>
+   </bean>
+
+</deployment>

Modified: branches/MC_VDF_WORK/connector/src/resources/jca-sar/jbossjca-service.xml
===================================================================
--- branches/MC_VDF_WORK/connector/src/resources/jca-sar/jbossjca-service.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/connector/src/resources/jca-sar/jbossjca-service.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -38,20 +38,20 @@
      <depends optional-attribute-name="XATerminatorName">jboss:service=TransactionManager</depends>
   </mbean>
 
-  <mbean code="org.jboss.resource.deployment.RARDeployer" 
+  <!--mbean code="org.jboss.resource.deployment.RARDeployer" 
 	      name="jboss.jca:service=RARDeployer">
 	  <depends optional-attribute-name="WorkManagerName">jboss.jca:service=WorkManager</depends>
      <depends optional-attribute-name="XATerminatorName">jboss:service=TransactionManager</depends>
      <depends>jboss.system:service=MainDeployer</depends>
-  </mbean>
+  </mbean-->
 
-  <mbean code="org.jboss.deployment.XSLSubDeployer" name="jboss.jca:service=ConnectionFactoryDeployer">
+  <!--mbean code="org.jboss.deployment.XSLSubDeployer" name="jboss.jca:service=ConnectionFactoryDeployer">
     <attribute name="DdSuffix">-ds.xml</attribute>
     <attribute name="EnhancedSuffixes">300:-ds.xml</attribute>
     <attribute name="XslUrl">stylesheets/ConnectionFactoryTemplate.xsl</attribute>
     <attribute name="ValidateDTDs">false</attribute>
     <depends>jboss.system:service=ServiceDeployer</depends>
-  </mbean>
+  </mbean-->
 
    <!-- Experimental for new DsSubDeployer support
    <mbean code="org.jboss.resource.deployment.ds.DsSubDeployer" name="jboss.jca:service=ConnectionFactoryDeployer">

Modified: branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml
===================================================================
--- branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/server/src/etc/conf/default/deployer-beans.xml	2006-09-20 12:00:16 UTC (rev 57003)
@@ -50,13 +50,33 @@
       </property>
    </bean>
    
-   <!-- Hot deployment service that directly uses the MainDeployer -->
-   <bean name="VFSDeploymentScanner" class="org.jboss.system.server.profileservice.VFSDeploymentScannerImpl">
+   <!-- Scan for bootstraps -->
+   <bean name="VFSBootstrapScanner" class="org.jboss.system.server.profileservice.VFSBootstrapScannerImpl">
       <property name="profileService"><inject bean="ProfileService"/></property>
       <property name="URIList">
          <list elementClass="java.net.URI">
             <!-- Legacy static conf/jboss-service.xml -->
             <value>${jboss.server.home.url}conf/jboss-service.xml</value>
+         </list>
+      </property>
+   </bean>
+   
+   <!-- Scan for deployers -->
+   <bean name="VFSDeployerScanner" class="org.jboss.system.server.profileservice.VFSDeployerScannerImpl">
+      <property name="profileService"><inject bean="ProfileService"/></property>
+      <property name="URIList">
+         <list elementClass="java.net.URI">
+            <!-- Directory for deployers -->
+            <value>${jboss.server.home.url}deployers/</value>
+         </list>
+      </property>
+   </bean>
+   
+   <!-- Scan for deployments -->
+   <bean name="VFSDeploymentScanner" class="org.jboss.system.server.profileservice.VFSDeploymentScannerImpl">
+      <property name="profileService"><inject bean="ProfileService"/></property>
+      <property name="URIList">
+         <list elementClass="java.net.URI">
             <!-- Standard hot deployment directory -->
             <value>${jboss.server.home.url}deploy/</value>
          </list>

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/profileservice/spi/Profile.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/profileservice/spi/Profile.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/profileservice/spi/Profile.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -1,25 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, 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.
-  */
-
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.profileservice.spi;
 
 import java.util.Collection;
@@ -35,8 +34,12 @@
  */
 public interface Profile
 {
-   /** The x.y.z version of the profile */
-   public String getVersion();
+   /**
+    * The x.y.z version of the profile
+    * 
+    * @return the version
+    */
+   String getVersion();
 
    /**
     * Get a deployment template.
@@ -45,25 +48,102 @@
     * @return the named DeploymentTemplate
     * @throws NoSuchDeploymentException - if there is no such deployment
     */
-   public DeploymentTemplate getTemplate(String name)
-      throws NoSuchDeploymentException;
-   public void addDeployment(DeploymentContext d);
-   public void removeDeployment(String name);
+   DeploymentTemplate getTemplate(String name) throws NoSuchDeploymentException;
 
    /**
+    * Add a bootstrap
+    * 
+    * @param d the bootstrap
+    */
+   void addBootstrap(DeploymentContext d);
+
+   /**
+    * Remove a bootstrap
+    * 
+    * @param name the name
+    */
+   void removeBootstrap(String name);
+
+   /**
+    * Get a named bootstrap.
+    * 
+    * @param name - the bootstrap name
+    * @return the named bootstrap
+    * @throws NoSuchDeploymentException - if there is no such bootstrap
+    */
+   DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException;
+
+   /**
+    * Get all bootstraps defined in this profile
+    * 
+    * @return the bootstrap instances in this profile.
+    */
+   Collection<DeploymentContext> getBootstraps();
+
+   /**
+    * Add a deployer
+    * 
+    * @param d the deployer
+    */
+   void addDeployer(DeploymentContext d);
+
+   /**
+    * Remove a deployer
+    * 
+    * @param name the name
+    */
+   void removeDeployer(String name);
+
+   /**
+    * Get a named deployer.
+    * 
+    * @param name - the deployer name 
+    * @return the named Deployer
+    * @throws NoSuchDeploymentException - if there is no such deployer
+    */
+   DeploymentContext getDeployer(String name) throws NoSuchDeploymentException;
+
+   /**
+    * Get all deployer defined in this profile
+    * 
+    * @return the deployer instances in this profile.
+    */
+   Collection<DeploymentContext> getDeployers();
+
+   /**
+    * Add a deployment
+    * 
+    * @param d the deployment
+    */
+   void addDeployment(DeploymentContext d);
+
+   /**
+    * Remove a deployment
+    * 
+    * @param name the name
+    */
+   void removeDeployment(String name);
+
+   /**
     * Get a named deployment.
     * 
-    * @param name - the deployment name to identify the template to retrieve
+    * @param name - the deployment name
     * @return the named Deployment
     * @throws NoSuchDeploymentException - if there is no such deployment
     */
-   public DeploymentContext getDeployment(String name)
-      throws NoSuchDeploymentException;
+   DeploymentContext getDeployment(String name) throws NoSuchDeploymentException;
 
    /**
     * Get all deployments defined in this profile
-    * @return Array of the Deployment instances in this profile.
+    * 
+    * @return the deployment instances in this profile.
     */
-   public Collection<DeploymentContext> getDeployments();
-   public Map<String, Object> getConfig();
+   Collection<DeploymentContext> getDeployments();
+
+   /**
+    * Get the config
+    * 
+    * @return the config
+    */
+   Map<String, Object> getConfig();
 }

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/ServerConfigUtil.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/ServerConfigUtil.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/ServerConfigUtil.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -135,6 +135,12 @@
       if (longUrl.startsWith(serverHomeUrl))
         return ".../" + longUrl.substring(serverHomeUrl.length());
       else
-        return longUrl;
+      {
+         String jarServerHomeUrl = "jar:" + serverHomeUrl;
+         if (longUrl.startsWith(jarServerHomeUrl))
+            return ".../" + longUrl.substring(jarServerHomeUrl.length());
+         else
+            return longUrl;
+      }
    }
 }

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -24,7 +24,7 @@
 import java.io.File;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
@@ -40,6 +40,7 @@
  * TODO: this needs to be converted to a read/write VFS implementation.
  * 
  * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
  * @version $Revision$
  */
 public class ProfileImpl extends JBossObject
@@ -48,7 +49,9 @@
    private String name;
    /** The directory containing the profiles */
    private File profileRoot;
-   private HashMap<String,DeploymentContext> deployments = new HashMap<String,DeploymentContext>();
+   private LinkedHashMap<String,DeploymentContext> bootstraps = new LinkedHashMap<String,DeploymentContext>();
+   private LinkedHashMap<String,DeploymentContext> deployments = new LinkedHashMap<String,DeploymentContext>();
+   private LinkedHashMap<String,DeploymentContext> deployers = new LinkedHashMap<String,DeploymentContext>();
 
    public ProfileImpl(String profileRoot, String name)
    {
@@ -68,6 +71,48 @@
       return null;
    }
 
+   public void addBootstrap(DeploymentContext d)
+   {
+      bootstraps.put(d.getName(), d);
+   }
+
+   public void removeBootstrap(String name)
+   {
+      bootstraps.remove(name);
+   }
+
+   public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
+   {
+      DeploymentContext deployment = bootstraps.get(name);
+      return deployment;
+   }
+
+   public Collection<DeploymentContext> getBootstraps()
+   {
+      return Collections.unmodifiableCollection(bootstraps.values());
+   }
+
+   public void addDeployer(DeploymentContext d)
+   {
+      deployers.put(d.getName(), d);
+   }
+
+   public void removeDeployer(String name)
+   {
+      deployers.remove(name);
+   }
+
+   public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
+   {
+      DeploymentContext deployment = deployers.get(name);
+      return deployment;
+   }
+
+   public Collection<DeploymentContext> getDeployers()
+   {
+      return Collections.unmodifiableCollection(deployers.values());
+   }
+
    public DeploymentTemplate getTemplate(String name)
          throws NoSuchDeploymentException
    {
@@ -77,8 +122,7 @@
 
    public void addDeployment(DeploymentContext d)
    {
-      String name = d.getRoot().getName();
-      deployments.put(name, d);
+      deployments.put(d.getName(), d);
    }
 
    public void removeDeployment(String name)
@@ -103,5 +147,4 @@
       // TODO Auto-generated method stub
       return null;
    }
-
 }

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -311,10 +311,43 @@
       // Load the named profile
       ProfileKey key = new ProfileKey(name);
       Profile profile = ps.getProfile(key);
-      Collection<DeploymentContext> profileDeployments = profile.getDeployments();
-      // Deploy the profile deployments
-      for (DeploymentContext d : profileDeployments)
+
+      // HACK
+      DeploymentContext first = null;
+      
+      // Deploy the bootstrap
+      Collection<DeploymentContext> boostraps = profile.getBootstraps();
+      for (DeploymentContext d : boostraps)
+      {
          deployer.addDeploymentContext(d);
+         if (first == null)
+            first = d;
+      }
       deployer.process();
+
+      ClassLoader cl = first.getClassLoader();
+      Thread thread = Thread.currentThread();
+      ClassLoader old = thread.getContextClassLoader();
+      if (cl != null)
+         thread.setContextClassLoader(cl);
+      try
+      {
+         
+         // Deploy the profile deployers
+         Collection<DeploymentContext> profileDeployers = profile.getDeployers();
+         for (DeploymentContext d : profileDeployers)
+            deployer.addDeploymentContext(d);
+         deployer.process();
+
+         // Deploy the profile deployments
+         Collection<DeploymentContext> profileDeployments = profile.getDeployments();
+         for (DeploymentContext d : profileDeployments)
+            deployer.addDeploymentContext(d);
+         deployer.process();
+      }
+      finally
+      {
+         thread.setContextClassLoader(old);
+      }
    }
 }

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -274,7 +274,6 @@
     * Check if the server is started.
     *
     * @return   True if the server is started, else false.
-    * @jmx:managed-attribute
     */
    public boolean isStarted()
    {
@@ -362,7 +361,7 @@
     * Start the server by booting the kernel, loading deployers, and loading
     * the profile deployments.
     * 
-    * @throws Exception
+    * @throws Throwable for any error
     */
    private void doStart() throws Throwable
    {
@@ -387,7 +386,7 @@
       }
 
       // Install the shutdown hook
-      shutdownHook = new ShutdownHook(bootstrap);
+      shutdownHook = new ShutdownHook();
       shutdownHook.setDaemon(true);
       try
       {
@@ -433,11 +432,9 @@
    /**
     * Shutdown the Server instance and run shutdown hooks.
     *
-    * <p>If the exit on shutdown flag is true, then {@link #exit}
+    * <p>If the exit on shutdown flag is true, then {@link #exit()}
     *    is called, else only the shutdown hook is run.
     *
-    * @jmx:managed-operation
-    *
     * @throws IllegalStateException    No started.
     */
    public void shutdown() throws IllegalStateException
@@ -485,8 +482,6 @@
    /**
     * Shutdown the server, the JVM and run shutdown hooks.
     *
-    * @jmx:managed-operation
-    *
     * @param exitcode   The exit code returned to the operating system.
     */
    public void exit(final int exitcode)
@@ -506,8 +501,6 @@
    /**
     * Shutdown the server, the JVM and run shutdown hooks.  Exits with
     * code 1.
-    *
-    * @jmx:managed-operation
     */
    public void exit()
    {
@@ -518,8 +511,6 @@
     * Forcibly terminates the currently running Java virtual machine.
     *
     * @param exitcode   The exit code returned to the operating system.
-    *
-    * @jmx:managed-operation
     */
    public void halt(final int exitcode)
    {
@@ -542,8 +533,6 @@
    /**
     * Forcibly terminates the currently running Java virtual machine.
     * Exits with code 1.
-    *
-    * @jmx:managed-operation
     */
    public void halt()
    {
@@ -555,7 +544,11 @@
    //                            Runtime Access                             //
    ///////////////////////////////////////////////////////////////////////////
 
-   /** A simple helper used to log the Runtime memory information. */
+   /** 
+    * A simple helper used to log the Runtime memory information.
+    * 
+    * @param rt the runtime
+    */
    private void logMemoryUsage(final Runtime rt)
    {
       log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
@@ -563,8 +556,6 @@
 
    /**
     * Hint to the JVM to run the garbage collector.
-    *
-    * @jmx:managed-operation
     */
    public void runGarbageCollector()
    {
@@ -577,9 +568,7 @@
    }
 
    /**
-    * Hint to the JVM to run any pending object finailizations.
-    *
-    * @jmx:managed-operation
+    * Hint to the JVM to run any pending object finalizations.
     */
    public void runFinalization()
    {
@@ -589,8 +578,8 @@
 
    /**
     * Enable or disable tracing method calls at the Runtime level.
-    *
-    * @jmx:managed-operation
+    * 
+    * @param flag whether to enable trace
     */
    public void traceMethodCalls(final Boolean flag)
    {
@@ -599,8 +588,8 @@
 
    /**
     * Enable or disable tracing instructions the Runtime level.
-    *
-    * @jmx:managed-operation
+    * 
+    * @param flag whether to enable trace
     */
    public void traceInstructions(final Boolean flag)
    {
@@ -612,57 +601,36 @@
    //                          Server Information                           //
    ///////////////////////////////////////////////////////////////////////////
 
-   /**
-    * @jmx:managed-attribute
-    */
    public Date getStartDate()
    {
       return startDate;
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getVersion()
    {
       return version.toString();
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getVersionName()
    {
       return version.getName();
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getBuildNumber()
    {
       return version.getBuildNumber();
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getBuildJVM()
    {
       return version.getBuildJVM();
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getBuildOS()
    {
       return version.getBuildOS();
    }
 
-   /**
-    * @jmx:managed-attribute
-    */
    public String getBuildID()
    {
       return version.getBuildID();
@@ -720,17 +688,12 @@
    private class ShutdownHook
       extends Thread
    {
-      /** The ServiceController which we will ask to shut things down with. */
-      private ProfileServiceBootstrap bootstrap;
-
       private boolean forceHalt = true;
 
-      public ShutdownHook(final ProfileServiceBootstrap bootstrap)
+      public ShutdownHook()
       {
          super("JBoss Shutdown Hook");
 
-         this.bootstrap = bootstrap;
-
          String value = SecurityActions.getSystemProperty("jboss.shutdown.forceHalt", null);
          if (value != null)
          {

Added: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,49 @@
+/*
+ * 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.system.server.profileservice;
+
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VFSBootstrapScannerImpl.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSBootstrapScannerImpl extends VFSScanner
+{
+   protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
+   {
+      DeploymentContext deployment = new AbstractDeploymentContext(file);
+      if( profile.getBootstrap(deployment.getName()) == null )
+         profile.addBootstrap(deployment);
+      return deployment;
+   }
+
+   protected void remove(Profile profile, String name)
+   {
+      profile.removeBootstrap(name);
+   }
+}

Added: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,49 @@
+/*
+ * 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.system.server.profileservice;
+
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VFSDeployerScannerImpl.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSDeployerScannerImpl extends VFSScanner
+{
+   protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
+   {
+      DeploymentContext deployment = new AbstractDeploymentContext(file);
+      if( profile.getDeployer(deployment.getName()) == null )
+         profile.addDeployer(deployment);
+      return deployment;
+   }
+
+   protected void remove(Profile profile, String name)
+   {
+      profile.removeDeployer(name);
+   }
+}

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.
  *
@@ -21,605 +21,29 @@
  */
 package org.jboss.system.server.profileservice;
 
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.net.protocol.URLLister;
-import org.jboss.net.protocol.URLLister.URLFilter;
 import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.util.JBossObject;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 
 /**
- * A DeploymentScanner build on top of the VFS and ProfileService. This is a
- * first pass to flesh out the APIs/concepts.
+ * VFSDeploymentScannerImpl.
  * 
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
  */
-public class VFSDeploymentScannerImpl extends JBossObject
+public class VFSDeploymentScannerImpl extends VFSScanner
 {
-   // Private Data --------------------------------------------------
-
-   private ProfileService ps;
-
-   private ProfileKey profileKey;
-
-   /** The URIfied ServerHomeURL */
-   private URI serverHomeURI;
-   
-   /** The list of URIs to scan */
-   private List<URI> uriList = new CopyOnWriteArrayList<URI>();
-   
-   /** The list of VirtualFiles to scan */
-   private List<VirtualFile> vdfList = new CopyOnWriteArrayList<VirtualFile>();;
-   
-   /** Allow a filter for scanned directories */
-   private URLLister.URLFilter filter;   
-
-   /** Whether to search for files inside directories whose names containing no dots */
-   private boolean doRecursiveSearch = true;
-   
-   /** A map of deployed virtual files to their names */
-   private Map<VirtualFile, String> deployedSet = new ConcurrentHashMap<VirtualFile, String>();
-
-   // Constructor ---------------------------------------------------
-   
-   public VFSDeploymentScannerImpl()
+   protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
    {
-      // empty
+      DeploymentContext deployment = new AbstractDeploymentContext(file);
+      if( profile.getDeployment(deployment.getName()) == null )
+         profile.addDeployment(deployment);
+      return deployment;
    }
-   
-   // Attributes ----------------------------------------------------
 
-   public void setProfileService(ProfileService ps)
+   protected void remove(Profile profile, String name)
    {
-      this.ps = ps;
+      profile.removeDeployment(name);
    }
-   public ProfileService getProfileService()
-   {
-      return ps;
-   }
-
-   public ProfileKey getProfileKey()
-   {
-      return profileKey;
-   }
-   public void setProfileKey(ProfileKey key)
-   {
-      this.profileKey = key;
-   }
-
-    /**
-    * @throws URISyntaxException
-    * @throws IOException
-    */
-   public void setURIs(final String listspec) throws URISyntaxException, IOException
-   {
-      if (listspec == null)
-      {
-         throw new NullPointerException("listspec argument cannot be null");
-      }
-      List<URI> list = new LinkedList<URI>();
-   
-      StringTokenizer stok = new StringTokenizer(listspec, ",");
-      while (stok.hasMoreTokens())
-      {
-         String urispec = stok.nextToken().trim();
-   
-         log.debug("Adding URI from spec: " + urispec);
-   
-         URI uri = makeURI(urispec);
-
-         log.debug("URI: " + uri);
-
-         list.add(uri);
-      }
-      setURIList(list);
-   }
-
-   /**
-    * 
-    * @throws IOException
-    */
-   public void setURIList(final List<URI> list) throws IOException
-   {
-      if (list == null)
-      {
-         throw new NullPointerException("list argument cannot be null");
-      }
-   
-      // start out with a fresh list
-      uriList.clear();
-   
-      for(int n = 0; n < list.size(); n ++)
-      {
-         URI uri = list.get(n);
-         if (uri == null)
-         {
-            throw new IllegalArgumentException("list element["+n+"] is null");
-         }
-         addURI(uri);
-      }
-      log.debug("URI list: " + uriList);
-   }
-   
-   /**
-    * @jmx:managed-attribute
-    */
-   public List<URI> getURIList()
-   {
-      return new ArrayList<URI>(uriList);
-   }
-
-   /**
-    * @jmx:managed-attribute
-    */
-   public void setRecursiveSearch(boolean recurse)
-   {
-      doRecursiveSearch = recurse;
-   }
-   
-   /**
-    * @jmx:managed-attribute
-    */
-   public boolean getRecursiveSearch()
-   {
-      return doRecursiveSearch;
-   }
-
-   /**
-    * @jmx:managed-attribute
-    */
-   public void setFilter(String classname)
-      throws ClassNotFoundException, IllegalAccessException, InstantiationException
-   {
-      Class filterClass = Thread.currentThread().getContextClassLoader().loadClass(classname);
-      filter = (URLLister.URLFilter)filterClass.newInstance();
-   }
-   
-   /**
-    * @jmx:managed-attribute
-    */
-   public String getFilter()
-   {
-      if (filter == null)
-      {
-         return null;
-      }
-      return filter.getClass().getName();
-   }
-
-   /**
-    * @jmx:managed-attribute
-    */
-   public void setFilterInstance(URLFilter filter)
-   {
-      this.filter = filter;
-   }
-
-   /**
-    * @jmx:managed-attribute
-    */
-   public URLFilter getFilterInstance()
-   {
-      return filter;
-   }
-   
-   // Operations ----------------------------------------------------
-   
-   /**
-    * @jmx:managed-operation
-    */
-   public void addURI(final URI uri) throws IOException
-   {
-      if (uri == null)
-      {
-         throw new NullPointerException("uri argument cannot be null");
-      }
-      if( uriList.add(uri) == true )
-      {
-         log.debug("Added URI: " + uri);
-         VirtualFile vf = getVFforURI(uri);
-         vdfList.add(vf);
-      }      
-   }
-
-   /**
-    * @jmx:managed-operation
-    */
-   public void removeURI(final URI uri)
-      throws IOException
-   {
-      if (uri == null)
-      {
-         throw new NullPointerException("uri argument cannot be null");
-      }
-      VirtualFile vf = getVFforURI(uri);
-      vdfList.remove(vf);
-      boolean success = uriList.remove(uri);
-      
-      if (success)
-      {
-         log.debug("Removed URI: " + uri);
-      }
-   }
-   
-   /**
-    * @jmx:managed-operation
-    */
-   public boolean hasURI(final URI uri)
-   {
-      if (uri == null)
-      {
-         throw new NullPointerException("uri argument cannot be null");
-      }
-      return uriList.contains(uri);
-   }
-
-   public void start() throws Exception
-   {
-      // synchronize uriList and vdfList because only at this point
-      // setVirtualFileFactory() injection has been performed
-      vdfList.clear();
-      for (Iterator<URI> i = uriList.iterator(); i.hasNext(); )
-      {
-         URI uri = i.next();
-         VirtualFile vf = this.getVFforURI(uri);
-         vdfList.add(vf);
-      }
-      if( profileKey == null )
-      {
-         profileKey = new ProfileKey("default");
-      }
-      scan();
-   }
-
-   // AbstractDeploymentScanner overrides ---------------------------
-   
-   public synchronized void scan() throws Exception
-   {
-      if (vdfList == null)
-      {
-         throw new IllegalStateException("not initialized");
-      }
-   
-      boolean trace = log.isTraceEnabled();
-    
-      // Scan for deployments
-      if (trace)
-      {
-         log.trace("Scanning for new deployments");
-      }
-
-      // VirtualFiles to deploy
-      List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
-      synchronized (vdfList)
-      {
-         for (Iterator i = vdfList.iterator(); i.hasNext();)
-         {
-            VirtualFile component = (VirtualFile)i.next();
-            if (component.isFile())
-            {
-               // treat this as a deployable unit
-               toDeployList.add(component);
-            }
-            else if (component.isDirectory())
-            {
-               // process (possibly recursively) the dir
-               addDeployments(toDeployList, component);
-            }
-         }
-      }
-      
-      if (trace)
-      {
-         log.trace("toDeployList");
-         for (Iterator i = toDeployList.iterator(); i.hasNext();)
-         {
-            log.trace(i.next());
-         }
-      }
-      LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
-      LinkedList<VirtualFile> toCheckForUpdateList = new LinkedList<VirtualFile>();
-
-      synchronized (deployedSet)
-      {
-         // remove previously deployed URLs no longer needed
-         for (VirtualFile deployedComponent : deployedSet.keySet())
-         {
-            if (toDeployList.contains(deployedComponent))
-            {
-               toCheckForUpdateList.add(deployedComponent);
-            }
-            else
-            {
-               toRemoveList.add(deployedComponent);
-            }
-         }
-      }
-
-      // ********
-      // Undeploy
-      // ********
-   
-      for (Iterator i = toRemoveList.iterator(); i.hasNext();)
-      {
-         VirtualFile deployedComponent = (VirtualFile)i.next();
-         undeploy(deployedComponent);
-      }
-
-      // ********
-      // Redeploy
-      // ********
-
-      // compute the DeployedURL list to update
-      ArrayList<VirtualFile> toUpdateList = new ArrayList<VirtualFile>(toCheckForUpdateList.size());
-      for (Iterator i = toCheckForUpdateList.iterator(); i.hasNext();)
-      {
-         VirtualFile deployedComponent = (VirtualFile)i.next();
-         if (isModified(deployedComponent))
-         {
-            if (trace)
-            {
-               log.trace("Re-deploying " + deployedComponent);
-            }
-            toUpdateList.add(deployedComponent);
-         }
-      }
-
-      // sort to update list
-      //Collections.sort(toUpdateList, sorter);
-
-      // Undeploy in order
-      for (int i = toUpdateList.size() - 1; i >= 0; i--)
-      {
-         VirtualFile vf = toUpdateList.get(i);
-         undeploy(vf);
-      }
-
-      // Deploy in order
-      for (int i = 0; i < toUpdateList.size(); i++)
-      {
-         VirtualFile vf = toUpdateList.get(i);
-         deploy(vf);
-      }
-   
-      // ******
-      // Deploy
-      // ******
-
-      //Collections.sort(toDeployList, sorter);
-      for (Iterator i = toDeployList.iterator(); i.hasNext();)
-      {
-         VirtualFile component = (VirtualFile)i.next();
-         
-         // if component is not deployed already, deploy it
-         if (!deployedSet.containsKey(component))
-         {
-            deploy(component);
-         }
-
-         // component must have been deployed by now, so remove it from list 
-         i.remove();
-         
-         /* Check to see if mainDeployer suffix list has changed, if so, then resort
-         if (i.hasNext() && updateSorter())
-         {
-            Collections.sort(toDeployList, sorter);
-            i = toDeployList.iterator();
-         }
-         */
-      }
-   
-      /* TODO: Validate that there are still incomplete deployments
-      if (lastIncompleteDeploymentException != null)
-      {
-         try
-         {
-            Object[] args = {};
-            String[] sig = {};
-            getServer().invoke(getDeployer(), "checkIncompleteDeployments", args, sig);
-         }
-         catch (Exception e)
-         {
-            Throwable t = JMXExceptionDecoder.decode(e);
-            log.error(t);
-         }
-      }
-      */
-   }
-      
-   // Private -------------------------------------------------------
-   
-    /**
-     * A helper to make a URI from a full/partial urispec
-     */
-   private URI makeURI(String urispec) throws URISyntaxException
-   {
-      // First replace URI with appropriate properties
-      urispec = StringPropertyReplacer.replaceProperties(urispec);
-      return serverHomeURI.resolve(urispec);
-   }
-   
-   /**
-    * A helper to find all deployments under a directory component
-    * and add them to the supplied list.
-    * 
-    * We may recurse.
-    */
-   private void addDeployments(List<VirtualFile> list, VirtualFile root)
-      throws IOException
-   {
-      List<VirtualFile> components = root.getChildren();
-      
-      for (VirtualFile component : components)
-      {
-         if (component.isFile())
-         {
-            // the first arg in filter.accept is not used!
-            if (filter == null || filter.accept(null, component.getName()))
-            {
-               list.add(component);
-            }            
-         }
-         else if (component.isDirectory())
-         {
-            if (component.getName().indexOf('.') == -1 && this.doRecursiveSearch)
-            {
-               // recurse if not '.' in name and recursive search is enabled
-               addDeployments(list, component);
-            }
-            else
-            {
-               list.add(component);
-            }
-         }
-      }
-   }
-
-   /**
-    * A helper to deploy the given component using the deployer.
-    */
-   private void deploy(final VirtualFile component)
-   {
-      // If the deployer is null simply ignore the request
-      if (ps == null)
-      {
-         return;
-      }
-      if (log.isTraceEnabled())
-      {
-         log.trace("Deploying: " + component);
-      }
-
-      DeploymentContext deployment = null;
-      try
-      {
-         Profile profile = ps.getProfile(profileKey);
-         deployment = new AbstractDeploymentContext(component);
-         if( profile.getDeployment(deployment.getName()) == null )
-            profile.addDeployment(deployment);
-      }
-      catch (Exception e)
-      {
-         log.debug("Failed to deploy: " + component, e);
-      }
-
-      String watchPath = getWatchURL(deployment);
-      VirtualFile watchComponent = null;
-      long deployedLastModified = -1;
-      try
-      {
-         if (watchPath != null)
-         {
-            watchComponent = component.findChild(watchPath);
-            deployedLastModified = watchComponent.getLastModified();
-         }
-         else
-         {
-            deployedLastModified = component.getLastModified();
-         }
-      }
-      catch (IOException e)
-      {
-         log.warn(e);
-      }
-      //component.setContext(new ComponentContext(watchComponent, deployedLastModified));
-   
-      if (!deployedSet.containsKey(component))
-      {
-         deployedSet.put(component, deployment.getName());
-      }
-   }
-   
-   /**
-    * A helper to undeploy the given component using the deployer.
-    */
-   private void undeploy(final VirtualFile component)
-   {
-      try
-      {
-         if (log.isTraceEnabled())
-         {
-            log.trace("Undeploying: " + component);
-         }
-         String name = deployedSet.remove(component);         
-         Profile profile = ps.getProfile(profileKey);
-         profile.removeDeployment(name);
-      }
-      catch (Exception e)
-      {
-         log.error("Failed to undeploy: " + component, e);
-      }
-   }      
-   
-   /**
-    * Helper to get the watchURL for a deployment, if different.
-    * Returns null otherwise
-    */
-   private String getWatchURL(DeploymentContext deployment)
-   {
-      String watchPath = (String) deployment.getPredeterminedManagedObjects().getAttachment("WATCH_URL");
-      return watchPath;
-   }
-
-   /**
-    * Helper to find out if a deployed component has been modified
-    * TODO: How should this be implemented
-    */
-   public boolean isModified(VirtualFile component) throws IOException
-   {
-      // get the context stored with every deployed component
-      ComponentContext cc = null; //(ComponentContext)component.getContext();
-      
-      // get modification time at the time of deployment
-      long deployedLastModified = cc.deployedLastModified;
-      
-      // find out the current lastModified time either from
-      // the component or the watched component, if exists
-      long lastModified = (cc.watchComponent != null) ? cc.watchComponent.getLastModified() 
-                                                      : component.getLastModified();
-
-       return deployedLastModified != lastModified;
-    }
-   
-   private VirtualFile getVFforURI(URI uri)
-      throws IOException
-   {
-      VFS vfs = VFS.getVFS(uri);
-      return vfs.getRoot();
-   }
-
-   /**
-    * Simple holder class to let us store extra info
-    * on a VirtualFile object
-    */
-   private static class ComponentContext
-   {
-      public VirtualFile watchComponent;
-      public long deployedLastModified;
-      
-      public ComponentContext(VirtualFile watchComponent, long deployedLastModified)
-      {
-         this.watchComponent = watchComponent;
-         this.deployedLastModified = deployedLastModified;
-      }
-   }
 }

Added: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,712 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.system.server.profileservice;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.net.protocol.URLLister;
+import org.jboss.net.protocol.URLLister.URLFilter;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.util.JBossObject;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A DeploymentScanner build on top of the VFS and ProfileService. This is a
+ * first pass to flesh out the APIs/concepts.
+ * 
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public abstract class VFSScanner extends JBossObject
+{
+   /** The profile service */
+   private ProfileService profileService;
+
+   /** The profile service key */
+   private ProfileKey profileKey;
+
+   /** The URIfied ServerHomeURL */
+   private URI serverHomeURI;
+   
+   /** The list of URIs to scan */
+   private List<URI> uriList = new CopyOnWriteArrayList<URI>();
+   
+   /** The list of VirtualFiles to scan */
+   private List<VirtualFile> vdfList = new CopyOnWriteArrayList<VirtualFile>();;
+   
+   /** Allow a filter for scanned directories */
+   private URLLister.URLFilter filter;   
+
+   /** Whether to search for files inside directories whose names containing no dots */
+   private boolean doRecursiveSearch = true;
+   
+   /** A map of deployed virtual files to their names */
+   private Map<VirtualFile, String> deployedSet = new ConcurrentHashMap<VirtualFile, String>();
+
+    /**
+    * Get the profileKey.
+    * 
+    * @return the profileKey.
+    */
+   public ProfileKey getProfileKey()
+   {
+      return profileKey;
+   }
+
+   /**
+    * Set the profileKey.
+    * 
+    * @param profileKey the profileKey.
+    */
+   public void setProfileKey(ProfileKey profileKey)
+   {
+      this.profileKey = profileKey;
+   }
+
+   /**
+    * Get the profileService.
+    * 
+    * @return the profileService.
+    */
+   public ProfileService getProfileService()
+   {
+      return profileService;
+   }
+
+   /**
+    * Set the profileService.
+    * 
+    * @param profileService the profileService.
+    */
+   public void setProfileService(ProfileService profileService)
+   {
+      this.profileService = profileService;
+   }
+
+   /**
+    * Set the uris
+    * 
+    * @param listspec the uris
+    * @throws URISyntaxException
+    * @throws IOException
+    */
+   public void setURIs(final String listspec) throws URISyntaxException, IOException
+   {
+      if (listspec == null)
+      {
+         throw new NullPointerException("listspec argument cannot be null");
+      }
+      List<URI> list = new LinkedList<URI>();
+   
+      StringTokenizer stok = new StringTokenizer(listspec, ",");
+      while (stok.hasMoreTokens())
+      {
+         String urispec = stok.nextToken().trim();
+   
+         log.debug("Adding URI from spec: " + urispec);
+   
+         URI uri = makeURI(urispec);
+
+         log.debug("URI: " + uri);
+
+         list.add(uri);
+      }
+      setURIList(list);
+   }
+
+   /**
+    * Set the uri list
+    * 
+    * @param list the list
+    * @throws IOException
+    */
+   public void setURIList(final List<URI> list) throws IOException
+   {
+      if (list == null)
+      {
+         throw new NullPointerException("list argument cannot be null");
+      }
+   
+      // start out with a fresh list
+      uriList.clear();
+   
+      for(int n = 0; n < list.size(); n ++)
+      {
+         URI uri = list.get(n);
+         if (uri == null)
+         {
+            throw new IllegalArgumentException("list element["+n+"] is null");
+         }
+         addURI(uri);
+      }
+      log.debug("URI list: " + uriList);
+   }
+
+   /**
+    * Get the uri list
+    * 
+    * @return the list
+    */
+   public List<URI> getURIList()
+   {
+      return new ArrayList<URI>(uriList);
+   }
+
+   /**
+    * Set whether to do recursive search
+    * 
+    * @param recurse true when recurisve
+    */
+   public void setRecursiveSearch(boolean recurse)
+   {
+      doRecursiveSearch = recurse;
+   }
+
+   /**
+    * Get the recursive search
+    * 
+    * @return true when recursive
+    */
+   public boolean getRecursiveSearch()
+   {
+      return doRecursiveSearch;
+   }
+
+   /**
+    * Set the filer
+    * 
+    * @param classname the filer class name
+    * @throws ClassNotFoundException when the class is not found
+    * @throws IllegalAccessException when the class's default constructor is not public
+    * @throws InstantiationException when there is an error constructing the class
+    */
+   public void setFilter(String classname)
+      throws ClassNotFoundException, IllegalAccessException, InstantiationException
+   {
+      Class filterClass = Thread.currentThread().getContextClassLoader().loadClass(classname);
+      filter = (URLLister.URLFilter)filterClass.newInstance();
+   }
+
+   /**
+    * Get the filer
+    * 
+    * @return the filter
+    */
+   public String getFilter()
+   {
+      if (filter == null)
+      {
+         return null;
+      }
+      return filter.getClass().getName();
+   }
+
+   /**
+    * Set the filter instance
+    * 
+    * @param filter ther filter
+    */
+   public void setFilterInstance(URLFilter filter)
+   {
+      this.filter = filter;
+   }
+
+   /**
+    * Get the filter instance
+    * 
+    * @return the filter
+    */
+   public URLFilter getFilterInstance()
+   {
+      return filter;
+   }
+
+   /**
+    * Add a uri
+    * 
+    * @param uri the uri
+    * @throws IOException for an error accessing the uri
+    */
+   public void addURI(final URI uri) throws IOException
+   {
+      if (uri == null)
+      {
+         throw new NullPointerException("uri argument cannot be null");
+      }
+      if( uriList.add(uri) == true )
+      {
+         log.debug("Added URI: " + uri);
+         VirtualFile vf = getVFforURI(uri);
+         vdfList.add(vf);
+      }      
+   }
+
+   /**
+    * Remove a uri
+    * 
+    * @param uri the uri
+    * @throws IOException for an error accessing the uri
+    */
+   public void removeURI(final URI uri)
+      throws IOException
+   {
+      if (uri == null)
+      {
+         throw new NullPointerException("uri argument cannot be null");
+      }
+      VirtualFile vf = getVFforURI(uri);
+      vdfList.remove(vf);
+      boolean success = uriList.remove(uri);
+      
+      if (success)
+      {
+         log.debug("Removed URI: " + uri);
+      }
+   }
+
+   /**
+    * Whether it has the uri
+    * 
+    * @param uri the uri
+    * @return when the uri is configured
+    */
+   public boolean hasURI(final URI uri)
+   {
+      if (uri == null)
+      {
+         throw new NullPointerException("uri argument cannot be null");
+      }
+      return uriList.contains(uri);
+   }
+
+   /**
+    * Start the scan
+    * 
+    * @throws Exception for any error
+    */
+   public void start() throws Exception
+   {
+      // synchronize uriList and vdfList because only at this point
+      // setVirtualFileFactory() injection has been performed
+      vdfList.clear();
+      for (Iterator<URI> i = uriList.iterator(); i.hasNext(); )
+      {
+         URI uri = i.next();
+         VirtualFile vf = this.getVFforURI(uri);
+         vdfList.add(vf);
+      }
+      if( profileKey == null )
+      {
+         profileKey = new ProfileKey("default");
+      }
+      scan();
+   }
+
+   /**
+    * Scan
+    * 
+    * @throws Exception for any error
+    */
+   public synchronized void scan() throws Exception
+   {
+      if (vdfList == null)
+      {
+         throw new IllegalStateException("not initialized");
+      }
+   
+      boolean trace = log.isTraceEnabled();
+    
+      // Scan for deployments
+      if (trace)
+      {
+         log.trace("Scanning for new deployments");
+      }
+
+      // VirtualFiles to deploy
+      List<VirtualFile> toDeployList = new LinkedList<VirtualFile>();
+      synchronized (vdfList)
+      {
+         for (Iterator i = vdfList.iterator(); i.hasNext();)
+         {
+            VirtualFile component = (VirtualFile)i.next();
+            if (component.isFile())
+            {
+               // treat this as a deployable unit
+               toDeployList.add(component);
+            }
+            else if (component.isDirectory())
+            {
+               // process (possibly recursively) the dir
+               addDeployments(toDeployList, component);
+            }
+         }
+      }
+      
+      if (trace)
+      {
+         log.trace("toDeployList");
+         for (Iterator i = toDeployList.iterator(); i.hasNext();)
+         {
+            log.trace(i.next());
+         }
+      }
+      LinkedList<VirtualFile> toRemoveList = new LinkedList<VirtualFile>();
+      LinkedList<VirtualFile> toCheckForUpdateList = new LinkedList<VirtualFile>();
+
+      synchronized (deployedSet)
+      {
+         // remove previously deployed URLs no longer needed
+         for (VirtualFile deployedComponent : deployedSet.keySet())
+         {
+            if (toDeployList.contains(deployedComponent))
+            {
+               toCheckForUpdateList.add(deployedComponent);
+            }
+            else
+            {
+               toRemoveList.add(deployedComponent);
+            }
+         }
+      }
+
+      // ********
+      // Undeploy
+      // ********
+   
+      for (Iterator i = toRemoveList.iterator(); i.hasNext();)
+      {
+         VirtualFile deployedComponent = (VirtualFile)i.next();
+         undeploy(deployedComponent);
+      }
+
+      // ********
+      // Redeploy
+      // ********
+
+      // compute the DeployedURL list to update
+      ArrayList<VirtualFile> toUpdateList = new ArrayList<VirtualFile>(toCheckForUpdateList.size());
+      for (Iterator i = toCheckForUpdateList.iterator(); i.hasNext();)
+      {
+         VirtualFile deployedComponent = (VirtualFile)i.next();
+         if (isModified(deployedComponent))
+         {
+            if (trace)
+            {
+               log.trace("Re-deploying " + deployedComponent);
+            }
+            toUpdateList.add(deployedComponent);
+         }
+      }
+
+      // sort to update list
+      //Collections.sort(toUpdateList, sorter);
+
+      // Undeploy in order
+      for (int i = toUpdateList.size() - 1; i >= 0; i--)
+      {
+         VirtualFile vf = toUpdateList.get(i);
+         undeploy(vf);
+      }
+
+      // Deploy in order
+      for (int i = 0; i < toUpdateList.size(); i++)
+      {
+         VirtualFile vf = toUpdateList.get(i);
+         deploy(vf);
+      }
+   
+      // ******
+      // Deploy
+      // ******
+
+      //Collections.sort(toDeployList, sorter);
+      for (Iterator i = toDeployList.iterator(); i.hasNext();)
+      {
+         VirtualFile component = (VirtualFile)i.next();
+         
+         // if component is not deployed already, deploy it
+         if (!deployedSet.containsKey(component))
+         {
+            deploy(component);
+         }
+
+         // component must have been deployed by now, so remove it from list 
+         i.remove();
+         
+         /* Check to see if mainDeployer suffix list has changed, if so, then resort
+         if (i.hasNext() && updateSorter())
+         {
+            Collections.sort(toDeployList, sorter);
+            i = toDeployList.iterator();
+         }
+         */
+      }
+   
+      /* TODO: Validate that there are still incomplete deployments
+      if (lastIncompleteDeploymentException != null)
+      {
+         try
+         {
+            Object[] args = {};
+            String[] sig = {};
+            getServer().invoke(getDeployer(), "checkIncompleteDeployments", args, sig);
+         }
+         catch (Exception e)
+         {
+            Throwable t = JMXExceptionDecoder.decode(e);
+            log.error(t);
+         }
+      }
+      */
+   }
+
+   /**
+    * Make a uri
+    * 
+    * @param urispec the uri spec
+    * @return the uri
+    * @throws URISyntaxException for an error parsing he uri
+    */
+   private URI makeURI(String urispec) throws URISyntaxException
+   {
+      // First replace URI with appropriate properties
+      urispec = StringPropertyReplacer.replaceProperties(urispec);
+      return serverHomeURI.resolve(urispec);
+   }
+   
+   /**
+    * A helper to find all deployments under a directory component
+    * and add them to the supplied list.
+    * 
+    * We may recurse.
+    * 
+    * @param list the list of virtual files 
+    * @param root the root file
+    * @throws IOException for any error
+    */
+   private void addDeployments(List<VirtualFile> list, VirtualFile root)
+      throws IOException
+   {
+      List<VirtualFile> components = root.getChildren();
+      
+      for (VirtualFile component : components)
+      {
+         if (component.isFile())
+         {
+            // the first arg in filter.accept is not used!
+            if (filter == null || filter.accept(null, component.getName()))
+            {
+               list.add(component);
+            }            
+         }
+         else if (component.isDirectory())
+         {
+            if (component.getName().indexOf('.') == -1 && this.doRecursiveSearch)
+            {
+               // recurse if not '.' in name and recursive search is enabled
+               addDeployments(list, component);
+            }
+            else
+            {
+               list.add(component);
+            }
+         }
+      }
+   }
+
+   /**
+    * A helper to deploy the given component using the deployer.
+    * 
+    * @param component the virtual file
+    */
+   private void deploy(final VirtualFile component)
+   {
+      // If the deployer is null simply ignore the request
+      if (profileService == null)
+      {
+         return;
+      }
+      if (log.isTraceEnabled())
+      {
+         log.trace("Deploying: " + component);
+      }
+
+      DeploymentContext deployment = null;
+      try
+      {
+         Profile profile = profileService.getProfile(profileKey);
+         deployment = add(profile, component);
+      }
+      catch (Exception e)
+      {
+         log.debug("Failed to deploy: " + component, e);
+      }
+
+      /* TODO
+      String watchPath = getWatchURL(deployment);
+      VirtualFile watchComponent = null;
+      long deployedLastModified = -1;
+      try
+      {
+         if (watchPath != null)
+         {
+            watchComponent = component.findChild(watchPath);
+            deployedLastModified = watchComponent.getLastModified();
+         }
+         else
+         {
+            deployedLastModified = component.getLastModified();
+         }
+      }
+      catch (IOException e)
+      {
+         log.warn(e);
+      }
+      component.setContext(new ComponentContext(watchComponent, deployedLastModified));
+      */
+   
+      if (!deployedSet.containsKey(component))
+      {
+         deployedSet.put(component, deployment.getName());
+      }
+   }
+   
+   /**
+    * A helper to undeploy the given component using the deployer.
+    * 
+    * @param component the component
+    */
+   private void undeploy(final VirtualFile component)
+   {
+      try
+      {
+         if (log.isTraceEnabled())
+         {
+            log.trace("Undeploying: " + component);
+         }
+         String name = deployedSet.remove(component);         
+         Profile profile = profileService.getProfile(profileKey);
+         remove(profile, name);
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to undeploy: " + component, e);
+      }
+   }      
+   
+   /**
+    * Remove the component
+    * 
+    * @param profile the profile
+    * @param file the virtual file
+    * @return the deployment context or null if not added, e.g. it already exists
+    * @throws Exception for any error
+    */
+   protected abstract DeploymentContext add(Profile profile, VirtualFile file) throws Exception;
+   
+   /**
+    * Remove the component
+    * 
+    * @param profile the profile
+    * @param name the name
+    */
+   protected abstract void remove(Profile profile, String name);
+   
+   /**
+    * Helper to get the watchURL for a deployment, if different.
+    * Returns null otherwise
+    * 
+    * @param deployment the deployment
+    * @return the watch url
+    */
+   /* TODO
+   private String getWatchURL(DeploymentContext deployment)
+   {
+      String watchPath = (String) deployment.getPredeterminedManagedObjects().getAttachment("WATCH_URL");
+      return watchPath;
+   }
+   /*/
+
+   /**
+    * Helper to find out if a deployed component has been modified
+    * TODO: How should this be implemented
+    * 
+    * @param component the component
+    * @return true when modified
+    * @throws IOException for any error accessing the file
+    */
+   public boolean isModified(VirtualFile component) throws IOException
+   {
+      // get the context stored with every deployed component
+      ComponentContext cc = null; //(ComponentContext)component.getContext();
+      
+      // get modification time at the time of deployment
+      long deployedLastModified = cc.deployedLastModified;
+      
+      // find out the current lastModified time either from
+      // the component or the watched component, if exists
+      long lastModified = (cc.watchComponent != null) ? cc.watchComponent.getLastModified() 
+                                                      : component.getLastModified();
+
+       return deployedLastModified != lastModified;
+    }
+   
+   private VirtualFile getVFforURI(URI uri)
+      throws IOException
+   {
+      VFS vfs = VFS.getVFS(uri);
+      return vfs.getRoot();
+   }
+
+   /**
+    * Simple holder class to let us store extra info
+    * on a VirtualFile object
+    */
+   private static class ComponentContext
+   {
+      public VirtualFile watchComponent;
+      public long deployedLastModified;
+      
+      public ComponentContext(VirtualFile watchComponent, long deployedLastModified)
+      {
+         this.watchComponent = watchComponent;
+         this.deployedLastModified = deployedLastModified;
+      }
+   }
+}

Modified: branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -24,22 +24,15 @@
 
 import java.io.IOException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
-import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.DemandMetaData;
 import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.profileservice.spi.DeploymentTemplate;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.DeploymentTemplate;
 
 /**
  * A test profile with a fixed default deployment. The contents of the
@@ -146,4 +139,52 @@
          throw new NoSuchDeploymentException(name);
       return d;
    }
+
+   public void addBootstrap(DeploymentContext d)
+   {
+      // @todo addBootstrap
+      throw new org.jboss.util.NotImplementedException("addBootstrap");
+   }
+
+   public void addDeployer(DeploymentContext d)
+   {
+      // @todo addDeployer
+      throw new org.jboss.util.NotImplementedException("addDeployer");
+   }
+
+   public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
+   {
+      // @todo getBootstrap
+      throw new org.jboss.util.NotImplementedException("getBootstrap");
+   }
+
+   public Collection<DeploymentContext> getBootstraps()
+   {
+      // @todo getBootstraps
+      throw new org.jboss.util.NotImplementedException("getBootstraps");
+   }
+
+   public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
+   {
+      // @todo getDeployer
+      throw new org.jboss.util.NotImplementedException("getDeployer");
+   }
+
+   public Collection<DeploymentContext> getDeployers()
+   {
+      // @todo getDeployers
+      throw new org.jboss.util.NotImplementedException("getDeployers");
+   }
+
+   public void removeBootstrap(String name)
+   {
+      // @todo removeBootstrap
+      throw new org.jboss.util.NotImplementedException("removeBootstrap");
+   }
+
+   public void removeDeployer(String name)
+   {
+      // @todo removeDeployer
+      throw new org.jboss.util.NotImplementedException("removeDeployer");
+   }
 }

Modified: branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl2.java
===================================================================
--- branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl2.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system/src/tests/org/jboss/test/profileservice/simple1/ProfileImpl2.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -266,4 +266,52 @@
          throw new NoSuchDeploymentException(name);
       return d;
    }
+
+   public void addBootstrap(DeploymentContext d)
+   {
+      // @todo addBootstrap
+      throw new org.jboss.util.NotImplementedException("addBootstrap");
+   }
+
+   public void addDeployer(DeploymentContext d)
+   {
+      // @todo addDeployer
+      throw new org.jboss.util.NotImplementedException("addDeployer");
+   }
+
+   public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
+   {
+      // @todo getBootstrap
+      throw new org.jboss.util.NotImplementedException("getBootstrap");
+   }
+
+   public Collection<DeploymentContext> getBootstraps()
+   {
+      // @todo getBootstraps
+      throw new org.jboss.util.NotImplementedException("getBootstraps");
+   }
+
+   public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
+   {
+      // @todo getDeployer
+      throw new org.jboss.util.NotImplementedException("getDeployer");
+   }
+
+   public Collection<DeploymentContext> getDeployers()
+   {
+      // @todo getDeployers
+      throw new org.jboss.util.NotImplementedException("getDeployers");
+   }
+
+   public void removeBootstrap(String name)
+   {
+      // @todo removeBootstrap
+      throw new org.jboss.util.NotImplementedException("removeBootstrap");
+   }
+
+   public void removeDeployer(String name)
+   {
+      // @todo removeDeployer
+      throw new org.jboss.util.NotImplementedException("removeDeployer");
+   }
 }

Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -21,31 +21,23 @@
 */
 package org.jboss.system.deployers;
 
-import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.deployers.plugins.deployers.helpers.AbstractParsingDeployer;
+import org.jboss.deployers.plugins.deployers.helpers.JAXPDeployer;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
 import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
 import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceDeploymentClassPath;
+import org.jboss.system.metadata.ServiceDeploymentParser;
 import org.jboss.system.server.ServerConfig;
 import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
 
 /**
  * SARDeployer.<p>
@@ -58,11 +50,8 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
-public class SARDeployer extends AbstractParsingDeployer<ServiceDeployment>
+public class SARDeployer extends JAXPDeployer<ServiceDeployment>
 {
-   /** Use a namespace aware parser */
-   private boolean useNamespaceAwareParser;
-   
    /**
     * Create a new SARDeployer.
     * 
@@ -73,150 +62,68 @@
       super(ServiceDeployment.class);
    }
 
-   /**
-    * Get the useNamespaceAwareParser.
-    * 
-    * @return the useNamespaceAwareParser.
-    */
-   public boolean isUseNamespaceAwareParser()
+   protected ServiceDeployment parse(DeploymentUnit unit, VirtualFile file, Document document) throws Exception
    {
-      return useNamespaceAwareParser;
-   }
-
-   /**
-    * Set the useNamespaceAwareParser.
-    * 
-    * @param useNamespaceAwareParser the useNamespaceAwareParser.
-    */
-   public void setUseNamespaceAwareParser(boolean useNamespaceAwareParser)
-   {
-      this.useNamespaceAwareParser = useNamespaceAwareParser;
-   }
-
-   protected ServiceDeployment parse(DeploymentUnit unit, VirtualFile file) throws Exception
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-      
-      ServiceDeployment parsed = new ServiceDeployment();
+      ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
+      ServiceDeployment parsed = parser.parse();
       String name = file.toURI().toString();
       parsed.setName(name);
-      InputStream is = file.openStream();
-      try
-      {
-         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-         factory.setNamespaceAware(useNamespaceAwareParser);
-         DocumentBuilder parser = factory.newDocumentBuilder();
-         InputSource source = new InputSource(is);
-         source.setSystemId(parsed.getName());
-         parser.setEntityResolver(new JBossEntityResolver());
-         Document document = parser.parse(is);
 
-         parseXMLClasspath(unit.getDeploymentContext(), document);
+      List<ServiceDeploymentClassPath> classPaths = parsed.getClassPaths();
+      if (classPaths != null)
+         processXMLClasspath(unit.getDeploymentContext(), classPaths);
 
-         // Check for a custom loader-repository for scoping
-         NodeList loaders = document.getElementsByTagName("loader-repository");
-         if( loaders.getLength() > 0 )
-         {
-            Element loader = (Element) loaders.item(0);
-            LoaderRepositoryConfig config = LoaderRepositoryFactory.parseRepositoryConfig(loader);
-            if (config != null)
-               unit.addAttachment(LoaderRepositoryConfig.class.getName(), config);
-         }
-
-         // We can't parse the services yet, because it requires the classloader
-         parsed.setConfig(document.getDocumentElement());
-      }
-      finally
-      {
-         try
-         {
-            is.close();
-         }
-         catch (Exception ignored)
-         {
-         }
-      }
-      if (parsed == null)
-         throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");
+      LoaderRepositoryConfig config = parsed.getLoaderRepositoryConfig();
+      if (config != null)
+         unit.addAttachment(LoaderRepositoryConfig.class.getName(), config);
       return parsed;
    }
 
-   // TODO make this optional
-   protected void init(DeploymentUnit unit, ServiceDeployment metaData, VirtualFile file) throws Exception
-   {
-   }
-
    public void deploy(DeploymentUnit unit) throws DeploymentException
    {
       createMetaData(unit, null, "-service.xml");
    }
 
-   // TODO make this optional
-   public void undeploy(DeploymentUnit unit)
-   {
-   }
-
    /**
-    * Parse the xml classpath
+    * Process the xml classpath
     * 
     * @param context the context
-    * @param document the document
+    * @param classpaths the classpaths
     * @throws Exception for any error
     */
-   private void parseXMLClasspath(DeploymentContext context, Document document) throws Exception
+   private void processXMLClasspath(DeploymentContext context, List<ServiceDeploymentClassPath> classpaths) throws Exception
    {
       ArrayList<VirtualFile> classpath = new ArrayList<VirtualFile>();
 
-      NodeList children = document.getDocumentElement().getChildNodes();
-      for (int i = 0; i < children.getLength(); ++i)
+      for (ServiceDeploymentClassPath path : classpaths)
       {
-         if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
+         String codebase = path.getCodeBase();
+         String archives = path.getArchives();
+
+         log.debug("Processing classpath: " + context.getName() + " codebase=" + codebase + " archives=" + archives);
+         VirtualFile codebaseFile = context.getRoot();
+         if (".".equals(codebase) == false)
          {
-            Element classpathElement = (Element)children.item(i);
-            if (classpathElement.getTagName().equals("classpath"))
-            {
-               log.debug("Found classpath element: " + classpathElement);
-               if (classpathElement.hasAttribute("codebase") == false)
-                  throw new DeploymentException("Invalid classpath element missing codebase: " + classpathElement);
+            ServerConfig config = ServerConfigLocator.locate();
+            URL codeBaseURL = new URL(config.getServerHomeURL(), codebase);
+            codebaseFile = VFS.getVirtualFile(codeBaseURL, "");
+         }
 
-               String codebase = classpathElement.getAttribute("codebase").trim();
-               codebase = StringPropertyReplacer.replaceProperties(codebase);
+         if (codebaseFile == null)
+            throw new DeploymentException("Cannot use classpath without a root: " + context.getName());
 
-               String archives = null;
-               if (classpathElement.hasAttribute("archives"))
-               {
-                  archives = classpathElement.getAttribute("archives").trim();
-                  archives = StringPropertyReplacer.replaceProperties(archives);
-                  if ("".equals(archives))
-                     archives = null;
-               }
-
-               log.debug("Processing classpath: " + context.getName() + " codebase=" + codebase + " archives=" + archives);
-               VirtualFile codebaseFile = context.getRoot();
-               if (".".equals(codebase) == false)
-               {
-                  ServerConfig config = ServerConfigLocator.locate();
-                  URL codeBaseURL = new URL(config.getServerHomeURL(), codebase);
-                  codebaseFile = VFS.getVirtualFile(codeBaseURL, "");
-               }
-
-               if (codebaseFile == null)
-                  throw new DeploymentException("Cannot use classpath without a root: " + context.getName());
-
-               if (archives == null)
-               {
-                  classpath.add(codebaseFile);
-                  log.debug("Using codebase as classpath: " + context.getName());
-               }
-               else
-               {
-                  SARArchiveFilter filter = new SARArchiveFilter(archives);
-                  List<VirtualFile> archiveFiles = codebaseFile.getChildren(filter);
-                  classpath.addAll(archiveFiles);
-               }
-            }
+         if (archives == null)
+         {
+            classpath.add(codebaseFile);
+            log.debug("Using codebase as classpath: " + context.getName());
          }
+         else
+         {
+            SARArchiveFilter filter = new SARArchiveFilter(archives);
+            List<VirtualFile> archiveFiles = codebaseFile.getChildren(filter);
+            classpath.addAll(archiveFiles);
+         }
+
       }
 
       List<VirtualFile> origClassPath = context.getClassPath();

Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -37,6 +37,7 @@
 import org.jboss.mx.loading.RepositoryClassLoader;
 import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
 import org.jboss.system.ServiceController;
+import org.jboss.system.metadata.ServiceDeployment;
 import org.jboss.virtual.VirtualFile;
 
 /**

Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -29,6 +29,7 @@
 import org.jboss.mx.loading.RepositoryClassLoader;
 import org.jboss.system.ServiceContext;
 import org.jboss.system.ServiceController;
+import org.jboss.system.metadata.ServiceDeployment;
 import org.jboss.system.metadata.ServiceMetaData;
 
 /**

Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -1,105 +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.system.deployers;
-
-import java.util.List;
-
-import org.jboss.system.metadata.ServiceMetaData;
-import org.w3c.dom.Element;
-
-/**
- * ServiceDeployment.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceDeployment
-{
-   /** The deployment name */
-   private String name;
-
-   /** The services */
-   private List<ServiceMetaData> services;
-   
-   /** The config */
-   private Element config;
-   
-   /**
-    * Get the name.
-    * 
-    * @return the name.
-    */
-   public String getName()
-   {
-      return name;
-   }
-
-   /**
-    * Set the name.
-    * 
-    * @param name the name.
-    */
-   public void setName(String name)
-   {
-      this.name = name;
-   }
-
-   /**
-    * Get the services.
-    * 
-    * @return the services.
-    */
-   public List<ServiceMetaData> getServices()
-   {
-      return services;
-   }
-
-   /**
-    * Set the services.
-    * 
-    * @param services the services.
-    */
-   public void setServices(List<ServiceMetaData> services)
-   {
-      this.services = services;
-   }
-
-   /**
-    * Get the config.
-    * 
-    * @return the config.
-    */
-   public Element getConfig()
-   {
-      return config;
-   }
-
-   /**
-    * Set the config.
-    * 
-    * @param config the config.
-    */
-   public void setConfig(Element config)
-   {
-      this.config = config;
-   }
-}

Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeploymentDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeploymentDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeploymentDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -29,6 +29,7 @@
 import org.jboss.deployers.plugins.deployers.helpers.SimpleDeploymentVisitor;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.system.metadata.ServiceDeployment;
 import org.jboss.system.metadata.ServiceMetaData;
 import org.jboss.system.metadata.ServiceMetaDataParser;
 import org.w3c.dom.Element;

Added: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceXSLDeployer.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceXSLDeployer.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceXSLDeployer.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,78 @@
+/*
+* 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.system.deployers;
+
+import org.jboss.deployers.plugins.deployers.helpers.XSLDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceDeploymentParser;
+import org.jboss.virtual.VirtualFile;
+import org.w3c.dom.Document;
+
+public class ServiceXSLDeployer extends XSLDeployer<ServiceDeployment>
+{
+   /** The suffix */
+   private String suffix;
+
+   /**
+    * Create a new ServiceXSLDeployer.
+    */
+   public ServiceXSLDeployer()
+   {
+      super(ServiceDeployment.class);
+   }
+   
+   /**
+    * Get the suffix.
+    * 
+    * @return the suffix.
+    */
+   public String getSuffix()
+   {
+      return suffix;
+   }
+
+   /**
+    * Set the suffix.
+    * 
+    * @param suffix the suffix.
+    */
+   public void setSuffix(String suffix)
+   {
+      this.suffix = suffix;
+   }
+
+   protected ServiceDeployment parse(DeploymentUnit unit, VirtualFile file, Document document) throws Exception
+   {
+      ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
+      ServiceDeployment parsed = parser.parse();
+      String name = file.toURI().toString();
+      parsed.setName(name);
+      return parsed;
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      createMetaData(unit, null, getSuffix());
+   }
+}

Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -56,6 +56,9 @@
    /** The constructor parameters. */
    private String[] params = EMPTY_PARAMS;
 
+   /** The real parameters */
+   private Object[] parameters;
+   
    /**
     * Get the params.
     * 
@@ -115,6 +118,9 @@
     */
    public Object[] getParameters(ClassLoader cl) throws Exception
    {
+      if (parameters != null)
+         return parameters;
+      
       if (params.length == 0)
          return EMPTY_PARAMETERS;
 
@@ -163,4 +169,14 @@
       }
       return result;
    }
+
+   /**
+    * Set the parameters.
+    * 
+    * @param parameters the parameters.
+    */
+   public void setParameters(Object[] parameters)
+   {
+      this.parameters = parameters;
+   }
 }

Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeployment.java (from rev 56932, branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java)
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/deployers/ServiceDeployment.java	2006-09-18 06:08:11 UTC (rev 56932)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeployment.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,151 @@
+/*
+* 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.system.metadata;
+
+import java.util.List;
+
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.w3c.dom.Element;
+
+/**
+ * ServiceDeployment.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServiceDeployment
+{
+   /** The deployment name */
+   private String name;
+
+   /** The services */
+   private List<ServiceMetaData> services;
+   
+   /** The config */
+   private Element config;
+   
+   /** The loader repository config */
+   private LoaderRepositoryConfig loaderRepositoryConfig;
+
+   /** The classpaths */
+   private List<ServiceDeploymentClassPath> classPaths;
+   
+   /**
+    * Get the name.
+    * 
+    * @return the name.
+    */
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param name the name.
+    */
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   /**
+    * Get the services.
+    * 
+    * @return the services.
+    */
+   public List<ServiceMetaData> getServices()
+   {
+      return services;
+   }
+
+   /**
+    * Set the services.
+    * 
+    * @param services the services.
+    */
+   public void setServices(List<ServiceMetaData> services)
+   {
+      this.services = services;
+   }
+
+   /**
+    * Get the config.
+    * 
+    * @return the config.
+    */
+   public Element getConfig()
+   {
+      return config;
+   }
+
+   /**
+    * Set the config.
+    * 
+    * @param config the config.
+    */
+   public void setConfig(Element config)
+   {
+      this.config = config;
+   }
+
+   /**
+    * Get the loaderRepositoryConfig.
+    * 
+    * @return the loaderRepositoryConfig.
+    */
+   public LoaderRepositoryConfig getLoaderRepositoryConfig()
+   {
+      return loaderRepositoryConfig;
+   }
+
+   /**
+    * Set the loaderRepositoryConfig.
+    * 
+    * @param loaderRepositoryConfig the loaderRepositoryConfig.
+    */
+   public void setLoaderRepositoryConfig(LoaderRepositoryConfig loaderRepositoryConfig)
+   {
+      this.loaderRepositoryConfig = loaderRepositoryConfig;
+   }
+
+   /**
+    * Get the classPaths.
+    * 
+    * @return the classPaths.
+    */
+   public List<ServiceDeploymentClassPath> getClassPaths()
+   {
+      return classPaths;
+   }
+
+   /**
+    * Set the classPaths.
+    * 
+    * @param classPaths the classPaths.
+    */
+   public void setClassPaths(List<ServiceDeploymentClassPath> classPaths)
+   {
+      this.classPaths = classPaths;
+   }
+}

Added: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentClassPath.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentClassPath.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentClassPath.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,95 @@
+/*
+* 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.system.metadata;
+
+/**
+ * ServiceDeploymentClassPath.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServiceDeploymentClassPath
+{
+   /** The code base */
+   private String codeBase;
+   
+   /** The archives */
+   private String archives;
+   
+   /**
+    * Create a new ServiceDeploymentClassPath.
+    * 
+    * @param codeBase the code base
+    * @param archives the archives
+    * @throws IllegalArgumentException for a null codebase
+    */
+   public ServiceDeploymentClassPath(String codeBase, String archives)
+   {
+      if (codeBase == null)
+         throw new IllegalArgumentException("Null codebase");
+      this.codeBase = codeBase;
+      this.archives = archives;
+   }
+
+   /**
+    * Get the archives.
+    * 
+    * @return the archives.
+    */
+   public String getArchives()
+   {
+      return archives;
+   }
+
+   /**
+    * Set the archives.
+    * 
+    * @param archives the archives.
+    */
+   public void setArchives(String archives)
+   {
+      this.archives = archives;
+   }
+
+   /**
+    * Get the codeBase.
+    * 
+    * @return the codeBase.
+    */
+   public String getCodeBase()
+   {
+      return codeBase;
+   }
+
+   /**
+    * Set the codeBase.
+    * 
+    * @param codeBase the codeBase.
+    * @throws IllegalArgumentException for a null codebase
+    */
+   public void setCodeBase(String codeBase)
+   {
+      if (codeBase == null)
+         throw new IllegalArgumentException("Null codebase");
+      this.codeBase = codeBase;
+   }
+}

Added: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentParser.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentParser.java	2006-09-20 11:55:46 UTC (rev 57002)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDeploymentParser.java	2006-09-20 12:00:16 UTC (rev 57003)
@@ -0,0 +1,156 @@
+/*
+* 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.system.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.logging.Logger;
+import org.jboss.mx.loading.LoaderRepositoryFactory;
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.jboss.util.StringPropertyReplacer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * ServiceDeploymentParser
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServiceDeploymentParser
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(ServiceDeploymentParser.class);
+   
+   /** The document */
+   private Document document;
+   
+   /**
+    * Create a new service deployment parser
+    * 
+    * @param document the xml config
+    */
+   public ServiceDeploymentParser(Document document)
+   {
+      if (document == null)
+         throw new IllegalArgumentException("Null document");
+      
+      this.document = document;
+   }
+
+   /**
+    * Parse the xml 
+    * 
+    * @return the service deployment
+    * @throws DeploymentException for any error
+    */
+   public ServiceDeployment parse() throws DeploymentException
+   {
+      ServiceDeployment parsed = new ServiceDeployment();
+
+      List<ServiceDeploymentClassPath> classPaths = parseXMLClasspath(document);
+      parsed.setClassPaths(classPaths);
+
+      LoaderRepositoryConfig repository = parseLoaderRepositoryConfig(document);
+      if (repository != null)
+         parsed.setLoaderRepositoryConfig(repository);
+
+      // We can't parse the services yet, because it requires the classloader
+      parsed.setConfig(document.getDocumentElement());
+      return parsed;
+   }
+
+   /**
+    * Parse the xml classpath
+    * 
+    * @param document the document
+    * @return the list of classpaths
+    * @throws DeploymentException for any error
+    */
+   private List<ServiceDeploymentClassPath> parseXMLClasspath(Document document) throws DeploymentException
+   {
+      ArrayList<ServiceDeploymentClassPath> classPaths = null;
+      
+      NodeList children = document.getDocumentElement().getChildNodes();
+      for (int i = 0; i < children.getLength(); ++i)
+      {
+         if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
+         {
+            Element classpathElement = (Element)children.item(i);
+            if (classpathElement.getTagName().equals("classpath"))
+            {
+               log.debug("Found classpath element: " + classpathElement);
+               if (classpathElement.hasAttribute("codebase") == false)
+                  throw new DeploymentException("Invalid classpath element missing codebase: " + classpathElement);
+
+               String codebase = classpathElement.getAttribute("codebase").trim();
+               codebase = StringPropertyReplacer.replaceProperties(codebase);
+
+               String archives = null;
+               if (classpathElement.hasAttribute("archives"))
+               {
+                  archives = classpathElement.getAttribute("archives").trim();
+                  archives = StringPropertyReplacer.replaceProperties(archives);
+                  if ("".equals(archives))
+                     archives = null;
+               }
+               
+               if (classPaths == null)
+                  classPaths = new ArrayList<ServiceDeploymentClassPath>();
+
+               ServiceDeploymentClassPath classPath = new ServiceDeploymentClassPath(codebase, archives);
+               classPaths.add(classPath);
+            }
+         }
+      }
+      return classPaths;
+   }
+
+   /**
+    * Parse the loader repository config
+    * 
+    * @param document the document
+    * @return the config
+    * @throws DeploymentException for any error
+    */
+   private LoaderRepositoryConfig parseLoaderRepositoryConfig(Document document) throws DeploymentException
+   {
+      // Check for a custom loader-repository for scoping
+      NodeList loaders = document.getElementsByTagName("loader-repository");
+      if( loaders.getLength() > 0 )
+      {
+         Element loader = (Element) loaders.item(0);
+         try
+         {
+            return LoaderRepositoryFactory.parseRepositoryConfig(loader);
+         }
+         catch (Exception e)
+         {
+            throw DeploymentException.rethrowAsDeploymentException("Unable to parse loader repository config", e);
+         }
+      }
+      return null;
+   }
+}




More information about the jboss-cvs-commits mailing list