[jboss-cvs] JBossAS SVN: r101110 - in projects/profileservice/trunk: core and 39 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 18 08:47:20 EST 2010


Author: emuckenhuber
Date: 2010-02-18 08:47:17 -0500 (Thu, 18 Feb 2010)
New Revision: 101110

Added:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/DeploymentBuilder.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeploymentRegistry.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/dependency/
Removed:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java
Modified:
   projects/profileservice/trunk/core/pom.xml
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/AbstractProfileDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/AbstractHDScannerFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerLifeCycleCallback.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/Scanner.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/ScannerConfiguration.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractProfileKeyCapability.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractSubProfileKeyMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureCapability.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureRequirement.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifact.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DefaultNotFoundHandler.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactRepositoryFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/AbstractMavenArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualDeploymentRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/DelegatingDeploymentRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/VirtualRepositoryMetaData.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestVirtualDeploymentRepository.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/repository/test/repository.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml
   projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
   projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
   projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
   projects/profileservice/trunk/pom.xml
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java
Log:
[JBPROFILE-5]

Modified: projects/profileservice/trunk/core/pom.xml
===================================================================
--- projects/profileservice/trunk/core/pom.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/pom.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -19,7 +19,7 @@
 			<groupId>org.jboss.deployers</groupId>
 			<artifactId>jboss-deployers-vfs</artifactId>
 			<version>${version.org.jboss.deployers}</version>
-			<scope>provided</scope>
+			<scope>compile</scope>
 		</dependency>
 
 		<dependency>

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -56,7 +56,7 @@
    
    public ProfileServiceConfig()
    {
-
+      //
    }
 
    public ProfileServiceConfig(ManagementDomain managementDomain, ServerConfiguration serverConfiguration)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,7 +22,6 @@
 package org.jboss.profileservice.dependency;
 
 import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.Controller;
 import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
 import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
 import org.jboss.profileservice.spi.Profile;
@@ -45,12 +44,6 @@
    {
       super(null, metaData, target != null ? ProfileControllerContextActions.getNoInstantiate() : ProfileControllerContextActions.getInstance() , target);
    }
-
-   @Override
-   public void setController(Controller controller)
-   {
-      super.setController(controller);
-   }
    
    public Profile getProfile()
    {

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -66,9 +66,6 @@
    /** Contexts registered as on-demand. */
    private List<ProfileKey> onDemandContexts = new ArrayList<ProfileKey>();
    
-   /** Check consistency. */
-   private boolean checkConsistency = true;
-   
    public ProfileMetaDataRegistry(ProfileServiceConfig config)
    {
       if(config == null)
@@ -149,11 +146,6 @@
       {
          throw new IllegalArgumentException("null context");
       }
-      if(checkConsistency)
-      {
-         // Check if all new capabilities are consistent
-         checkConsistent(context);
-      }
       this.profiles.add(context);
       this.registeredProfiles.add(context.getKey());
       this.profilesByName.put(context.getName(), context);
@@ -232,6 +224,7 @@
    {
       // Resolve the requirements based on the exposed capabilities
       final boolean trace = log.isTraceEnabled();
+      ProfileKey resolved = null;
       for(ProfileDependencyContext profile : profiles)
       {
          Collection<ProfileCapability> capabilities = profile.getCapabilities();
@@ -245,39 +238,20 @@
                   {
                      log.trace(profile.getKey() + ":" + capability + " resolved " + requirement);
                   }
-                  return profile.getKey();
-               }
-            }
-         }
-      }
-      // Unresolved
-      return null;
-   }
-
-   void checkConsistent(ProfileDependencyContext context)
-   {
-      for(ProfileDependencyContext profile : profiles)
-      {
-         Collection<ProfileCapability> capabilities = profile.getCapabilities();
-         if(capabilities != null && capabilities.isEmpty() == false)
-         {
-            for(ProfileCapability capability : capabilities)
-            {
-               Collection<ProfileCapability> newCapabilities = context.getCapabilities();
-               if(newCapabilities != null && newCapabilities.isEmpty() == false)
-               {
-                  for(ProfileCapability newCapability : newCapabilities)
+                  if(resolved == null)
                   {
-                     if(newCapability.isConsistent(capability) == false)
-                     {
-                        throw new IllegalStateException("capability " + newCapability + " inconsistent with " + capability);
-                     }
+                     resolved = profile.getKey();
                   }
+                  else
+                  {
+                     return null;
+                  }
                }
-               
             }
          }
       }
+      // Unresolved
+      return resolved;
    }
    
    protected ProfileKey createProfileKey(String profileName)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -61,7 +61,7 @@
    
    public void stop()
    {
-      registry.removedefaultPlugin();
+      registry.removeDefaultPlugin();
    }
    
    @Override

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,9 +21,13 @@
  */ 
 package org.jboss.profileservice.deployers;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.deployment.DeploymentBuilder;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.virtual.assembly.StructureMetaDataBuilder;
 
@@ -32,7 +36,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class VDFDeploymentBuilder
+public class VDFDeploymentBuilder implements DeploymentBuilder<Deployment>
 {
  
    /** The instance. */
@@ -41,26 +45,43 @@
    /** The vfs deployment factory. */
    private static final VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
 
-   /** A strcuture meta data plugin. */
-   private static StructureMetaDataBuilder structureMetaDataBuilder = new StructureMetaDataBuilder();
+   /** The attachment processor. */
+   private final List<DeploymentAttachmentsProcessor<Deployment>> attachmentProcessors = new ArrayList<DeploymentAttachmentsProcessor<Deployment>>();
    
    public static VDFDeploymentBuilder getInstance()
    {
       return instance;
    }
+
+   protected VDFDeploymentBuilder()
+   {   
+      attachmentProcessors.add(new StructureMetaDataBuilder());
+   }
    
-   public Deployment createDeployment(ProfileDeployment deployment)
+   public Deployment createDeployment(ProfileDeployment profileDeployment)
    {
       Deployment d = null;
-      if(deployment.getRoot() == null)
+      if(profileDeployment.getRoot() == null)
       {
-         d = new AbstractDeployment(deployment.getName());
+         d = new AbstractDeployment(profileDeployment.getName());
       }
       else
       {
-         d = deploymentFactory.createVFSDeployment(deployment.getRoot());
+         d = deploymentFactory.createVFSDeployment(profileDeployment.getRoot());
       }
-      return structureMetaDataBuilder.processDeployment(deployment, d);
+      for(DeploymentAttachmentsProcessor<Deployment> processor : attachmentProcessors)
+      {
+         processor.processDeployment(profileDeployment, d);
+      }
+      return d;
    }
+
+   public void addAttachmentsProcessor(DeploymentAttachmentsProcessor<Deployment> processor)
+   {
+      synchronized(attachmentProcessors)
+      {
+         attachmentProcessors.add(processor);
+      }
+   }
    
 }

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/AbstractProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/AbstractProfileDeployment.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/AbstractProfileDeployment.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -25,7 +25,8 @@
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.deployment.DeploymentAttachments;
 import org.jboss.profileservice.spi.deployment.ProfileDeploymentInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The abstract profile deployment.
@@ -39,8 +40,8 @@
    /** The serialVersionUID */
    private static final long serialVersionUID = 1536294883676418931L;
 
-   /** The deployment policy. */
-   private final ProfileDeploymentInfo policy;
+   /** The deployment info. */
+   private final ProfileDeploymentInfo info;
    
    /** The vfs root. */
    private VirtualFile root;
@@ -62,7 +63,7 @@
       {
          throw new IllegalArgumentException("empty name");
       }
-      this.policy = new AbstractDeploymentInfo(name);
+      this.info = new AbstractDeploymentInfo(name);
    }
    
    /**
@@ -75,11 +76,13 @@
    protected static final String safeVirtualFileName(VirtualFile root)
    {
       if (root == null)
+      {
          throw new IllegalArgumentException("null root");
-
+      }
       try
       {
-         return root.toURI().toString();
+         // URI without the trailing '/'
+         return VFSUtils.fixName(root.toURI().toString());
       }
       catch (Exception e)
       {
@@ -94,7 +97,7 @@
     */
    public String getName()
    {
-      return this.policy.getName();
+      return this.info.getName();
    }
 
    /**
@@ -138,7 +141,7 @@
     */
    public ProfileDeploymentInfo getDeploymentInfo()
    {
-      return this.policy;
+      return this.info;
    }
    
    /**
@@ -156,6 +159,14 @@
    {
       return transientAttachments;
    }
+ 
+   /**
+    * {@inheritDoc}
+    */
+   public void cleanup() throws Exception
+   {
+      // FIXME cleanup
+   }
    
 }
 

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/DeploymentBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/DeploymentBuilder.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/DeploymentBuilder.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.deployment;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * The deployment builder, used to create the actual deployment
+ * based on the <code>ProfileDeployment</code>.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentBuilder<T>
+{
+
+   /**
+    * Create a deployment based on the <code>ProfileDeployment</code>.
+    * 
+    * @param profileDeployment the profile deployment
+    * @return the actual deployment 
+    */
+   T createDeployment(ProfileDeployment profileDeployment);
+
+   /**
+    * The deployment attachment processor.
+    */
+   public interface DeploymentAttachmentsProcessor<T>
+   {
+      
+      /**
+       * Process the deployment attachments.
+       * 
+       * @param profileDeployment the profile deployment
+       * @param deployment the actual deployment
+       */
+      void processDeployment(ProfileDeployment profileDeployment, T deployment);
+
+   }
+   
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,12 +21,19 @@
  */ 
 package org.jboss.profileservice.deployment;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 import org.jboss.kernel.Kernel;
 import org.jboss.profileservice.profile.bootstrap.BootstrapDeployerPlugin;
 import org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
 /**
@@ -36,7 +43,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class ProfileDeployerPluginRegistry
+public class ProfileDeployerPluginRegistry implements ProfileDeploymentRegistry
 {
   
    /** The default. */
@@ -45,6 +52,10 @@
    /** The registered deployers. */
    private Map<String, ProfileDeployerPlugin> map = new ConcurrentHashMap<String, ProfileDeployerPlugin>();
 
+   /** The registered deployments. */
+   private Map<String, ProfileKey> registeredDeployments = new ConcurrentHashMap<String, ProfileKey>();
+   private ConcurrentMap<String, Set<String>> registeredSimpleDeploymentNames = new ConcurrentHashMap<String, Set<String>>();
+   
    public ProfileDeployerPluginRegistry(Kernel kernel)
    {
       ProfileDeployerPlugin kernelDeployer = new BootstrapDeployerPlugin(kernel);
@@ -69,7 +80,7 @@
       map.put(DEFAULT, plugin);
    }
    
-   public void removedefaultPlugin()
+   public void removeDefaultPlugin()
    {
       map.remove(DEFAULT);
    }
@@ -113,5 +124,65 @@
       }
    }
 
