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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 29 09:25:10 EDT 2010


Author: emuckenhuber
Date: 2010-03-29 09:25:07 -0400 (Mon, 29 Mar 2010)
New Revision: 103119

Added:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/MainDeployerPlugin.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/VDFDeploymentBuilder.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileActivationUnitTestCase.java
   projects/profileservice/trunk/core/src/test/resources/repository/static/deployment.jar/
Removed:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
Modified:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.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/ProfileServiceController.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScanner.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileLifeCycleEvent.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileModificationEvent.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ScanningProfileFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/helpers/AbstractProfileMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/BasicResolverFactory.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.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/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
   projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
   projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/TransientProfileActivator.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentDistributeAction.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/DefaultContextStateMapper.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/RegisteredProfileView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/ManagedProfileSupport.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/TransientProfileUnitTestCase.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/action/engine/ModificationEvent.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfile.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfileConfiguration.java
Log:
wip

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	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -84,10 +84,6 @@
     */
    public void setDeploymentManager(DeploymentManager deploymentMgr)
    {
-      if(deploymentMgr == null)
-      {
-         throw new IllegalArgumentException("null deployment manager");
-      }
       this.deploymentMgr = deploymentMgr;
    }
 
@@ -106,10 +102,6 @@
     */
    public void setViewManager(ManagementView mgtView)
    {
-      if(mgtView == null)
-      {
-         throw new IllegalArgumentException("null management view");
-      }
       this.mgtView = mgtView;
    }
 

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	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -60,6 +60,9 @@
    /** The requirement resolver factory. */
    private ProfileRequirementResolverFactory resolverFactory;
    
+   /** flag indicating if we are about to shutdown. */
+   private volatile boolean isShutdown = false;
+   
    public AbstractProfileServiceBootstrap(Kernel kernel, ProfileServiceConfig config)
    {
       super(config);
@@ -80,7 +83,6 @@
 
    protected void start(AbstractDomainMetaData domainMetaData) throws Throwable
    {
-      createProfileService(domainMetaData);
       ProfileRequirementResolver resolver = createRequirementResolver(domainMetaData);
       BasicDomainMetaDataVisitor visitor = new BasicDomainMetaDataVisitor(resolver, getMetaDataRegistry());
       Collection<DomainFeatureNode> features = domainMetaData.getFeatures();
@@ -94,7 +96,36 @@
       resolver.resolve();
       resolver.deploy();
    }
+
+   public void activate(ProfileKey key) throws Exception
+   {
+      checkShutdown();
+      if(this.activatedProfiles.contains(key) == false)
+      {
+         try
+         {
+            getController().installRegisteredContext(key);
+         }
+         catch(Exception e)
+         {
+            throw e;
+         }
+         catch(Throwable t)
+         {
+            throw new RuntimeException(t); 
+         }
+         getProfileService().activateProfile(key);
+         // Add in reversed order
+         this.activatedProfiles.add(0, key);
+      }
+      getProfileService().validateProfile(key);
+   }
    
+   protected void prepareShutdown()
+   {
+      this.isShutdown = true;
+   }
+   
    protected void stop(DomainMetaData domainMetaData)
    {
       for(ProfileKey key : activatedProfiles)
@@ -105,7 +136,7 @@
          }
          catch(NoSuchProfileException ignore)
          {
-            log.debug("failed to deactivate profile " + key);
+            log.warn("failed to deactivate profile " + key);
          }
       }
       for(ProfileKey key : activatedProfiles)
@@ -116,22 +147,23 @@
          }
          catch(NoSuchProfileException ignore)
          {
-            log.debug("failed to unregister profile " + key);
+            log.warn("failed to unregister profile " + key);
          }         
       }
    }
 
-   public void activate(ProfileKey key) throws Exception
-   {
-      getProfileService().activateProfile(key);
-      this.activatedProfiles.add(key);
-      getProfileService().validateProfile(key);
-   }
-   
    protected ProfileRequirementResolver createRequirementResolver(DomainMetaData domainMetaData)
    {
       return resolverFactory.createResolver(getConfig().getServerConfiguration().getServerName());
    }
+
+   protected void checkShutdown()
+   {
+      if(isShutdown)
+      {
+         throw new IllegalStateException("deployers are shutdown!");
+      }
+   }
    
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -54,6 +54,9 @@
    /** The meta data registry. */
    private ProfileMetaDataRegistry registry;
    
+   /** The profile service controller. */
+   private ProfileServiceController controller;
+   
    /** The profile service. */
    private ProfileService profileService;
    
@@ -105,6 +108,20 @@
    }
    
    /**
+    * Get the profile service controller.
+    * 
+    * @return the profile service controller
+    */
+   public ProfileServiceController getController()
+   {
+      if(controller == null)
+      {
+         throw new IllegalStateException("ProfileService not initialized");
+      }
+      return controller;
+   }
+   
+   /**
     * Get the MC kernel.
     * 
     * @return the kernel
@@ -124,7 +141,7 @@
       config.setManagementDomain(createManagementDomain(domainMetaData));
       config.setServerConfiguration(createServerConfiguration(domainMetaData));     
       // Create profile service
-      createProfileService();
+      initializeProfileService();
    }
    
    /**
@@ -133,12 +150,12 @@
     * @return the profile service
     * @throws Throwable
     */
-   public ProfileService createProfileService() throws Throwable
+   public ProfileService initializeProfileService() throws Throwable
    {
       // Create the registry
       this.registry = createProfileMetaDataRegistry();
       // Create the controller
-      ProfileServiceController controller = new ProfileServiceController(getKernel().getController(), registry, config);
+      this.controller = new ProfileServiceController(getKernel().getController(), registry, config);
       // Create the profile service
       this.profileService = new AbstractProfileService(controller);
       register(ProfileServiceConstants.PROFILESERVICE_NAME, profileService);

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -29,6 +29,7 @@
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
+import org.jboss.profileservice.spi.managed.ManagedProfileConfiguration;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
@@ -69,6 +70,15 @@
       return new DelegateDeployer(this);
    }
    
