[jboss-cvs] JBossAS SVN: r93604 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice and 26 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 16 08:31:50 EDT 2009


Author: emuckenhuber
Date: 2009-09-16 08:31:48 -0400 (Wed, 16 Sep 2009)
New Revision: 93604

Added:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ManagementDomainMetaData.java
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ServerMetaData.java
   projects/profileservice/trunk/sandbox/src/main/java/org/
   projects/profileservice/trunk/sandbox/src/main/java/org/jboss/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/MutableArtifactRepository.java
Removed:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java
Modified:
   projects/profileservice/trunk/core/pom.xml
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.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/ProfileDeployAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.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/bootstrap/BootstrapProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.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/DelegatingArtifactRepository.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/LocalMavenArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/MavenArtifactReference.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/version/helpers/VersionSupport.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.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/test/BasicProfileServiceUnitTestCase.java
   projects/profileservice/trunk/core/src/test/resources/bootstrap/bootstrap.xml
   projects/profileservice/trunk/domain/pom.xml
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.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
Log:
update profile creation and use some basic external domain information for the PSBootstrap.

Modified: projects/profileservice/trunk/core/pom.xml
===================================================================
--- projects/profileservice/trunk/core/pom.xml	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/pom.xml	2009-09-16 12:31:48 UTC (rev 93604)
@@ -44,6 +44,12 @@
 
 		<dependency>
 			<groupId>org.jboss.profileservice</groupId>
+			<artifactId>jboss-profileservice-domain</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.profileservice</groupId>
 			<artifactId>jboss-profileservice-spi</artifactId>
 			<version>${project.parent.version}</version>
 		</dependency>

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -37,8 +37,9 @@
 import org.jboss.dependency.spi.DependencyItem;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.profileservice.dependency.AbstractProfileContextFactory;
+import org.jboss.profileservice.dependency.LocalProfileServiceDomain;
 import org.jboss.profileservice.dependency.ProfileControllerContext;
+import org.jboss.profileservice.dependency.ProfileDependencyContext;
 import org.jboss.profileservice.dependency.ProfileServiceController;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.Profile;
@@ -60,8 +61,8 @@
    /** The controller. */
    private final ProfileServiceController controller;
    
-   /** The profile controller context factory. */
-   private AbstractProfileContextFactory contextFactory; 
+   /** The local profile registry. */
+   private LocalProfileServiceDomain domain;
 
    /** The deployment manager plugin. */
    private DeploymentManager deploymentMgr;
@@ -78,7 +79,7 @@
       ProfileServiceController controller = new ProfileServiceController(parent);
       // TODO this should not be set to the controller
       controller.setDeployerRegistry(reg);
-      controller.setFactory(delegate);
+      controller.setProfileFactory(delegate);
       this.controller = controller;
    }
    
@@ -102,16 +103,36 @@
       this.mgtView = mgtView;
    }
    
-   public AbstractProfileContextFactory getContextFactory()
+   public LocalProfileServiceDomain getDomain()
    {
-      return contextFactory;
+      return domain;
    }
    
-   public void setContextFactory(AbstractProfileContextFactory contextFactory)
+   public void setDomain(LocalProfileServiceDomain domain)
    {
-      this.contextFactory = contextFactory;
+      this.domain = domain;
    }
    
+   public void create()
+   {
+      if(domain == null)
+      {
+         throw new IllegalStateException("null domain injected");
+      }
+   }
+   
+   @Override
+   public String getDomainName()
+   {
+      return this.domain.getDomainName();
+   }
+   
+   @Override
+   public String getServerName()
+   {
+      return this.domain.getServerName();
+   }
+   
    public void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception
    {
       if(key == null)
@@ -181,19 +202,10 @@
       return profiles;
    }
 