+   /**
+    * {@inheritDoc}
+    */
+   public Collection<String> getDeploymentNames()
+   {
+      return this.registeredDeployments.keySet();
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public ProfileKey getProfileForDeployment(String deploymentName)
+   {
+      return this.registeredDeployments.get(deploymentName);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public Collection<String> resolveDeploymentName(String simpleDeploymentName)
+   {
+      Collection<String> simpleNameMappings = this.registeredSimpleDeploymentNames.get(simpleDeploymentName);
+      if(simpleNameMappings == null)
+      {
+         return Collections.emptySet();
+      }
+      return simpleNameMappings;
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public void registerDeployment(ProfileKey key, ProfileDeployment deployment)
+   {
+      String deploymentName = deployment.getName();
+      String simpleName = deployment.getSimpleName();
+      this.registeredDeployments.put(deploymentName, key);
+      this.registeredSimpleDeploymentNames.putIfAbsent(simpleName, new HashSet<String>());
+      this.registeredSimpleDeploymentNames.get(simpleName).add(deploymentName);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public void unregisterDeployment(ProfileDeployment deployment)
+   {
+      String deploymentName = deployment.getName();
+      String simpleName = deployment.getSimpleName();
+      this.registeredDeployments.remove(deploymentName);
+      Set<String> simpleNameMappings = this.registeredSimpleDeploymentNames.get(simpleName);
+      if(simpleNameMappings != null)
+      {
+         simpleNameMappings.remove(deploymentName);
+         if(simpleNameMappings.isEmpty())
+         {
+            this.registeredSimpleDeploymentNames.remove(simpleName);
+         }
+      }
+   }
+   
 }
 

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeploymentRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeploymentRegistry.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeploymentRegistry.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.deployment;
+
+import java.util.Collection;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * Server wide deployment registry.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDeploymentRegistry
+{
+
+   /**
+    * Get all deployment names.
+    * 
+    * @return the deployment names
+    */
+   Collection<String> getDeploymentNames();
+   
+   /**
+    * Get the profile for a deployment 
+    * 
+    * @param deploymentName the deployment name
+    * @return the profile, null if there is no such deployment
+    */
+   ProfileKey getProfileForDeployment(String deploymentName);
+   
+   /**
+    * Try to resolve the deployment name, based on the simple name.
+    * 
+    * @param simpleDeploymentName the deployments simple name
+    * @return a collection of matching deployments
+    */
+   Collection<String> resolveDeploymentName(String simpleDeploymentName);
+   
+   /**
+    * Register a deployment.
+    * 
+    * @param key the profile key
+    * @param deployment the deployment
+    */
+   void registerDeployment(ProfileKey key, ProfileDeployment deployment);
+   
+   /**
+    * Unregister a deployment.
+    * 
+    * @param deployment the deployment
+    */
+   void unregisterDeployment(ProfileDeployment deployment);
+
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/AbstractHDScannerFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/AbstractHDScannerFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/AbstractHDScannerFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,8 +21,8 @@
 */
 package org.jboss.profileservice.deployment.hotdeploy;
 
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -46,7 +46,7 @@
    protected static final Logger log = Logger.getLogger(HDScannerFactory.class);
    
    /** The registered scans. */
-   private Map<ProfileKey, ScannerWrapper> registeredScans = new ConcurrentHashMap<ProfileKey, ScannerWrapper>(); 
+   private ConcurrentMap<ProfileKey, ScannerWrapper> registeredScans = new ConcurrentHashMap<ProfileKey, ScannerWrapper>(); 
   
    /** The action controller. */
    private final ActionController actionController;

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -42,7 +42,7 @@
     * Scanners registered with startAutomatically
     * enabled will be scheduled.
     * 
-    * Until this point no HDScanner is allowed to
+    * Until this point no HDScanner will be able to
     * schedule itself using it's lifecycle methods.
     */
    void enableScanning();

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerLifeCycleCallback.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerLifeCycleCallback.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScannerLifeCycleCallback.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,6 +21,11 @@
 */
 package org.jboss.profileservice.deployment.hotdeploy;
 
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.registry.BeanKernelRegistryEntry;
+import org.jboss.kernel.spi.config.KernelConfig;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
 import org.jboss.profileservice.dependency.plugin.ProfileLifeCycleCallbackAction;
 import org.jboss.profileservice.spi.MutableProfile;
 import org.jboss.profileservice.spi.Profile;
@@ -40,6 +45,9 @@
    /** The HDScanner factory. */
    private final HDScannerFactory hdScannerFactory;
    
+   /** The kernel. */
+   private Kernel kernel;
+   
    public HDScannerLifeCycleCallback(HDScannerFactory hdScannerFactory)
    {
       if(hdScannerFactory == null)
@@ -74,5 +82,48 @@
       }
    }
 
+   /**
+    * Register an object
+    * 
+    * @param name the name
+    * @param object the object
+    * @throws Throwable for any error
+    */
+   protected void register(Object name, Object object) throws Throwable
+   {
+      register(kernel, name, object);
+   }
+   
+   /**
+    * Register an object
+    * 
+    * @param kernel the kernel
+    * @param name the name
+    * @param object the object
+    * @throws Throwable for any error
+    */
+   @SuppressWarnings("deprecation")
+   protected void register(Kernel kernel, Object name, Object object) throws Throwable
+   {
+      KernelRegistryEntry entry = createKernelRegistryEntry(kernel, object);
+      org.jboss.kernel.spi.registry.KernelRegistry registry = kernel.getRegistry();
+      registry.registerEntry(name, entry);
+   }
+   
+   /**
+    * Create a kernel registry entry
+    * 
+    * @param kernel the kernel
+    * @param object the object
+    * @return the entry
+    * @throws Throwable for any error
+    */
+   protected KernelRegistryEntry createKernelRegistryEntry(Kernel kernel, Object object) throws Throwable
+   {
+      KernelConfig config = kernel.getConfig();
+      BeanInfo info = config.getBeanInfo(object.getClass());
+      return new BeanKernelRegistryEntry(object, info);
+   }
+   
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/Scanner.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/Scanner.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/Scanner.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -37,7 +37,6 @@
  *
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  */
-// TODO check how to expose this scanner MO through PS 
 @ManagementObject(componentType = @ManagementComponent(type="Profile", subtype = "HDScanner"),
       properties = ManagementProperties.EXPLICIT)
 public interface Scanner extends ScannerConfiguration
@@ -49,7 +48,7 @@
     * @return the profile key
     */
    @ManagementProperty(name = "profile", description = "The associated profile", readOnly = true)
-   @ManagementObjectID
+   @ManagementObjectID(type = "HDScanner")
    ProfileKey getKey();
    
    /**

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/ScannerConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/ScannerConfiguration.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/ScannerConfiguration.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -51,7 +51,7 @@
    /**
     * Boolean flag indicating if the scanner
     * should be started automatically, once the 
-    * boostrap deployment process is complete.
+    * bootstrap deployment process is complete.
     * 
     * When the server is started and the flag is
     * set to true the scanner will be started

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -23,6 +23,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
@@ -30,9 +31,9 @@
 
 import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
@@ -99,9 +100,9 @@
       }
    }
    
-   public void parse(URL rootURL) throws JBossXBException, IOException
+   public void parse(URL rootURL) throws JBossXBException, IOException, URISyntaxException
    {
-      VirtualFile root = VFS.getRoot(rootURL);
+      VirtualFile root = VFS.getChild(rootURL);
       for(VirtualFile vf : root.getChildren(filter))
       {
          parse(vf);

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractProfileKeyCapability.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractProfileKeyCapability.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractProfileKeyCapability.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -49,17 +49,6 @@
    }
    
    @Override
-   public boolean isConsistent(ProfileCapability other)
-   {
-      // If the other capability is the same, it is not consistent
-      if(equals(other))
-      {
-         return false;
-      }
-      return true;
-   }
-   
-   @Override
    public boolean equals(Object obj)
    {
       if (obj == this)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractSubProfileKeyMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractSubProfileKeyMetaData.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/helpers/AbstractSubProfileKeyMetaData.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.metadata.helpers;
 
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
 import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
 import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
 
@@ -55,6 +56,11 @@
       visitor.addRequirement(this);  
    }
    
+   public boolean isConsistent(ProfileRequirement other)
+   {
+      return true;
+   }
+   
    @Override
    public boolean equals(Object obj)
    {

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,7 +29,7 @@
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A immutable vfs based profile.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -38,9 +38,9 @@
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileDeployment;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
 
 /**
  * A abstract VFS based source for profile deployments.
@@ -217,7 +217,7 @@
     */
    protected void addedDeployments(List<VirtualFile> list, VirtualFile root) throws IOException, URISyntaxException
    {
-      if(root.isLeaf() == true || root.isArchive() == true)
+      if(root.isFile())
       {
          addedDeployment(list, root);
       }
@@ -255,7 +255,7 @@
          return;
 
       // If it's a directory or exploded deployment
-      if(component.isLeaf() == false && component.isArchive() == false)
+      if(component.isFile() == false)
       {
          // Check the name
          if(isRecursiveScan() && component.getName().indexOf('.') == -1)
@@ -353,7 +353,7 @@
       VirtualFile vf = getCachedVirtualFile(uri.toString());
       if(vf == null)
       {
-         vf = VFS.getRoot(uri);
+         vf = VFS.getChild(uri);
          this.applicationVFCache.put(uri.toString(), vf);
       }
       return vf;

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -1,156 +0,0 @@
-/*
- * 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.profileservice.profile;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileDeployment;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class FilteredProfile extends AbstractVFSProfileSource implements Profile
-{
-
-   /** The profile key. */
-   private ProfileKey key;
-   
-   /** The deployments names. */
-   private final Collection<String> deploymentNames;
-   
-   /** The logger. */
-   private static final Logger log = Logger.getLogger(FilteredProfile.class);
-   
-   public FilteredProfile(ProfileKey key, Collection<String> deploymentNames, URI[] uris)
-   {
-      super(uris);
-      this.key = key;
-      this.deploymentNames = deploymentNames;
-   }
-
-   public void create() throws Exception
-   {
-      for(String deploymentName : deploymentNames)
-      {
-         VirtualFile deployment = null; 
-         for(URI uri : getRepositoryURIs())
-         {
-            VirtualFile root = getCachedVirtualFile(uri);
-            deployment = root.getChild(deploymentName);
-            if(deployment != null)
-               break;
-         }
-         if(deployment == null)
-            throw new IllegalStateException("could not find deployment " + deploymentName + " in "
-                  + Arrays.asList(getRepositoryURIs()));
-         
-         ProfileDeployment d = createDeployment(deployment);
-         super.addDeployment(d);
-      }
-   }
-   
-   @Override
-   public ProfileKey getKey()
-   {
-      return this.key;
-   }
-   
-   @Override
-   public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
-   {
-      if(vfsPath == null)
-         throw new IllegalArgumentException("Null name");
-      
-      ProfileDeployment ctx = super.getDeployment(vfsPath);
-      if(ctx == null)
-      {
-         List<String> names = findDeploymentContent(vfsPath);
-         if(names.size() == 1)
-         {
-            ctx = super.getDeployment(names.get(0));
-         }
-         else if(names.size() > 1)
-         {
-            throw new NoSuchDeploymentException("Multiple deployments found for: "+ vfsPath +", available: " + names);            
-         }
-      }
-      if(ctx == null)
-      {
-         log.debug("Failed to find application for: "+vfsPath+", available: " + getDeploymentNames());
-         throw new NoSuchDeploymentException("Failed to find deployment in file: " + vfsPath);
-      }
-      return ctx;
-   }
-
-   public boolean hasDeployment(String name)
-   {
-      if(name == null)
-         throw new IllegalArgumentException("Null name.");
-
-      try
-      {
-         return super.getDeployment(name) != null;
-      }
-      catch(Exception e)
-      {
-         return false;
-      }
-   }
-
-   @Override
-   public boolean isMutable()
-   {
-      return false;
-   }
-
-   @Override
-   public String toString()
-   {
-      StringBuilder builder = new StringBuilder();
-      builder.append(getClass().getSimpleName());
-      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
-      builder.append("{key = ").append(getKey());
-      toString(builder);
-      builder.append("}");
-      return builder.toString();
-   }
-   
-   /**
-    * Additional information for toString().
-    * 
-    * @param builder the builder.
-    */
-   protected void toString(StringBuilder builder)
-   {
-      builder.append(", deployments=").append(getDeploymentNames());
-   }
-}
-

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,6 +21,7 @@
  */ 
 package org.jboss.profileservice.profile.bootstrap;
 
+import java.io.FileNotFoundException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,6 +42,7 @@
 import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
 import org.jboss.metadata.spi.MetaData;
 import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.ProfileDeployment;
 
 /**
@@ -84,6 +86,10 @@
       checkShutdown();
       try
       {
+         if(deployment.getRoot().exists() == false)
+         {
+            throw new FileNotFoundException(deployment.getRoot().getPathName());
+         }
          // Deploy
          // TODO update management changes before deploying
          KernelDeployment result = this.deployer.deploy(deployment.getRoot().toURL());
@@ -108,6 +114,10 @@
          for(String name : names)
          {
             KernelDeployment deployment = this.deployments.get(name);
+            if(deployment == null)
+            {
+               throw new NoSuchDeploymentException(name);
+            }
             try
             {
                deployer.validate(deployment);

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureCapability.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureCapability.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureCapability.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -83,16 +83,6 @@
       }
       return false;
    }
-
-   @Override
-   public boolean isConsistent(ProfileCapability other)
-   {
-      if(this.equals(other))
-      {
-         return false;
-      }
-      return true;
-   }
    
    @Override
    public void visit(ProfileMetaDataVisitor visitor)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureRequirement.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureRequirement.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FeatureRequirement.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -79,6 +79,11 @@
    {
       return false;
    }
+
+   public boolean isConsistent(ProfileRequirement other)
+   {
+      return true;
+   }
    
    @Override
    public DependencyMode getDependencyMode()

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -41,9 +41,9 @@
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
 
 /**
  * ClassPath adapter profile. 
@@ -150,7 +150,7 @@
          String archives = item.getArchives();
 
          log.debug("Processing classpath: codebase=" + codebase + " archives=" + archives);
-         VirtualFile codebaseFile = VFS.getRoot(uri);
+         VirtualFile codebaseFile = VFS.getChild(uri);
          if (codebaseFile == null)
             throw new RuntimeException("Cannot use classpath without a root: " + uri);
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,7 +22,7 @@
 package org.jboss.profileservice.repository;
 
 import org.jboss.profileservice.deployment.AbstractProfileDeployment;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The basic profile deployment.
@@ -30,7 +30,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class BasicProfileDeployment extends AbstractProfileDeployment
+class BasicProfileDeployment extends AbstractProfileDeployment
 {
    
    /** The serialVersionUID */
@@ -46,6 +46,11 @@
       this(safeVirtualFileName(vf));
       setRoot(vf);
    }
+
+   public void cleanup() throws Exception
+   {
+      super.cleanup();
+   }
    
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,7 +22,7 @@
 package org.jboss.profileservice.repository;
 
 import org.jboss.profileservice.spi.ProfileDeployment;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The profile deployment factory.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifact.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifact.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifact.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -28,7 +28,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactId;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The abstract artifact.
@@ -80,7 +80,7 @@
    {
       return this.repository.getIdentifier();
    }
-
+   
    public InputStream getInputStream() throws IOException
    {
       return getFile().openStream();

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,8 +29,8 @@
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The abstract artifact repository.
@@ -60,7 +60,7 @@
       {
          throw new IllegalArgumentException("null repository root.");
       }
-      this.repositoryRoot = VFS.getRoot(root);
+      this.repositoryRoot = VFS.getChild(root);
       this.identifier = identifier;
       this.configuration = new BasicRepositoryConfiguration(root, false);;
    }

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,6 +22,8 @@
 package org.jboss.profileservice.repository.artifact;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -51,6 +53,16 @@
    private Map<String, ArtifactRepositoryFactory<ArtifactId>> factories = new ConcurrentHashMap<String, ArtifactRepositoryFactory<ArtifactId>>();
    
    /**
+    * Get all registered repositories.
+    * 
+    * @return the repositories
+    */
+   public Collection<ArtifactRepository<ArtifactId>> getRepositories()
+   {
+      return new ArrayList<ArtifactRepository<ArtifactId>>(this.repositories.values());
+   }
+   
+   /**
     * Get a artifact repository based on a id. 
     * 
     * @param repositoryId the repository id

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DefaultNotFoundHandler.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DefaultNotFoundHandler.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DefaultNotFoundHandler.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -33,13 +33,14 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
+ at SuppressWarnings("unchecked")
 public class DefaultNotFoundHandler<T extends ArtifactId> implements ArtifactNotFoundHandler<T>
 {
 
    /** The instance. */
    private static final DefaultNotFoundHandler instance = new DefaultNotFoundHandler();
    
-   public static DefaultNotFoundHandler getInstance()
+   public static <X extends ArtifactId> DefaultNotFoundHandler<X> getInstance()
    {
       return instance;
    }

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactRepositoryFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactRepositoryFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,8 +29,8 @@
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryFactory;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The file artifact repository factory.
@@ -46,15 +46,28 @@
    
    public FileArtifactRepositoryFactory(URI rootURI) throws IOException
    {
-      this.root = VFS.getRoot(rootURI);
+      this.root = VFS.getChild(rootURI);
    }
-   
+
    @Override
    public String getRepositoryType()
    {
       return FileArtifactId.TYPE;
    }
+
+   protected VirtualFile getRoot()
+   {
+      return this.root;
+   }
    
+   public void start()
+   {
+      if(getRoot().exists() == false)
+      {
+         throw new IllegalStateException("non existing root repository " + getRoot().getPathName());
+      }
+   }
+
    @Override
    public ArtifactRepository<FileArtifactId> createArtifactRepository(ArtifactRepositoryId repositoryId,
          ArtifactRepositoryConfiguration<FileArtifactId> configuration) throws IOException
@@ -64,13 +77,7 @@
          throw new IllegalArgumentException("null repository id");
       }
       String name = repositoryId.getName();
-      VirtualFile vf = root.getChild(name);
-      if(vf == null)
-      {
-         // FIXME ignore for testing 
-         // throw new FileNotFoundException("child ("+ name +") not found in " + root);
-         vf = root;       
-      }
+      VirtualFile vf = getRoot().getChild(name);
       try
       {
          return new LocalFileArtifactRepository(repositoryId, vf);

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -30,7 +30,7 @@
 import org.jboss.profileservice.repository.artifact.AbstractArtifactRepository;
 import org.jboss.profileservice.spi.repository.Artifact;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -52,15 +52,8 @@
    @Override
    public boolean containsArtifact(FileArtifactId artifact)
    {
-      try
-      {
-         VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
-         return vf != null ? vf.exists() : false;
-      }
-      catch(IOException e)
-      {
-         return false;
-      }
+      VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
+      return vf != null ? vf.exists() : false;
    }
    
    @Override
@@ -87,7 +80,7 @@
          throw new IllegalArgumentException("null artifact path");
       }
       VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
-      if(vf == null)
+      if(vf == null) // vf.exists()
       {
          getConfiguration().getNotFoundHandler().handleArtifactNotFound(this, artifact);
       }

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/AbstractMavenArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/AbstractMavenArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/AbstractMavenArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -26,7 +26,7 @@
 
 import org.jboss.profileservice.repository.artifact.AbstractArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A MVN like artifact repository.
@@ -42,47 +42,28 @@
       super(identifier, root);
    }
 
-   protected VirtualFile getGroupRoot(MavenArtifactId artifactId) throws IOException
+   protected VirtualFile getGroupRoot(MavenArtifactId artifactId)
    {
       String[] groups = artifactId.getGroupId().split("\\.");
       VirtualFile child = getRepositoryRoot();
       for(String group : groups)
       {
          child = child.getChild(group);
-         if(child == null)
-         {
-            getConfiguration().getNotFoundHandler().handleArtifactNotFound(this, artifactId);
-         }
       }
       return child;
    }
 
-   protected VirtualFile getArtifactIdRoot(MavenArtifactId artifactId) throws IOException
+   protected VirtualFile getArtifactIdRoot(MavenArtifactId artifactId)
    {
-      VirtualFile artifact = getGroupRoot(artifactId).getChild(artifactId.getArtifactId());
-      if(artifact == null)
-      {
-         getConfiguration().getNotFoundHandler().handleArtifactNotFound(this, artifactId);
-      }
-      return artifact;
+      return getGroupRoot(artifactId).getChild(artifactId.getArtifactId());
    }
    
-   protected VirtualFile resolveArtifactFile(MavenArtifactMetaData artifact) throws IOException
+   protected VirtualFile resolveArtifactFile(MavenArtifactMetaData artifact)
    {
-      VirtualFile artifactIdRoot = getArtifactIdRoot(artifact);
-      VirtualFile vf = artifactIdRoot.getChild(artifact.getVersion().toString());
-      if(vf == null)
-      {
-         getConfiguration().getNotFoundHandler().handleArtifactNotFound(this, artifact);
-      }
-      // Build the artifact name
-      String artifactName = createArtifactName(artifact);
-      VirtualFile artifactRoot = vf.getChild(artifactName);
-      if(artifactRoot == null)
-      {
-         getConfiguration().getNotFoundHandler().handleArtifactNotFound(this, artifact);
-      }
-      return artifactRoot;
+      // repositoryRoot/groupId/version/
+      VirtualFile artifactRoot = getArtifactIdRoot(artifact).getChild(artifact.getVersion().toString());
+      // repositoryRoot/groupId/version/artifact
+      return artifactRoot.getChild(createArtifactName(artifact));
    }
    
    String createArtifactName(MavenArtifactMetaData artifact)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -33,7 +33,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryFactory;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A local mvn like artifact repository,  based on a repository

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -37,7 +37,7 @@
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A abstract VFS based deployment repository.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -25,6 +25,7 @@
 import java.net.URISyntaxException;
 
 import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileSourceMetaData;
+import org.jboss.profileservice.repository.artifact.ArtifactRepositoryManager;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
 import org.jboss.profileservice.spi.ProfileKey;
@@ -40,6 +41,9 @@
    /** The repository types. */
    private static final String[] types;
    
+   /** The artifact repository manager. */
+   private ArtifactRepositoryManager repositoryManager;
+   
    static
    {
       types = new String[] {

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -42,8 +42,8 @@
 import org.jboss.profileservice.spi.ModificationInfo;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A basic deployment repository.
@@ -215,7 +215,7 @@
          }
 
          // Get the vfs uri and add the VFS uri to the cached VFS uris
-         VirtualFile contentVF = VFS.getRoot(contentFile.toURI());
+         VirtualFile contentVF = VFS.getChild(contentFile.toURI());
          try
          {
             // Add the new virtual file to the cache

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -48,9 +48,11 @@
    
    static
    {
-      types = new String[] { HotDeploymentProfileMetaData.class.getName(),
-            PropertyProfileMetaData.class.getName(),
-            FarmingProfileMetaData.class.getName()};
+      types = new String[] { 
+               HotDeploymentProfileMetaData.class.getName(),
+               PropertyProfileMetaData.class.getName(),
+               FarmingProfileMetaData.class.getName()
+            };
    }
 
    @Override

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualDeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualDeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -30,7 +30,7 @@
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
 import org.jboss.profileservice.virtual.assembly.AbstractVirtualDeploymentAssembly;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The abstract virtual deployment repository.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/DelegatingDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/DelegatingDeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/DelegatingDeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,6 +29,8 @@
 import org.jboss.profileservice.spi.repository.ArtifactId;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 
 /**
@@ -41,7 +43,7 @@
 {
 
    /** The repository ids. */
-   private Map<String, ArtifactRepositoryId> repos = new HashMap<String, ArtifactRepositoryId>();
+   private Map<String, ArtifactRepositoryId> repositoryRefs = new HashMap<String, ArtifactRepositoryId>();
    
    /** The artifact repository manager. */
    private final ArtifactRepositoryManager repositoryManager;
@@ -56,6 +58,12 @@
       this.repositoryManager = repositoryManager;
    }
 
+   protected VirtualFile getAssembledRoot()
+   {
+      // FIXME
+      return VFS.getChild("virtual-deployments");
+   }
+   
    /**
     * {@inheritDoc}
     */
@@ -68,7 +76,7 @@
    
    protected ArtifactRepositoryId resolveRepositoryId(ArtifactId artifact)
    {
-      ArtifactRepositoryId reference = this.repos.get(artifact.getType());
+      ArtifactRepositoryId reference = this.repositoryRefs.get(artifact.getType());
       if(reference == null)
       {
          throw new IllegalArgumentException("failed to find artifact repository reference for " + artifact);
@@ -94,7 +102,7 @@
       }
       for(ArtifactRepositoryId id : ids)
       {
-         repos.put(id.getType(), id);
+         repositoryRefs.put(id.getType(), id);
       }
    }
    

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,7 +21,6 @@
 */
 package org.jboss.profileservice.repository.virtual;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -108,16 +107,43 @@
                this.deployments.add(deployment);
                this.deploymentsByName.put(deployment.getName(), deployment);
             }
-            catch(IOException e)
+            catch(Exception e)
             {
-               // FIXME, this is only for testing purpose
-               log.error("failed to create deployment " + virtual);
+               // FIXME for testing purpose only
+               log.error("failed to create deployment " + virtual.getName());
             }
          }         
       }
    }
    
    /**
+    * Clean up the created {@code ProfileDeployment}s as part of
+    * the lifecycle of the profile. At this point the deployments
+    * should be undeployed already.
+    *
+    */
+   public void destroy()
+   {
+      if(this.deployments != null && this.deployments.isEmpty() == false)
+      {
+         for(ProfileDeployment deployment : this.deployments)
+         {
+            try
+            {
+               deployment.cleanup();
+            }
+            catch(Exception e)
+            {
+               log.debug("failed to clean up deployment " + deployment);
+            }
+         }
+         // Restore original state
+         this.deployments = Collections.emptyList();
+         this.deploymentsByName = Collections.emptyMap();
+      }
+   }
+   
+   /**
     * {@inheritDoc}
     */
    @Override

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -35,6 +35,7 @@
 import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.dependency.DependencyMode;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
 import org.jboss.profileservice.spi.dependency.ProfileRequirement;
 
 /**
@@ -67,6 +68,9 @@
    /** All referenced nodes. */
    private Map<ProfileKey, ProfileNode> nodes = new HashMap<ProfileKey, ProfileNode>();
    