+   public ManagedProfileConfiguration getConfiguration()
+   {
+      if(getProfileMetaData() instanceof ManagedProfileConfiguration)
+      {
+         return ManagedProfileConfiguration.class.cast(getProfileMetaData());
+      }
+      return null;
+   }
+   
    public ManagedDeployment getManagedDeployment(ProfileDeployment deployment) throws Exception
    {
       return getDeployerPlugin().getManagedDeployment(deployment);

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	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -35,6 +35,7 @@
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.deployment.ProfileDeploymentFlag;
+import org.jboss.profileservice.spi.deployment.ProfileDeploymentInfo;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
@@ -80,7 +81,7 @@
       {
          throw new NoSuchProfileException("null profile " + context.getProfileKey());
       }
-      if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
+      if(profile.getDeployments() != null && profile.getDeployments().isEmpty() == false)
       {
          // Get the deployer plugin
          final ManagedProfileDeployer deployer = context.getManagedDeployer();
@@ -99,7 +100,7 @@
    {
       ProfileControllerContext context = ProfileControllerContext.class.cast(ctx);
       Profile profile = context.getProfile();
-      if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
+      if(profile.getDeployments() != null && profile.getDeployments().isEmpty() == false)
       {
          // Get the deployer plugin
          ManagedProfileDeployer deployer = context.getManagedDeployer();
@@ -116,7 +117,7 @@
    protected void deploy(final Profile profile, final ManagedProfileDeployer deployer, final boolean isCheckComplete) throws Exception
    {
       final Collection<? extends ProfileDeployment> deployments = profile.getDeployments();
-      if (deployments != null && !deployments.isEmpty())
+      if (deployments != null && deployments.isEmpty() == false)
       {
          // Add deployments
          final Set<String> deploymentNames = new HashSet<String>();
@@ -126,6 +127,8 @@
             {
                // Add deployment
                deployer.addDeployment(deployment);
+               // Add to check complete set
+               deploymentNames.add(deployment.getName());
                // mark as deployed  
                deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.DEPLOYED);
             }
@@ -154,11 +157,17 @@
    protected void undeploy(Profile profile, ManagedProfileDeployer deployer)
    {
       Collection<ProfileDeployment> deployments = profile.getDeployments();
-      if (deployments != null && !deployments.isEmpty())
+      if (deployments != null && deployments.isEmpty() == false)
       {
          // remove deployments
          for (ProfileDeployment deployment : profile.getDeployments())
          {
+            ProfileDeploymentInfo info = deployment.getDeploymentInfo();
+            if(info.isDeployed() == false)
+            {
+               // Don't undeploy already stopped deployments
+               continue;
+            }
             try
             {
                // remove deployment

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	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -34,7 +34,6 @@
 import org.jboss.dependency.spi.ControllerStateModel;
 import org.jboss.dependency.spi.LifecycleCallbackItem;
 import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.metadata.spi.scope.CommonLevels;
 import org.jboss.profileservice.config.ProfileServiceConfig;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.Profile;
@@ -165,6 +164,16 @@
       return metaDataRegistry.getContext(key.getName());
    }
    
+   public void installRegisteredContext(ProfileKey key) throws Throwable
+   {
+      ProfileDependencyContext context = metaDataRegistry.getContext(key.getName());
+      if(context == null)
+      {
+         throw new NoSuchProfileException("no such profile "+ key);
+      }
+      install(context, null);
+   }
+   
    public ProfileKey registerAndInstallContext(ProfileMetaData metaData, Profile profile) throws Throwable
    {
       ProfileDependencyContext context = internalRegisterProfile(metaData, false);
@@ -221,16 +230,23 @@
             builder.addAlias(alias);
          }
       }
-      // Constructor
-      builder.setFactory(metaDataRegistry.getProfileFactory());
-      builder.setFactoryMethod("createProfile");
-      builder.addConstructorParameter(ProfileKey.class.getName(), context.getKey());
-      builder.addConstructorParameter(ProfileMetaData.class.getName(), context.getProfileMetaData());
-      // Uninstall
-      // TODO remove name to TypedProfileFactory
-      ParameterMetaDataBuilder parameters = builder.addUninstallWithParameters("destroyProfile", "TypedProfileFactory");
-      parameters.addParameterMetaData(ProfileMetaData.class.getName(), context.getProfileMetaData());
-      parameters.addParameterMetaData(Profile.class.getName(), builder.createThis());      
+      if(profile != null)
+      {
+         builder.setBean(profile.getClass().getName());
+      }
+      else
+      {
+         // Constructor
+         builder.setFactory(metaDataRegistry.getProfileFactory());
+         builder.setFactoryMethod("createProfile");
+         builder.addConstructorParameter(ProfileKey.class.getName(), context.getKey());
+         builder.addConstructorParameter(ProfileMetaData.class.getName(), context.getProfileMetaData());
+         // Uninstall
+         // TODO remove name to TypedProfileFactory
+         ParameterMetaDataBuilder parameters = builder.addUninstallWithParameters("destroyProfile", "TypedProfileFactory");
+         parameters.addParameterMetaData(ProfileMetaData.class.getName(), context.getProfileMetaData());
+         parameters.addParameterMetaData(Profile.class.getName(), builder.createThis());         
+      }
       // No autowire
       builder.setAutowireType(AutowireType.NONE);
 
@@ -251,8 +267,8 @@
       }
 
       // Update scope info
-      kCtx.getScopeInfo().getScope().addScope(CommonLevels.SERVER, key);
-      kCtx.getScopeInfo().getMutableScope().addScope(CommonLevels.SERVER, key);
+      // kCtx.getScopeInfo().getScope().addScope(CommonLevels.SERVER, key);
+      // kCtx.getScopeInfo().getMutableScope().addScope(CommonLevels.SERVER, key);
       
       // We are done here
       return kCtx;

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -46,12 +46,10 @@
  */
 public class ProfileDeployerPluginRegistry implements ProfileDeploymentRegistry
 {
-  
-   /** The default. */
-   private static final String DEFAULT = "___default___";
-   
+
    /** The registered deployers. */
    private Map<String, ProfileDeployerPlugin> map = new ConcurrentHashMap<String, ProfileDeployerPlugin>();
+   private ProfileDeployerPlugin defaultPlugin = null;
 
    /** The registered deployments. */
    private Map<String, ProfileKey> registeredDeployments = new ConcurrentHashMap<String, ProfileKey>();
@@ -68,8 +66,9 @@
       String type = metaData.getClass().getName();
       ProfileDeployerPlugin plugin = map.get(type);
       if(plugin == null)
-         plugin = map.get(DEFAULT);
-         
+      {
+         return defaultPlugin;
+      }
       return plugin;
    }
    
@@ -78,12 +77,12 @@
       if(plugin == null)
          throw new IllegalArgumentException("null deployer plugin");
       
-      map.put(DEFAULT, plugin);
+      this.defaultPlugin = plugin;
    }
    
    public void removeDefaultPlugin()
    {
-      map.remove(DEFAULT);
+      this.defaultPlugin = null;
    }
    
    public void addPlugin(String type, ProfileDeployerPlugin plugin)
@@ -112,15 +111,11 @@
    {
       for(Entry<String, ProfileDeployerPlugin> deployers : map.entrySet())
       {
-         if(deployers.getKey().equals(DEFAULT) == false)
-         {
-            deployers.getValue().checkComplete();
-         }
+         deployers.getValue().checkComplete();
       }
-      ProfileDeployerPlugin defaultDeployer = map.get(DEFAULT);
-      if(defaultDeployer != null)
+      if(defaultPlugin != null)
       {
-         defaultDeployer.checkComplete();
+         defaultPlugin.checkComplete();
       }
    }
    

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScanner.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScanner.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/hotdeploy/HDScanner.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -36,6 +36,8 @@
 import org.jboss.profileservice.spi.action.ProfileModificationType;
 import org.jboss.profileservice.spi.action.engine.ActionController;
 import org.jboss.profileservice.spi.action.engine.ModificationStatus;
+import org.jboss.profileservice.spi.deployment.ProfileDeploymentFlag;
+import org.jboss.profileservice.spi.deployment.ProfileDeploymentInfo;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 
@@ -206,12 +208,12 @@
          {
             log.trace("Begin deployment scan: " + profile.getKey());
          }
-         boolean modified = false;
-         Collection<String> modifiedDeploymentNames = new ArrayList<String>();
+         Collection<String> checkCompleteNames = new ArrayList<String>();
          Collection<ModificationInfo> modifiedDeployments = profile.getModifiedDeployments();
          for (ModificationInfo info : modifiedDeployments)
          {
             ProfileDeployment ctx = info.getDeployment();
+            ProfileDeploymentInfo deploymentInfo = ctx.getDeploymentInfo();
             try
             {
                switch (info.getStatus())
@@ -219,11 +221,11 @@
                   case ADDED:
                   case MODIFIED:
                      deployer.addDeployment(ctx);
-                     modifiedDeploymentNames.add(ctx.getName());
+                     checkCompleteNames.add(ctx.getName());
+                     deploymentInfo.setFlag(ProfileDeploymentFlag.DEPLOYED);
                      break;
                   case REMOVED:
                      deployer.removeDeployment(ctx);
-                     modified = true;
                      break;
                }
             }
@@ -232,18 +234,14 @@
                log.warn("Failed to add deployment: " + ctx.getName(), e);
             }
          }
-         if (modifiedDeployments.size() > 0)
-         {
-            modified = true;
-         }
          // Process the changes
-         if (modified)
+         if (modifiedDeployments.isEmpty() == false)
          {
             deployer.process();
             // Only check the modified deployments to avoid duplicate errors
-            for(String name : modifiedDeploymentNames)
+            if(checkCompleteNames.isEmpty() == false)
             {
-               deployer.checkComplete(name);
+               deployer.checkComplete(checkCompleteNames.toArray(new String[checkCompleteNames.size()]));
             }
          }
          if(trace)

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/AbstractActionController.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -22,11 +22,9 @@
 package org.jboss.profileservice.management;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.jboss.managed.api.ManagedDeployment;
@@ -45,6 +43,7 @@
 import org.jboss.profileservice.spi.action.engine.ActionController;
 import org.jboss.profileservice.spi.action.engine.ModificationStatus;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
+import org.jboss.profileservice.spi.managed.ManagedProfileConfiguration;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
@@ -56,7 +55,7 @@
 {
 
    /** The profiles. */
-   private List<ProfileKey> profiles = new CopyOnWriteArrayList<ProfileKey>();
+   private Map<String, ProfileKey> profiles = new ConcurrentHashMap<String, ProfileKey>();
    private Map<ProfileKey, ProfileWrapper> profilesByName = new ConcurrentHashMap<ProfileKey, ProfileWrapper>();
 
    /**
@@ -64,7 +63,7 @@
     */
    public List<ProfileKey> getActiveProfiles()
    {
-      return Collections.unmodifiableList(this.profiles);
+      return new ArrayList<ProfileKey>(this.profiles.values());
    }
    
    /**
@@ -72,7 +71,8 @@
     */
    public ManagedProfile getManagedProfile(ProfileKey key)
    {
-      return this.profilesByName.get(key);
+      ProfileKey resolved = profiles.get(key.getName());
+      return resolved != null ? this.profilesByName.get(resolved) : null;
    }
    
    /**
@@ -83,11 +83,12 @@
    public void addProfile(ManagedProfile context)
    {
       ProfileKey key = context.getProfileKey();
-      if(profiles.contains(key))
+      String profileName = key.getName();
+      if(profiles.containsKey(profileName))
       {
          throw new IllegalArgumentException("duplicate profile " + key);
       }
-      this.profiles.add(key);
+      this.profiles.put(profileName, key);
       this.profilesByName.put(key, new ProfileWrapper(context));
       fireModificationEvent(new ProfileLifeCycleEvent(key, LifeCycleState.INSTALLED));
    }
@@ -252,8 +253,10 @@
             success &= tpca.prepare();
             prepared.add(tpca);
          }
-         // FIXME
-         fireModificationEvent(new ProfileModificationEvent(key));
+         if(actions.getType() != ProfileModificationType.GET)
+         {
+            fireModificationEvent(new ProfileModificationEvent(actions.getType(), key));
+         }
       }
       if(success)
       {
@@ -300,6 +303,10 @@
       {
          return getManaged().getProfileMetaData();
       }
+      public ManagedProfileConfiguration getConfiguration()
+      {
+         return getManaged().getConfiguration();
+      }
       public ManagedProfileDeployer getManagedDeployer()
       {
          return getManaged().getManagedDeployer();

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileLifeCycleEvent.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileLifeCycleEvent.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileLifeCycleEvent.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.management.event;
 
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.action.ProfileModificationType;
 import org.jboss.profileservice.spi.action.engine.ModificationEvent;
 
 /**
@@ -58,5 +59,12 @@
       return key;
    }
    
+   public ProfileModificationType getModificationType()
+   {
+      // TODO
+      return ProfileModificationType.UPDATE;
+   }
+
+   
 }
 

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileModificationEvent.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileModificationEvent.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/management/event/ProfileModificationEvent.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.management.event;
 
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.action.ProfileModificationType;
 import org.jboss.profileservice.spi.action.engine.ModificationEvent;
 
 /**
@@ -31,14 +32,23 @@
 public class ProfileModificationEvent implements ModificationEvent
 {
 
+   /** The modification type. */
+   private final ProfileModificationType type;
+   
    /** The profile key. */
    private final ProfileKey key;
    
-   public ProfileModificationEvent(ProfileKey key)
+   public ProfileModificationEvent(ProfileModificationType type, ProfileKey key)
    {
+      this.type = type;
       this.key = key;
    }
    
+   public ProfileModificationType getModificationType()
+   {
+      return type;
+   }
+   
    public ProfileKey getKey()
    {
       return key;

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -1,180 +0,0 @@
-/*
-* 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.metadata;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VFSUtils;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.resolver.MutableSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-
-/**
- * Basic profile meta data factory.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileMetaDataFactory
-{
-   /** The profiles suffix. */
-   public static final String PROFILES_SUFFIX = "-profiles.xml";
-   
-   /** The profiles filter. */
-   private static final VirtualFileFilter filter = new ProfilesFilter();
-   
-   /** The schema resolver. */
-   private static final MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
-
-   /** The parsed profiles. */
-   private final Map<String, ProfileMetaData> profiles = new HashMap<String, ProfileMetaData>();
-
-   /** The unmarshaller. */
-   private final Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
-   
-   static
-   {
-      resolver.mapURIToClass("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
-   }
-   
-   public ProfileMetaDataFactory()
-   {
-      // 
-   }
-   
-   public void setClassBinding(String nsUri, Class<?> clazz)
-   {
-      if(nsUri == null)
-      {
-         throw new IllegalArgumentException("null nsUri");
-      }
-      synchronized(resolver)
-      {
-         if(clazz == null)
-         {
-            resolver.removeLocationToClassMapping(nsUri);
-         }
-         else
-         {
-            resolver.mapLocationToClass(nsUri, clazz);
-         }
-      }
-   }
-   
-   public void parse(URL rootURL) throws JBossXBException, IOException, URISyntaxException
-   {
-      VirtualFile root = VFS.getChild(rootURL);
-      for(VirtualFile vf : root.getChildren(filter))
-      {
-         parse(vf);
-      }
-   }
-   
-   public Map<String, ProfileMetaData> getProfiles()
-   {
-      return profiles;
-   }
-
-   protected void processProfilesMetaData(ProfilesMetaData metaData)
-   {
-      List<ProfileMetaData> profiles = metaData.getProfiles();
-      if(profiles != null && profiles.isEmpty() == false)
-      {
-         for(ProfileMetaData profile : profiles)
-         {
-            addProfileMetaData(profile);
-         }
-      }
-   }
-   
-   protected String addProfileMetaData(ProfileMetaData metaData)
-   {
-      String profileName = metaData.getName();
-      if(profileName == null)
-      {
-         throw new IllegalStateException("null profile name");
-      }
-      profileName = profileName.trim();
-      if(profileName.isEmpty())
-      {
-         throw new IllegalStateException("empty profile name");
-      }
-      if(profiles.containsKey(profileName))
-      {
-         // TODO, ignore in case there is a profile override?
-         throw new IllegalStateException("duplicate profile name " + profileName);
-      }
-      profiles.put(profileName, metaData);
-      return profileName;
-   }
-   
-   protected void parse(VirtualFile vf) throws JBossXBException, IOException
-   {
-      InputStream is = null; 
-      try
-      {
-         is = vf.openStream();
-         processProfilesMetaData(unmarshal(is, ProfilesMetaData.class));
-      }
-      catch(Exception e)
-      {
-         throw new RuntimeException("failed to parse : " + vf.getPathName(), e);
-      }
-      finally
-      {
-         VFSUtils.safeClose(is);
-      }
-   }
-
-   protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
-   {
-      return clazz.cast(unmarshaller.unmarshal(is, resolver));      
-   }
-   
-   static class ProfilesFilter implements VirtualFileFilter
-   {
-      @Override
-      public boolean accepts(VirtualFile file)
-      {
-         if(file.getName().endsWith(PROFILES_SUFFIX))
-         {
-            return true;
-         }
-         return false;
-      }
-   }
-   
-}
-

Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java (from rev 103051, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -0,0 +1,180 @@
+/*
+* 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.metadata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.resolver.MutableSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * Basic profile meta data factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfilesMetaDataFactory
+{
+   /** The profiles suffix. */
+   public static final String PROFILES_SUFFIX = "-profiles.xml";
+   
+   /** The profiles filter. */
+   private static final VirtualFileFilter filter = new ProfilesFilter();
+   
+   /** The schema resolver. */
+   private static final MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+
+   /** The parsed profiles. */
+   private final Map<String, ProfileMetaData> profiles = new HashMap<String, ProfileMetaData>();
+
+   /** The unmarshaller. */
+   private final Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+   
+   static
+   {
+      resolver.mapURIToClass("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
+   }
+   
+   public ProfilesMetaDataFactory()
+   {
+      // 
+   }
+   
+   public void setClassBinding(String nsUri, Class<?> clazz)
+   {
+      if(nsUri == null)
+      {
+         throw new IllegalArgumentException("null nsUri");
+      }
+      synchronized(resolver)
+      {
+         if(clazz == null)
+         {
+            resolver.removeLocationToClassMapping(nsUri);
+         }
+         else
+         {
+            resolver.mapLocationToClass(nsUri, clazz);
+         }
+      }
+   }
+   
+   public void parse(URL rootURL) throws JBossXBException, IOException, URISyntaxException
+   {
+      VirtualFile root = VFS.getChild(rootURL);
+      for(VirtualFile vf : root.getChildren(filter))
+      {
+         parse(vf);
+      }
+   }
+   
+   public Map<String, ProfileMetaData> getProfiles()
+   {
+      return profiles;
+   }
+
+   protected void processProfilesMetaData(ProfilesMetaData metaData)
+   {
+      List<ProfileMetaData> profiles = metaData.getProfiles();
+      if(profiles != null && profiles.isEmpty() == false)
+      {
+         for(ProfileMetaData profile : profiles)
+         {
+            addProfileMetaData(profile);
+         }
+      }
+   }
+   
+   protected String addProfileMetaData(ProfileMetaData metaData)
+   {
+      String profileName = metaData.getName();
+      if(profileName == null)
+      {
+         throw new IllegalStateException("null profile name");
+      }
+      profileName = profileName.trim();
+      if(profileName.isEmpty())
+      {
+         throw new IllegalStateException("empty profile name");
+      }
+      if(profiles.containsKey(profileName))
+      {
+         // TODO, ignore in case there is a profile override?
+         throw new IllegalStateException("duplicate profile name " + profileName);
+      }
+      profiles.put(profileName, metaData);
+      return profileName;
+   }
+   
+   protected void parse(VirtualFile vf) throws JBossXBException, IOException
+   {
+      InputStream is = null; 
+      try
+      {
+         is = vf.openStream();
+         processProfilesMetaData(unmarshal(is, ProfilesMetaData.class));
+      }
+      catch(Exception e)
+      {
+         throw new RuntimeException("failed to parse : " + vf.getPathName(), e);
+      }
+      finally
+      {
+         VFSUtils.safeClose(is);
+      }
+   }
+
+   protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
+   {
+      return clazz.cast(unmarshaller.unmarshal(is, resolver));      
+   }
+   
+   static class ProfilesFilter implements VirtualFileFilter
+   {
+      @Override
+      public boolean accepts(VirtualFile file)
+      {
+         if(file.getName().endsWith(PROFILES_SUFFIX))
+         {
+            return true;
+         }
+         return false;
+      }
+   }
+   
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ScanningProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ScanningProfileFactory.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ScanningProfileFactory.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -43,6 +43,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration.VFSBackupPolicy;
 
 /**
  * The scanning profile factory, creating scanning profiles.
@@ -186,6 +187,10 @@
       FileRepositoryConfiguration configuration = new FileRepositoryConfiguration();
       configuration.setOverrideURI(new URI(source.getPath()));
       configuration.setMutable(mutable);
+      if(mutable)
+      {
+         configuration.setBackupPolicy(VFSBackupPolicy.BACKUP);
+      }
       return ArtifactRepositoryConfiguration.class.cast(configuration);
    }
    

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -142,7 +142,10 @@
    {
       try
       {
-         this.deployer.validate();
+         for(KernelDeployment deployment : deployments.values())
+         {
+            this.deployer.validate(deployment);            
+         }
       }
       catch(Exception e)
       {

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/helpers/AbstractProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/helpers/AbstractProfileMetaData.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/helpers/AbstractProfileMetaData.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -65,6 +65,11 @@
       return false;
    }
    
+   public boolean isDeploymentTarget()
+   {
+      return false;
+   }
+   
    public void visit(ProfileMetaDataVisitor visitor)
    {
       // We provide a profile

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -89,6 +89,14 @@
    }
    
    /**
+    * Mark as deployment target.
+    */
+   public boolean isDeploymentTarget()
+   {
+      return true;
+   }
+   
+   /**
     * Check complete should be done externally, so that the
     * profile can be installed - although all deployments 
     * might not be fully deployment due to errors.

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/BasicResolverFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/BasicResolverFactory.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/BasicResolverFactory.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -56,12 +56,11 @@
       {
          throw new IllegalArgumentException("null profile name");
       }
-      final EmptyProfileMetaData metaData = new EmptyProfileMetaData();
+      final EmptyProfileMetaData metaData = new EmptyProfileMetaData(name);
       registry.registerProfileMetaData(metaData);
       final ProfileDependencyContext ctx = registry.getContext(name);
       return new ProfileResolverFacade(ctx, callback);
    }
-
    
    public class ProfileResolverFacade implements ProfileRequirementResolver
    {
@@ -104,10 +103,7 @@
          resolved = resolver.sort();
          return true;
       }
-      
-      
-      
-      
+
    }
    
 }

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/deployment/test/HDScannerUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -38,6 +38,7 @@
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
+import org.jboss.profileservice.spi.managed.ManagedProfileConfiguration;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.test.BaseTestCase;
@@ -260,6 +261,10 @@
       {
          return false;
       }
+      public ManagedProfileConfiguration getConfiguration()
+      {
+         return null;
+      }
       @Override
       public boolean isMutable()
       {

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -28,7 +28,7 @@
 
 import org.jboss.profileservice.dependency.ProfileDependencyContext;
 import org.jboss.profileservice.domain.spi.DomainMetaData;
-import org.jboss.profileservice.metadata.ProfileMetaDataFactory;
+import org.jboss.profileservice.metadata.ProfilesMetaDataFactory;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.dependency.ProfileCapability;
 import org.jboss.profileservice.spi.dependency.ProfileRequirement;
@@ -53,7 +53,7 @@
    public void test() throws Exception
    {
       final URL profiles = findResource("system/profiles");
-      final ProfileMetaDataFactory metaDataFactory = new ProfileMetaDataFactory();
+      final ProfilesMetaDataFactory metaDataFactory = new ProfilesMetaDataFactory();
       
       metaDataFactory.parse(profiles);
     

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/repository/test/ArtifactRepositoryUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -95,7 +95,12 @@
          
          Automounter.cleanup(vf);
          log.debug(artifact.getPhysicalFile());
-         assertFalse(artifact.getChild("META-INF").exists());         
+         assertFalse(artifact.getChild("META-INF").exists());
+         
+         ProfileDeployment simple = deployments.get("deployment.jar");
+         assertNotNull(simple);
+         assertEquals("deployment.jar", simple.getSimpleName());
+         
       }
       finally
       {

Copied: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/MainDeployerPlugin.java (from rev 103051, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java)
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/MainDeployerPlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/MainDeployerPlugin.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -0,0 +1,141 @@
+/*
+* 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.test.profileservice.support;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MainDeployerPlugin implements ProfileDeployerPlugin
+{
+   
+   /** The deployment builder. */
+   private final VDFDeploymentBuilder deploymentBuilder = VDFDeploymentBuilder.getInstance();
+   
+   /** The main deployer. */
+   private final MainDeployer deployer;
+   
+   /** The deployer registry. */
+   private final ProfileDeployerPluginRegistry registry;
+   
+   public MainDeployerPlugin(MainDeployer deployer, ProfileDeployerPluginRegistry registry)
+   {
+      if(deployer == null)
+      {
+         throw new IllegalArgumentException("null deployer");
+      }
+      this.deployer = deployer;
+      this.registry = registry;
+   }
+   
+   public void start()
+   {
+      registry.setDefaultPlugin(this);
+   }
+   
+   public void stop()
+   {
+      registry.removeDefaultPlugin();
+   }
+   
+   @Override
+   public void addDeployment(ProfileKey key, ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+      {
+         throw new IllegalArgumentException("null profile deployment");
+      }
+      Deployment d = createDeployment(deployment);
+      deployer.addDeployment(d);
+   }
+
+   @Override
+   public void checkComplete(String... names) throws Exception
+   {
+      deployer.checkComplete(names);
+   }
+
+   @Override
+   public void checkComplete() throws Exception
+   {
+      deployer.checkComplete();
+   }
+
+   @Override
+   public ManagedDeployment getManagedDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+      {
+         throw new IllegalArgumentException("null profile deployment");
+      }
+      return deployer.getManagedDeployment(deployment.getName());
+   }
+
+   @Override
+   public boolean isSupportRedeployment()
+   {
+      return true;
+   }
+
+   @Override
+   public void process()
+   {
+      this.deployer.process();
+   }
+
+   @Override
+   public void removeDeployment(ProfileKey key, ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+      {
+         throw new IllegalArgumentException("null profile deployment");
+      }
+      this.deployer.removeDeployment(deployment.getName());
+   }
+
+   @Override
+   public void prepareShutdown()
+   {
+      this.deployer.prepareShutdown();
+   }
+   
+   @Override
+   public void shutdown()
+   {
+      this.deployer.shutdown();
+   }
+   
+   Deployment createDeployment(ProfileDeployment deployment)
+   {
+      return deploymentBuilder.createDeployment(deployment);
+   }
+   
+}
+

Copied: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/VDFDeploymentBuilder.java (from rev 103051, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java)
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/VDFDeploymentBuilder.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/VDFDeploymentBuilder.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -0,0 +1,87 @@
+/*
+ * 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.test.profileservice.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.deployment.DeploymentBuilder;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.virtual.assembly.StructureMetaDataBuilder;
+
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class VDFDeploymentBuilder implements DeploymentBuilder<Deployment>
+{
+ 
+   /** The instance. */
+   private static final VDFDeploymentBuilder instance = new VDFDeploymentBuilder();
+   
+   /** The vfs deployment factory. */
+   private static final VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+
+   /** The attachment processor. */
+   private final List<DeploymentAttachmentsProcessor<Deployment>> attachmentProcessors = new ArrayList<DeploymentAttachmentsProcessor<Deployment>>();
+   
+   public static VDFDeploymentBuilder getInstance()
+   {
+      return instance;
+   }
+
+   protected VDFDeploymentBuilder()
+   {   
+      attachmentProcessors.add(new StructureMetaDataBuilder());
+   }
+   
+   public Deployment createDeployment(ProfileDeployment profileDeployment)
+   {
+      Deployment d = null;
+      if(profileDeployment.getRoot() == null)
+      {
+         d = new AbstractDeployment(profileDeployment.getName());
+      }
+      else
+      {
+         d = deploymentFactory.createVFSDeployment(profileDeployment.getRoot());
+      }
+      for(DeploymentAttachmentsProcessor<Deployment> processor : attachmentProcessors)
+      {
+         processor.processDeployment(profileDeployment, d);
+      }
+      return d;
+   }
+
+   public void addAttachmentsProcessor(DeploymentAttachmentsProcessor<Deployment> processor)
+   {
+      synchronized(attachmentProcessors)
+      {
+         attachmentProcessors.add(processor);
+      }
+   }
+   
+}

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileActivationUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileActivationUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileActivationUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.profileservice.test;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.jboss.profileservice.config.ProfileServiceConstants;
+import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileActivationUnitTestCase extends AbstractProfileServiceTest
+{
+
+   private static final ProfileKey key = new ProfileKey("test");
+   
+   public BasicProfileActivationUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testPredefined() throws Throwable
+   {
+      deploy(findResource("system/bootstrap.xml"));
+      ProfileService ps = getBean(ProfileServiceConstants.PROFILESERVICE_NAME, ProfileService.class);
+      ProfileKey key = ps.registerProfile(new EmptyProfileMetaData("test"), new TestProfile());
+      ps.activateProfile(key);
+      ps.validateProfile(key);
+      // 
+      ps.deactivateProfile(key);
+      ps.unregisterProfile(key);
+   }
+
+   static class TestProfile implements Profile
+   {
+
+      public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException { return null; }
+      public Set<String> getDeploymentNames() { return null; }
+      public Collection<ProfileDeployment> getDeployments() { return null; }
+      public ProfileKey getKey() { return key; }
+      public long getLastModified() { return 0; }
+      public boolean hasDeployment(String name) { return false; }
+      public boolean isMutable() { return false; }
+      
+   }
+   
+}
+

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -26,25 +26,21 @@
 import java.util.List;
 
 import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.scope.CommonLevels;
-import org.jboss.metadata.spi.scope.ScopeKey;
 import org.jboss.profileservice.Hack;
 import org.jboss.profileservice.config.ProfileServiceConstants;
 import org.jboss.profileservice.dependency.ProfileDependencyContext;
 import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
-import org.jboss.profileservice.deployers.MainDeployerPlugin;
 import org.jboss.profileservice.deployment.hotdeploy.HDScannerFactory;
 import org.jboss.profileservice.domain.spi.DomainFeatureNode;
 import org.jboss.profileservice.domain.spi.DomainMetaData;
-import org.jboss.profileservice.metadata.ProfileMetaDataFactory;
+import org.jboss.profileservice.metadata.ProfilesMetaDataFactory;
 import org.jboss.profileservice.resolver.AbstractRequirementResolver;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.test.profileservice.domain.support.AbstractDomainMetaDataVisitor;
 import org.jboss.test.profileservice.domain.support.DomainMetaDataRepoSupport;
+import org.jboss.test.profileservice.support.MainDeployerPlugin;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -65,7 +61,7 @@
       deploy(findResource("system/bootstrap.xml"));
 
       URL profiles = findResource("system/profiles");
-      ProfileMetaDataFactory metaDataFactory = new ProfileMetaDataFactory();
+      ProfilesMetaDataFactory metaDataFactory = new ProfilesMetaDataFactory();
 
       metaDataFactory.parse(profiles);
     
@@ -127,20 +123,6 @@
       {
          getLog().debug("active " + key);
       }
-      for(ProfileKey profile : list)
-      {
-         if(profile.getName().equals("test") == false)
-         {
-            KernelControllerContext context = (KernelControllerContext) getController().getInstalledContext(profile);
-            assertNotNull(profile.toString(), context);
-            ScopeKey key = context.getScopeInfo().getMutableScope();
-            MetaData md = context.getScopeInfo().getMetaData().getScopeMetaData(CommonLevels.SERVER);
-            for(Object o : md.getMetaData())
-            {
-               log.debug(o);
-            }
-         }
-      }
 
       // reverse
       Collections.reverse(list);

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -32,11 +32,11 @@
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaData;
 import org.jboss.profileservice.Hack;
-import org.jboss.profileservice.deployers.VDFDeploymentBuilder;
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.VirtualDeploymentRepository;
 import org.jboss.profileservice.spi.virtual.VirtualDeploymentMetaData;
 import org.jboss.test.profileservice.metadata.support.VirtualRepositoryMetaData;
+import org.jboss.test.profileservice.support.VDFDeploymentBuilder;
 
 /**
  * Test StructureMetaData creation.

Modified: projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml	2010-03-29 13:25:07 UTC (rev 103119)
@@ -26,5 +26,9 @@
 			</virtual-deployment>
 		</virtual-deployment>
 	</profile>
+	
+	<profile name="test.deployment.jar">
+		<deployment name="deployment.jar" />
+	</profile>
 
 </profiles>
\ No newline at end of file

Modified: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml	2010-03-29 13:25:07 UTC (rev 103119)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-	<bean name="MainDeployerPlugin" class="org.jboss.profileservice.deployers.MainDeployerPlugin">
+	<bean name="MainDeployerPlugin" class="org.jboss.test.profileservice.support.MainDeployerPlugin">
 		<constructor>
 			<parameter><inject bean="MainDeployer" /></parameter>
 			<parameter><inject bean="ProfileDeployerPluginRegistry" /></parameter>

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/AbstractDeployHandler.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -111,7 +111,7 @@
       }
       else
       {
-         ManagedProfile managed = actionController.getManagedProfile(TransientProfileActivator.TRANSIENT_PROFILE_KEY);
+         ManagedProfile managed = actionController.getManagedProfile(TransientProfileActivator.getTransientProfileKey());
          if(managed != null && managed.getProfile().isMutable() && managed.getProfile() instanceof MutableProfile)
          {
             MutableProfile mutable = MutableProfile.class.cast(managed.getProfile());
@@ -119,7 +119,7 @@
          }
          else
          {
-            throw new IllegalStateException("failed to get profile " + TransientProfileActivator.TRANSIENT_PROFILE_KEY);
+            throw new IllegalStateException("failed to get profile " + TransientProfileActivator.getTransientProfileKey());
          }
       }
       ModificationStatus status = actionController.perform(actions);
@@ -190,7 +190,7 @@
    protected void removeDeployments(String... deploymentNames) throws Exception
    {
       Map<ProfileKey, Set<String>> mappings = resolveProfiles(deploymentNames, true, true);
-      BasicProfileModificationActions actions = new BasicProfileModificationActions(ProfileModificationType.UPDATE);
+      BasicProfileModificationActions actions = new BasicProfileModificationActions(ProfileModificationType.DELETE);
       for(ProfileKey key : mappings.keySet())
       {
          ManagedProfile managed = actionController.getManagedProfile(key);

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/TransientProfileActivator.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/TransientProfileActivator.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/TransientProfileActivator.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -46,7 +46,7 @@
 {
    
    /** The transient profile name. */
-   public static final ProfileKey TRANSIENT_PROFILE_KEY = new ProfileKey("transient-deployments");
+   private static ProfileKey TRANSIENT_PROFILE_KEY = new ProfileKey("transient-deployments");
    
    /** The attachment name for the transient deployment url. */ 
    public static final String TRANSIENT_DEPLOYMENT_URL_KEY = "deployment-url";
@@ -54,6 +54,11 @@
    /** The profile service. */
    private ProfileService ps;
 
+   public static ProfileKey getTransientProfileKey()
+   {
+      return TRANSIENT_PROFILE_KEY;
+   }
+   
    public ProfileService getProfileService()
    {
       return this.ps;
@@ -72,7 +77,7 @@
    public void start() throws Exception
    {
       Profile profile = new TransientDeploymentsProfile();
-      this.ps.registerProfile(new EmptyProfileMetaData(TRANSIENT_PROFILE_KEY.getName()), profile);
+      TRANSIENT_PROFILE_KEY = this.ps.registerProfile(new EmptyProfileMetaData(TRANSIENT_PROFILE_KEY.getName()), profile);
       this.ps.activateProfile(TRANSIENT_PROFILE_KEY);
       this.ps.validateProfile(TRANSIENT_PROFILE_KEY);
    }

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentDistributeAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentDistributeAction.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/deploy/actions/DeploymentDistributeAction.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -64,12 +64,20 @@
    {
       try
       {
+         String deploymentName = getDeploymentName();
+         // in case there is already a deployment, lock the contents.
+         // TODO this might should not be done here ?
+         if(getProfile().hasDeployment(deploymentName))
+         {
+            ProfileDeployment deployment = getProfile().getDeployment(deploymentName);
+            deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.LOCKED);
+         }
+         //
          VirtualDeploymentRepository deploymentRepository = resolveDeploymentRepository(getProfile());
          if(deploymentRepository == null)
          {
             return false;
          }
-         String deploymentName = getDeploymentName();
          MutableArtifactRepository<FileArtifactId> artifactRepository = resolveRepository(deploymentRepository);
          // Create the artifact based on the deployment name
          String artifactName = deploymentName;
@@ -91,7 +99,7 @@
             transformer = CopyStreamArtifactTransformer.getInstance();
          }
          
-         // Create the deployment
+         // Create a new deployment
          ProfileDeployment deployment = deploymentRepository.createDeployment(new BasicProfileDeploymentMetaData(artifactName));
          // Mark it as locked, so we can add contents after
          deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.LOCKED);

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -50,7 +50,6 @@
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.ProfileKey;
 
 /**
  * The aggregating management view. This represents the local view of
@@ -499,7 +498,7 @@
          String msg = formatter.format(args);
          throw new IllegalArgumentException(msg);
       }
-      ProfileKey target = resolveProfile(serverComponent.getDeployment().getName());
+      ProfileViewWrapper target = resolveWrapper(serverComponent.getDeployment().getName());
       if(target == null)
       {
          throw new IllegalStateException("failed to resolve target profile for component " + serverComponent);
@@ -525,7 +524,7 @@
          String msg = formatter.format(args);
          throw new IllegalArgumentException(msg);
       }
-      ProfileKey target = resolveProfile(serverComponent.getDeployment().getName());
+      ProfileViewWrapper target = resolveWrapper(serverComponent.getDeployment().getName());
       if(target == null)
       {
          throw new IllegalStateException("failed to resolve target profile for component " + serverComponent);
@@ -613,14 +612,13 @@
     * @param deploymentName the deployment name
     * @return the profile
     */
-   protected ProfileKey resolveProfile(String deploymentName)
+   protected ProfileViewWrapper resolveWrapper(String deploymentName)
    {
       for(ProfileViewWrapper view : views)
       {
-         ProfileKey resolved = view.resolveProfile(deploymentName);
-         if(resolved != null)
+         if(view.getDeploymentNames().contains(deploymentName))
          {
-            return resolved;
+            return view;
          }
       }
       return null;

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -315,8 +315,18 @@
             return view.getKey();
          }
       }
-      return null;
+      return null;     
    }
    
+   public void removeComponent(ManagedComponent update, ManagedComponent original) throws Exception
+   {
+      //
+   }
+   
+   public void updateComponent(ManagedComponent update, ManagedComponent original) throws Exception
+   {
+      //
+   }
+   
 }
 

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/DefaultContextStateMapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/DefaultContextStateMapper.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/DefaultContextStateMapper.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -41,23 +41,20 @@
    @Override
    public T map(String currentState, String toState)
    {
-      // TODO dependency missing on jboss-kernel
-      
-//    // If the context is in the required state 
-//    if(toState == null || currentState.equals(toState))
-//       return getMapping(currentState);
-//    // The error state
-//    if(ControllerState.ERROR.equals(currentState))
-//       return error;
-//    // installing state
-//    if(ControllerState.INSTALLED.equals(toState))
-//       return installState;
-//    // uninstalling state
-//    if(ControllerState.NOT_INSTALLED.equals(toState))
-//       return uninstallState;
-//    // Fallback
-//    return getMapping(currentState);
-      return unknown;
+    // If the context is in the required state 
+    if(toState == null || currentState.equals(toState))
+       return getMapping(currentState);
+    // The error state
+    if("**ERROR**".equals(currentState))
+       return error;
+    // installing state
+    if("INSTALLED".equals(toState))
+       return installState;
+    // uninstalling state
+    if("NOT_INSTALLED".equals(toState))
+       return uninstallState;
+    // Fallback
+    return getMapping(currentState);
    }
 
 

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectProcessor.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -83,18 +83,7 @@
     */
    protected abstract RunState updateRunState(ManagedObject runtimeMO, ManagedComponent comp);
    
-   //
-
    /**
-    * FIXME clear()
-    */
-   public void clear()
-   {
-      moRegistry.clear();
-      unresolvedRefs.clear();
-   }
-   
-   /**
     * Process a managed object
     * 
     * @param mo the managed object

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedObjectRuntimeProcessor.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -95,13 +95,6 @@
       this.proxyFactory = proxyFactory;
       this.dispatcher = proxyFactory.getDispatcher();
    }
-
-   @Override
-   public void clear()
-   {
-      super.clear();
-      this.runtimeMOs.clear();
-   }
    
    protected void processManagedObject(String key, ManagedObject mo, ManagedDeployment md,
          ProfileViewProcessingContext context) throws Exception
@@ -380,9 +373,7 @@
       {
          try
          {
-            //TODO, update RuntimeComponentDispatcher
-            RuntimeComponentDispatcher xdispatcher = dispatcher;
-            state = xdispatcher.mapControllerState(name, mapper);
+            state = dispatcher.mapControllerState(name, mapper);
          }
          catch (Exception e)
          {

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -231,8 +231,7 @@
       final HashSet<ManagedDeployment> mds = new HashSet<ManagedDeployment>();
       for(String name : names)
       {
-         final ManagedDeployment md = getManagedDeployment(name);
-         mds.add(md);
+         mds.add(getManagedDeployment(name));
       }
       return mds;
    }
@@ -299,7 +298,7 @@
       // nothing here
    }
 
-   void markAsModified()
+   public void markAsModified()
    {
       this.modified.set(true);
    }

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -24,12 +24,12 @@
 import java.util.Collection;
 
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
 import org.jboss.managed.plugins.jmx.ManagementFactoryUtils;
 import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
 import org.jboss.profileservice.plugins.spi.ProfileView;
-import org.jboss.profileservice.spi.ProfileKey;
 
 /**
  * A ProfileView exposing the Platform MBeans as <code>ManagedComponents</code>.
@@ -100,11 +100,17 @@
          }
       }
    }
+
+   public void removeComponent(ManagedComponent update, ManagedComponent original) throws Exception
+   {
+      // we cannot remove platform mbeans
+   }
    
-   public ProfileKey resolveProfile(String deploymentName)
+   public void updateComponent(ManagedComponent update, ManagedComponent original) throws Exception
    {
-      return null;
+      // we cannot update a platform mbean
    }
    
+   
 }
 

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/RegisteredProfileView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/RegisteredProfileView.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/RegisteredProfileView.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.plugins.management.view;
 
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.action.ProfileModificationType;
 import org.jboss.profileservice.spi.action.engine.ModificationEvent;
 
 /**
@@ -55,7 +56,8 @@
    public void notify(final ModificationEvent event)
    {
       // TODO this should be more fine grained
-      if(getKey().equals(event.getKey()))
+      if(event.getModificationType() != ProfileModificationType.GET &&
+            getKey().equals(event.getKey()))
       {
          markAsModified();
       }

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -21,8 +21,8 @@
 */
 package org.jboss.profileservice.plugins.spi;
 
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
-import org.jboss.profileservice.spi.ProfileKey;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -39,12 +39,28 @@
    void setManagementProxyFactory(AbstractManagementProxyFactory proxyFactory);
 
    /**
-    * Try to resolve the {@code Profile} for a given deployment.
+    * Update the given component. This takes the component ManagedDeployment,
+    * obtains the ManagedObject set for the underlying deployment, and applies
+    * the component ManagedProperty set to matching the deployment ManagedObject
+    * properties.
     * 
-    * @param deploymentName the deployment
-    * @return the profile key, null if not resolvable
+    * @param update the managed component update
+    * @param original the managed component original
+    * @throws Exception
     */
-   ProfileKey resolveProfile(String deploymentName);
+   void updateComponent(ManagedComponent update, ManagedComponent original)
+      throws Exception;
    
+   /**
+    * Removes a given component. This will remove a component from the
+    * associated ManagedDeployment.
+    * 
+    * @param update the managed component update
+    * @param original the managed component original
+    * @throws Exception
+    */
+   void removeComponent(ManagedComponent update, ManagedComponent original)
+      throws Exception;
+   
 }
 

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/ManagedProfileSupport.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/ManagedProfileSupport.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/support/ManagedProfileSupport.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -26,6 +26,7 @@
 import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