-   public String[] getDomains()
-   {
-      List<String> domains = new ArrayList<String>();
-      Collection<ProfileKey> profiles = getActiveProfileKeys();
-      for(ProfileKey key : profiles)
-         domains.add(key.getDomain());
-      return domains.toArray(new String[ domains.size() ]);
-   }
-
    public Collection<ProfileKey> getProfileKeys()
    {
       List<ProfileKey> profiles = new ArrayList<ProfileKey>();
-      for(ControllerContext ctx : controller.getContextsByState(null))
+      for(ControllerContext ctx : controller.getAllContexts())
       {
          if(ctx instanceof ProfileControllerContext)
          {
@@ -217,28 +229,27 @@
       throw new NoSuchProfileException("No such registered profile " + key);
    }
 
-   public void registerProfile(ProfileMetaData metaData) throws Exception
+   public ProfileKey registerProfile(ProfileMetaData metaData) throws Exception
    {
       if(metaData == null)
          throw new IllegalArgumentException("null profile meta data");
     
-      ProfileKey key = ProfileKey.createProfileKey(metaData);
-      registerProfile(key, metaData);
+      return registerProfile(metaData, null);
    }
    
-   public void registerProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
+   public ProfileKey registerProfile(ProfileMetaData metaData, Profile profile) throws Exception
    {
-      registerProfile(key, metaData, null);
-   }
-   
-   public void registerProfile(ProfileKey key, ProfileMetaData metaData, Profile profile) throws Exception
-   {
-      if(key == null)
-         throw new IllegalArgumentException("null profile key");
       if(metaData == null)
          throw new IllegalArgumentException("null profile meta data");
       
-      ProfileControllerContext ctx = contextFactory.createProfileContext(key, metaData, profile);
+      // Create the profile key
+      ProfileKey key = new ProfileKey(getDomainName(), getServerName(), metaData.getName());
+      
+      // Register
+      ProfileDependencyContext dependency = new ProfileDependencyContext(key, metaData, domain);
+      domain.addProfile(dependency);
+      
+      ProfileControllerContext ctx = new ProfileControllerContext(dependency);
       if(ctx == null)
          throw new IllegalStateException("created null profile context");
       
@@ -252,8 +263,9 @@
       }
       catch(Throwable t)
       {
-         throw new RuntimeException("failed to install profile context"  + key, t);
+         throw new RuntimeException("failed to install profile context"  + metaData.getName(), t);
       }
+      return key;
    }
 
    public void unregisterProfile(ProfileKey key) throws NoSuchProfileException
@@ -265,6 +277,9 @@
       if(ctx == null)
          throw new NoSuchProfileException("No such registered profile");
       
+      //
+      domain.removeProfile(key);
+      //
       controller.uninstall(key);
    }
 

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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;
+
+/**
+ * The management domain information.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagementDomain
+{
+   
+   /** The domain name. */
+   private String name;
+
+   public ManagementDomain(String name)
+   {
+      if(name == null)
+      {
+         throw new IllegalArgumentException("null domain name");
+      }
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return getName().hashCode();
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      if(obj == this)
+         return true;
+      if(obj == null || obj instanceof ManagementDomain == false)
+         return false;
+      return getName().equals(((ManagementDomain)obj).getName());
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('{');
+      builder.append("domainName=").append(getName());
+      toString(builder);
+      builder.append('}');
+      return builder.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+   
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -25,6 +25,7 @@
 import java.util.Map;
 
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.profileservice.spi.ProfileDeployment;
 
 /**
@@ -77,5 +78,11 @@
          log.trace("remove " + deployment);
    }
 
+   @Override
+   public ManagedDeployment getManagedDeployment(ProfileDeployment deployment)
+   {
+      return null;
+   }
+   
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -21,6 +21,7 @@
  */ 
 package org.jboss.profileservice;
 
+import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.profileservice.spi.ProfileDeployment;
 
 /**
@@ -66,6 +67,14 @@
     * @throws Exception
     */
    public void checkComplete() throws Exception;
+ 
+   /**
+    * Get a managed deployment.
+    * 
+    * @param deployment the profile deployment
+    * @return the managed deployment
+    */
+   ManagedDeployment getManagedDeployment(ProfileDeployment deployment);
    
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -21,7 +21,24 @@
  */ 
 package org.jboss.profileservice.bootstrap;
 
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.profileservice.AbstractProfileService;
+import org.jboss.profileservice.ManagementDomain;
+import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.dependency.LocalProfileServiceDomain;
+import org.jboss.profileservice.domain.DomainMetaData;
+import org.jboss.profileservice.domain.ManagementDomainMetaData;
+import org.jboss.profileservice.domain.ServerMetaData;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
+
 /**
  * The abstract profile service bootstrap.
  * 
@@ -30,8 +47,78 @@
  */
 public abstract class AbstractProfileServiceBootstrap
 {
+   
+   /** The local profile domain bean name. */
+   public static final String LOCALDOMAIN_BEANNAME = "org.jboss:service=LocalProfileServiceDomain";
+   public static final String PROFILESERVICE_BEANNAME = "org.jboss:service=ProfileService";
 
-   // TODO
+   protected abstract KernelController getController();
+   protected abstract ProfileDeployerPluginRegistry getDeployerRegistry();
+   protected abstract ProfileFactory<ProfileMetaData, Profile> getProfileFactory();
    
+   protected ProfileService createProfileService(DomainMetaData domainMetaData) throws Throwable
+   {
+      if(domainMetaData == null)
+         throw new IllegalArgumentException("null domain meta data");
+      
+      BeanMetaData localDomain = createLocalDomain(domainMetaData);
+      if(localDomain == null)
+         throw new IllegalStateException("failed to create local domain");
+      
+      //
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(PROFILESERVICE_BEANNAME, AbstractProfileService.class.getName());
+      builder.addConstructorParameter(AbstractController.class.getName(), getController());
+      builder.addConstructorParameter(ProfileDeployerPluginRegistry.class.getName(), getDeployerRegistry());
+      builder.addConstructorParameter(ProfileFactory.class.getName(), getProfileFactory());
+      builder.addPropertyMetaData("domain", builder.createInject(localDomain.getName()));
+      
+      // TODO
+      ControllerContext ps = getController().install(builder.getBeanMetaData());
+
+      return (ProfileService) ps.getTarget();
+   }
+   
+
+   protected BeanMetaData createLocalDomain(DomainMetaData domainMetaData) throws Throwable
+   {
+      ManagementDomainMetaData domain = domainMetaData.getDomain();
+      if(domain == null)
+         throw new IllegalArgumentException("null domain meta data");
+      
+      // Get the domain name
+      String domainName = domain.getDomainName();
+      if(domainName == null)
+         throw new IllegalArgumentException("null domain name");
+      domainName = domainName.trim();
+      if(domainName.length() == 0)
+         throw new IllegalArgumentException("empty domain name");
+      
+      ServerMetaData serverMetaData = domainMetaData.getServer();
+      if(serverMetaData == null)
+         throw new IllegalArgumentException("null server meta data");
+
+      // Get the server name
+      String serverName = serverMetaData.getName();
+      if(serverName == null)
+         throw new IllegalArgumentException("null server name");
+      serverName = serverName.trim();
+      if(serverName.length() == 0)
+         throw new IllegalArgumentException("empty server name");
+
+      // The management domain
+      ManagementDomain mgtDomain = new ManagementDomain(domainName);
+      
+      // Create the local domain
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(
+            LOCALDOMAIN_BEANNAME, LocalProfileServiceDomain.class.getName());
+      builder.addConstructorParameter(ManagementDomain.class.getName(), mgtDomain);
+      builder.addConstructorParameter(String.class.getName(), serverName);
+
+      // Install
+      BeanMetaData bmd = builder.getBeanMetaData();
+      getController().install(bmd);
+      return bmd;
+   }
+   
 }
 

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,79 +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.dependency;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.dependency.plugins.AbstractControllerContextActions;
-import org.jboss.dependency.plugins.action.ControllerContextAction;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileContextFactory
-{
-
-   /** The default actions. */
-   protected static final AbstractControllerContextActions defaultActions;
-   
-   /** The resolver. */
-   private static final ProfilesRequirementResolver resolver = new ProfilesRequirementResolver();
-   
-   static
-   {
-      Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
-      actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstace());
-      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
-      actions.put(ControllerState.START, ProfileStartAction.getInstance());
-      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
-      actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
-      defaultActions = new AbstractControllerContextActions(actions);
-   }
-   
-   public String[] getTypes()
-   {
-      return new String[0];
-   }
-   
-   /**
-    * Create a ProfileControllerContext.
-    * 
-    * @param key the profile key
-    * @param metaData the profile meta data
-    * @param profile the profile
-    * @return the profile controller context
-    */
-   public abstract ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile);
-   
-   protected ProfilesRequirementResolver getRequirementResolver()
-   {
-      return resolver;
-   }
-   
-}
-

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,134 +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.dependency;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.dependency.ProfileCapability;
-import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
-import org.jboss.profileservice.spi.dependency.ProfileRequirement;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
-
-/**
- * The abstract dependency context.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class AbstractProfileDependencyContext implements ProfileDependencyContext, ProfileMetaDataVisitor
-{
-   
-   /** The profile key. */
-   private final ProfileKey key;
-
-   /** The profile meta data. */
-   private final ProfileMetaData profileMetaData;
-   
-   /** The profile structure. */
-   private final ProfilesRequirementResolver resolver;
-   
-   /** The capabilities. */
-   private List<ProfileCapability> capabilites = new ArrayList<ProfileCapability>();
-   
-   /** The requirements. */
-   private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
-   
-   public AbstractProfileDependencyContext(ProfileKey key, ProfileMetaData metaData, ProfilesRequirementResolver resolver)
-   {
-      if(key == null)
-         throw new IllegalArgumentException("null profile key");
-      if(metaData == null)
-         throw new IllegalArgumentException("null meta data");
-      this.key = key;
-      this.profileMetaData = metaData;
-      this.resolver = resolver;
-      // Visit the profile meta data
-      visit(profileMetaData);
-   }
-   
-   public ProfileKey getKey()
-   {
-      return key;
-   }
-   
-   public ProfileMetaData getProfileMetaData()
-   {
-      return profileMetaData;
-   }
-   
-   public ProfilesRequirementResolver getResolver()
-   {
-      return resolver;
-   }
-   
-   public void addCapability(ProfileCapability capability)
-   {
-      this.capabilites.add(capability);
-   }
-
-   public void addRequirement(ProfileRequirement requirement)
-   {
-      this.requirements.add(requirement);
-   }
-
-   public Collection<ProfileCapability> getCapabilities()
-   {
-      return this.capabilites;
-   }
-
-   public Collection<ProfileRequirement> getRequirements()
-   {
-      return this.requirements;
-   }
-
-   public void visit(ProfileMetaDataVisitorNode node)
-   {
-      node.visit(this);
-   }
-
-   public ProfileKey resolve(ProfileRequirement requirement)
-   {
-      return getResolver().resolve(this, requirement); 
-   }
-
-   public String toString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(getClass().getSimpleName()).append('@');
-      buffer.append(Integer.toHexString(System.identityHashCode(this)));
-      buffer.append('{');
-      toString(buffer);
-      buffer.append('}');
-      return buffer.toString();
-   }
-   
-   protected void toString(StringBuilder builder)
-   {
-      builder.append("key=").append(getKey());
-   }
-}
-

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,51 +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.dependency;
-
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-
-/**
- * The default profile controller context factory.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class DefaultProfileContextFactory extends AbstractProfileContextFactory
-{
-   
-   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
-   {
-      ProfileDependencyContext ctx = createDependencyContext(key, metaData);
-      return new ProfileControllerContext(ctx, defaultActions, profile);
-   }
-   
-   protected ProfileDependencyContext createDependencyContext(ProfileKey key, ProfileMetaData metaData)
-   {
-      return new AbstractProfileDependencyContext(key, metaData, getRequirementResolver());
-   }
-   
-}
-

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,103 +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.dependency;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * The delegating profile context factory. 
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class DelegatingProfileContextFactory extends AbstractProfileContextFactory
-{
-
-   /** The factories. */
-   private Map<String, AbstractProfileContextFactory> factories = new ConcurrentHashMap<String, AbstractProfileContextFactory>();
- 
-   private DefaultProfileContextFactory defaultFactory;
-   
-   public void setDefaultContextFactory(DefaultProfileContextFactory defaultFactory)
-   {
-      this.defaultFactory = defaultFactory;
-   }
-   
-   public DefaultProfileContextFactory getDefaultContextFactory()
-   {
-      return defaultFactory;
-   }
-   
-   public void create()
-   {
-      if(getDefaultContextFactory() == null)
-         throw new IllegalStateException("null default ctx factory");
-   }
-   
-   @Override
-   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
-   {
-      if(key == null)
-         throw new IllegalArgumentException("null profile key");
-      if(metaData == null)
-         throw new IllegalArgumentException("null profile meta data");
-      
-      String factoryType = metaData.getClass().getName();
-      AbstractProfileContextFactory factory = factories.get(factoryType);
-      if(factory == null)
-         factory = getDefaultContextFactory();
-      
-      ProfileControllerContext ctx = factory.createProfileContext(key, metaData, profile);
-      if(ctx == null)
-         throw new IllegalStateException("created null ctx");
-      // add dependency context
-      getRequirementResolver().addDependencyContext(ctx.getDependencyContext());
-      return ctx;
-   }
-   
-   public void addProfileContextFactory(AbstractProfileContextFactory factory)
-   {
-      if(factory == null)
-         throw new IllegalArgumentException("null profile ctx factory");
-      if(factory.getTypes() == null)
-         throw new IllegalArgumentException("null profile ctx factory types");
-      for(String type : factory.getTypes())
-         this.factories.put(type, factory);
-   }
-
-   public void removeProfileContextFactory(AbstractProfileContextFactory factory)
-   {
-      if(factory == null)
-         throw new IllegalArgumentException("null profile ctx factory");
-      if(factory.getTypes() == null)
-         throw new IllegalArgumentException("null profile ctx factory types");
-      for(String type : factory.getTypes())
-         this.factories.remove(type);
-   }
-   
-}
-

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,197 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.dependency;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.ManagementDomain;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+
+/**
+ * The local profile service domain.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalProfileServiceDomain
+{
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(LocalProfileServiceDomain.class);
+
+   /** The management domain information. */
+   private final ManagementDomain domain;
+   
+   /** The server name. */
+   private final String server;
+
+   /** The profiles. */
+   private List<ProfileDependencyContext> profiles = new CopyOnWriteArrayList<ProfileDependencyContext>();
+   
+   /** The profiles by name. */
+   private Map<ProfileKey, ProfileDependencyContext> profilesByKey = new ConcurrentHashMap<ProfileKey, ProfileDependencyContext>();
+  
+   /** The deployments to profile mapping. */
+   private Map<String, ProfileKey> deploymentsToProfiles;
+   
+   public LocalProfileServiceDomain(ManagementDomain domain, String server)
+   {
+      if(domain == null)
+      {
+         throw new IllegalArgumentException("null management domain");
+      }
+      if(server == null)
+      {
+         throw new IllegalArgumentException("null server name");
+      }
+      this.domain = domain;
+      this.server = server;
+   }
+   
+   public String getDomainName()
+   {
+      return domainName();
+   }
+   
+   public ManagementDomain getDomain()
+   {
+      return this.domain;
+   }
+
+   public String getServerName()
+   {
+      return this.server;
+   }
+   
+   public void addProfile(ProfileDependencyContext ctx)
+   {
+      if(ctx == null)
+         throw new IllegalArgumentException("null context");
+      if(ctx.getKey() == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      this.profiles.add(ctx);
+      this.profilesByKey.put(ctx.getKey(), ctx);
+   }
+   
+   public ProfileDependencyContext getProfile(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("null profile name");
+      
+      return getProfile(new ProfileKey(domainName(), server, name));
+   }
+   
+   public ProfileDependencyContext getProfile(ProfileKey key)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      return this.profilesByKey.get(key);
+   }
+   
+   public void removeProfile(ProfileDependencyContext ctx)
+   {
+      if(ctx == null)
+         throw new IllegalArgumentException("null context");
+      if(ctx.getKey() == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      removeProfile(ctx.getKey());
+   }
+   
+   public void removeProfile(ProfileKey key)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      this.profiles.remove(key);
+      this.profilesByKey.remove(key);
+   }
+   
+//   TODO  
+//   public void installProfile(Profile profile) throws Exception
+//   {
+//      ProfileKey key = profile.getKey();
+//      ProfileDeployerPlugin deployer = getProfile(key).getDeployerPlugin();
+//      for(ProfileDeployment deployment : profile.getDeployments())
+//      {
+//         deployer.addDeployment(deployment);
+//         this.deploymentsToProfiles.put(deployment.getName(), key);
+//      }
+//      deployer.process();
+//      deployer.checkComplete();
+//   }
+//   
+//   public void uninstallProfile(Profile profile) throws Exception
+//   {
+//      ProfileKey key = profile.getKey();
+//      ProfileDeployerPlugin deployer = null;
+//      for(ProfileDeployment deployment : profile.getDeployments())
+//      {
+//         deployer.removeDeployment(deployment);
+//         this.deploymentsToProfiles.remove(deployment.getName());
+//      }
+//      deployer.process();
+//   }
+   
+   protected String domainName()
+   {
+      String domainName = domain.getName();
+      if(domainName == null)
+         throw new IllegalStateException("null domain name");
+      return domainName;
+   }
+   
+   protected ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
+   {
+      // Resolve the requirements based on the exposed capabilities
+      boolean trace = log.isTraceEnabled();
+      for(ProfileDependencyContext child : profiles)
+      {
+         Collection<ProfileCapability> capabilities = child.getCapabilities();
+         if(capabilities != null && capabilities.isEmpty() == false)
+         {
+            for(ProfileCapability capability : capabilities)
+            {
+               if(capability.resolves(requirement))
+               {
+                  if(trace)
+                     log.trace(child.getKey() + ":" + capability + " resolved " + requirement);
+                  return child.getKey();
+               }
+            }
+         }
+      }
+      // Unresolved
+      return null;
+   }
+   
+}
+

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -21,16 +21,10 @@
  */ 
 package org.jboss.profileservice.dependency;
 
