[jboss-cvs] JBossAS SVN: r89127 - in branches/Branch_5_x: profileservice/src/main/org/jboss/profileservice/management and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 19 12:00:27 EDT 2009


Author: emuckenhuber
Date: 2009-05-19 12:00:27 -0400 (Tue, 19 May 2009)
New Revision: 89127

Added:
   branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/
   branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/META-INF/
   branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/META-INF/bindings-jboss-beans.xml
   branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/
   branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/META-INF/
   branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/META-INF/bindings-jboss-beans.xml
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/PersistenceModificationChecker.java
Removed:
   branches/Branch_5_x/server/src/etc/conf/all/bindings-jboss-beans.xml
   branches/Branch_5_x/server/src/etc/conf/minimal/bindings-jboss-beans.xml
Modified:
   branches/Branch_5_x/build/build-distr.xml
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
   branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
   branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
Log:
move binding service to it's own deployment and update the attachmentstore.

Modified: branches/Branch_5_x/build/build-distr.xml
===================================================================
--- branches/Branch_5_x/build/build-distr.xml	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/build/build-distr.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -1047,12 +1047,18 @@
         <include name="hsqldb-plugin.jar"/>
         <include name="autonumber-plugin.jar"/>
         <include name="properties-plugin.jar"/>
-        <include name="jboss-bindingservice.jar"/>
         <include name="jboss-monitoring.jar"/>
         <include name="jboss-srp.jar"/>
       </fileset>
     </copy>
 
+  	<!-- copy the service binding manager to it's deployment --> 
+    <copy todir="${install.server}/all/conf/bindingservice.sar">
+     <fileset dir="${_module.output}/lib">
+     	<include name="jboss-bindingservice.jar"/>
+     </fileset>
+	</copy>
+  	
     <!-- Copy to docs/examples -->
     <mkdir dir="${install.examples.varia}"/>
     <copy todir="${install.examples.varia}" filtering="no">

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -501,7 +501,7 @@
       log.debug("remove component: " + comp + ", deployment: "+ profileDeployment);
       // Remove
       Profile profile = getProfileForDeployment(md.getName());
-      this.store.removeComponent(profileDeployment, serverComp);      
+      this.store.removeComponent(comp.getDeployment().getName(), serverComp);      
       this.profileViews.put(profile.getKey(), createProfileView(profile));
    }
 
@@ -620,7 +620,7 @@
    
       // Persist the changed values
       Profile profile = getProfileForDeployment(md.getName());
-      this.store.updateDeployment(compDeployment, serverComp);
+      this.store.updateDeployment(comp.getDeployment().getName(), serverComp);
       this.profileViews.put(profile.getKey(), createProfileView(profile));
    }
 

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -36,6 +36,7 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -1074,7 +1075,7 @@
     */
    public Set<String> getDeploymentNames()
    {
-      return new HashSet<String>(this.managedDeployments.keySet());
+      return new TreeSet<String>(this.managedDeployments.keySet());
    }
 
    /**
@@ -1085,7 +1086,7 @@
     */
    public Set<String> getDeploymentNamesForType(String type)
    {
-      HashSet<String> matches = new HashSet<String>();
+      Set<String> matches = new TreeSet<String>();
       for(ManagedDeployment md : managedDeployments.values())
       {
          String name = md.getName();
@@ -1094,24 +1095,12 @@
          {
             if(types.contains(type))
             {
-               log.debug(name+" matches type: "+type+", types:"+types);
+               if(log.isTraceEnabled())
+                  log.trace(name+" matches type: "+type+", types:"+types);
                matches.add(name);
             }
          }
       }
-      for(ManagedDeployment md : bootstrapManagedDeployments.values())
-      {
-         String name = md.getName();
-         Set<String> types = md.getTypes();
-         if(types != null)
-         {
-            if(types.contains(type))
-            {
-               log.debug(name+" matches type: "+type+", types:"+types);
-               matches.add(name);
-            }
-         }
-      }
       return matches;
    }
 
@@ -1151,13 +1140,13 @@
 
    public void addManagedMBeanDeployments(ManagedMBeanDeploymentFactory factory)
    {
-      log.info("addManagedDeployment, "+factory);
+      log.debug("addManagedDeployment, "+factory);
       String name = factory.getFactoryName();
       this.mdfs.put(name, factory);
    }
    public void removeManagedMBeanDeployments(ManagedMBeanDeploymentFactory factory)
    {
-      log.info("removeManagedDeployment, "+factory);
+      log.debug("removeManagedDeployment, "+factory);
       String name = factory.getFactoryName();
       this.mdfs.remove(name);
    }
@@ -1498,7 +1487,7 @@
       }
 
       // Persist the changed values
-      this.store.updateDeployment(compDeployment, serverComp);
+      this.store.updateDeployment(comp.getDeployment().getName(), serverComp);
       // Force reload
       this.forceReload = true;
    }
@@ -1562,7 +1551,7 @@
       //
       log.debug("remove component: " + comp + ", deployment: "+ profileDeployment);
       // Remove