+import org.jboss.profileservice.spi.managed.ManagedProfileConfiguration;
 import org.jboss.profileservice.spi.managed.ManagedProfileDeployer;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 
@@ -56,6 +57,11 @@
       return deployer.getManagedDeployment(deployment);
    }
 
+   public ManagedProfileConfiguration getConfiguration()
+   {
+      return null;
+   }
+   
    public Profile getProfile()
    {
       return profile;

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/TransientProfileUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/TransientProfileUnitTestCase.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/TransientProfileUnitTestCase.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -55,10 +55,13 @@
       getDeployHandler().addDeployment(url);
       assertTrue(profile.hasDeployment("deployment1.jar"));
       assertTrue(profile.hasDeployment(url.toExternalForm()));
+      ProfileDeployment deployment = profile.getDeployment("deployment1.jar");
+      assertFalse(deployment.getDeploymentInfo().isDeployed());
+      assertTrue(deployment.getDeploymentInfo().isLocked());
       
       // Start
       getDeployHandler().startDeployment(url);
-      ProfileDeployment deployment = profile.getDeployment("deployment1.jar");
+      deployment = profile.getDeployment("deployment1.jar");
       assertTrue(getDeployer().hasDeployment(deployment.getName()));
       assertTrue(deployment.getDeploymentInfo().isDeployed());
       assertFalse(deployment.getDeploymentInfo().isLocked());

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/action/engine/ModificationEvent.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/action/engine/ModificationEvent.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/action/engine/ModificationEvent.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.spi.action.engine;
 
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.action.ProfileModificationType;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -37,5 +38,12 @@
     */
    ProfileKey getKey();
    
+   /**
+    * Get the modification type. 
+    * 
+    * @return the modification type
+    */
+   ProfileModificationType getModificationType();
+   
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfile.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfile.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfile.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -69,6 +69,13 @@
    ManagedProfileDeployer getManagedDeployer();
    
    /**
+    * Get the managed profile configuration.
+    * 
+    * @return the configuration
+    */
+   ManagedProfileConfiguration getConfiguration();
+   
+   /**
     * Get a managed deployment.
     * 
     * @param deployment the profile deployment

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfileConfiguration.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfileConfiguration.java	2010-03-29 13:21:45 UTC (rev 103118)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/managed/ManagedProfileConfiguration.java	2010-03-29 13:25:07 UTC (rev 103119)
@@ -33,9 +33,18 @@
     * "false" return value means that the server has to be
     * restarted to apply modifications.
     * 
-    * @return true, if this profile supports redeployment. 
+    * @return true, if this profile supports redeployment 
     */
    boolean isSupportRedeployment();
+ 
    
+   /**
+    * Check whether a profile is a deployment target and 
+    * allows content additions and removals.
+    * 
+    * @return true, if the profile is a deployment target
+    */
+   boolean isDeploymentTarget();
+   
 }
 




More information about the jboss-cvs-commits mailing list