-import java.util.Collection;
-
 import org.jboss.dependency.plugins.AbstractControllerContext;
-import org.jboss.dependency.spi.ControllerContextActions;
 import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
-import org.jboss.profileservice.spi.dependency.ProfileRequirement;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
 /**
@@ -55,14 +49,14 @@
       return ctx.getKey();
    }
    
-   public ProfileControllerContext(ProfileDependencyContext ctx, ControllerContextActions actions)
+   public ProfileControllerContext(ProfileDependencyContext ctx)
    {
-      this(ctx, actions, null);
+      this(ctx, null);
    }
    
-   public ProfileControllerContext(ProfileDependencyContext ctx, ControllerContextActions actions, Profile profile)
+   public ProfileControllerContext(ProfileDependencyContext ctx, Profile profile)
    {
-      super(getKey(ctx), actions);
+      super(getKey(ctx), profile != null ? ProfileControllerContextActions.instantiatedActions : ProfileControllerContextActions.defaultActions);
       if(ctx == null)
          throw new IllegalArgumentException("null profile meta data");
       
@@ -70,7 +64,6 @@
       if(profile != null)
          setTarget(profile);
       //
-      processMetaData();
       setMode(ControllerMode.ON_DEMAND);
    }
    
@@ -100,25 +93,5 @@
       return (Profile) super.getTarget();
    }
    
-   public ProfileKey resolve(ProfileRequirementDependencyItem dependencyItem)
-   {
-      ProfileRequirement requirement = dependencyItem.getRequirement();
-      return getDependencyContext().resolve(requirement);
-   }
-
-   protected void processMetaData()
-   {
-      Collection<ProfileRequirement> requirements = getDependencyContext().getRequirements();
-      if(requirements != null && requirements.isEmpty() == false)
-      {
-         for(ProfileRequirement requirement : requirements)
-         {
-            getDependencyInfo().addIDependOn(
-                  new ProfileRequirementDependencyItem(this,
-                        requirement, ControllerState.DESCRIBED));
-         }
-      }
-   }
-   
 }
 

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.dependency;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileControllerContextActions
+{
+
+   /** The default actions. */
+   public static final AbstractControllerContextActions defaultActions;
+   
+   /** The instantiated actions. */
+   public static final AbstractControllerContextActions instantiatedActions;
+   
+   static
+   {
+      Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+      actions.put(ControllerState.DESCRIBED, ProfileDescribeAction.getInstance());
+      actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstance());
+      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
+      actions.put(ControllerState.START, ProfileStartAction.getInstance());
+      actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
+      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
+      defaultActions = new AbstractControllerContextActions(actions);
+      
+      actions = new HashMap<ControllerState, ControllerContextAction>();
+      actions.put(ControllerState.DESCRIBED, ProfileDescribeAction.getInstance());
+      // actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstance());
+      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
+      actions.put(ControllerState.START, ProfileStartAction.getInstance());
+      actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
+      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
+      instantiatedActions = new AbstractControllerContextActions(actions);
+      
+   }
+   
+}
+

Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java (from rev 92959, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,151 @@
+/*
+ * 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.dependency;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+
+/**
+ * The abstract dependency context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDependencyContext implements ProfileMetaDataVisitor
+{
+   
+   /** The profile key. */
+   private final ProfileKey key;
+
+   /** The profile meta data. */
+   private final ProfileMetaData profileMetaData;
+
+   /** The local PS domain. */
+   private final LocalProfileServiceDomain domain;
+
+   /** The capabilities. */
+   private List<ProfileCapability> capabilites = new ArrayList<ProfileCapability>();
+   
+   /** The requirements. */
+   private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
+   
+   /** Is described. */
+   private final AtomicBoolean described = new AtomicBoolean(false);
+   
+   public ProfileDependencyContext(ProfileKey key, ProfileMetaData metaData, LocalProfileServiceDomain domain)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      if(metaData == null)
+         throw new IllegalArgumentException("null meta data");
+      this.key = key;
+      this.domain = domain;
+      this.profileMetaData = metaData;
+   }
+   
+   public ProfileKey getKey()
+   {
+      return key;
+   }
+   
+   public ProfileMetaData getProfileMetaData()
+   {
+      return profileMetaData;
+   }
+   
+   public void addCapability(ProfileCapability capability)
+   {
+      this.capabilites.add(capability);
+   }
+
+   public void addRequirement(ProfileRequirement requirement)
+   {
+      this.requirements.add(requirement);
+   }
+
+   public Collection<ProfileCapability> getCapabilities()
+   {
+      return this.capabilites;
+   }
+
+   public Collection<ProfileRequirement> getRequirements()
+   {
+      return this.requirements;
+   }
+
+   public void visit(ProfileMetaDataVisitorNode node)
+   {
+      node.visit(this);
+   }
+
+   protected ProfileKey resolve(ProfileRequirementDependencyItem requirement)
+   {
+      return domain.resolve(this, requirement.getRequirement()); 
+   }
+
+   protected void describe(ProfileControllerContext context)
+   {
+      if(described.getAndSet(true))
+         return;
+      
+      // Visit the profile meta data
+      visit(profileMetaData);
+      // Create the dependencies
+      Collection<ProfileRequirement> requirements = getRequirements();
+      if(requirements != null && requirements.isEmpty() == false)
+      {
+         for(ProfileRequirement requirement : requirements)
+         {
+            context.getDependencyInfo().addIDependOn(
+                  new ProfileRequirementDependencyItem(this,
+                        requirement, ControllerState.DESCRIBED));
+         }
+      }
+   }
+   
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName()).append('@');
+      buffer.append(Integer.toHexString(System.identityHashCode(this)));
+      buffer.append('{');
+      toString(buffer);
+      buffer.append('}');
+      return buffer.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append("key=").append(getKey());
+   }
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -59,13 +59,13 @@
       ProfileControllerContext ctx = (ProfileControllerContext) context;
       
       Profile profile = ctx.getProfile();