+   /** The included root contexts. */
+   private List<ProfileDependencyContext> includedContexts = new ArrayList<ProfileDependencyContext>();
+   
    public AbstractRequirementResolver(ProfileMetaDataRegistry registry)
    {
       if(registry == null)
@@ -87,7 +91,7 @@
       {
          throw new IllegalArgumentException("null dependency context");
       }
-      resolve(context, false);
+      resolve(context, false, true);
    }
    
    /**
@@ -96,7 +100,7 @@
     * @param context the context
     * @param fromActivationCallback is recursively called from an activation callback
     */
-   void resolve(final ProfileDependencyContext context, final boolean fromActivationCallback)
+   void resolve(final ProfileDependencyContext context, final boolean fromActivationCallback, final boolean root)
    {
       final boolean trace = log.isTraceEnabled();
       final ProfileKey currentKey = context.getKey();
@@ -133,9 +137,17 @@
          for(final ProfileRequirement requirement : requirements)
          {
             // Try to resolve the requirement
-            final ProfileKey dependencyKey = registry.resolve(context, requirement);
+            ProfileKey dependencyKey = null; 
+            if(root == false)
+            {
+               dependencyKey = internalResolve(context, requirement);
+            }
             if(dependencyKey == null)
             {
+               dependencyKey = registry.resolve(context, requirement);
+            }
+            if(dependencyKey == null)
+            {
                // if the requirement is not optional add to unresolved
                if(requirement.isOptional() == false)
                {
@@ -152,16 +164,20 @@
             final DependencyMode mode = getDependencyMode(requirement);
             final ProfileNode depenencyNode = getNode(dependencyKey);
             final ProfileDependencyContext dependencyContext = registry.getProfile(dependencyKey);
-            if(mode == DependencyMode.RESOLVE || dependencyContext.isOnDemandEnabled())
+            
+            // TODO consistency check
+            this.includedContexts.add(dependencyContext);
+            
+            if(root || mode == DependencyMode.RESOLVE || dependencyContext.isOnDemandEnabled())
             {
                // Resolve
-               resolve(dependencyContext, false);
+               resolve(dependencyContext, false, false);
             }
             // We don't support nested activation callbacks
             else if(fromActivationCallback == false && mode == DependencyMode.ACTIVATION_CALLBACK)
             {
                // Process activation callbacks
-               resolve(dependencyContext, true);
+               resolve(dependencyContext, true, false);
             }
             // If the dependency is already included we can mark it as non-optional
             final boolean dependencyIncluded = included(depenencyNode);
@@ -185,6 +201,40 @@
       }
    }
    
+   public ProfileKey internalResolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
+   {
+      // Resolve the requirements based on the exposed capabilities
+      final boolean trace = log.isTraceEnabled();
+      ProfileKey resolved = null;
+      for(ProfileDependencyContext profile : includedContexts)
+      {
+         Collection<ProfileCapability> capabilities = profile.getCapabilities();
+         if(capabilities != null && capabilities.isEmpty() == false)
+         {
+            for(ProfileCapability capability : capabilities)
+            {
+               if(capability.resolves(requirement))
+               {
+                  if(trace)
+                  {
+                     log.trace(profile.getKey() + ":" + capability + " resolved " + requirement);
+                  }
+                  if(resolved == null)
+                  {
+                     resolved = profile.getKey();
+                  }
+                  else
+                  {
+                     return null;
+                  }
+               }
+            }
+         }
+      }
+      // Unresolved
+      return resolved;
+   }
+   
    /**
     * Sort the included profile nodes and check if we can include
     * some additional activation callbacks.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -37,8 +37,8 @@
    private final ProfileKey from;
    
    /** The to node. */
-   private final ProfileKey to;
-
+   private ProfileKey to;
+   
    /** Is optional from -> to. */
    private boolean optional;
    
@@ -51,7 +51,8 @@
    /** The requirement, for reporting. */
    private final ProfileRequirement requirement;
    
-   ProfileNodeDependency(final ProfileRequirement requirement, final ProfileKey from, final ProfileKey to, final boolean optional)
+   ProfileNodeDependency(final ProfileRequirement requirement, final ProfileKey from,
+         final ProfileKey to, final boolean optional)
    {
       this.requirement = requirement;
       this.from = from;
@@ -73,7 +74,17 @@
    {
       return to;
    }
+
+   void setTo(ProfileKey key)
+   {
+      this.to = key;
+   }
    
+   boolean isDetermined()
+   {
+      return this.to != null;
+   }
+   
    boolean isOptional()
    {
       return optional;

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,6 +21,7 @@
  */ 
 package org.jboss.profileservice.virtual.assembly;
 
+import java.io.Closeable;
 import java.io.IOException;
 
 import org.jboss.profileservice.spi.repository.ArtifactId;
@@ -28,9 +29,9 @@
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssembly;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileAssembly;
 
 
 /**
@@ -42,10 +43,6 @@
  */
 public abstract class AbstractVirtualDeploymentAssembly implements VirtualDeploymentAssembly
 {
-   
-   /** The assembled context factory. */
-   private static final AssembledContextFactory assemblyFactory = AssembledContextFactory.getInstance();
-
    /**
     * Get the virtual file for an artifact.
     * 
@@ -56,6 +53,13 @@
    protected abstract VirtualFile getVirtualFile(ArtifactId artifact) throws IOException;
    
    /**
+    * Get the assembled root.
+    * 
+    * @return the assembled root.
+    */
+   protected abstract VirtualFile getAssembledRoot();
+   
+   /**
     * Assemble a virtual deployment.
     * 
     * @param deployment the virtual deployment
@@ -110,7 +114,7 @@
     */
    protected String createDeploymentName(VirtualDeployment deployment)
    {
-      return deployment.getName() + System.currentTimeMillis();
+      return deployment.getName();
    }
 
    /**
@@ -134,17 +138,19 @@
     * Create a child assembly context.
     * 
     * @param deployment the virtual deployment child
-    * @param parent the assembled parent directory
+    * @param parent the parent directory
     * @return the child virtual deployment assembly context
     * @throws IOException
     */
-   protected VirtualDeploymentAssemblyContext createChildAssemblyContext(VirtualDeployment deployment, AssembledDirectory parent) throws IOException
+   protected VirtualDeploymentAssemblyContext createChildAssemblyContext(VirtualDeployment deployment, VirtualFile parent) throws IOException
    {
       VirtualDeploymentAssemblyContext ctx = createNonAssembledContext(deployment);
       if(ctx == null)
       {
-         AssembledDirectory root = parent.mkdir(deployment.getName());
-         return createAssemblyContext(root);         
+         VirtualFileAssembly child = new VirtualFileAssembly();
+         VirtualFile mountPoint = parent.getChild(deployment.getName());
+         Closeable closeable = VFS.mountAssembly(child, mountPoint);
+         return createAssemblyContext(child, mountPoint, closeable);
       }
       return ctx;
    }
@@ -155,14 +161,16 @@
     * @param deployment the virtual deployment meta data
     * @return the virtual deployment assembly context
     */
-   protected VirtualDeploymentAssemblyContext assembleNewContext(VirtualDeployment deployment)
+   protected VirtualDeploymentAssemblyContext assembleNewContext(VirtualDeployment deployment) throws IOException
    {
       // Create assembled directory
       String fileName = createDeploymentName(deployment);
-      // Create the assembled directory
-      AssembledDirectory root = assemblyFactory.create(fileName, deployment.getName());
+      
+      VirtualFileAssembly assembly = new VirtualFileAssembly();
+      VirtualFile mountPoint = getAssembledRoot().getChild(fileName);
+      Closeable closeable = VFS.mountAssembly(assembly, mountPoint);
       // Create the assembly context
-      return createAssemblyContext(root); 
+      return createAssemblyContext(assembly, mountPoint, closeable); 
    }
 
    /**
@@ -171,9 +179,9 @@
     * @param root the assembled root directory
     * @return the virtual deployment assembly context
     */
-   protected VirtualDeploymentAssemblyContext createAssemblyContext(AssembledDirectory root)
+   protected VirtualDeploymentAssemblyContext createAssemblyContext(VirtualFileAssembly assembly, VirtualFile vf, Closeable closeable)
    {
-      return new BasicVirtualAssemblyContext(root, this);
+      return new BasicVirtualAssemblyContext(assembly, vf, closeable, this);
    }
 
    /**

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,17 +21,17 @@
  */ 
 package org.jboss.profileservice.virtual.assembly;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.Collection;
-import java.util.List;
 
 import org.jboss.profileservice.spi.virtual.PathRestriction;
 import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileAssembly;
+import org.jboss.vfs.VirtualFileFilter;
 
 /**
  * The basic virtual assembly context.
@@ -46,56 +46,39 @@
    /** The meta-inf name. */
    public static final String META_INF = "META-INF";
    
-   /** The assembled directory. */
-   private final AssembledDirectory root;
+   /** The root. */
+   private final VirtualFile root;
+   
+   /** The virtual file assembly. */
+   private final VirtualFileAssembly fileAssembly;
 
    /** The virtual deployment assembly. */
    private final AbstractVirtualDeploymentAssembly assembly;
    
-   public BasicVirtualAssemblyContext(AssembledDirectory root, AbstractVirtualDeploymentAssembly assembly)
+   /** The closeable. */
+   private final Closeable closeable;
+   
+   public BasicVirtualAssemblyContext(VirtualFileAssembly fileAssembly, VirtualFile vf, Closeable closeable, AbstractVirtualDeploymentAssembly assembly)
    {
-      if(root == null)
-      {
-         throw new IllegalArgumentException("null root");
-      }
-      if(assembly == null)
-      {
-         throw new IllegalArgumentException("null assembly");
-      }
-      this.root = root;
+      this.root = vf;
+      this.fileAssembly = fileAssembly;
       this.assembly = assembly;
-      initialize();
+      this.closeable = closeable;
    }
    
-   protected void initialize()
+   public VirtualFile getRoot()
    {
-      // initialize the META-INF
-      getRoot().mkdir(META_INF);
-   }
-   
-   public AssembledDirectory getRoot()
-   {
       return this.root;
    }
    
-   public void addChild(VirtualFile vf)
+   public VirtualFileAssembly getAssemblyRoot()
    {
-      if(vf == null)
-      {
-         throw new IllegalArgumentException("null virtual file");
-      }
-      getRoot().addChild(vf);
+      return this.fileAssembly;
    }
-
-   public void addChild(VirtualFile vf, String name)
-   {
-      if(vf == null)
-      {
-         throw new IllegalArgumentException("null virtual file");
-      }
-      getRoot().addChild(vf, name);
-   }
    
+   /**
+    * {@inheritDoc}
+    */
    public VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException
    {
       if(child == null)
@@ -112,183 +95,146 @@
       return ctx;
    }
 
-   public void addPath(VirtualFile vf) throws IOException 
+   /**
+    * {@inheritDoc}
+    */
+   public void addArtifact(VirtualArtifactMetaData artifactId) throws IOException
    {
-      if(vf == null)
+      if(artifactId == null)
       {
-         throw new IllegalArgumentException("null virtual file");
+         throw new IllegalArgumentException("null artifact id");
       }
-      getRoot().addPath(vf);  
-   }
-
-   public void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException
-   {
-      if(vf == null)
+    
+      // Resolve the artifact against the repository
+      VirtualFile resolved = resolveRealArtifact(artifactId);
+      
+      // Build the target path
+      String targetPath = artifactId.getTargetPath();
+      if(targetPath != null)
       {
-         throw new IllegalArgumentException("null virtual file");
+         targetPath = targetPath.trim();
       }
-      getRoot().addPath(vf, filter);
+      else
+      {
+         targetPath = "";
+      }
+      addArtifact(targetPath, resolved, new RecurseFilter(resolved, artifactId));
    }
 
-   @Override
-   public void addArtifact(VirtualArtifactMetaData artifact) throws IOException
+   /**
+    * Add an artifact.
+    * 
+    * @param targetPath the relative target path
+    * @param location the artifact file
+    * @param filter the include/exclude filter
+    * @throws IOException for any error
+    */
+   void addArtifact(String targetPath, final VirtualFile location, final VirtualFileFilter filter) throws IOException
    {
-      if(artifact == null)
+      if(location.isFile())
       {
-         throw new IllegalArgumentException("null artifact");
+         boolean isMetaInf = targetPath.startsWith(META_INF);
+         targetPath += location.getName();
+         getAssemblyRoot().add(targetPath, location);
+         if(isMetaInf == false)
+         {
+            getRoots().add(targetPath);
+         }
       }
-      // Create
-      boolean addChildsToRoots = true;
-      VirtualFile vf = resolvePath(artifact);
-      AssembledDirectory directory = getRoot();
-      String targetPath = artifact.getTargetPath();
-      if(targetPath != null)
+      else
       {
-         targetPath = targetPath.trim();
          if(targetPath.isEmpty() == false)
          {
-            directory = (AssembledDirectory) getRoot().getChild(targetPath); 
-            if(directory == null)
+            targetPath = targetPath.endsWith("/") ? targetPath : targetPath + "/";
+         }         
+         for(VirtualFile child : location.getChildren())
+         {
+            if(filter.accepts(child))
             {
-               directory = getRoot().mkdir(targetPath);
-               addRoots(targetPath);
+               addArtifact(targetPath, child, filter);
             }
-            addChildsToRoots = false;
          }
       }
-      addVirtualPath(directory, vf, artifact.getIncludes(), artifact.getExcludes(), addChildsToRoots);
-   }   
-   
-   protected VirtualFile resolvePath(VirtualArtifactMetaData path) throws IOException
-   {
-      return assembly.getVirtualFile(path);
    }
    
    /**
-    * Visit a virtual file and add the children based on includes, excludes.
-    * 
-    * The used filer is similar to the one used in the AssembledDirectory, except that not
-    * defined includes mean we accept everything.
-    * 
-    * @param directory the assembled directory
-    * @param location the file to visit
-    * @param includes the includes
-    * @param excludes the excludes
-    * @param addToClasspath add to classpath
-    * @throws IOException
+    * {@inheritDoc}
     */
-   protected void addVirtualPath(final AssembledDirectory directory, 
-         final VirtualFile location, final Collection<PathRestriction> includes,
-         final Collection<PathRestriction> excludes, boolean addToClasspath) throws IOException
+   public void cleanup() throws IOException
    {
-      // Create the filter
-      final VirtualFileFilter recurseFilter = new VirtualFileFilter()
-      {
-         public boolean accepts(VirtualFile file)
-         {           
-            boolean matched = false;
-            String path = file.getPathName();
-            if(includes == null || includes.isEmpty())
-            {
-               // if not defined we match all
-               matched = true;
-            }
-            else
-            {
-               for (PathRestriction include : includes)
-               {
-                  if (include.matches(path))
-                  {
-                     matched = true;
-                     break;
-                  }
-               }
-            }
-            if (matched == false)
-               return false;
-            if (excludes != null && excludes.isEmpty() == false)
-            {
-               for (PathRestriction exclude : excludes)
-               {
-                  if (exclude.matches(path))
-                     return false;
-               }
-            }
-            return true;
-         }
-      };
-      
-      // Process files
-       recurse(directory, location, recurseFilter, addToClasspath);
+      closeable.close();
    }
    
    /**
-    * Recurse through the children. 
+    * Resolve the real file in the {@code ArtifactRepository}.
     * 
-    * FIXME this will stop at a .jar level as well - we might
-    * need better control when to recurse into a archive and when
-    * not.   
-    * 
-    * @param directory the assembled directory
-    * @param location the virtual file
-    * @param filter the accept filter
-    * @param add2Classpath add to classpath
+    * @param path the artifact meta data
+    * @return the virtual file
     * @throws IOException
     */
-   protected void recurse(AssembledDirectory directory, VirtualFile location, VirtualFileFilter filter, boolean addToClasspath) throws IOException
+   protected VirtualFile resolveRealArtifact(VirtualArtifactMetaData path) throws IOException
    {
-      if(isLeaf(location) && filter.accepts(location))
+      return assembly.getVirtualFile(path);
+   }
+
+   protected static class RecurseFilter implements VirtualFileFilter
+   {
+      
+      private final VirtualFile parent;
+      private final VirtualArtifactMetaData artifact;
+
+      public RecurseFilter(VirtualFile parent, VirtualArtifactMetaData artifactId)
       {
-         VirtualFile assembled = directory.mkdirs(location.getPathName()).addChild(location, location.getName());
-         if(addToClasspath)
+         this.parent = parent;
+         this.artifact = artifactId;
+      }
+      
+      public boolean accepts(VirtualFile file)
+      {           
+         boolean matched = false;
+         String path = file.getPathNameRelativeTo(parent);
+         if(getIncludes() == null || getIncludes().isEmpty())
          {
-            addRoots(assembled.getName());
+            // if not defined we match all
+            matched = true;
          }
-         return;
-      }
-      List<VirtualFile> children = location.getChildren();
-      for(VirtualFile vf : children)
-      {
-         if(isLeaf(vf))
+         else
          {
-            if(filter.accepts(vf))
+            for (PathRestriction include : getIncludes())
             {
-               VirtualFile assembled = directory.mkdirs(vf.getPathName()).addChild(vf, vf.getName());
-               if(addToClasspath)
+               if (include.matches(path))
                {
-                  addRoots(assembled.getName());
+                  matched = true;
+                  break;
                }
             }
          }
-         else
+         if (matched == false)
          {
-            recurse(directory, vf, filter, addToClasspath);
+            return false;
          }
-      }      
-   }
-   
-   protected void addRoots(String pathName)
-   {
-      if(META_INF.equals(pathName) == false)
-      {
-         if(getRoots().contains(pathName) == false)
+         if (getExcludes() != null && getExcludes().isEmpty() == false)
          {
-            getRoots().add(pathName);
+            for (PathRestriction exclude : getExcludes())
+            {
+               if (exclude.matches(path))
+                  return false;
+            }
          }
+         return true;
       }
+      
+      Collection<PathRestriction> getIncludes()
+      {
+         return artifact.getIncludes();
+      }
+      
+      Collection<PathRestriction> getExcludes()
+      {
+         return artifact.getExcludes();
+      }
+      
    }
    
-   /**
-    * Check if the file is a leaf. We also consider archives
-    * as leaves, as we don't care about their contents.
-    * 
-    * @param vf the virtual file
-    * @return true if the vf is a leaf or archive
-    * @throws IOException
-    */
-   protected static boolean isLeaf(VirtualFile vf) throws IOException
-   {
-      return vf.isLeaf() || vf.isArchive();
-   }
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -26,7 +26,7 @@
 import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A immutable virtual deployment assembly context, which is not based on
@@ -68,5 +68,10 @@
       throw new IllegalStateException("cannot add a child to a non-assembled context");
    }
    
+   public void cleanup() throws IOException
+   {
+      
+   }
+   
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -30,6 +30,7 @@
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.deployment.DeploymentBuilder.DeploymentAttachmentsProcessor;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
 
@@ -41,13 +42,13 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class StructureMetaDataBuilder
+public class StructureMetaDataBuilder implements DeploymentAttachmentsProcessor<Deployment>
 {
 
    /** The deployment factory. */
    private static final DeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
    
-   public Deployment processDeployment(ProfileDeployment deployment, Deployment target)
+   public void processDeployment(ProfileDeployment deployment, Deployment target)
    {
       // Get the assembly context
       VirtualDeploymentAssemblyContext ctx = deployment.getTransientAttachments().getAttachment(
@@ -58,7 +59,6 @@
       {
          createStructureMetaData(target, "", ctx);
       }
-      return target;
    }
    
    protected ContextInfo createStructureMetaData(Deployment deployment, String path, VirtualDeploymentAssemblyContext ctx)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,7 +29,6 @@
 
 import org.jboss.profileservice.metadata.helpers.AbstractProfileCapability;
 import org.jboss.profileservice.metadata.helpers.AbstractProfileRequirement;
-import org.jboss.profileservice.spi.dependency.ProfileCapability;
 import org.jboss.profileservice.spi.dependency.ProfileRequirement;
 import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
@@ -170,13 +169,6 @@
    {
       this.requires = requires;
    }
-
-   @Override
-   public boolean isConsistent(ProfileCapability other)
-   {
-      // TODO
-      return true;
-   }
    
    @Override
    public boolean resolves(ProfileRequirement requirement)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,11 +21,12 @@
  */ 
 package org.jboss.profileservice.virtual.deployment;
 
+import java.util.regex.Pattern;
+
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.profileservice.spi.virtual.PathRestriction;
-import org.jboss.virtual.AssembledDirectory;
 
 /**
  * Basic ant match restriction for includes/excludes. 
@@ -58,8 +59,78 @@
    @Override
    public boolean matches(String path)
    {
-      return AssembledDirectory.antMatch(path, getName());
+      return antMatch(path, getName());
    }
    
+   // ---- from VFS2
+   
+   /**
+    * Create a regular expression pattern from an Ant file matching pattern
+    *
+    * @param matcher the matcher pattern
+    * @return the pattern instance
+    */
+   public static Pattern getPattern(String matcher)
+   {
+      if (matcher == null)
+         throw new IllegalArgumentException("Null matcher");
+
+      matcher = matcher.replace(".", "\\.");
+      matcher = matcher.replace("*", ".*");
+      matcher = matcher.replace("?", ".{1}");
+      return Pattern.compile(matcher);
+   }
+
+   /**
+    * Determine whether a given file path matches an Ant pattern.
+    *
+    * @param path the path
+    * @param expression the expression
+    * @return true if we match
+    */
+   public static boolean antMatch(String path, String expression)
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      if (expression == null)
+         throw new IllegalArgumentException("Null expression");
+      if (path.startsWith("/")) path = path.substring(1);
+      if (expression.endsWith("/")) expression += "**";
+      String[] paths = path.split("/");
+      String[] expressions = expression.split("/");
+
+      int x = 0, p;
+      Pattern pattern = getPattern(expressions[0]);
+
+      for (p = 0; p < paths.length && x < expressions.length; p++)
+      {
+         if (expressions[x].equals("**"))
+         {
+            do
+            {
+               x++;
+            } while (x < expressions.length && expressions[x].equals("**"));
+            if (x == expressions.length)
+               return true; // "**" with nothing after it
+            pattern = getPattern(expressions[x]);
+         }
+         String element = paths[p];
+         if (pattern.matcher(element).matches())
+         {
+            x++;
+            if (x < expressions.length)
+            {
+               pattern = getPattern(expressions[x]);
+            }
+         }
+         else if (!(x > 0 && expressions[x - 1].equals("**"))) // our previous isn't "**"
+         {
+            return false;
+         }
+      }
+      return p >= paths.length && x >= expressions.length;
+   }
+
+   
 }
 

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/VirtualRepositoryMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/VirtualRepositoryMetaData.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/VirtualRepositoryMetaData.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -40,6 +40,7 @@
 @JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
       namespace= "urn:jboss:profileservice:virtual:repository:1.0",
       elementFormDefault=XmlNsForm.QUALIFIED,
+      replacePropertyRefs = false,
       normalizeSpace=true)
 @XmlType(name = "virtualRepositoryType", propOrder = "deployments")
 public class VirtualRepositoryMetaData

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -23,6 +23,8 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
 import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
@@ -35,9 +37,13 @@
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.profileservice.virtual.deployment.VirtualMavenArtifactMetaData;
 import org.jboss.test.profileservice.ProfileServiceTestBase;
 import org.jboss.test.profileservice.virtual.support.TestArtifactRepository;
 import org.jboss.test.profileservice.virtual.support.TestVirtualDeploymentRepository;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.util.automount.Automounter;
+import org.jboss.vfs.util.automount.MountOption;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -58,6 +64,7 @@
       ProfilesMetaData profiles = unmarshal(getIS("repository/profiles.xml"), ProfilesMetaData.class);
       
       //
+      Map<String, ProfileDeployment> deployments = new HashMap<String, ProfileDeployment>();
       VirtualDeploymentRepository factory = createRepository(metaData);
       for(ProfileMetaData md : profiles.getProfiles())
       {
@@ -66,8 +73,30 @@
             ProfileDeployment d = factory.createDeployment(deployment);
             assertNotNull(d);
             assertNotNull(d.getTransientAttachments().getAttachment(VirtualDeploymentAssemblyContext.class.getName()));
+            deployments.put(deployment.getName(), d);
          }
       }
+      
+      VirtualFile vf = deployments.get("test-deployer").getRoot();
+      VirtualFile artifact = vf.getChild("test-common-2.0.0.SP1.jar"); 
+      assertTrue(artifact.exists());
+      Automounter.mount(vf, artifact, MountOption.EXPANDED);
+      assertTrue(artifact.getChild("META-INF").exists());
+      log.debug(artifact.getPhysicalFile());
+      
+      VirtualMavenArtifactMetaData id = new VirtualMavenArtifactMetaData();
+      // <artifact groupId="org.jboss.test" artifactId="test-common" from="2.0.0" to="2.1.0" />
+      id.setArtifactId("test-common");
+      id.setGroupId("org.jboss.test");
+      VirtualFile art = ((TestVirtualDeploymentRepository)factory).getVirtualFile(id);
+      log.debug(art.getPhysicalFile());
+      
+      Automounter.cleanup(vf);
+      log.debug(artifact.getPhysicalFile());
+      assertFalse(artifact.getChild("META-INF").exists());
+      
+      
+
    }
    
    @SuppressWarnings("unchecked")

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -59,6 +59,11 @@
       return "test-profile";
    }
    