-      this.store.removeComponent(profileDeployment, serverComp);
+      this.store.removeComponent(comp.getDeployment().getName(), serverComp);
    }
 
    /**

Deleted: branches/Branch_5_x/server/src/etc/conf/all/bindings-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bindings-jboss-beans.xml	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/server/src/etc/conf/all/bindings-jboss-beans.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -1,489 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <classloader><inject bean="bindings-classloader:0.0.0"/></classloader>
-
-   <classloader name="bindings-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
-      <root>${jboss.common.lib.url}jboss-bindingservice.jar</root>
-   </classloader>
-   
-   <!-- The actual SBM from which services obtain binding information -->
-   <bean name="ServiceBindingManager" class="org.jboss.services.binding.ServiceBindingManager">
-
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.system:service=ServiceBindingManager", exposedInterface=org.jboss.services.binding.ServiceBindingManagerMBean.class, registerDirectly=true)</annotation>
-      
-      <!-- Here we use the ServiceBindingManagementObject as a factory to create the SBM -->
-      <constructor factoryMethod="getServiceBindingManager">     
-         <factory bean="ServiceBindingManagementObject"/>
-      </constructor>
-
-   </bean>
-
-   <!-- Provides management tools with a ProfileService ManagementView 
-        interface to the SBM and its components -->
-   <bean name="ServiceBindingManagementObject" 
-         class="org.jboss.services.binding.managed.ServiceBindingManagementObject">
-         
-      <constructor>
-         <!-- The name of the set of bindings to use for this server -->
-         <parameter>${jboss.service.binding.set:ports-default}</parameter>
-          
-         <!--  The binding sets -->
-         <parameter>
-            <set>
-               <inject bean="PortsDefaultBindings"/>
-               <inject bean="Ports01Bindings"/>
-               <inject bean="Ports02Bindings"/>
-               <inject bean="Ports03Bindings"/>
-            </set>
-         </parameter>
-         
-         <!-- Base binding metadata that is used to create bindings for each set -->
-         <parameter><inject bean="StandardBindings"/></parameter>
-         
-      </constructor>
-   </bean>
-   
-   
-   <!-- The ports-default bindings are obtained by taking the base bindings and adding 0 to each port value  -->
-   <bean name="PortsDefaultBindings"  class="org.jboss.services.binding.impl.ServiceBindingSet">
-      <constructor>
-         <!--  The name of the set -->
-         <parameter>ports-default</parameter>
-         <!-- Default host name -->
-         <parameter>${jboss.bind.address}</parameter>
-         <!-- The port offset -->
-         <parameter>0</parameter>
-         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
-         <parameter><null/></parameter>
-      </constructor>
-   </bean>
-
-   <!-- The ports-01 bindings are obtained by taking the base bindings and adding 100 to each port value -->
-   <bean name="Ports01Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
-      <constructor>
-         <!--  The name of the set -->
-         <parameter>ports-01</parameter>
-         <!-- Default host name -->
-         <parameter>${jboss.bind.address}</parameter>
-         <!-- The port offset -->
-         <parameter>100</parameter>
-         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
-         <parameter><null/></parameter>
-      </constructor>
-   </bean>
-
-   <!-- The ports-02 bindings are obtained by taking ports-default and adding 200 to each port value -->
-   <bean name="Ports02Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
-      <constructor>
-         <!--  The name of the set -->
-         <parameter>ports-02</parameter>
-         <!-- Default host name -->
-         <parameter>${jboss.bind.address}</parameter>
-         <!-- The port offset -->
-         <parameter>200</parameter>
-         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
-         <parameter><null/></parameter>
-      </constructor>
-   </bean>
-
-   <!-- The ports-03 bindings are obtained by taking ports-default and adding 300 to each port value -->
-   <bean name="Ports03Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
-      <constructor>
-         <!--  The name of the set -->
-         <parameter>ports-03</parameter>
-         <!-- Default host name -->
-         <parameter>${jboss.bind.address}</parameter>
-         <!-- The port offset -->
-         <parameter>300</parameter>
-         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
-         <parameter><null/></parameter>
-      </constructor>
-   </bean>
-
-   <!-- Base binding metadata that ServiceBindingStore uses to create bindings for each set -->
-   <bean name="StandardBindings" class="java.util.HashSet">
-      <constructor>
-         <parameter class="java.util.Collection">
-            <set elementClass="org.jboss.services.binding.ServiceBindingMetadata">
-            <!-- ********************* conf/jboss-service.xml ****************** -->
-
-            <!-- Naming Service -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=Naming</property>
-               <property name="bindingName">Port</property>
-               <property name="port">1099</property>
-               <property name="description">The listening socket for the Naming service</property>
-            </bean>
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=Naming</property>
-               <property name="bindingName">RmiPort</property>
-               <property name="port">1098</property>
-               <property name="description">Socket Naming service uses to receive RMI requests from client proxies</property>
-            </bean>
-
-            <!-- Remote classloading service -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=WebService</property>
-               <property name="port">8083</property>
-               <property name="description">Socket for dynamic class and resource loading</property>
-            </bean>
-
-            <!-- Remoting Connector -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">UnifiedInvokerConnector</property>
-               <property name="port">4446</property>
-               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker</property>
-            </bean>
-            
-            <!-- Used to create a multihome Remoting server.   See -->
-            <!-- deploy/remoting-jboss-beans.xml for more details. -->
-            <!--bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">UnifiedInvokerConnector:bindingHome1</property>
-               <parameter>192.168.2.2</property>
-               <property name="port">7777</property>
-               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker on a multihome server</property>
-            </bean-->
-            
-            <!-- Used to create a multihome Remoting server.   See -->
-            <!-- deploy/remoting-jboss-beans.xml for more details. -->
-            <!--bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">UnifiedInvokerConnector:bindingHome2</property>
-               <parameter>10.11.12.238</property>
-               <property name="port">8888</property>
-               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker on a multihome server</property>
-            </bean-->
-
-            <!-- ********************* deploy/legacy-invokers-service.xml ****************** -->
-
-            <!-- RMI/JRMP invoker -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=invoker,type=jrmp</property>
-               <property name="port">4444</property>
-               <property name="description">Socket for the legacy RMI/JRMP invoker</property>
-            </bean>
-
-            <!-- Pooled invoker -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=invoker,type=pooled</property>
-               <property name="port">4445</property>
-               <property name="description">Socket for the legacy Pooled invoker</property>
-            </bean>
-
-            <!-- ********************* deploy/cluster/hajndi-service.xml ****************** -->
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=HAJNDI</property>
-               <property name="bindingName">Port</property>
-               <property name="port">1100</property>
-               <property name="description">The listening socket for the HA-JNDI service</property>
-            </bean>
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=HAJNDI</property>
-               <property name="bindingName">RmiPort</property>
-               <property name="port">1101</property>
-               <property name="description">Socket HA-JNDI service uses to receive RMI requests from client proxies</property>
-            </bean>
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=HAJNDI</property>
-               <property name="bindingName">AutoDiscovery</property>
-               <property name="hostName">${jboss.partition.udpGroup:230.0.0.4}</property>
-               <property name="port">1102</property>
-               <property name="description">Multicast socket on which HA-JNDI listens for auto-discovery requests from clients</property>
-               <!-- This address should not be changed between different 
-                    binding sets; all nodes need to listen on the same 
-                    multicast address -->
-               <property name="fixedHostName">true</property>
-               <!-- This port should not be changed between different 
-                    binding sets; all nodes need to listen on the same port -->
-               <property name="fixedPort">true</property>
-            </bean>
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=HAJNDI</property>
-               <property name="bindingName">AutoDiscoveryInterface</property>
-               <property name="hostName">${jboss.bind.address}</property>
-               <property name="description">Interface for multicast socket on which HA-JNDI listens for auto-discovery requests from clients</property>
-            </bean>
-
-            <!-- ********************* deploy/cluster/ha-legacy-service.xml ****************** -->
-
-            <!-- HA RMI/JRMP invoker -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=invoker,type=jrmpha</property>
-               <property name="port">4447</property>
-               <property name="description">Socket for high availability version of the legacy RMI/JRMP invoker</property>
-            </bean>
-
-            <!-- HA Pooled invoker -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=invoker,type=pooledha</property>
-               <property name="port">4448</property>
-               <property name="description">Socket for high availability version of the legacy Pooled invoker</property>
-            </bean>
-
-            <!-- ********************* deploy/iiop-service.xml ****************** -->
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=CorbaORB</property>
-               <property name="port">3528</property>
-               <property name="description">IIOP socket for the Corba ORB</property>
-            </bean>
-
-            <!-- ********************* deploy/snmp-adaptor.sar **************** -->
-
-            <!-- Trap receiver that acts as an SNMP Manager -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.jmx:name=SnmpAgent,service=trapd,type=logger</property>
-               <property name="port">1162</property>
-               <property name="description">Socket for the SNMP trap receiver</property>
-            </bean>
-
-            <!-- The SNMP adaptor MBean -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor</property>
-               <property name="port">1161</property>
-               <property name="description">Socket for the SNMP adaptor MBean</property>
-            </bean>
-
-            <!-- ********************* deploy/jmx-remoting.sar **************** -->
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.remoting:service=JMXConnectorServer,protocol=rmi</property>
-               <property name="port">1090</property>
-               <property name="description">RMI/JRMP socket for connecting to the JMX MBeanServer</property>
-            </bean>
-
-            <!-- ********************* deploy/ejb3-connectors-service.xml **************** -->
-
-            <!-- EJB3 wants to have the service create its own ServiceBinding object
-                 dynamically.  See the value-factory usage in deploy/ejb3-connectors-service.xml -->
-
-
-            <!-- ********************* deploy/jbossweb.sar **************** -->
-            <!-- ********************* deploy/httpha-invoker.sar **************** -->
-
-            <!--
-                JBoss Web server.xml configuration.
-
-                Same binding config can be used by the following services, or really
-                anything else that needs to point to the JBoss Web HTTP connector
-                but doesn't need an XSL Transform
-
-                jboss:service=invoker,type=http
-                jboss:service=invoker,type=http,target=Naming
-                jboss:service=invoker,type=http,target=Naming,readonly=true
-                jboss:service=invoker,type=httpHA
-                jboss:service=invoker,type=http,target=HAJNDI
-                jboss.ws:service=ServiceEndpointManager
-            -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.web:service=WebServer</property>
-               <property name="port">8080</property>
-               <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets</property>
-
-               <!--
-                   Inject a XSLT transform configuration (see below) that describes
-                   how to transform server.xml
-                   If the binding value request doesn't require an XSL Transform, this config
-                   will be ignored.
-               -->
-               <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
-            </bean>
-
-            <!-- For services like those listed above that need to know the
-                 port of the HTTPS connector -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.web:service=WebServer</property>
-               <property name="bindingName">HttpsConnector</property>
-               <property name="port">8443</property>
-               <property name="description">JBoss Web HTTPS connector socket</property>
-            </bean>
-
-            <!-- ********************* deploy/messaging/remoting-bisocket-service.xml ********************** -->
-
-            <!-- Standard JBM bisocket connector -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
-               <property name="port">4457</property>
-               <property name="description">Socket for JBoss Messaging 1.x</property>
-            </bean>
-
-            <!-- ********************* JBoss Messaging 2 **************** -->
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-                <property name="serviceName">JBM2</property>
-                <property name="bindingName">netty-port</property>
-                <property name="port">5445</property>
-                <property name="description">Socket for JBoss Messaging 2.x</property>
-            </bean>
-
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-                <property name="serviceName">JBM2</property>
-                <property name="bindingName">netty-ssl-port</property>
-                <property name="port">5446</property>
-                <property name="description">SSL socket for JBoss Messaging 2.x</property>
-            </bean>
-
-            <!-- ********************* deploy/transaction-jboss-beans.xml ********************** -->
-
-            <!-- JBossTS Recovery Manager -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-                <property name="serviceName">TransactionManager</property>
-                <property name="bindingName">recoveryManager</property>
-                <property name="port">4712</property>
-                <property name="description">Socket for JBossTS Recovery Manager</property>
-            </bean>
-
-            <!-- JBossTS Transaction Status Manager -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-                <property name="serviceName">TransactionManager</property>
-                <property name="bindingName">transactionStatusManager</property>
-                <property name="port">4713</property>
-                <property name="description">Socket for JBossTS Transaction Status Manager</property>
-            </bean>
-
-            <!-- JBossTS SocketProcessId.  The address part is ignored,
-                it will always use localhost/127.0.0.1. -->
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-                <property name="serviceName">TransactionManager</property>
-                <property name="bindingName">socketProcessId</property>
-                <property name="port">4714</property>
-                <property name="description">Socket used to provide unique process id for JBossTS. The address configuration is ignored; will always use localhost/127.0.0.1</property>
-            </bean>
-
-            <!-- ********************* deploy/hsqldb-ds.xml **************** -->
-
-            <!-- Commented out as tcp/ip access to Hypersonic is not enabled by default -->
-            <!--
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss:service=Hypersonic</property>
-               <property name="port">1701</property>
-               <property name="description">TCP/IP socket for remote connection to Hypersonic database</property>
-            </bean>
-            -->
-
-            <!-- ********************* JBoss MQ **************** -->
-
-            <!-- Commented out as JBoss MQ is not installed by default
-                 If you uncomment this and also use jboss.mq:service=InvocationLayer,type=HTTP,
-                 configure the http invocation layer using the jboss.web:service=WebServer binding above
-             -->
-            <!--
-            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
-               <property name="serviceName">jboss.mq:service=InvocationLayer,type=UIL2</property>
-               <property name="port">8093</property>
-               <property name="description">UIL2 socket for JBossMQ</property>
-            </bean>
-            -->
-         </set>
-         </parameter>
-      </constructor>
-   </bean>
-
-   <!-- Conversion of selected bindings into system properties -->
-   <bean name="SystemPropertyBinder" class="org.jboss.services.binding.SystemPropertyBinder">
-
-      <constructor>
-         <parameter>
-            <set>
-               <!-- JBM's remoting connector -->
-               <bean class="org.jboss.services.binding.SystemPropertyBinding">
-                  <constructor>
-                     <parameter>jboss.messaging.connector.bisocket.port</parameter>
-                     <parameter class="int">
-                        <value-factory bean="ServiceBindingManager" method="getIntBinding"
-                                       parameter="jboss.messaging:service=Connector,transport=bisocket"/>
-                     </parameter>
-                  </constructor>
-               </bean>
-               <!-- JBM2 netty connector -->
-               <bean class="org.jboss.services.binding.SystemPropertyBinding">
-                  <constructor>
-                     <parameter>jbm.remoting.netty.port</parameter>
-                     <parameter class="int">
-                        <value-factory bean="ServiceBindingManager" method="getIntBinding">
-                             <parameter>JBM2</parameter>
-                             <parameter>netty-port</parameter>
-                        </value-factory>
-                     </parameter>
-                  </constructor>
-               </bean>
-               <!-- JBM2 netty ssl connector  -->
-               <bean class="org.jboss.services.binding.SystemPropertyBinding">
-                  <constructor>
-                     <parameter>jbm.remoting.netty.ssl.port</parameter>
-                     <parameter class="int">
-                        <value-factory bean="ServiceBindingManager" method="getIntBinding">
-                             <parameter>JBM2</parameter>
-                             <parameter>netty-ssl-port</parameter>
-                        </value-factory>
-                     </parameter>
-                  </constructor>
-               </bean>
-            </set>
-         </parameter>
-      </constructor>
-
-   </bean>
-
-   <!-- XSL Transform to apply to server.xml -->
-   <bean name="JBossWebConnectorXSLTConfig"
-         class="org.jboss.services.binding.impl.XSLTServiceBindingValueSourceConfig">
-
-      <constructor>
-          <parameter><![CDATA[
-   <xsl:stylesheet
-         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
-
-     <xsl:output method="xml" />
-     <xsl:param name="port"/>
-
-     <xsl:variable name="portAJP" select="$port - 71"/>
-     <xsl:variable name="portHttps" select="$port + 363"/>
-
-     <xsl:template match="/">
-       <xsl:apply-templates/>
-     </xsl:template>
-
-      <xsl:template match = "Connector">
-         <Connector>
-            <xsl:for-each select="@*">
-            <xsl:choose>
-               <xsl:when test="(name() = 'port' and . = '8080')">
-                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
-               </xsl:when>
-               <xsl:when test="(name() = 'port' and . = '8009')">
-                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
-               </xsl:when>
-               <xsl:when test="(name() = 'redirectPort')">
-                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
-               </xsl:when>
-               <xsl:when test="(name() = 'port' and . = '8443')">
-                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
-               </xsl:when>
-               <xsl:otherwise>
-                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
-               </xsl:otherwise>
-            </xsl:choose>
-            </xsl:for-each>
-            <xsl:apply-templates/>
-         </Connector>
-      </xsl:template>
-
-     <xsl:template match="*|@*">
-       <xsl:copy>
-         <xsl:apply-templates select="@*|node()"/>
-       </xsl:copy>
-     </xsl:template>
-   </xsl:stylesheet>
-   ]]>
-          </parameter>
-      </constructor>
-   </bean>
-
-</deployment>

Copied: branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/META-INF/bindings-jboss-beans.xml (from rev 89033, branches/Branch_5_x/server/src/etc/conf/all/bindings-jboss-beans.xml)
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/META-INF/bindings-jboss-beans.xml	                        (rev 0)
+++ branches/Branch_5_x/server/src/etc/conf/all/bindingservice.sar/META-INF/bindings-jboss-beans.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   
+   <!-- The actual SBM from which services obtain binding information -->
+   <bean name="ServiceBindingManager" class="org.jboss.services.binding.ServiceBindingManager">
+
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.system:service=ServiceBindingManager", exposedInterface=org.jboss.services.binding.ServiceBindingManagerMBean.class, registerDirectly=true)</annotation>
+      
+      <!-- Here we use the ServiceBindingManagementObject as a factory to create the SBM -->
+      <constructor factoryMethod="getServiceBindingManager">     
+         <factory bean="ServiceBindingManagementObject"/>
+      </constructor>
+
+   </bean>
+
+   <!-- Provides management tools with a ProfileService ManagementView 
+        interface to the SBM and its components -->
+   <bean name="ServiceBindingManagementObject" 
+         class="org.jboss.services.binding.managed.ServiceBindingManagementObject">
+         
+      <constructor>
+         <!-- The name of the set of bindings to use for this server -->
+         <parameter>${jboss.service.binding.set:ports-default}</parameter>
+          
+         <!--  The binding sets -->
+         <parameter>
+            <set>
+               <inject bean="PortsDefaultBindings"/>
+               <inject bean="Ports01Bindings"/>
+               <inject bean="Ports02Bindings"/>
+               <inject bean="Ports03Bindings"/>
+            </set>
+         </parameter>
+         
+         <!-- Base binding metadata that is used to create bindings for each set -->
+         <parameter><inject bean="StandardBindings"/></parameter>
+         
+      </constructor>
+   </bean>
+   
+   
+   <!-- The ports-default bindings are obtained by taking the base bindings and adding 0 to each port value  -->
+   <bean name="PortsDefaultBindings"  class="org.jboss.services.binding.impl.ServiceBindingSet">
+      <constructor>
+         <!--  The name of the set -->
+         <parameter>ports-default</parameter>
+         <!-- Default host name -->
+         <parameter>${jboss.bind.address}</parameter>
+         <!-- The port offset -->
+         <parameter>0</parameter>
+         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
+         <parameter><null/></parameter>
+      </constructor>
+   </bean>
+
+   <!-- The ports-01 bindings are obtained by taking the base bindings and adding 100 to each port value -->
+   <bean name="Ports01Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
+      <constructor>
+         <!--  The name of the set -->
+         <parameter>ports-01</parameter>
+         <!-- Default host name -->
+         <parameter>${jboss.bind.address}</parameter>
+         <!-- The port offset -->
+         <parameter>100</parameter>
+         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
+         <parameter><null/></parameter>
+      </constructor>
+   </bean>
+
+   <!-- The ports-02 bindings are obtained by taking ports-default and adding 200 to each port value -->
+   <bean name="Ports02Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
+      <constructor>
+         <!--  The name of the set -->
+         <parameter>ports-02</parameter>
+         <!-- Default host name -->
+         <parameter>${jboss.bind.address}</parameter>
+         <!-- The port offset -->
+         <parameter>200</parameter>
+         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
+         <parameter><null/></parameter>
+      </constructor>
+   </bean>
+
+   <!-- The ports-03 bindings are obtained by taking ports-default and adding 300 to each port value -->
+   <bean name="Ports03Bindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
+      <constructor>
+         <!--  The name of the set -->
+         <parameter>ports-03</parameter>
+         <!-- Default host name -->
+         <parameter>${jboss.bind.address}</parameter>
+         <!-- The port offset -->
+         <parameter>300</parameter>
+         <!-- Set of bindings to which the "offset by X" approach can't be applied -->
+         <parameter><null/></parameter>
+      </constructor>
+   </bean>
+
+   <!-- Base binding metadata that ServiceBindingStore uses to create bindings for each set -->
+   <bean name="StandardBindings" class="java.util.HashSet">
+      <constructor>
+         <parameter class="java.util.Collection">
+            <set elementClass="org.jboss.services.binding.ServiceBindingMetadata">
+            <!-- ********************* conf/jboss-service.xml ****************** -->
+
+            <!-- Naming Service -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=Naming</property>
+               <property name="bindingName">Port</property>
+               <property name="port">1099</property>
+               <property name="description">The listening socket for the Naming service</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=Naming</property>
+               <property name="bindingName">RmiPort</property>
+               <property name="port">1098</property>
+               <property name="description">Socket Naming service uses to receive RMI requests from client proxies</property>
+            </bean>
+
+            <!-- Remote classloading service -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=WebService</property>
+               <property name="port">8083</property>
+               <property name="description">Socket for dynamic class and resource loading</property>
+            </bean>
+
+            <!-- Remoting Connector -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">UnifiedInvokerConnector</property>
+               <property name="port">4446</property>
+               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker</property>
+            </bean>
+            
+            <!-- Used to create a multihome Remoting server.   See -->
+            <!-- deploy/remoting-jboss-beans.xml for more details. -->
+            <!--bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">UnifiedInvokerConnector:bindingHome1</property>
+               <parameter>192.168.2.2</property>
+               <property name="port">7777</property>
+               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker on a multihome server</property>
+            </bean-->
+            
+            <!-- Used to create a multihome Remoting server.   See -->
+            <!-- deploy/remoting-jboss-beans.xml for more details. -->
+            <!--bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">UnifiedInvokerConnector:bindingHome2</property>
+               <parameter>10.11.12.238</property>
+               <property name="port">8888</property>
+               <property name="description">Socket for JBoss Remoting Connector used by UnifiedInvoker on a multihome server</property>
+            </bean-->
+
+            <!-- ********************* deploy/legacy-invokers-service.xml ****************** -->
+
+            <!-- RMI/JRMP invoker -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=invoker,type=jrmp</property>
+               <property name="port">4444</property>
+               <property name="description">Socket for the legacy RMI/JRMP invoker</property>
+            </bean>
+
+            <!-- Pooled invoker -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=invoker,type=pooled</property>
+               <property name="port">4445</property>
+               <property name="description">Socket for the legacy Pooled invoker</property>
+            </bean>
+
+            <!-- ********************* deploy/cluster/hajndi-service.xml ****************** -->
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=HAJNDI</property>
+               <property name="bindingName">Port</property>
+               <property name="port">1100</property>
+               <property name="description">The listening socket for the HA-JNDI service</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=HAJNDI</property>
+               <property name="bindingName">RmiPort</property>
+               <property name="port">1101</property>
+               <property name="description">Socket HA-JNDI service uses to receive RMI requests from client proxies</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=HAJNDI</property>
+               <property name="bindingName">AutoDiscovery</property>
+               <property name="hostName">${jboss.partition.udpGroup:230.0.0.4}</property>
+               <property name="port">1102</property>
+               <property name="description">Multicast socket on which HA-JNDI listens for auto-discovery requests from clients</property>
+               <!-- This address should not be changed between different 
+                    binding sets; all nodes need to listen on the same 
+                    multicast address -->
+               <property name="fixedHostName">true</property>
+               <!-- This port should not be changed between different 
+                    binding sets; all nodes need to listen on the same port -->
+               <property name="fixedPort">true</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=HAJNDI</property>
+               <property name="bindingName">AutoDiscoveryInterface</property>
+               <property name="hostName">${jboss.bind.address}</property>
+               <property name="description">Interface for multicast socket on which HA-JNDI listens for auto-discovery requests from clients</property>
+            </bean>
+
+            <!-- ********************* deploy/cluster/ha-legacy-service.xml ****************** -->
+
+            <!-- HA RMI/JRMP invoker -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=invoker,type=jrmpha</property>
+               <property name="port">4447</property>
+               <property name="description">Socket for high availability version of the legacy RMI/JRMP invoker</property>
+            </bean>
+
+            <!-- HA Pooled invoker -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=invoker,type=pooledha</property>
+               <property name="port">4448</property>
+               <property name="description">Socket for high availability version of the legacy Pooled invoker</property>
+            </bean>
+
+            <!-- ********************* deploy/iiop-service.xml ****************** -->
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=CorbaORB</property>
+               <property name="port">3528</property>
+               <property name="description">IIOP socket for the Corba ORB</property>
+            </bean>
+
+            <!-- ********************* deploy/snmp-adaptor.sar **************** -->
+
+            <!-- Trap receiver that acts as an SNMP Manager -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.jmx:name=SnmpAgent,service=trapd,type=logger</property>
+               <property name="port">1162</property>
+               <property name="description">Socket for the SNMP trap receiver</property>
+            </bean>
+
+            <!-- The SNMP adaptor MBean -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor</property>
+               <property name="port">1161</property>
+               <property name="description">Socket for the SNMP adaptor MBean</property>
+            </bean>
+
+            <!-- ********************* deploy/jmx-remoting.sar **************** -->
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.remoting:service=JMXConnectorServer,protocol=rmi</property>
+               <property name="port">1090</property>
+               <property name="description">RMI/JRMP socket for connecting to the JMX MBeanServer</property>
+            </bean>
+
+            <!-- ********************* deploy/ejb3-connectors-service.xml **************** -->
+
+            <!-- EJB3 wants to have the service create its own ServiceBinding object
+                 dynamically.  See the value-factory usage in deploy/ejb3-connectors-service.xml -->
+
+
+            <!-- ********************* deploy/jbossweb.sar **************** -->
+            <!-- ********************* deploy/httpha-invoker.sar **************** -->
+
+            <!--
+                JBoss Web server.xml configuration.
+
+                Same binding config can be used by the following services, or really
+                anything else that needs to point to the JBoss Web HTTP connector
+                but doesn't need an XSL Transform
+
+                jboss:service=invoker,type=http
+                jboss:service=invoker,type=http,target=Naming
+                jboss:service=invoker,type=http,target=Naming,readonly=true
+                jboss:service=invoker,type=httpHA
+                jboss:service=invoker,type=http,target=HAJNDI
+                jboss.ws:service=ServiceEndpointManager
+            -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.web:service=WebServer</property>
+               <property name="port">8080</property>
+               <property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets</property>
+
+               <!--
+                   Inject a XSLT transform configuration (see below) that describes
+                   how to transform server.xml
+                   If the binding value request doesn't require an XSL Transform, this config
+                   will be ignored.
+               -->
+               <property name="serviceBindingValueSourceConfig"><inject bean="JBossWebConnectorXSLTConfig"/></property>
+            </bean>
+
+            <!-- For services like those listed above that need to know the
+                 port of the HTTPS connector -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.web:service=WebServer</property>
+               <property name="bindingName">HttpsConnector</property>
+               <property name="port">8443</property>
+               <property name="description">JBoss Web HTTPS connector socket</property>
+            </bean>
+
+            <!-- ********************* deploy/messaging/remoting-bisocket-service.xml ********************** -->
+
+            <!-- Standard JBM bisocket connector -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
+               <property name="port">4457</property>
+               <property name="description">Socket for JBoss Messaging 1.x</property>
+            </bean>
+
+            <!-- ********************* JBoss Messaging 2 **************** -->
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">JBM2</property>
+                <property name="bindingName">netty-port</property>
+                <property name="port">5445</property>
+                <property name="description">Socket for JBoss Messaging 2.x</property>
+            </bean>
+
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">JBM2</property>
+                <property name="bindingName">netty-ssl-port</property>
+                <property name="port">5446</property>
+                <property name="description">SSL socket for JBoss Messaging 2.x</property>
+            </bean>
+
+            <!-- ********************* deploy/transaction-jboss-beans.xml ********************** -->
+
+            <!-- JBossTS Recovery Manager -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">TransactionManager</property>
+                <property name="bindingName">recoveryManager</property>
+                <property name="port">4712</property>
+                <property name="description">Socket for JBossTS Recovery Manager</property>
+            </bean>
+
+            <!-- JBossTS Transaction Status Manager -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">TransactionManager</property>
+                <property name="bindingName">transactionStatusManager</property>
+                <property name="port">4713</property>
+                <property name="description">Socket for JBossTS Transaction Status Manager</property>
+            </bean>
+
+            <!-- JBossTS SocketProcessId.  The address part is ignored,
+                it will always use localhost/127.0.0.1. -->
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+                <property name="serviceName">TransactionManager</property>
+                <property name="bindingName">socketProcessId</property>
+                <property name="port">4714</property>
+                <property name="description">Socket used to provide unique process id for JBossTS. The address configuration is ignored; will always use localhost/127.0.0.1</property>
+            </bean>
+
+            <!-- ********************* deploy/hsqldb-ds.xml **************** -->
+
+            <!-- Commented out as tcp/ip access to Hypersonic is not enabled by default -->
+            <!--
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss:service=Hypersonic</property>
+               <property name="port">1701</property>
+               <property name="description">TCP/IP socket for remote connection to Hypersonic database</property>
+            </bean>
+            -->
+
+            <!-- ********************* JBoss MQ **************** -->
+
+            <!-- Commented out as JBoss MQ is not installed by default
+                 If you uncomment this and also use jboss.mq:service=InvocationLayer,type=HTTP,
+                 configure the http invocation layer using the jboss.web:service=WebServer binding above
+             -->
+            <!--
+            <bean class="org.jboss.services.binding.ServiceBindingMetadata">
+               <property name="serviceName">jboss.mq:service=InvocationLayer,type=UIL2</property>
+               <property name="port">8093</property>
+               <property name="description">UIL2 socket for JBossMQ</property>
+            </bean>
+            -->
+         </set>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <!-- Conversion of selected bindings into system properties -->
+   <bean name="SystemPropertyBinder" class="org.jboss.services.binding.SystemPropertyBinder">
+
+      <constructor>
+         <parameter>
+            <set>
+               <!-- JBM's remoting connector -->
+               <bean class="org.jboss.services.binding.SystemPropertyBinding">
+                  <constructor>
+                     <parameter>jboss.messaging.connector.bisocket.port</parameter>
+                     <parameter class="int">
+                        <value-factory bean="ServiceBindingManager" method="getIntBinding"
+                                       parameter="jboss.messaging:service=Connector,transport=bisocket"/>
+                     </parameter>
+                  </constructor>
+               </bean>
+               <!-- JBM2 netty connector -->
+               <bean class="org.jboss.services.binding.SystemPropertyBinding">
+                  <constructor>
+                     <parameter>jbm.remoting.netty.port</parameter>
+                     <parameter class="int">
+                        <value-factory bean="ServiceBindingManager" method="getIntBinding">
+                             <parameter>JBM2</parameter>
+                             <parameter>netty-port</parameter>
+                        </value-factory>
+                     </parameter>
+                  </constructor>
+               </bean>
+               <!-- JBM2 netty ssl connector  -->
+               <bean class="org.jboss.services.binding.SystemPropertyBinding">
+                  <constructor>
+                     <parameter>jbm.remoting.netty.ssl.port</parameter>
+                     <parameter class="int">
+                        <value-factory bean="ServiceBindingManager" method="getIntBinding">
+                             <parameter>JBM2</parameter>
+                             <parameter>netty-ssl-port</parameter>
+                        </value-factory>
+                     </parameter>
+                  </constructor>
+               </bean>
+            </set>
+         </parameter>
+      </constructor>
+
+   </bean>
+
+   <!-- XSL Transform to apply to server.xml -->
+   <bean name="JBossWebConnectorXSLTConfig"
+         class="org.jboss.services.binding.impl.XSLTServiceBindingValueSourceConfig">
+
+      <constructor>
+          <parameter><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+          </parameter>
+      </constructor>
+   </bean>
+
+</deployment>

Modified: branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -19,7 +19,7 @@
          The uri to the deployers folder.
          A list of uris to deploy folders. -->
    <bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.StaticClusteredProfileFactory">
-      <property name="bindingsURI">${jboss.server.home.url}conf/bindings-jboss-beans.xml</property>
+      <property name="bindingsURI">${jboss.server.home.url}conf/bindingservice.sar</property>
       <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
       <property name="deployersURI">${jboss.server.home.url}deployers</property>
       <property name="applicationURIs">
@@ -179,7 +179,6 @@
 		<property name="mainDeployer"><inject bean="MainDeployer" /></property>
 		<property name="serializer"><inject bean="AttachmentsSerializer" /></property>
 		<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
-		<property name="metaDataFilter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
 	</bean>
 
 	<bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer">
@@ -193,6 +192,7 @@
 
    <bean name="ProfileServicePersistenceDeployer" class="org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer">
    		<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
+   		<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
    </bean>
    
    <bean name="KernelDeploymentComponentMapper" class="org.jboss.deployers.plugins.managed.KernelDeploymentComponentMapper">

Modified: branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -12,14 +12,6 @@
 		<root>${jboss.lib.url}jboss-profileservice-spi.jar</root>
 	</classloader>
 
-	<bean name="ComponentMapperRegistry"
-		class="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry">
-		<constructor factoryClass="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry" factoryMethod="getInstance"/>
-		<!-- Accept any AbstractprofileFactory -->
-		<incallback method="addMapper" />
-		<uncallback method="removeComponentMapper" />
-	</bean>
-
 	<!-- 
 		The profile configuration
 		This contains required properties:
@@ -27,7 +19,7 @@
 			The uri to the deployers folder.
 			A list of uris to deploy folders. -->
 	<bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
-      <property name="bindingsURI">${jboss.server.home.url}conf/bindings-jboss-beans.xml</property>
+      <property name="bindingsURI">${jboss.server.home.url}conf/bindingservice.sar</property>
       <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
 		<property name="deployersURI">${jboss.server.home.url}deployers</property>
 		<property name="applicationURIs">
@@ -131,6 +123,14 @@
 		<property name="checker"><inject bean="StructureModificationChecker" /></property>
 	</bean>
 
+	<bean name="ComponentMapperRegistry"
+		class="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry">
+		<constructor factoryClass="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry" factoryMethod="getInstance"/>
+		<!-- Accept any AbstractprofileFactory -->
+		<incallback method="addMapper" />
+		<uncallback method="removeComponentMapper" />
+	</bean>
+
 	<!-- A persistence factory for creating the persisted format of ManagedComponents -->
 	<bean name="PersistenceFactory" class="org.jboss.system.server.profileservice.persistence.AbstractPersistenceFactory">
 		<constructor><parameter><inject bean="ManagedObjectFactory" /></parameter></constructor>
@@ -148,7 +148,6 @@
 		<property name="mainDeployer"><inject bean="MainDeployer" /></property>
 		<property name="serializer"><inject bean="AttachmentsSerializer" /></property>
 		<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
-		<property name="metaDataFilter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
 	</bean>
 
 	<bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer">
@@ -162,6 +161,7 @@
 
 	<bean name="ProfileServicePersistenceDeployer" class="org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer">
    		<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
+   		<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
    </bean>
    
    <bean name="KernelDeploymentComponentMapper" class="org.jboss.deployers.plugins.managed.KernelDeploymentComponentMapper">

Deleted: branches/Branch_5_x/server/src/etc/conf/minimal/bindings-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/minimal/bindings-jboss-beans.xml	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/server/src/etc/conf/minimal/bindings-jboss-beans.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <!--  In the minimal config, bindings-jboss-beans.xml is just a placeholder
-         we use to avoid having to exclude it from conf/profile.xml -->
-
-</deployment>

Copied: branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/META-INF/bindings-jboss-beans.xml (from rev 89033, branches/Branch_5_x/server/src/etc/conf/minimal/bindings-jboss-beans.xml)
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/META-INF/bindings-jboss-beans.xml	                        (rev 0)
+++ branches/Branch_5_x/server/src/etc/conf/minimal/bindingservice.sar/META-INF/bindings-jboss-beans.xml	2009-05-19 16:00:27 UTC (rev 89127)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!--  In the minimal config, bindings-jboss-beans.xml is just a placeholder
+         we use to avoid having to exclude it from conf/profile.xml -->
+
+</deployment>

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -26,6 +26,8 @@
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.persistence.xml.PersistenceRoot;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * The AttachmentStore.
@@ -42,32 +44,51 @@
     * @return the attachment store root
     */
    URI getAttachmentStoreRoot();