+      if(profile == null)
+         throw new NoSuchProfileException("null profile " + ctx.getProfileKey());
       if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
       {
          ProfileDeployerPlugin deployer = ((ProfileServiceController)ctx.getController()).getDeployer(ctx.getProfileMetaData());
-         if(profile == null)
-            throw new NoSuchProfileException("null profile " + ctx.getProfileKey());
          if(deployer == null)
-            throw new IllegalStateException("null deployer");
+            throw new IllegalStateException("null deployer for profile " + profile.getKey());
             
          // Deploy
          deploy(profile, deployer);         

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.dependency;
+
+import org.jboss.dependency.spi.ControllerContext;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDescribeAction extends AbstractProfileAction
+{
+
+   /** The instance. */
+   private static final ProfileDescribeAction instance = new ProfileDescribeAction();
+   
+   public static ProfileDescribeAction getInstance()
+   {
+      return instance;
+   }
+   
+   @Override
+   public void install(ControllerContext context) throws Throwable
+   {
+      if(context instanceof ProfileControllerContext)
+      {
+         ((ProfileControllerContext)context).getDependencyContext().describe((ProfileControllerContext) context);
+      }
+   }
+   
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -35,7 +35,7 @@
    /** The instance. */
    protected final static ProfileInstantiateAction instace = new ProfileInstantiateAction();
    
-   public static ProfileInstantiateAction getInstace()
+   public static ProfileInstantiateAction getInstance()
    {
       return instace;
    }
@@ -60,7 +60,9 @@
    @Override
    public void uninstall(ControllerContext context)
    {
-      //
+      if(context instanceof ProfileControllerContext == false) return;
+      ProfileControllerContext ctx = (ProfileControllerContext) context;
+      ctx.setTarget(null);
    }
    
 }

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -40,7 +40,7 @@
 {
 
    /** The profile controller context. */
-   private ProfileControllerContext context;
+   private ProfileDependencyContext context;
    
    /** The profile requirement to resolve. */
    private ProfileRequirement requirement;
@@ -48,9 +48,9 @@
    /** The on demand ctx. */
    private ProfileKey resolvedCtx;
    
-   public ProfileRequirementDependencyItem(ProfileControllerContext context, ProfileRequirement requirement, ControllerState state)
+   public ProfileRequirementDependencyItem(ProfileDependencyContext context, ProfileRequirement requirement, ControllerState state)
    {
-      super(context != null ? context.getName() : null, null, state, ControllerState.INSTALLED);
+      super(context != null ? context.getKey() : null, null, state, ControllerState.INSTALLED);
       if(context == null)
          throw new IllegalArgumentException("null context");
       if(requirement == null)
@@ -70,8 +70,7 @@
       ProfileKey iDependOn = resolvedCtx;
       if(iDependOn == null)
       {
-         // Cache the result, as we only do setIDependOn
-         // when the dependent context is installed (fully deployed)
+         // Cache the result
          iDependOn = context.resolve(this);
       }
       if(iDependOn != null)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -46,7 +46,7 @@
    public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy"); 
    
    /** The profile factory. */
-   private ProfileFactory<ProfileMetaData, Profile> factory;
+   private ProfileFactory<ProfileMetaData, Profile> profileFactory;
    
    /** The deployers registry. */
    private ProfileDeployerPluginRegistry registry;
@@ -60,14 +60,14 @@
       addState(DEPLOY_STATE, ControllerState.INSTALLED);
    }
    
-   public void setFactory(ProfileFactory<ProfileMetaData, Profile> factory)
+   public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> factory)
    {
-      this.factory = factory;
+      this.profileFactory = factory;
    }
    
    public Profile createProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
    {
-      return this.factory.createProfile(key, metaData);
+      return this.profileFactory.createProfile(key, metaData);
    }
    
    public void setDeployerRegistry(ProfileDeployerPluginRegistry registry)

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,105 +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.dependency;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.dependency.ProfileCapability;
-import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
-import org.jboss.profileservice.spi.dependency.ProfileRequirement;
-
-/**
- * A ordered structure of ProfileContexts used for resolving dependencies.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfilesRequirementResolver
-{
-   
-   /** The dependency contexts. */
-   private List<ProfileDependencyContext> contexts = new CopyOnWriteArrayList<ProfileDependencyContext>();
-   
-   /** The logger. */
-   private static final Logger log = Logger.getLogger(ProfilesRequirementResolver.class);
-   
-   public void addDependencyContext(ProfileDependencyContext ctx)
-   {
-      if(ctx == null)
-         throw new IllegalArgumentException("null dependency context");
-      this.contexts.add(ctx);
-   }
-   
-   public void removeDependencyContext(ProfileDependencyContext ctx)
-   {
-      if(ctx == null)
-         throw new IllegalArgumentException("null dependency context");
-      this.contexts.remove(ctx);
-   }
-   
-   public ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
-   {
-      // Resolve the requirements based on the exposed capabilities
-      boolean trace = log.isTraceEnabled();
-      for(ProfileDependencyContext child : contexts)
-      {
-         Collection<ProfileCapability> capabilities = child.getCapabilities();
-         if(capabilities != null && capabilities.isEmpty() == false)
-         {
-            for(ProfileCapability capability : capabilities)
-            {
-               if(capability.resolves(requirement))
-               {
-                  if(trace)
-                     log.trace(child.getKey() + " matched " + requirement + " with capability " + capability);
-                  return child.getKey();
-               }
-            }
-         }
-      }
-      
-      // Unresolved
-      return null;
-   }
-
-   public String toString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(getClass().getSimpleName()).append('@');
-      buffer.append(Integer.toHexString(System.identityHashCode(this)));
-      buffer.append('{');
-      toString(buffer);
-      buffer.append('}');
-      return buffer.toString();
-   }
-   
-   protected void toString(StringBuilder builder)
-   {
-      builder.append(", contexts=").append(this.contexts);
-   }
-   
-}
-

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -29,7 +29,6 @@
 import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
 import org.jboss.profileservice.profile.metadata.RootProfileMetaData;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.Unmarshaller;