+   public ProfileMetaDataRegistry getRegistry()
+   {
+      return registry;
+   }
+   
    protected ProfileServiceConfig createConfig()
    {
       ManagementDomain domain = new ManagementDomain("default");
@@ -98,9 +103,14 @@
       {
          context.addRequirement(new ResolveRequirement(requirement));
       }
+      return resolveRequirements(context);
+   }
+   
+   List<String> resolveRequirements(ProfileDependencyContext context)
+   {
       registry.addContext(context);
       resolver.resolve(context);
-      return getNames(resolver.sort());
+      return getNames(resolver.sort());      
    }
    
    List<String> getNames(List<ProfileKey> contexts)

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -29,7 +29,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -68,8 +68,13 @@
       return null;
    }
 
+   public String getRelativePath(Artifact<ArtifactId> artifact)
+   {
+      return null;
+   }
+   
    @Override
-   public ArtifactRepositoryConfiguration getConfiguration()
+   public ArtifactRepositoryConfiguration<ArtifactId> getConfiguration()
    {
       return null;
    }

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -45,7 +45,6 @@
 import org.jboss.test.profileservice.domain.support.AbstractDomainMetaDataVisitor;
 import org.jboss.test.profileservice.domain.support.DomainMetaDataRepoSupport;
 
-
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -23,14 +23,15 @@
 
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.jboss.profileservice.repository.artifact.AbstractRepositoryId;
 import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
 import org.jboss.profileservice.repository.artifact.file.LocalFileArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * Test artifact repository, which also resolves full urls.