-   
+
    /**
-    * Persist the changes of the managed component.
+    * Load the repository attachment meta data
     * 
-    * @param deployment the profile deployment
-    * @param comp the managed component
+    * @param deploymentCtx the deployment root
+    * @return the persisted meta data or null if it does not exist
     * @throws Exception
     */
-   void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
-   
+   RepositoryAttachmentMetaData loadMetaData(VirtualFile deploymentCtx) throws Exception;
+
    /**
-    * Remove a component from the persisted attachment.
+    * Load a attachment.
     * 
-    * @param deployment the profile deployment
+    * @param deploymentCtx
+    * @param attachment
+    * @return
+    * @throws Exception
+    */
+   PersistenceRoot loadAttachment(VirtualFile deploymentCtx, AttachmentMetaData attachment) throws Exception;
+
+   /**
+    * Persist the managed component.
+    * 
+    * @param ctx the deployment context name
     * @param comp the managed componenbt
     * @throws Exception
     */
-   void removeComponent(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
+   void updateDeployment(String ctx, ManagedComponent comp) throws Exception;
+
+   /**
+    * Remove a component from the attachment.
+    * 
+    * @param ctx the deployment context name
+    * @param comp the managed componenbt
+    * @throws Exception
+    */
+   void removeComponent(String ctx, ManagedComponent comp) throws Exception;
    
    /**
-    * Create the deployment with the persisted attachments.
+    * Create a MC deployment.
     * 
-    * @param deployment the profile deployment
-    * @return the mc deployment
+    * @param deployment
+    * @return
     * @throws Exception
     */
-   Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception;
+   Deployment createDeployment(ProfileDeployment deployment) throws Exception;
    
 }