@@ -139,11 +138,6 @@
       Unmarshaller un = UnmarshallerFactory.newInstance().newUnmarshaller();
       return clazz.cast(un.unmarshal(is, resolver));      
    }
- 
-   protected ProfileKey createProfileKey(ProfileKeyMetaData metaData)
-   {
-      return ProfileKey.createProfileKey(metaData);
-   }
    
 }
 

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -34,7 +34,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.jboss.logging.Logger;
-import org.jboss.profileservice.repository.BasicProfileDeployment;
+import org.jboss.profileservice.repository.ProfileDeploymentFactory;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileDeployment;
@@ -73,7 +73,7 @@
    protected final Logger log = Logger.getLogger(getClass());
    
    /** The deployment factory. */
-   // TODO private ProfileDeploymentFactory deploymentFacotry;
+   private final static ProfileDeploymentFactory deploymentFactory = ProfileDeploymentFactory.getInstance();
    
    public AbstractVFSProfileSource(URI[] uris)
    {
@@ -367,8 +367,7 @@
     */
    protected static ProfileDeployment createDeployment(VirtualFile vf)
    {
-      // TODO use the deployment factory
-      return new BasicProfileDeployment(vf);
+      return deploymentFactory.createDeployment(vf); 
    }
    
    /**

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -21,11 +21,13 @@
  */ 
 package org.jboss.profileservice.profile.bootstrap;
 
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.profileservice.ProfileDeployerPlugin;
 import org.jboss.profileservice.spi.ProfileDeployment;
 
@@ -37,7 +39,7 @@
 {
 
    /** The deployments. */
-   private final Collection<String> deployments = new ArrayList<String>();
+   private final Map<String, KernelDeployment> deployments = new ConcurrentHashMap<String, KernelDeployment>();
    
    /** The deployer. */
    private final BasicXMLDeployer deployer;
@@ -55,9 +57,9 @@
       try
       {
          // Deploy
-         this.deployer.deploy(deployment.getRoot().toURL());
+         KernelDeployment result = this.deployer.deploy(deployment.getRoot().toURL());
          // Add to the deployments
-         this.deployments.add(deployment.getName());
+         this.deployments.put(deployment.getName(), result);
       }
       catch(Exception e)
       {
@@ -107,12 +109,29 @@
       if(deployment == null)
          throw new IllegalArgumentException("null deployment");
       
-      if(this.deployments.contains(deployment.getName()))
+      if(this.deployments.containsKey(deployment.getName()))
       {
          this.deployments.remove(deployment.getName());
          this.deployer.undeploy(deployment.getRoot().toURL());
       }
    }
    
+   @Override
+   public ManagedDeployment getManagedDeployment(ProfileDeployment deployment)
+   {
+      if(deployment == null)
+      {
+         throw new IllegalArgumentException("null deployment");
+      }
+      KernelDeployment result = this.deployments.get(deployment.getName());
+      if(result == null)
+      {
+         throw new IllegalStateException("no deployment registered with name " + deployment.getName());
+      }
+      // FIXME getManagedDeployment
+      // mgtDeploymentCreator.build(result, managedObjects);
+      return null;
+   }
+   
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -24,70 +24,28 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import org.jboss.dependency.plugins.AbstractControllerContextActions;
-import org.jboss.dependency.plugins.action.ControllerContextAction;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.profileservice.dependency.AbstractProfileContextFactory;
-import org.jboss.profileservice.dependency.AbstractProfileDependencyContext;
-import org.jboss.profileservice.dependency.ProfileControllerContext;
-import org.jboss.profileservice.dependency.ProfileCreateAction;
-import org.jboss.profileservice.dependency.ProfileInstallAction;
-import org.jboss.profileservice.dependency.ProfileInstantiateAction;
-import org.jboss.profileservice.dependency.ProfileServiceController;
-import org.jboss.profileservice.dependency.ProfileStartAction;
 import org.jboss.profileservice.profile.FilteredProfile;
 import org.jboss.profileservice.profile.metadata.BasicProfileDeploymentMetaData;
-import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileFactory;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class BootstrapProfileContextFactory extends AbstractProfileContextFactory implements ProfileFactory<BootstrapProfileMetaData, FilteredProfile>
+public class BootstrapProfileContextFactory implements ProfileFactory<BootstrapProfileMetaData, FilteredProfile>
 {
 
    /** The types. */
    private static final String[] types = new String[] { BootstrapProfileMetaData.class.getName() };
    
-   /** The default actions. */
-   protected static final AbstractControllerContextActions defaultActions;
-   
-   static
-   {
-      Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
-      actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstace());
-      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
-      actions.put(ControllerState.START, ProfileStartAction.getInstance());
-      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
-      actions.put(ProfileServiceController.DEPLOY_STATE, BootstrapDeployAction.getInstance());
-      defaultActions = new AbstractControllerContextActions(actions);
-   }
-   
    @Override
    public String[] getTypes()
    {
       return types;
    }
-   
-   @Override
-   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
-   {
-      ProfileDependencyContext ctx = createDependencyContext(key, metaData);
-      return new ProfileControllerContext(ctx, defaultActions, profile);
-   }
-   
-   protected ProfileDependencyContext createDependencyContext(ProfileKey key, ProfileMetaData metaData)
-   {
-      return new AbstractProfileDependencyContext(key, metaData, getRequirementResolver());
-   }
 
    @Override
    public FilteredProfile createProfile(ProfileKey key, BootstrapProfileMetaData metaData) throws Exception

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -76,15 +76,25 @@
       return this.deployments;
    }
    
+   /**
+    * The domain attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "domain")
+   @XmlTransient
    public String getDomain()
    {
       return super.getDomain();
    }
    
+   /**
+    * The server attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "server")
+   @XmlTransient
    public String getServer()
    {
       return super.getServer();
@@ -104,13 +114,6 @@
       return super.getSubprofiles();
    }
    
-   @Override
-   @XmlTransient
-   public ProfileKey getKey()
-   {
-      return super.getKey();
-   }
-   
    @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
    public void setDeployments(List<BasicProfileDeploymentMetaData> deployments)
    {

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -78,15 +78,25 @@
       return this.deployments;
    }
    
+   /**
+    * The domain attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "domain")
+   @XmlTransient
    public String getDomain()
    {
       return super.getDomain();
    }
    
+   /**
+    * The server attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "server")
+   @XmlTransient
    public String getServer()
    {
       return super.getServer();
@@ -106,13 +116,6 @@
       return super.getSubprofiles();
    }
    
-   @Override
-   @XmlTransient
-   public ProfileKey getKey()
-   {
-      return super.getKey();
-   }
-   
    @XmlElements
    ({
       @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class),

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -59,15 +59,25 @@
       super(key);
    }
    
+   /**
+    * The domain attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "domain")
+   @XmlTransient
    public String getDomain()
    {
       return super.getDomain();
    }
    
+   /**
+    * The server attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "server")
+   @XmlTransient
    public String getServer()
    {
       return super.getServer();
@@ -81,13 +91,6 @@
    }
    
    @Override
-   @XmlTransient
-   public ProfileKey getKey()
-   {
-      return super.getKey();
-   }
-   
-   @Override
    public boolean isOptional()
    {
       return optional;

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -29,6 +29,7 @@
 import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlNsForm;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData;
@@ -83,18 +84,30 @@
       return super.getName();
    }
    
-   @XmlAttribute(name = "server")
-   public String getServer()
-   {
-      return super.getServer();
-   }
-
-   @XmlAttribute(name = "domain")
+   /**
+    * The domain attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
+   @Override
+   @XmlTransient
    public String getDomain()
    {
       return super.getDomain();
    }
    
+   /**
+    * The server attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
+   @Override
+   @XmlTransient
+   public String getServer()
+   {
+      return super.getServer();
+   }
+   
    @XmlElements({
       @XmlElement(name = "profile", type = BasicProfileMetaData.class),
       @XmlElement(name = "bootstrap-profile", type = BootstrapProfileMetaData.class),

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -21,6 +21,7 @@
  */ 
 package org.jboss.profileservice.repository;
 
+import org.jboss.profileservice.repository.artifact.DelegatingArtifactRepository;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.repository.ArtifactId;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
@@ -38,6 +39,19 @@
 public class ProfileDeploymentFactory extends AbstractVirtualDeploymentAssembly
 {
 
+   /** The instance. */
+   private static final ProfileDeploymentFactory instance = new ProfileDeploymentFactory();
+   
+   public static final ProfileDeploymentFactory getInstance()
+   {
+      return instance;
+   }
+   
+   public ProfileDeploymentFactory()
+   {
+      super(DelegatingArtifactRepository.getInstance());
+   }
+   
    public ProfileDeploymentFactory(ArtifactRepository<ArtifactId> repository)
    {
       super(repository);

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifact.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -61,6 +61,19 @@
    }
 
    @Override
+   public long getLastModified()
+   {
+      try
+      {
+         return getFile().getLastModified();
+      }
+      catch(IOException e)
+      {
+         return 0L;
+      }
+   }
+   
+   @Override
    public ArtifactRepository<T> getRepository()
    {
       return this.repository;

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -43,6 +43,9 @@
    /** The repository root. */
    private VirtualFile repositoryRoot;
 
+   /** Is mutable. */
+   private boolean mutable;
+   
    public AbstractArtifactRepository(String type, URI root) throws IOException
    {
       if(root == null)
@@ -73,6 +76,12 @@
    {
       return this.repositoryRoot;
    }
+
+   @Override
+   public boolean isMutable()
+   {
+      return this.mutable;
+   }
    
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DelegatingArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DelegatingArtifactRepository.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/DelegatingArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.repository.artifact;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -40,16 +41,42 @@
 public class DelegatingArtifactRepository implements ArtifactRepository<ArtifactId>
 {
    
+   /** The instance. */
+   private static final DelegatingArtifactRepository instance = new DelegatingArtifactRepository();
+   
    /** The repositories. */
    private Map<String, ArtifactRepository<ArtifactId>> repositories = new ConcurrentHashMap<String, ArtifactRepository<ArtifactId>>();
-
-   @Override
+   
+   public static DelegatingArtifactRepository getInstance()
+   {
+      return instance;
+   }
+   
+   private DelegatingArtifactRepository()
+   {
+      
+   }
+   
    public ArtifactRepositoryConfiguration getConfiguration()
    {
       return null; // TODO
    }
    
    @Override
+   public Collection<Artifact<ArtifactId>> getArtifacts()
+   {
+      // FIXME getArtifacts
+      return null;
+   }
+   
+   @Override
+   public boolean isMutable()
+   {
+      // FIXME isMutable
+      return false;
+   }
+   
+   @Override
    public boolean containsArtifact(ArtifactId artifact)
    {
       return getRepository(artifact).containsArtifact(artifact);

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
+import java.util.Collection;
 
 import org.jboss.profileservice.repository.artifact.AbstractArtifactRepository;
 import org.jboss.profileservice.spi.repository.Artifact;
@@ -62,6 +63,12 @@
    }
    
    @Override
+   public Collection<Artifact<FileArtifact>> getArtifacts()
+   {
+      return null;
+   }
+   
+   @Override
    public VirtualFile getArtifactFile(FileArtifact artifact) throws IOException
    {
       if(artifact == null)

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.jboss.profileservice.spi.repository.Artifact;
@@ -71,6 +72,15 @@
    }
    
    @Override
+   public Collection<Artifact<MavenArtifactId>> getArtifacts()
+   {
+      Collection<Artifact<MavenArtifactId>> artifacts = new ArrayList<Artifact<MavenArtifactId>>();
+      for(MavenArtifact artifact : this.artifacts)
+         artifacts.add(artifact);
+      return artifacts;
+   }
+   
+   @Override
    public VirtualFile getArtifactFile(MavenArtifactId artifactId) throws IOException
    {
       MavenArtifact artifact = resolveArtifact(artifactId);

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/MavenArtifactReference.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/MavenArtifactReference.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/MavenArtifactReference.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -256,6 +256,10 @@
    {
       buffer.append("group=").append(getGroupId());
       buffer.append(", artifact=").append(getArtifactId());
+      if(getClassifier() != null)
+         buffer.append(", classifier=").append(getClassifier());
+      if(getPackagingType() != null)
+         buffer.append(", packaging=").append(getPackagingType());
       buffer.append(", version=").append(getVersionRange().toString());
    }
    

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -278,8 +278,8 @@
          
          if(deleteFile && root != null)
          {
-            // Delete the file
-            if(root.delete() == false)
+            // Delete the file and check if the delete was successful
+            if(root.delete() == false && root.exists())
                throw new IOException("Failed to delete: " + root);
             
             cleanUpRoot(root);  

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/version/helpers/VersionSupport.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/version/helpers/VersionSupport.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/version/helpers/VersionSupport.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -33,7 +33,7 @@
 import org.jboss.profileservice.version.VersionComparatorRegistry;
 
 /**
- * NameAndVersionSupport.
+ * VersionSupport.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -58,8 +58,9 @@
    protected ContextInfo createStructureMetaData(Deployment deployment, String path, VirtualDeploymentAssemblyContext ctx)
    {
       if(ctx instanceof BasicVirtualAssemblyContext)
+      {
          return createStructureMetaData(deployment, path, (BasicVirtualAssemblyContext) ctx);
-      
+      }
       return null;
    }
    

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -27,6 +27,7 @@
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlNsForm;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.profileservice.profile.metadata.BasicProfileSourceMetaData;
@@ -80,15 +81,25 @@
       return this.deployments;
    }
    
+   /**
+    * The domain attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "domain")
+   @XmlTransient
    public String getDomain()
    {
       return super.getDomain();
    }
    
+   /**
+    * The server attribute needs to be configured
+    * in the domain meta data and is shared across
+    * all local profiles.
+    */
    @Override
-   @XmlAttribute(name = "server")
+   @XmlTransient
    public String getServer()
    {
       return super.getServer();

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -70,7 +70,7 @@
    
    protected DelegatingArtifactRepository createRepository(MavenArtifactRepositoryMetaData metaData) throws Exception
    {
-      DelegatingArtifactRepository repository = new DelegatingArtifactRepository();
+      DelegatingArtifactRepository repository = DelegatingArtifactRepository.getInstance();
       repository.addRepository(FileArtifact.TYPE, (ArtifactRepository) new LocalFileArtifactRepository(getResource("repository/static").toURI()));
       repository.addRepository(MavenArtifactId.TYPE, (ArtifactRepository) new LocalMavenArtifactRepository(metaData, getResource("repository").toURI()));
       return repository;

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.profileservice.support;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
+import org.jboss.profileservice.domain.DomainMetaData;
+import org.jboss.profileservice.domain.ManagementDomainMetaData;
+import org.jboss.profileservice.domain.ServerMetaData;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileServiceBootstrap extends AbstractProfileServiceBootstrap
+{
+
+   private Kernel kernel;
+   private ProfileDeployerPluginRegistry registry;
+   private ProfileFactory<ProfileMetaData, Profile> profileFactory;
+   
+   public ProfileServiceBootstrap(Kernel kernel)
+   {
+      if(kernel == null)
+         throw new IllegalArgumentException("null kernel");
+      this.kernel = kernel;
+   }
+
+   @Override
+   protected KernelController getController()
+   {
+      return this.kernel.getController();
+   }
+
+   @Override
+   public ProfileDeployerPluginRegistry getDeployerRegistry()
+   {
+      return this.registry;
+   }
+   
+   public void setDeployerRegistry(ProfileDeployerPluginRegistry registry)
+   {
+      this.registry = registry;
+   }
+
+   @Override
+   public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
+   {
+      return this.profileFactory;
+   }
+
+   public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> profileFactory)
+   {
+      this.profileFactory = profileFactory;
+   }
+
+   public void start() throws Throwable
+   {
+      DomainMetaData domain = new DomainMetaData();
+      ManagementDomainMetaData mgtDomain = new ManagementDomainMetaData("domain1");
+      ServerMetaData server = new ServerMetaData("server1");
+      domain.setDomain(mgtDomain);
+      domain.setServer(server);
+      createProfileService(domain);
+   }
+   
+}
+

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -54,12 +54,11 @@
       getLog().debug(profiles);
       
       // Now get the ProfileService
-      ProfileService ps = getBean("ProfileService", ProfileService.class);
+      ProfileService ps = getBean("org.jboss:service=ProfileService", ProfileService.class);
       
       // And activate the profiles
-      for(ProfileMetaData profile : profiles)
+      for(ProfileKey key : ps.getProfileKeys())
       {
-         ProfileKey key = ProfileKey.createProfileKey(profile);
          ps.activateProfile(key);
       }
 

Modified: projects/profileservice/trunk/core/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/bootstrap/bootstrap.xml	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/core/src/test/resources/bootstrap/bootstrap.xml	2009-09-16 12:31:48 UTC (rev 93604)
@@ -5,24 +5,17 @@
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
 	<!-- The Profile Service -->
-	<bean name="ProfileService" class="org.jboss.profileservice.AbstractProfileService">
+	<bean name="ProfileServiceBootstrap" class="org.jboss.test.profileservice.support.ProfileServiceBootstrap">
 		<constructor>
-			<parameter><inject bean="jboss.kernel:service=KernelController" /></parameter>
-			<parameter><inject bean="ProfileDeployerPluginRegistry" /></parameter>
-			<parameter><inject bean="TypedProfileFactory" /></parameter>
+			<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
 		</constructor>
-		<property name="contextFactory"><inject bean="ControllerContextFactory" /></property>
+		<property name="deployerRegistry"><inject bean="ProfileDeployerPluginRegistry" /></property>
+		<property name="profileFactory"><inject bean="TypedProfileFactory" /></property>
 	</bean>
 	
 	<!-- A deployerPlugin registry - used when we want to swap the deployer -->
 	<bean name="ProfileDeployerPluginRegistry" class="org.jboss.profileservice.ProfileDeployerPluginRegistry" />
 	
-	<bean name="ControllerContextFactory" class="org.jboss.profileservice.dependency.DelegatingProfileContextFactory">
-		<property name="defaultContextFactory"><inject bean="DefaultControllerContextFactory" /></property>
-		<incallback method="addProfileContextFactory" />
-		<uncallback method="removeProfileContextFactory" />
-	</bean>
-	
 	<!-- Create a ctx for the BootstrapProfileMetaData -->
 	<bean name="BootstrapContextFactory" class="org.jboss.profileservice.profile.bootstrap.BootstrapProfileContextFactory" />
 	
@@ -36,12 +29,9 @@
 		</install>
 	</bean>
 
-	<!-- The default controller context factory -->
-	<bean name="DefaultControllerContextFactory" class="org.jboss.profileservice.dependency.DefaultProfileContextFactory" />
-
 	<!-- The Profile metaData factory - which is parsing the profile.xmls -->
 	<bean name="ProfileMetaDataFactory" class="org.jboss.profileservice.metadata.RegisteringProfileMetaDataFactory">
-		<constructor><parameter><inject bean="ProfileService" /></parameter></constructor>
+		<constructor><parameter><inject bean="org.jboss:service=ProfileService" /></parameter></constructor>
 	</bean>
 	
 	<!-- The profile factories -->

Modified: projects/profileservice/trunk/domain/pom.xml
===================================================================
--- projects/profileservice/trunk/domain/pom.xml	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/domain/pom.xml	2009-09-16 12:31:48 UTC (rev 93604)
@@ -8,12 +8,31 @@
   <groupId>org.jboss.profileservice</groupId>
   <artifactId>jboss-profileservice-domain</artifactId>
   <version>1.0.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
+  <packaging>jar</packaging>
   <name>JBoss ProfileService Domain Model</name>
   <url>http://www.jboss.org/jbossas</url>
   <description>JBoss ProfileService Management Domain Model</description>
 
   <dependencies>
+		<dependency>
+			<groupId>org.jboss.microcontainer</groupId>
+			<artifactId>jboss-dependency</artifactId>
+			<version>${version.org.jboss.microcontainer}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.microcontainer</groupId>
+			<artifactId>jboss-kernel</artifactId>
+			<version>${version.org.jboss.microcontainer}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.profileservice</groupId>
+			<artifactId>jboss-profileservice-spi</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
   </dependencies>
   
 </project>

Modified: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -18,15 +18,60 @@
  * 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.domain;
 
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
 /**
+ * The domain meta data.
+ * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
+ at XmlRootElement(name = "domain")
+ at XmlType(name = "managementDomainType", propOrder = {"domain", "server"})
 public class DomainMetaData
 {
 
+   /** The management domain information. */
+   private ManagementDomainMetaData domain;
+   
+   /** The local server information. */
+   private ServerMetaData server;
+   
+   /**
+    * Get the management domain information.
+    * 
+    * @return the domain meta data
+    */
+   @XmlElement(name = "management-domain")
+   public ManagementDomainMetaData getDomain()
+   {
+      return domain;
+   }
+   
+   public void setDomain(ManagementDomainMetaData domain)
+   {
+      this.domain = domain;
+   }
+
+   /**
+    * Get the server meta data.
+    * 
+    * @return the server meta data
+    */
+   @XmlElement(name = "jboss-server")
+   public ServerMetaData getServer()
+   {
+      return server;
+   }
+
+   public void setServer(ServerMetaData server)
+   {
+      this.server = server;
+   }
+
 }
-

Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ManagementDomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ManagementDomainMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ManagementDomainMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.domain;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagementDomainMetaData
+{
+   
+   /** The management domain name. */
+   private String domainName;
+   
+   public ManagementDomainMetaData()
+   {
+
+   }
+   
+   public ManagementDomainMetaData(String domainName)
+   {
+      this.domainName = domainName;
+   }
+   
+   @XmlAttribute(name = "name")
+   public String getDomainName()
+   {
+      return domainName;
+   }
+   
+   public void setDomainName(String domainName)
+   {
+      this.domainName = domainName;
+   }
+
+}
+

Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ServerMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ServerMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/ServerMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.domain;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Meta information for the local server.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ServerMetaData
+{
+
+   /** The server name. */
+   private String name;
+   
+   public ServerMetaData()
+   {
+
+   }
+   
+   public ServerMetaData(String name)
+   {
+      this.name = name;
+   }
+   
+   /** 
+    * Get the server name.
+    * 
+    * @return the server name
+    */
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+}
+

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -36,14 +36,21 @@
  */
 public interface ProfileService
 {
+
+   /**
+    * Get the management domain name.
+    * 
+    * @return the domain name
+    */
+   String getDomainName();
    
    /**
-    * Get the unique domains for which profiles exist.
+    * Get the local server name.
     * 
-    * @return array of profile domains
+    * @return the server name
     */
-   String[] getDomains();
-
+   String getServerName();
+   
    /**
     * Get the keys for all registered profiles.
     * 
@@ -95,26 +102,16 @@
     * @param profile the profile meta data
     * @throws Exception for any error
     */
-   void registerProfile(ProfileMetaData metaData) throws Exception;
+   ProfileKey registerProfile(ProfileMetaData metaData) throws Exception;
    
    /**
     * Register a Profile.
     * 
-    * @param key the profile key
     * @param profile the profile meta data
-    * @throws Exception for any error
-    */
-   void registerProfile(ProfileKey key, ProfileMetaData metaData) throws Exception;
-   
-   /**
-    * Register a Profile.
-    * 
-    * @param key the profile key
-    * @param profile the profile meta data
     * @param profile the profile
     * @throws Exception for any error
     */
-   void registerProfile(ProfileKey key, ProfileMetaData metaData, Profile profile) throws Exception;
+   ProfileKey registerProfile(ProfileMetaData metaData, Profile profile) throws Exception;
    
    /**
     * Activate a registered profile.

Deleted: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -1,75 +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.spi.dependency;
-
-import java.util.Collection;
-
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * A dependency context for a profile.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public interface ProfileDependencyContext
-{
-
-   /**
-    * Get the profile key.
-    * 
-    * @return
-    */
-   ProfileKey getKey();
-   
-   /**
-    * Get the profile meta data.
-    * 
-    * @return the meta data
-    */
-   ProfileMetaData getProfileMetaData();
-   
-   /**
-    * Get the capabilities of the profile.
-    * 
-    * @return the capabilities
-    */
-   Collection<ProfileCapability> getCapabilities();
-   
-   /**
-    * Get the requirements of the profile.
-    * 
-    * @return the requirements
-    */
-   Collection<ProfileRequirement> getRequirements();
-
-   /**
-    * Try to resolve a profile requirement.
-    * 
-    * @param requirement the profile requirement
-    * @return the resolved profile key, null if the requirement cannot be resolved
-    */
-   ProfileKey resolve(ProfileRequirement requirement);
-   
-}
-

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -56,14 +56,7 @@
    
    public boolean resolves(ProfileRequirement requirement)
    {
-      if(requirement instanceof AbstractProfileKeyMetaData)
-      {
-         // Resolve against any other AbstractProfileKeyMetaData
-         AbstractProfileKeyMetaData other = (AbstractProfileKeyMetaData) requirement;
-         if(getKey() != null && getKey().equals(other.getKey()))
-            return true;
-      }
-      return false;
+      return super.equals(requirement);
    }
    
    @Override
@@ -75,6 +68,8 @@
          return false;
       return super.equals(obj);
    }
+   
 
+
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -43,9 +43,6 @@
    /** The domain. */
    private String domain;
    
-   /** The profile key. */
-   private volatile ProfileKey key;
-   
    public AbstractProfileKeyMetaData()
    {
       //
@@ -61,7 +58,6 @@
       this.domain = domain;
       this.server = server;
       this.name = name;
-      createKey();
    }
    
    public AbstractProfileKeyMetaData(ProfileKey key)
@@ -69,7 +65,6 @@
       this.domain = key.getDomain();
       this.server = key.getServer();
       this.name = key.getName();
-      this.key = key;
    }
 
    public String getName()
@@ -102,19 +97,6 @@
       this.domain = domain;
    }
    
-   public ProfileKey getKey()
-   {
-      if(this.key == null)
-         createKey();
-      
-      return this.key;
-   }
-   
-   protected void createKey()
-   {
-      this.key = new ProfileKey(this);
-   }
-   
    @Override
    public boolean equals(Object obj)
    {
@@ -123,7 +105,14 @@
       if (obj == null || obj instanceof AbstractProfileKeyMetaData == false)
          return false;
       
-      return (getKey().equals(((AbstractProfileKeyMetaData)obj).getKey()));
+      AbstractProfileKeyMetaData other = (AbstractProfileKeyMetaData) obj;
+      if(equals(getDomain(), other.getDomain()) == false)
+         return false;
+      if(equals(getServer(), other.getServer()) == false)
+         return false;
+      if(equals(getName(), other.getName()) == false)
+         return false;
+      return true; 
    }
    
    @Override
@@ -149,6 +138,15 @@
       builder.append(", server=").append(getServer());
       builder.append(", name=").append(getName());
    }
+
+   private static boolean equals(Object one, Object two)
+   {
+      if (one == null && two == null)
+         return true;
+      if (one == null && two != null)
+         return false;
+      return one.equals(two);
+   }
    
 }
 

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -39,6 +39,13 @@
    T getIdentifier();
    
    /**
+    * Get the last modified.
+    * 
+    * @return last modified
+    */
+   long getLastModified();
+   
+   /**
     * Get the repository.
     * 
     * @return the repository

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	2009-09-16 11:59:34 UTC (rev 93603)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.spi.repository;
 
 import java.io.IOException;
+import java.util.Collection;
 
 import org.jboss.virtual.VirtualFile;
 
@@ -59,6 +60,13 @@
    Artifact<T> getArtifact(T artifactId);
    
    /**
+    * Get the available artifacts.
+    * 
+    * @return the artifacts
+    */
+   Collection<Artifact<T>> getArtifacts();
+   
+   /**
     * Get the artifact file from the repository.
     * 
     * @param artifact the artifact
@@ -66,6 +74,13 @@
     * @throws IOException
     */
    VirtualFile getArtifactFile(T artifact) throws IOException;
+
    
+   /**
+    * Is mutable.
+    * 
+    * @return isMutable
+    */
+   boolean isMutable();
 }
 

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/MutableArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/MutableArtifactRepository.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/MutableArtifactRepository.java	2009-09-16 12:31:48 UTC (rev 93604)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.spi.repository;
+
+import java.io.IOException;
+
+/**
+ * The mutable artifact repository.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface MutableArtifactRepository<T extends ArtifactId> extends ArtifactRepository<T>
+{
+
+   /**
+    * Add a artifact to the repository.
+    * 
+    * @param artifact the artifact to add
+    */
+   public void addArtifact(Artifact<T> artifact) throws IOException;
+   
+   /**
+    * Remove a artifact from the repository.
+    * 
+    * @param artifactId the artifact id
+    */
+   public void removeArtifact(T artifactId) throws IOException;
+   
+}
+




More information about the jboss-cvs-commits mailing list