@@ -52,13 +53,7 @@
    @Override
    public VirtualFile getArtifactFile(FileArtifactId artifact) throws IOException
    {
-      VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
-      if(vf == null)
-      {
-         URL rootURL = new URL(artifact.getPath());
-         return VFS.getRoot(rootURL);
-      }
-      return vf;
+      return getRepositoryRoot().getChild(artifact.getPath());
    }   
 }
 

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestVirtualDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestVirtualDeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestVirtualDeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -33,7 +33,8 @@
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
 import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
 import org.jboss.profileservice.virtual.assembly.AbstractVirtualDeploymentAssembly;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -48,6 +49,11 @@
    /** The repositories. */
    private Map<String, ArtifactRepository<ArtifactId>> repositories = new ConcurrentHashMap<String, ArtifactRepository<ArtifactId>>();
    
+   protected VirtualFile getAssembledRoot()
+   {
+      return VFS.getChild("virtual-deployments");
+   }
+   
    /**
     * Create a ProfileDeployment.
     * TODO - ProfileDeployment should maybe be a virtual deployment?

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -32,7 +32,7 @@
 import org.jboss.test.profileservice.metadata.support.VirtualRepositoryMetaData;
 import org.jboss.test.profileservice.virtual.support.TestArtifactRepository;
 import org.jboss.test.profileservice.virtual.support.TestVirtualDeploymentRepository;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -74,14 +74,14 @@
       }
       for(String child : children)
       {
-         assertNotNull(child  + " available " + vf.getChildren(), vf.getChild(child));
+         assertTrue(child  + " available " + vf.getChildren(), vf.getChild(child).exists());
       }
    }
    
    protected void asssertExcluded(VirtualFile vf, String... children) throws Exception
    {
       for(String child : children)
-         assertNull(child, vf.getChild(child));      
+         assertFalse(child, vf.getChild(child).exists());      
    }
 
    protected void asssertExcluded(VirtualFile vf, String target, String... children) throws Exception
@@ -92,7 +92,7 @@
       }
       for(String child : children)
       {
-         assertNull(child, vf.getChild(child));
+         assertFalse(child, vf.getChild(child).exists());
       }
    }
    

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -27,6 +27,7 @@
 import java.util.Map;
 
 import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.plugins.structure.MetaDataEntryImpl;
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaData;
@@ -63,12 +64,6 @@
       Map<String, VirtualDeployment> deployments = mapDeployments(repository);
     
       this.profileDeploymentFactory = createRepository(REPOSITORY_LOCATION);
-      for(VirtualDeployment d : repository.getDeployments())
-      {
-         ProfileDeployment pd = profileDeploymentFactory.createDeployment(d);
-         Deployment mcd = mcDeploymentBuilder.createDeployment(pd);
-         getLog().debug(mcd.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class));
-      }
       
       // test.simple
       /**
@@ -105,7 +100,7 @@
    {
       assertNotNull("null meta data path", info.getMetaDataPath());
       assertEquals("same size", info.getMetaDataPath().size(), 1);
-      assertTrue(info.getMetaDataPath().contains("META-INF"));
+      assertTrue(info.getMetaDataPath().contains(new MetaDataEntryImpl("META-INF")));
    }
    
    protected void assertClassPathEntries(ContextInfo info, String... paths)

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -31,8 +31,7 @@
 import org.jboss.profileservice.virtual.deployment.AbstractVirtualDeployment;
 import org.jboss.profileservice.virtual.deployment.AbstractVirtualDeploymentRequirement;
 import org.jboss.test.profileservice.metadata.support.VirtualRepositoryMetaData;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * Test virtual deployment assembly.
@@ -63,15 +62,14 @@
       // Test simple.deployer
       AbstractVirtualDeployment simpleVD = (AbstractVirtualDeployment) deployments.get("simple.deployer");
       ProfileDeployment simple = factory.createDeployment(simpleVD);
-      assertFalse("root must be a non-assembled file", simple.getRoot() instanceof AssembledDirectory);
       testDeploymentFlags(simple);
       log.debug(simple.getRoot());
+      simple.cleanup();
       
       // Test test.deployer
       AbstractVirtualDeployment deployerVD = (AbstractVirtualDeployment) deployments.get("test.deployer");
       ProfileDeployment deployer = factory.createDeployment(deployerVD);
-      assertTrue(deployer.getRoot() instanceof AssembledDirectory);
-      
+     
       // Check meta data includes/excludes
       assertIncluded(deployer.getRoot(), "META-INF", new String[] {
          "test.xml", "test1.xml", "include.xml"});
@@ -82,13 +80,10 @@
       asssertExcluded(deployer.getRoot(), new String[] {"bad.jar"});
       // Check requirement
       //resolves(simpleVD, deployerVD.getRequires().get(0));
-      log.debug(deployer.getRoot());
-      
-      
+
       // Test deployment
       AbstractVirtualDeployment deploymentVD = (AbstractVirtualDeployment) deployments.get("test-deployment");
       ProfileDeployment deployment = factory.createDeployment(deploymentVD);
-      assertTrue(deployment.getRoot() instanceof AssembledDirectory);
       // Get sub deployment
       VirtualFile subDeploymentRoot = deployment.getRoot().getChild("test-sub-deployment");
       assertNotNull(subDeploymentRoot);
@@ -100,11 +95,12 @@
       testDeploymentFlags(deployment);
       log.debug(deployment.getRoot());
       log.debug(subDeploymentRoot);
-      
-      // Test some VFS behavior
-      // This needs some updates in the AssembledFileHandler to allow children
+
       log.debug(deployer.getRoot().getChildrenRecursively());
       log.debug(deployment.getRoot().getChildrenRecursively());
+
+      deployer.cleanup();
+      deployment.cleanup();
       
    }
  

Modified: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/repository/test/repository.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/repository/test/repository.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/repository/test/repository.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -1,31 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <virtual-repository xmlns="urn:jboss:profileservice:virtual:repository:1.0">
 
-<!--
-	// VFS-roots/Properties should maybe be defined in the domain.xml ?
-	// At least jboss-xb could already replace those then
-	 
-	<vfs-root name="jboss.home" value="vfsfile:/home/jboss-jboss-6.x" />
- 	<vfs-root name="jboss.lib" value="${jboss.home}/lib" />
- 	<vfs-root name="jboss.common.lib" value="${jboss.home}/common/lib" /> 
- 	<vfs-root name="jboss.server.home" value="${jboss.home}/server" />
-	<vfs-root name="jboss.deployment.resources" path="${jboss.home}/common/deployments" />
- -->
- 
  	<!-- The simple.deployer -->
  	<virtual-deployment name="simple.deployer" version="1.1.0">
-	 	<file path="${jboss.deployment.resources}/simple-deployer-jboss-beans.xml"/>
+	 	<file path="simple-deployer-jboss-beans.xml"/>
 	</virtual-deployment>
  
  	<!-- The test.depoyer -->
 	<virtual-deployment name="test.deployer" version="2.0.1">
-		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf" />
-		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf2">
+		<meta-inf path="test.deployer/meta-inf" />
+		<meta-inf path="test.deployer/meta-inf2">
 			<include name="*.xml" />
 			<exclude name="*-beans.xml" />
 		</meta-inf>
-		<classpath path="${jboss.deployment.resources}/test.deployer/deployer.jar" />
-		<classpath path="${jboss.deployment.resources}/test.deployer/lib">
+		<classpath path="test.deployer/deployer.jar" />
+		<classpath path="test.deployer/lib">
 			<include name="*.jar" />
 			<exclude name="bad.jar" />
 		</classpath>
@@ -34,12 +23,12 @@
 
 	<!-- A test deployment  -->
 	<virtual-deployment name="test-deployment">
-		<meta-inf path="${jboss.deployment.resources}/test-deployment/META-INF" />
-		<classpath path="${jboss.deployment.resources}/test-deployment/lib" />
+		<meta-inf path="test-deployment/META-INF" />
+		<classpath path="test-deployment/lib" />
 		<requires name="test.deployer" from="2.0.0" to="2.1.0"/>
 		<virtual-deployment name="test-sub-deployment">
-			<meta-inf path="${jboss.deployment.resources}/test-deployment/child/META-INF" />
-			<classpath path="${jboss.deployment.resources}/test-deployment/child/test.jar" />
+			<meta-inf path="test-deployment/child/META-INF" />
+			<classpath path="test-deployment/child/test.jar" />
 		</virtual-deployment>
 	</virtual-deployment>
 

Modified: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -1,31 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <virtual-repository xmlns="urn:jboss:profileservice:virtual:repository:1.0">
-
-<!--
-	// VFS-roots/Properties should maybe be defined in the domain.xml ?
-	// At least jboss-xb could already replace those then
-	 
-	<vfs-root name="jboss.home" value="vfsfile:/home/jboss-jboss-6.x" />
- 	<vfs-root name="jboss.lib" value="${jboss.home}/lib" />
- 	<vfs-root name="jboss.common.lib" value="${jboss.home}/common/lib" /> 
- 	<vfs-root name="jboss.server.home" value="${jboss.home}/server" />
-	<vfs-root name="jboss.deployment.resources" path="${jboss.home}/common/deployments" />
- -->
  
  	<!-- The simple.deployer -->
  	<virtual-deployment name="simple.deployer" version="1.1.0" >
- 		<file path="${jboss.deployment.resources}/simple-deployer-jboss-beans.xml" />
+ 		<file path="simple-deployer-jboss-beans.xml" />
  	</virtual-deployment>
  
  	<!-- The test.depoyer -->
 	<virtual-deployment name="test.deployer" version="2.0.1">
-		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf" />
-		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf2">
+		<meta-inf path="test.deployer/meta-inf" />
+		<meta-inf path="test.deployer/meta-inf2">
 			<include name="*.xml" />
 			<exclude name="*-beans.xml" />
 		</meta-inf>
-		<classpath path="${jboss.deployment.resources}/test.deployer/deployer.jar" />
-		<classpath path="${jboss.deployment.resources}/test.deployer/lib">
+		<classpath path="test.deployer/deployer.jar" />
+		<classpath path="test.deployer/lib">
 			<include name="*.jar" />
 			<exclude name="bad.jar" />
 		</classpath>
@@ -34,12 +23,12 @@
 
 	<!-- A test deployment  -->
 	<virtual-deployment name="test-deployment">
-		<meta-inf path="${jboss.deployment.resources}/test-deployment/META-INF" />
-		<classpath path="${jboss.deployment.resources}/test-deployment/lib" />
+		<meta-inf path="test-deployment/META-INF" />
+		<classpath path="test-deployment/lib" />
 		<requires name="test.deployer" from="2.0.0" to="2.1.0"/>
 		<virtual-deployment name="test-sub-deployment">
-			<meta-inf path="${jboss.deployment.resources}/test-deployment/child/META-INF" />
-			<classpath path="${jboss.deployment.resources}/test-deployment/child/test.jar" />
+			<meta-inf path="test-deployment/child/META-INF" />
+			<classpath path="test-deployment/child/test.jar" />
 		</virtual-deployment>
 	</virtual-deployment>
 

Modified: projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -7,6 +7,7 @@
 		 	groupId="org.jboss.test" artifactId="jboss-simple-deployer" from="1.0.0"  to="1.1.0" />
 	</profile>
  -->
+ 
 	<profile name="test-deployer">
 		<virtual-deployment name="test-deployer">
 			<meta-inf path="test.deployer/meta-inf" />

Modified: projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -15,13 +15,17 @@
 			of the repository root to easier group files.  
 		 -->
 		<file-repository group="bootstrap" />
-		<deployment name="aop.xml" />
+		<!-- 
+			<deployment name="aop.xml" />
+		 -->
 		<deployment name="classloader.xml" />
 		<deployment name="deployers.xml" />
+		<deployment name="profile.xml" />
+		<!-- 
 		<deployment name="jmx.xml" />
-		<deployment name="profile.xml" />
 		<deployment name="logging.xml" />
 		<deployment name="vfs.xml" />
+		 -->
 		<management namespace="urn:jboss:profileservice:boostrap:1.0" />
 	</bootstrap>
 

Modified: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -12,13 +12,13 @@
    <!-- The ManagedObjectFactory -->
    <bean name="ManagedObjectFactory">
       <constructor factoryClass="org.jboss.managed.api.factory.ManagedObjectFactory" factoryMethod="getInstance"/>
-      <property name="metaValueFactory"><inject bean="MetaValueFactory"/></property>
       <!-- Accept any implementor of InstanceClassFactory -->
       <incallback method="addInstanceClassFactory"/>
       <uncallback method="removeInstanceClassFactory"/>
      <!-- Accept any ManagedObjectDefinition -->
       <incallback method="addManagedObjectDefinition"/>
       <uncallback method="removeManagedObjectDefinition"/>
+      <property name="metaValueFactory"><inject bean="MetaValueFactory"/></property>
    </bean>
    <!-- The ManagedObjectCreator implementation -->
    <bean name="ManagedObjectCreator" class="org.jboss.deployers.spi.deployer.helpers.DefaultManagedObjectCreator">
@@ -88,22 +88,6 @@
              </set>
           </parameter>
        </constructor>
-       <property name="candidateStructureVisitorFactory">
-          <!-- Any file that is not an ordinary directory is a candidate -->
-          <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
-             <!-- A filter to exclude some obvious non-subdeployments -->
-             <property name="filter">
-                <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
-                   <constructor><parameter>
-                      <list elementClass="java.lang.String">
-                         <!-- Exclude class files as subdeployments -->
-                         <value>.class</value>
-                      </list>
-                   </parameter></constructor>
-                </bean>
-             </property>
-          </bean>
-       </property>
     </bean>
 
     <!-- File Structure -->
@@ -121,14 +105,29 @@
        </constructor>
     </bean>
 
+   <!-- POJO Deployment -->
+
+   <bean name="CoreBeanAnnotationAdapterFactory">
+      <constructor factoryClass="org.jboss.kernel.plugins.annotations.BeanAnnotationAdapterFactory" factoryMethod="getInstance"/>
+   </bean>
+
+   <bean name="CoreBeanAnnotationAdapter">
+      <constructor factoryMethod="getBeanAnnotationAdapter">
+        <factory bean="CoreBeanAnnotationAdapterFactory"/>
+      </constructor>
+      <incallback method="addAnnotationPlugin"/>
+      <uncallback method="removeAnnotationPlugin"/>
+   </bean>
+
    <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer">
       <property name="suffix">jboss-beans.xml</property>
    </bean>
-   <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer" />
+   <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer">
+   </bean>
    <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
       <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
    </bean>
-   
+
    <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
       <constructor>
          <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
@@ -141,7 +140,6 @@
          <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
       </property>
    </bean>
-   <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
    <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
    <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
       <property name="classLoading"><inject bean="ClassLoading"/></property>

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -21,8 +21,12 @@
 */
 package org.jboss.profileservice.plugins.deploy;
 