Added: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/PersistenceModificationChecker.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/PersistenceModificationChecker.java	                        (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/PersistenceModificationChecker.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.system.server.profileservice.persistence.deployer;
+
+import java.util.List;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistenceModificationChecker
+{
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(PersistenceModificationChecker.class);
+   
+   private static final String suffix = ".xml";
+   
+   public static boolean hasBeenModified(VFSDeploymentUnit unit, long lastModified)
+   {
+      List<VirtualFile> files = unit.getMetaDataFiles(null, suffix);
+      for(VirtualFile vf : files)
+      {
+         try
+         {
+            if(vf.getLastModified() > lastModified)
+               return true;            
+         }
+         catch(Exception e)
+         {
+            log.debug("failed to check modified ", e);
+         }
+      }
+      return false;
+   }
+}
+

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -21,15 +21,19 @@
  */
 package org.jboss.system.server.profileservice.persistence.deployer;
 
-import java.util.Set;
-
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
 import org.jboss.system.server.profileservice.persistence.PersistenceFactory;
 import org.jboss.system.server.profileservice.persistence.xml.PersistenceRoot;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * The ProfileService Persistence Deployer. This deployer applies the
@@ -44,6 +48,9 @@
    /** The managed prefix. */
    public static final String PERSISTED_ATTACHMENT_PREFIX = "PERISTED";
    
+   /** The attachment store. */
+   private AttachmentStore store;
+   
    /** The persistence factory. */
    private PersistenceFactory persistenceFactory;
    
@@ -67,30 +74,68 @@
       this.persistenceFactory = persistenceFactory;
    }
    
+   public AttachmentStore getAttachmentStore()
+   {
+      return store;
+   }
+   
+   public void setAttachmentStore(AttachmentStore store)
+   {
+      this.store = store;
+   }
+   
    @Override
    protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
    {
-      // Check all attachments, if they have a managed attachment
-      // TODO there might be a better way to do that ? :)
-      Set<String> attachments = unit.getTransientManagedObjects().getAttachments().keySet();
-      for(String attachmentName : attachments)
+      if(unit == null || unit instanceof VFSDeploymentUnit == false)
+         return;
+      try
       {
-         // Get the persisted information
-         PersistenceRoot root = (PersistenceRoot) unit.getAttachment(PERSISTED_ATTACHMENT_PREFIX + attachmentName);
-         if(root != null)
+         internalDeployment((VFSDeploymentUnit) unit);
+      }
+      catch(Throwable e)
+      {
+         log.warn("Failed to update the persisted attachment information", e);
+      }
+   }
+   
+   protected void internalDeployment(VFSDeploymentUnit unit) throws Throwable
+   {
+      VirtualFile vf = unit.getRoot();
+      RepositoryAttachmentMetaData metaData = store.loadMetaData(vf);
+      if(metaData == null)
+         return;      
+      
+      // Check if the deployment was modified
+      if(PersistenceModificationChecker.hasBeenModified(unit, metaData.getLastModified()))
+      {
+         log.debug("Deployment was modified, not applying persisted information.");
+         return;
+      }
+      //
+      if(metaData.getAttachments() != null && metaData.getAttachments().isEmpty() == false)
+      {
+         for(AttachmentMetaData attachment: metaData.getAttachments())
          {
-            // Get the transient attachment
-            Object instance = unit.getTransientManagedObjects().getAttachment(attachmentName);
-            try
+            Object instance = unit.getAttachment(attachment.getName());
+            if(instance != null)
             {
+               PersistenceRoot root = this.store.loadAttachment(vf, attachment);
+               if(root == null)
+               {
+                  log.warn("Null persisted information for deployment: " + vf);
+               }
+               // update ...
+               MetaData md = unit.getMetaData();
                getPersistenceFactory().restorePersistenceRoot(root, instance, unit.getClassLoader());
             }
-            catch(Throwable e)
+            else
             {
-               log.warn("Failed to update the persisted attachment information", e);
+               log.warn("Could not apply changes, failed to find attachment: " + attachment.getName());
             }
-         }
-      }
+         }         
+      }      
    }
+   
 
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -22,7 +22,6 @@
 package org.jboss.system.server.profileservice.repository;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -30,16 +29,10 @@
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Formatter;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
 import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.structure.ClassPathEntry;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.spi.structure.StructureMetaData;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
@@ -47,88 +40,73 @@
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedCommon;
 import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
 import org.jboss.system.server.profileservice.attachments.AttachmentStore;
-import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
-import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
-import org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects;
 import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
 import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaDataFactory;
 import org.jboss.system.server.profileservice.persistence.PersistenceFactory;
 import org.jboss.system.server.profileservice.persistence.xml.PersistenceRoot;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
 
 /**
- * The AbstractAttachmentStore updates and restores the persisted attachments.
+ * The AbstractAttachmentStore.
  * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
 public class AbstractAttachmentStore implements AttachmentStore
 {
-   
-   /** The attachment store root. */
-   private final URI attatchmentStoreRoot;
 
-   /** The attachment serializer. */
-   protected AbstractFileAttachmentsSerializer serializer;
+   /** The metadata name */
+   public static final String METADATA_NAME = "metadata";
    
-   /** The deployment factory. */
-   protected VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(AbstractAttachmentStore.class);
    
-   /** The MainDeployerStructure. */
-   protected MainDeployerStructure mainDeployer;
+   /** The vfs deployment factory. */
+   private static final VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
    
-   /** The virutal file filter. */
-   private VirtualFileFilter metaDataFilter;
+   /** The attachment store root. */
+   private final URI attachmentStoreRoot;
    
-   /** The metadata name */
-   public static final String METADATA_NAME = "metadata";
+   /** The attachment serializer. */
+   private AbstractFileAttachmentsSerializer serializer;
+
+   /** The main deployer. */
+   private MainDeployerStructure mainDeployer;
    
    /** The persistence factory. */
    private PersistenceFactory persistenceFactory;
-
-   /** The logger. */
-   private static final Logger log = Logger.getLogger(AbstractAttachmentStore.class);
-   
-   public AbstractAttachmentStore(File root)
+  
+   protected static URI getURI(File root)
    {
       if(root == null)
-         throw new IllegalArgumentException("Null attachmentStoreDir");
+         throw new IllegalArgumentException("Null attachment root.");
       if(root.exists() && root.isDirectory() == false)
-         throw new IllegalArgumentException("AttachmentStoreRoot is not a directory.");
-      this.attatchmentStoreRoot = root.toURI();
+         throw new IllegalArgumentException("Attachment root is not a directory.");
+      return root.toURI();
    }
-   
-   public URI getAttachmentStoreRoot()
+
+   public AbstractAttachmentStore(File root)
    {
-      return this.attatchmentStoreRoot;
+      this(getURI(root));
    }
    
-   public VFSDeploymentFactory getDeploymentFactory()
+   public AbstractAttachmentStore(URI uri)
    {
-      return deploymentFactory;
+      if(uri == null)
+         throw new IllegalArgumentException("Null uri.");
+      
+      this.attachmentStoreRoot = uri;
    }
    