+import java.util.Collection;
+
 import org.jboss.deployers.spi.management.deploy.DeploymentID;
-import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
+import org.jboss.profileservice.deployment.ProfileDeploymentRegistry;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
 
 /**
@@ -32,8 +36,8 @@
 public class AbstractDeployHandler
 {
 
-   /** The local profile service domain. */
-   private ProfileMetaDataRegistry domain;
+   /** The deployment registry. */
+   private ProfileDeploymentRegistry deploymentRegistry;
    
    /** The ProfileService. */
    private ProfileService ps;
@@ -45,22 +49,42 @@
    
    protected void startDeployment(String deploymentName) throws Exception
    {
-
+      ProfileKey key = checkProfileForDeployment(deploymentName);
+      
    }
    
    protected void stopDeployment(String deploymentName) throws Exception
    {
+      ProfileKey key = checkProfileForDeployment(deploymentName);
 
    }
    
    protected void removeDeployment(String deploymentName) throws Exception
    {
+      ProfileKey key = checkProfileForDeployment(deploymentName);
       
    }
    
-   ProfileMetaDataRegistry domain()
+   ProfileKey checkProfileForDeployment(String deploymentName) throws NoSuchDeploymentException
    {
-      return this.domain;
+      ProfileKey key = deploymentRegistry.getProfileForDeployment(deploymentName);
+      if(key == null)
+      {
+         Collection<String> resolved = deploymentRegistry.resolveDeploymentName(deploymentName);
+         if(resolved != null && resolved.size() == 1)
+         {
+            key = deploymentRegistry.getProfileForDeployment(resolved.iterator().next());
+         }
+         else
+         {
+            throw new NoSuchDeploymentException("failed to resolve deployment name " + deploymentName + " result " + resolved);
+         }
+      }
+      if(key == null)
+      {
+         throw new NoSuchDeploymentException(deploymentName);
+      }
+      return key;
    }
    
 }