-   public void setDeploymentFactory(VFSDeploymentFactory deploymentFactory)
+   public URI getAttachmentStoreRoot()
    {
-      this.deploymentFactory = deploymentFactory;
+      return this.attachmentStoreRoot;
    }
-   
-   public PersistenceFactory getPersistenceFactory()
-   {
-      return persistenceFactory;
-   }
-   
-   public void setPersistenceFactory(PersistenceFactory persistenceFactory)
-   {
-      this.persistenceFactory = persistenceFactory;
-   }
-   
+  
    public MainDeployerStructure getMainDeployer()
    {
       return mainDeployer;
@@ -141,557 +119,212 @@
    
    public AbstractFileAttachmentsSerializer getSerializer()
    {
-      return serializer;
+      return this.serializer;
    }
    
    public void setSerializer(AbstractFileAttachmentsSerializer serializer)
    {
       this.serializer = serializer;
    }
-   
-   public VirtualFileFilter getMetaDataFilter()
+
+   public PersistenceFactory getPersistenceFactory()
    {
-      return metaDataFilter;
+      return persistenceFactory;
    }
    
-   public void setMetaDataFilter(VirtualFileFilter metaDataFilter)
+   public void setPersistenceFactory(PersistenceFactory persistenceFactory)
    {
-      this.metaDataFilter = metaDataFilter;
+      this.persistenceFactory = persistenceFactory;
    }
    
-   public Deployment createMCDeployment(ProfileDeployment profileDeployment) throws Exception
+   public Deployment createDeployment(ProfileDeployment deployment) throws Exception
    {
-      if(profileDeployment.getRoot() == null)
-      {
-         return new AbstractDeployment(profileDeployment.getName());
-      }
-      else
-      {
-         return deploymentFactory.createVFSDeployment(profileDeployment.getRoot());
-      }
+      if(deployment.getRoot() == null)
+         return new AbstractDeployment();
+      
+      return deploymentFactory.createVFSDeployment(deployment.getRoot());
    }
    
    /**
-    * Create a VFSDeployment with predetermined managed object.
+    * Load the attachment metadata for a deployment.
     * 
-    * @param file the deployment root.
-    * @param phase the deployment phase
-    * @return the VFSDeployment
+    * @param relativeDeploymentPath the relative path
+    * @return the attachment metadata
     */
-   public Deployment loadDeploymentData(ProfileDeployment profileDeployment) throws Exception
+   protected RepositoryAttachmentMetaData loadAttachmentMetaData(String relativeDeploymentPath)
    {
-      if(profileDeployment == null)
-         throw new IllegalArgumentException("Null profile deployment.");
-      
-      boolean trace = log.isTraceEnabled();
-      
-      // Create VFS deployment
-      Deployment deployment = createMCDeployment(profileDeployment);
-      if(log.isTraceEnabled())
-         log.trace("Created deployment: " + deployment);
-      
-      // TODO also handle normal Deployments
-      if(profileDeployment.getRoot() == null)
-         return deployment;
-      
-      // simpleName + hash
-      String deploymentPath = createRelativeDeploymentPath(profileDeployment);
-      if(trace)
-         log.trace("trying to load attachment from relative path: " + deploymentPath);
-      
-      // Load the metadata
-      RepositoryAttachmentMetaData attachmentMetaData = loadAttachmentMetaData(deploymentPath);
-      
-      if(attachmentMetaData == null)
-      {
-         log.debug("No persisted attachment found for deployment " + deployment + " with relative path: "+ deploymentPath);
-         return deployment;
-      }
-      
-      log.debug("Persisted attachment found for deployment " + deployment + " with relative path: "+ deploymentPath);
-      
+      // attachments/simpleName - hash/metadata.xml
+      String fixedMetadataPath = getMetaDataPathName(relativeDeploymentPath);   
+               
       try
-      {
-         // If the deployment has changes we skip restoring the persisted metadata.
-         // TODO delete attachments ?
-         // TODO check metadata locations
-         if(attachPredeterminedObject(profileDeployment.getRoot(), attachmentMetaData) == false)
-         {
-            log.debug("Not using the persisted metadata, as the deployment was modified.");
-            return deployment;
-         }
+      {  // Try to load the repository attachment metadata
+         return getSerializer().loadAttachment(fixedMetadataPath, RepositoryAttachmentMetaData.class);
       }
-      catch(IOException e)
+      catch(Exception e)
       {
-         log.error("failed to get LastModified date for file, not using persisted metadata: "+ profileDeployment.getName());
-         return deployment;
+         log.error("Failed to load attachment metadata from relative path: "+ relativeDeploymentPath, e);
       }
-      
-      // Start with "" the root contextPath
-      rebuildStructureContext(deployment, "", deploymentPath, attachmentMetaData, trace);
-      
-      return deployment;
+      return null;
    }
    
-   /**
-    * Determine whether to attach the PredeterminedManagedObjects or not.
-    * 
-    * TODO this should also check the metadata paths for the deployment. 
-    * 
-    * @param root the path of the deployment
-    * @param metaData the repository meta data
-    * @return hasBeenModified.
-    * @throws IOException
-    */
-   protected boolean attachPredeterminedObject(VirtualFile root, RepositoryAttachmentMetaData metaData)
-      throws IOException
+   public RepositoryAttachmentMetaData loadMetaData(VirtualFile deploymentRoot) throws Exception
    {
-      boolean attach = true;
-      long lastModified = metaData.getLastModified();
-      // Check directory
-      if(root.isLeaf() == false && root.isArchive() == false)
-      {
-         // TODO recursive checks
-         DeploymentStructureMetaData structure = metaData.getDeploymentStructure();
-         if(checkMetaDataModifications(root, structure, lastModified) == false)
-            return false;
-      }
-      else
-      {
-         // Otherwise we only check the root
-         if(lastModified < root.getLastModified())
-            return false;         
-      }
-      return attach;
+      if(deploymentRoot == null)
+         throw new IllegalArgumentException("Null deployment root.");
+      
+      String deploymentPath = createRelativeDeploymentPath(deploymentRoot);
+      return loadAttachmentMetaData(deploymentPath);
    }
-   
-   
-   protected boolean checkMetaDataModifications(VirtualFile root, DeploymentStructureMetaData structure, long lastModified)
-   {
-      if(structure == null)
-         return true;
 
-      List<String> metaDataPaths = structure.getMetaDataPaths();
-      if(metaDataPaths != null && metaDataPaths.isEmpty() == false)
-      {
-         for(String path : metaDataPaths)
-         {
-            try
-            {
-               VirtualFile vf = root.getChild(path);
-               if(vf != null)
-               {
-                  List<VirtualFile> children = vf.getChildren(metaDataFilter);
-                  if(children != null && children.isEmpty() == false)
-                  {
-                     for(VirtualFile child : children)
-                     {
-                        if(lastModified < child.getLastModified())
-                           return false;
-                     }
-                  }
-               }
-            }
-            catch(Exception e)
-            {
-               log.debug("Failed to check deployment modifications, ignoring persisted information.");
-               return false;
-            }
-         }            
-      }
-      return true;
-   }
-   
-   /**
-    * Remove a component will flag this component as removed and will therefore not
-    * be restored after a restart.
-    * 
-    * @param deployment the profile deployment
-    * @param comp the managed component
-    * @throws Exception
-    */
-   public void removeComponent(ProfileDeployment deployment, ManagedComponent comp)
-      throws Exception
+   public void removeComponent(String ctx, ManagedComponent comp) throws Exception
    {
-      if(deployment == null)
-         throw new IllegalArgumentException("Null deployment.");
+      if(ctx == null)
+         throw new IllegalArgumentException("null deployment ctx name");
       if(comp == null)
-         throw new IllegalArgumentException("Null managed component.");
+         throw new IllegalArgumentException("null managed component");
       
-      // Create the remove handler
-      updateDeployment(deployment, comp, true);
+      saveAttachment(ctx, comp, true);
    }
-   
-   
-   /**
-    * Persist the updated metadata for a managedComponent and generate a metadata describing
-    * the repository, if it does not exist already.
-    * 
-    * @param deployment the deployment.
-    * @param phase the deployment phase.
-    * @param comp the managed component.
-    * @throws Exception
-    */
-   public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp)
-      throws Exception
+
+   public void updateDeployment(String ctx, ManagedComponent comp) throws Exception
    {
+      if(ctx == null)
+         throw new IllegalArgumentException("null deployment ctx name");
       if(comp == null)
-         return;
-      
-      // Update deployment
-      updateDeployment(deployment, comp, false);      
+         throw new IllegalArgumentException("null managed component");
+
+      saveAttachment(ctx, comp, false);
    }
    
-   
-   public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp, boolean remove)
-      throws Exception
+   public void saveAttachment(String deploymentName, ManagedComponent component, boolean remove) throws Exception
    {
-      if(deployment == null)
-         throw new IllegalArgumentException("Null deployment.");
-      if(comp == null)
-         throw new IllegalArgumentException("Null managed component.");
+      VFSDeploymentContext ctx = getDeploymentContext(deploymentName);
+      if(ctx == null)
+         throw new IllegalStateException("Cannot persist attachment, failed to find deployment: " + deploymentName);
+
+      // Get the root
+      VirtualFile root = ctx.getRoot();
+      String deploymentPath = createRelativeDeploymentPath(root);
       
-      if(deployment.getRoot() == null)
+      // Load previous saved information
+      RepositoryAttachmentMetaData repositoryMetaData = loadAttachmentMetaData(deploymentPath);
+      if(repositoryMetaData == null)
       {
-         // TODO
-         log.debug("Cannot persist attachments for non VFS based deployment: " + deployment);
-         return;
+         repositoryMetaData = RepositoryAttachmentMetaDataFactory.createInstance();
+         repositoryMetaData.setDeploymentName(root.getName());
       }
-      
-      if(comp == null)
-         throw new IllegalArgumentException("ManagedComponent may not be null.");
-      
-      boolean trace = log.isTraceEnabled();
-      
-      // Log 
-      log.debug("updating deployment: "+ deployment + ", component: "+ comp);
-      
-      // simpleName + hash
-      String deploymentPath = createRelativeDeploymentPath(deployment);
-      RepositoryAttachmentMetaData savedMetaData = loadAttachmentMetaData(deploymentPath); 
-      
-      // Get parent deployment
-      ManagedDeployment md = comp.getDeployment();
-      String currentContextName = "";
-      if(md.getParent() != null)
-      {
-         while( md.getParent() != null )
-         {
-            currentContextName = md.getSimpleName() + "/" + currentContextName;
-            md = md.getParent();
-         }
-         currentContextName = fixName(currentContextName);
-      }
-      
-      RepositoryAttachmentMetaData currentContextMetaData = null;
-      if(savedMetaData != null)
-      {
-         if(trace)
-            log.trace("Previous metadata found for deployment: " + deployment);
-         
-         // The root context
-         if("".equals(currentContextName))
-         {
-            currentContextMetaData = savedMetaData;
-         }
-         else
-         {
-            for(RepositoryAttachmentMetaData child : savedMetaData.getChildren())
-            {
-               // extract the current context
-               if(child.getDeploymentName().equals(currentContextName))
-                  currentContextMetaData = child;
-            }
-         }
-      }
-      else
-      {
-         // Create the metadata
-         savedMetaData = RepositoryAttachmentMetaDataFactory.createInstance(md);
-         currentContextMetaData = createRepositoryMetaData(savedMetaData, currentContextName, md);
-      }
-      
-      if(currentContextMetaData == null)
-         throw new IllegalStateException("Could not create metadata");
-      
-      // Get the currentTimeMillis
-      long lastModified = System.currentTimeMillis();
-      
-      // Get the parent ManagedCommon
-      ManagedCommon parent = comp;
+
+      // Get the parent MO
+      ManagedCommon parent = component;
       while(parent.getParent() != null)
          parent = parent.getParent();
 
       // Get the managed object, as a component can also be a child of a managedObject
-      ManagedObject managedObject = comp.getDeployment().getManagedObject(parent.getName());
+      ManagedObject managedObject = component.getDeployment().getManagedObject(parent.getName());
       if(managedObject == null && parent instanceof ManagedObject)
          managedObject = (ManagedObject) parent;
       
-      // Create a AttachmentMetaData for the MO
-      if(managedObject == null)
-         throw new IllegalStateException("Could not get the parent managed object of component " + comp);
-      
+      // Get the current attachment
       String attachmentName = managedObject.getAttachmentName(); 
-      // Create attachmentMetaData if needed
-      AttachmentMetaData attachment = RepositoryAttachmentMetaDataFactory.findAttachment(attachmentName, currentContextMetaData.getAttachments());
+      List<AttachmentMetaData> attachments = repositoryMetaData.getAttachments();
+      if(attachments == null)
+      {
+         attachments = new ArrayList<AttachmentMetaData>();
+         repositoryMetaData.setAttachments(attachments);
+      }
+      // Extract the attachment 
+      AttachmentMetaData attachment = null;
+      for(AttachmentMetaData a : attachments)
+      {
+         if(attachmentName.equals(a.getName()))
+            attachment = a;
+      }      
+      
+      // Create a new one
       if(attachment == null)
       {
-         // Add a new attachment
+         // Create attachment meta data
          attachment = new AttachmentMetaData();
-         RepositoryAttachmentMetaDataFactory.addAttachment(currentContextMetaData, attachment);
+         // Add attachment meta data
+         attachments.add(attachment);
       }
-      
+
       // Is attachmentName the same as the className ?
       attachment.setName(attachmentName);
       attachment.setClassName(managedObject.getAttachment().getClass().getName());
+      
+      // Save the attachment
+      String attachmentPath = deploymentPath + attachment.getName();
+      // Create the persistence information
+      PersistenceRoot persistenceRoot = getSerializer().loadAttachment(attachmentPath, PersistenceRoot.class);
+      //
+      persistenceRoot = createPersistedMetaData(persistenceRoot, managedObject, component, remove);
+      // Serialize the attachment
+      getSerializer().saveAttachment(attachmentPath, persistenceRoot);
 
-      // Add the comp as transient attachment
-      attachment.setAttachment(comp);
+      // Update the last modified.
+      long lastModified = System.currentTimeMillis();
+      attachment.setLastModified(lastModified);
+      repositoryMetaData.setLastModified(lastModified);
       
-      // Update lastModified
-      currentContextMetaData.setLastModified(lastModified);
-      
-      // Save the attachment for the root
-      saveAttachmentMetaData(deploymentPath, savedMetaData, remove);
-   
-      // Set the last modified on the root metadata
-      savedMetaData.setLastModified(lastModified);
-      
-      // Save the repository meta data
-      this.serializer.saveAttachment(getMetaDataPathName(deploymentPath), savedMetaData);      
+      //  Save the updated repository meta data
+      getSerializer().saveAttachment(getMetaDataPathName(deploymentPath), repositoryMetaData);
    }
-   
-   /**
-    * Create the repository meta data from the parent ManagedDeployment.
-    * 
-    * @param parentMd the parent managed deployment
-    * @return the RepositoryAttachmentMetaData with the structure information 
-    * @throws Exception
-    */
-   protected RepositoryAttachmentMetaData createRepositoryMetaData(RepositoryAttachmentMetaData parentMetaData, String childPath, ManagedDeployment parentMd)
-      throws Exception
-   {
-      // Child metadata 
-      RepositoryAttachmentMetaData childMetaData = null;
-      
-      StructureMetaData structure = getStructureMetaData(parentMd.getName());
-      if(structure == null)
-         throw new IllegalStateException("Could not get the StructureMetaData.");
-      
-      List<ContextInfo> contextInfos = structure.getContexts();
-      if(contextInfos == null)
-         throw new IllegalStateException("StructureMetaData has no contexts."); // can this happen anyway ?
-      
-      // root context
-      RepositoryAttachmentMetaDataFactory.applyStructureContext(parentMetaData, structure.getContext(""));
-      // Other contexts
-      for(ContextInfo info : contextInfos)
-      {
-         // If it is not the root path
-         if(! "".equals(info.getPath()))
-         {
-            String childContextName = fixName(info.getPath());
-            // TODO we might need to check the context itself contains a subdeployment? 
-            
-            RepositoryAttachmentMetaData newChild = RepositoryAttachmentMetaDataFactory.createInstance();
-            newChild.setDeploymentName(childContextName);
-            
-            RepositoryAttachmentMetaDataFactory.applyStructureContext(newChild, info);
-            RepositoryAttachmentMetaDataFactory.addChild(parentMetaData, newChild);
-            
-            if(childPath.equals(childContextName))
-               childMetaData = newChild;
-         }
-      }
-      
-      if("".equals(childPath))
-         childMetaData = parentMetaData;
-      
-      return childMetaData;
-   }
-   
 
    /**
-    * Save the attachments based on the RepositoryAttachmentMetaData.
-    * 
-    * @param deploymentPath the deploymentPath
-    * @param metaData the repository meta data.
-    * @throws Exception
-    */
-   private void saveAttachmentMetaData(String deploymentPath, RepositoryAttachmentMetaData metaData, boolean remove)
-      throws Exception
-   {
-      boolean trace = log.isTraceEnabled();
-         
-      // Save attachments for the root context
-      if(metaData.getAttachments() != null && metaData.getAttachments().isEmpty() == false)
-      {
-         for(AttachmentMetaData attachment : metaData.getAttachments())
-         {
-            // Only save attachment if the attachment is present :)
-            if(attachment.getAttachment() == null)
-               continue;
+   * create the xml meta data for persisting the managed object.
+   * 
+   * @param parent the parent managed object.
+   * @param the managed object
+   * @param handler the persistence handler
+   * @return the xml metadata.
+   */
+  protected PersistenceRoot createPersistedMetaData(PersistenceRoot root, ManagedObject managedObject, ManagedComponent component, boolean remove)
+  {
+     if(root == null)
+        root = new PersistenceRoot();
+ 
+     if(remove)
+     {
+        root = this.persistenceFactory.removeComponent(root, managedObject, component);
+     }
+     else
+     {
+        root = this.persistenceFactory.updateComponent(root, managedObject, component);
+     }
+     if(root.getName() == null)
+        root.setName(managedObject.getAttachmentName());
+     if(root.getClassName() == null)
+        root.setClassName(managedObject.getAttachment().getClass().getName());
+     
+     return root;
+  }
 
-            String attachmentPath = deploymentPath + attachment.getName();
-            // Get the previous attachment
-            PersistenceRoot root = serializer.loadAttachment(attachmentPath, PersistenceRoot.class);
-            ManagedComponent component = (ManagedComponent) attachment.getAttachment();
-            root = createPersistedMetaData(root, component, remove);
-
-            // Serialize the attachment
-            serializer.saveAttachment(attachmentPath, root);
-            
-            if(trace)
-               log.trace("Stored attachment to : " + attachmentPath);
-         }
-      }
-      
-      // Save the attachments for the childs
-      if(metaData.getChildren() != null && metaData.getChildren().isEmpty() == false)
-      {
-         for(RepositoryAttachmentMetaData child : metaData.getChildren())
-         {
-            String childDeploymentPath = deploymentPath + File.separator + child.getDeploymentName() + File.separator;
-            saveAttachmentMetaData(childDeploymentPath, child, remove);
-         }
-      }
-   }
    