Modified: projects/profileservice/trunk/pom.xml
===================================================================
--- projects/profileservice/trunk/pom.xml	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/pom.xml	2010-02-18 13:47:17 UTC (rev 101110)
@@ -43,15 +43,15 @@
 
 		<version.junit>3.8.2</version.junit>
 		<version.org.jboss.common.core>2.2.17.GA</version.org.jboss.common.core>
-		<version.org.jboss.deployers>2.2.0.Alpha1</version.org.jboss.deployers>
+		<version.org.jboss.deployers>2.2.0-SNAPSHOT</version.org.jboss.deployers>
 		<version.org.jboss.jbossxb>2.0.2.Beta4</version.org.jboss.jbossxb>
 		<version.org.jboss.logging>2.2.0.CR1</version.org.jboss.logging>
 		<version.org.jboss.man>2.1.1.SP1</version.org.jboss.man>
 		<version.org.jboss.mdr>2.2.0.Alpha1</version.org.jboss.mdr>
-		<version.org.jboss.kernel>2.2.0.Alpha5</version.org.jboss.kernel>
+		<version.org.jboss.kernel>2.2.0.Alpha6</version.org.jboss.kernel>
 		<version.org.jboss.reflect>2.2.0.Alpha2</version.org.jboss.reflect>
 		<version.jboss.test>1.1.0.GA</version.jboss.test>