-   /**
-    * create the xml meta data for persisting the managed object.
-    * 
-    * @param parent the parent managed object.
-    * @param the managed object
-    * @param handler the persistence handler
-    * @return the xml metadata.
-    */
-   protected PersistenceRoot createPersistedMetaData(PersistenceRoot root, ManagedComponent component, boolean remove)
+   
+   public PersistenceRoot loadAttachment(VirtualFile deploymentCtx, AttachmentMetaData attachment) throws Exception
    {
-      if(root == null)
-         root = new PersistenceRoot();
-      // Get the parent ManagedCommon
-      ManagedCommon parent = component;
-      while(parent.getParent() != null)
-         parent = parent.getParent();
-
-      // Get the managed object, as a component can also be a child of a managedObject
-      ManagedObject managedObject = component.getDeployment().getManagedObject(parent.getName());
-      if(managedObject == null && parent instanceof ManagedObject)
-         managedObject = (ManagedObject) parent;
+      if(deploymentCtx == null)
+         throw new IllegalArgumentException("Null deployment root.");
+      if(attachment == null)
+         throw new IllegalArgumentException("Null attachment");
       
-      if(remove)
-      {
-         root = this.persistenceFactory.removeComponent(root, managedObject, component);
-      }
-      else
-      {
-         root = this.persistenceFactory.updateComponent(root, managedObject, component);
-      }
-      if(root.getName() == null)
-         root.setName(managedObject.getAttachmentName());
-      if(root.getClassName() == null)
-         root.setClassName(managedObject.getAttachment().getClass().getName());
+      String deploymentPath = createRelativeDeploymentPath(deploymentCtx);
       
-      return root;
+      // Load
+      String attachmentPath = deploymentPath + attachment.getName();
+      return getSerializer().loadAttachment(attachmentPath, PersistenceRoot.class);
    }
    
    /**
-    * Rebuild the StructureMetaData based on the RepositoryAttachmentMetaData
-    * and add predeterminedManagedObjects.
+    * Get the metadata path, based on a relative path.
     * 
-    * @param deployment the VFSDeployment
-    * @param contextName the structure context path
-    * @param deploymentPath the path to the attachment
-    * @param attachmentMetaData the meta data
+    * @param deploymentPath the relative path to the deployment
+    * @return
     */
-   protected void rebuildStructureContext(Deployment deployment,
-         String contextName,
-         String deploymentPath,
-         RepositoryAttachmentMetaData attachmentMetaData,
-         boolean trace)
+   protected String getMetaDataPathName(String deploymentPath)
    {
-      // The toplevel context
-      boolean isRoot = "".equals(contextName);
-      
-      if(trace)
-         log.trace("Rebuilding StructureMetaData for context: " + contextName);
-
-      // Get the stored deployment structure
-      DeploymentStructureMetaData structure = attachmentMetaData.getDeploymentStructure();
-      
-      // MetaData and ClassPath
-      List<String> metaDataPaths = new ArrayList<String>();
-      List<ClassPathEntry> classPath = new ArrayList<ClassPathEntry>();
-      if(structure != null)
-      {
-         if(structure.getClassPaths() != null)
-         {
-            for(DeploymentClassPathMetaData md : structure.getClassPaths())
-               classPath.add(deploymentFactory.createClassPathEntry(md.getPath(), md.getSuffixes()));
-         }
-         
-         if(structure.getMetaDataPaths() != null)
-            metaDataPaths = structure.getMetaDataPaths(); 
-      }
-      
-      // Now create the ContextInfo
-      ContextInfo info = deploymentFactory.addContext(deployment, contextName, metaDataPaths, classPath);
-      if(structure != null)
-      {
-         // Set the comparator
-         info.setComparatorClassName(structure.getComparatorClass());
-         // Set the relative order
-         info.setRelativeOrder(structure.getRelatativeOrder());
-      }
-      if(trace)
-         log.trace("created ContextInfo: "+  info + " for deployment: "+ deployment);
-      
-      // Add attachments if needed 
-      if(attachmentMetaData.getAttachments() != null && ! attachmentMetaData.getAttachments().isEmpty())
-      {
-         Set<String> availableAttachments = new HashSet<String>();
-         for(AttachmentMetaData attachment : attachmentMetaData.getAttachments())
-            availableAttachments.add(attachment.getName());
-
-          MutableAttachments mutable =  createPredeterminedAttachment(deploymentPath, availableAttachments);
-          
-          // TODO is there a better way to do this ?
-          if(isRoot)
-          {
-             deployment.setPredeterminedManagedObjects(mutable);
-          }
-          else
-          {
-             info.setPredeterminedManagedObjects(mutable);
-          }
-          
-          if(trace)
-             log.trace("Added PredetminedManagedObjects: " + availableAttachments + " to context " + contextName);
-      }
-      else
-      {
-         if(trace)
-            log.trace("No PredetminedManagedObjects found for context " + contextName);         
-      }
-      
-      // Process children
-      List<RepositoryAttachmentMetaData> children = attachmentMetaData.getChildren(); 
-      if(children != null && children.isEmpty() == false)
-      {
-         for(RepositoryAttachmentMetaData childMetaData : children)
-         {
-            // The structure context path
-            String childContextName = contextName + "/" + childMetaData.getDeploymentName();
-            // The relative path of the child attachment (therefore File.separator) 
-            String relativePath = deploymentPath + childMetaData.getDeploymentName() + File.separator;
-            
-            if(trace)
-               log.trace("Processing child context: "+ childContextName);
-            
-            // Rebuild the structure of the child
-            rebuildStructureContext(deployment, fixName(childContextName), relativePath, childMetaData, trace);
-         }
-      }
+      return deploymentPath.endsWith(File.separator) ? deploymentPath + METADATA_NAME : deploymentPath + File.separator + METADATA_NAME;
    }
    
    /**
@@ -702,14 +335,14 @@
     * @return the relative name
     * @throws Exception
     */
-   protected String createRelativeDeploymentPath(ProfileDeployment deployment) throws Exception
+   protected String createRelativeDeploymentPath(VirtualFile vf) throws Exception
    {
-      if(deployment == null)
+      if(vf == null)
          throw new IllegalStateException("Null deployment.");
       
       // deployment URI 
-      String pathName = deployment.getRoot().toURI().toString();
-      String fileName = deployment.getRoot().getName();
+      String pathName = vf.toURI().toString();
+      String fileName = vf.getName();
       // Generate hash
       String hash = HashGenerator.createHash(pathName);
       // simple name + "-" + hash
@@ -718,69 +351,6 @@
    }
    
    /**
-    * Create a predetermined managedObject attachment.
-    * 
-    * @param deploymentPath the relative deployment path
-    * @param availableAttachments the available attachments
-    * @return
-    */
-   protected MutableAttachments createPredeterminedAttachment(String deploymentPath, Set<String> availableAttachments)
-   {
-      return new LazyPredeterminedManagedObjects(this.serializer, deploymentPath, availableAttachments);
-   }
-   
-   /**
-    * Get the metadata path, based on a relative path.
-    * 
-    * @param deploymentPath the relative path to the deployment
-    * @return
-    */
-   protected String getMetaDataPathName(String deploymentPath)
-   {
-      return deploymentPath.endsWith(File.separator) ? deploymentPath + METADATA_NAME : deploymentPath + File.separator + METADATA_NAME;
-   }
-   
-   /**
-    * Load the attachment metadata for a deployment.
-    * 
-    * @param relativeDeploymentPath the relative path
-    * @return the attachment metadata
-    */
-   protected RepositoryAttachmentMetaData loadAttachmentMetaData(String relativeDeploymentPath)
-   {
-      // attachments/simpleName - hash/metadata.xml
-      String fixedMetadataPath = getMetaDataPathName(relativeDeploymentPath);   
-               
-      try
-      {  // Try to load the repository attachment metadata
-         return this.serializer.loadAttachment(fixedMetadataPath, RepositoryAttachmentMetaData.class);
-      }
-      catch(Exception e)
-      {
-         log.error("Failed to load attachment metadata from relative path: "+ relativeDeploymentPath, e);
-      }
-      return null;
-   }
-   
-   
-   /**
-    * Get the structure meta data for a deployment.
-    * 
-    * @param vfsDeploymentName the vfs deployment name
-    * @return the StructureMetaData
-    * @throws Exception
-    */
-   protected StructureMetaData getStructureMetaData(String vfsDeploymentName)
-   {
-      // Get the StructureMetaData;
-      DeploymentContext deploymentContext = getDeploymentContext(vfsDeploymentName);
-      if(deploymentContext == null)
-         throw new IllegalStateException("Could not find deployment context for name: "+ vfsDeploymentName);
-      
-      return deploymentContext.getDeploymentUnit().getAttachment(StructureMetaData.class);
-    }
-   
-   /**
     * Get deployment context.
     *
     * @param name the deployment context name
@@ -798,30 +368,7 @@
 
       return (VFSDeploymentContext)deploymentContext;
    }
-   
-   /**
-    * Make sure that the name does not start or end with /
-    * 
-    * @param name
-    * @return
-    */
-   private String fixName(String name)
-   {
-      if(name == null)
-         return null;
-      
-      if(name.equals(""))
-         return name;
-      
-      if(name.startsWith("/"))
-         name = name.substring(1);
-      
-      if(name.endsWith("/"))
-         name = name.substring(0, name.length() -1);
-      
-      return name;
-   }
-   
+
    private static class HashGenerator
    {
       /** The digest. */
@@ -836,7 +383,8 @@
        * @throws MalformedURLException
        * @throws URISyntaxException
        */
-      public static String createHash(String pathName) throws NoSuchAlgorithmException
+      public static String createHash(String pathName)
+            throws NoSuchAlgorithmException, MalformedURLException, URISyntaxException
       {
          // buffer
          StringBuffer buffer = new StringBuffer();
@@ -878,5 +426,5 @@
          return digest;
       }
    }
-   
+ 
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -147,7 +147,7 @@
     */
    protected Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
    {
-      return store.loadDeploymentData(deployment);
+      return store.createDeployment(deployment);
    }
    
 }

Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-05-19 15:56:36 UTC (rev 89126)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-05-19 16:00:27 UTC (rev 89127)
@@ -28,7 +28,11 @@
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
 import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
+import org.jboss.system.server.profileservice.persistence.xml.PersistenceRoot;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -44,6 +48,11 @@
       return null;
    }
 
+   public Deployment createDeployment(ProfileDeployment deployment) throws Exception
+   {
+      return loadDeploymentData(deployment);
+   }
+   
    public Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
    {
       if(deployment == null)
@@ -66,5 +75,29 @@
       // nothing
    }
 
+   public PersistenceRoot loadAttachment(VirtualFile deploymentCtx, AttachmentMetaData attachment) throws Exception
+   {
+      // FIXME loadAttachment
+      return null;
+   }
+
+   public RepositoryAttachmentMetaData loadMetaData(VirtualFile deploymentCtx) throws Exception
+   {
+      // FIXME loadMetaData
+      return null;
+   }
+
+   public void removeComponent(String ctx, ManagedComponent comp) throws Exception
+   {
+      // FIXME removeComponent
+      
+   }
+
+   public void updateDeployment(String ctx, ManagedComponent comp) throws Exception
+   {
+      // FIXME updateDeployment
+      
+   }
+
 }
 




More information about the jboss-cvs-commits mailing list