-		<version.org.jboss.vfs>2.2.0.Alpha2</version.org.jboss.vfs>
+		<version.org.jboss.vfs>3.0.0.CR1</version.org.jboss.vfs>
 		<version.sun.jaxb>2.1.9-brew</version.sun.jaxb>
 	</properties>
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -22,7 +22,7 @@
 package org.jboss.deployers.spi.management;
 
 import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A DeploymentTemplate is a template for creating a DeploymentContext given

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -28,7 +28,7 @@
 import java.util.Collection;
 import java.util.Set;
 
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * An interface for managing the contents of a Profile.

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -25,7 +25,7 @@
 
 import org.jboss.profileservice.spi.deployment.DeploymentAttachments;
 import org.jboss.profileservice.spi.deployment.ProfileDeploymentInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The profile deployment.
@@ -60,6 +60,13 @@
    VirtualFile getRoot();
 
    /**
+    * Cleanup the associated {@code VirtualFile} information.
+    *
+    * @throws Exception for any error
+    */
+   void cleanup() throws Exception;
+   
+   /**
     * Get the deployment info.
     * 
     * @return the deployment info

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -38,16 +38,5 @@
     */
    boolean resolves(ProfileRequirement requirement);
 
-   /**
-    * Check whether this capability is consistent with another capability.<p>
-    *
-    * Since the capabilties are within one shared 'domain' capabilties have to 
-    * be unique.
-    * 
-    * @param other the other capability
-    * @return true when consistent, false when inconsistent
-    */
-   boolean isConsistent(ProfileCapability other);
-   
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -43,6 +43,14 @@
     * @return if this requirement is optional
     */
    boolean isOptional();
+ 
+   /**
+    * Check whether this requirement is consistent with another requirement.<p>
+    * 
+    * @param other the other capability
+    * @return true when consistent, false when inconsistent
+    */
+   boolean isConsistent(ProfileRequirement other);
    
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -40,7 +40,7 @@
     * @return the repository id.
     */
    ArtifactRepositoryId getRepository();
-
+   
    /**
     * Get the last modified.
     * 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -24,7 +24,7 @@
 import java.io.IOException;
 import java.util.Collection;
 
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * The artifact repository.
@@ -74,7 +74,6 @@
     * @return the virtual file
     * @throws IOException
     */
-   // TODO remove dependency on VFS ? 
    VirtualFile getArtifactFile(T artifact) throws IOException;
 
 }

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java	2010-02-18 11:22:27 UTC (rev 101109)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java	2010-02-18 13:47:17 UTC (rev 101110)
@@ -25,7 +25,7 @@
 
 import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
 import org.jboss.profileservice.spi.virtual.VirtualDeployment;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A virtual deployment context.
@@ -58,6 +58,6 @@
     * @throws IOException
     */
    VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException;
-   
+
 }
 




More information about the jboss-cvs-commits mailing list