[jboss-cvs] JBossAS SVN: r83748 - in trunk/system/src: main/org/jboss/system/server/profileservice and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Feb 1 09:47:55 EST 2009


Author: emuckenhuber
Date: 2009-02-01 09:47:55 -0500 (Sun, 01 Feb 2009)
New Revision: 83748

Added:
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
Modified:
   trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java
   trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
   trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java
   trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile
   trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
   trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
Log:
update profileservice-spi and changes to use a ProfileDeployment instead of VFSDeployment

Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -26,12 +26,12 @@
 import java.util.List;
 import java.util.Set;
 
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.ModificationInfo;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 
 /**
@@ -73,7 +73,7 @@
       this.subProfiles = subProfiles;
    }
 
-   public void addDeployment(VFSDeployment d) throws Exception
+   public void addDeployment(ProfileDeployment d) throws Exception
    {
       if(d == null)
          throw new IllegalArgumentException("Null deployment");
@@ -85,7 +85,7 @@
       this.hotdeployEnabled = flag;
    }
    
-   public VFSDeployment getDeployment(String name) throws Exception, NoSuchDeploymentException
+   public ProfileDeployment getDeployment(String name) throws Exception, NoSuchDeploymentException
    {
       if(name == null)
          throw new IllegalArgumentException("Null name.");
@@ -97,7 +97,7 @@
       return this.repository.getDeploymentNames();
    }
 
-   public Collection<VFSDeployment> getDeployments() throws Exception
+   public Collection<ProfileDeployment> getDeployments() throws Exception
    {
       return this.repository.getDeployments();
    }
@@ -145,14 +145,14 @@
       }
    }
 
-   public VFSDeployment removeDeployment(String name) throws Exception
+   public ProfileDeployment removeDeployment(String name) throws Exception
    {
       if(name == null)
          throw new IllegalArgumentException("Null name.");
       return this.repository.removeDeployment(name);
    }
 
-   public void updateDeployment(VFSDeployment d, ManagedComponent comp) throws Exception
+   public void updateDeployment(ProfileDeployment d, ManagedComponent comp) throws Exception
    {
       if(d == null)
          throw new IllegalArgumentException("Null deployment");

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -46,8 +46,8 @@
    protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
    {
       VFSDeployment deployment = createDeployment(file);
-      if(profile.hasDeployment(deployment.getName()) == false)
-         profile.addDeployment(deployment);
+//      if(profile.hasDeployment(deployment.getName()) == false)
+//         profile.addDeployment(deployment);
       return deployment;
    }
 

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -278,7 +278,7 @@
       {
          // Unregister
          Profile profile = profileService.getProfile(profileKey);
-         profileService.unregisterProfile(profile);
+         profileService.unregisterProfile(profileKey);
       }
       catch(Throwable t)
       {
@@ -297,8 +297,7 @@
          try
          {
             // TODO update to unregister(ProfileKey);
-            Profile profile = profileService.getProfile(key);
-            profileService.unregisterProfile(profile);
+            profileService.unregisterProfile(key);
          }
          catch(Throwable t)
          {

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -29,15 +29,14 @@
 import java.util.concurrent.TimeUnit;
 
 import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
 import org.jboss.profileservice.spi.ModificationInfo;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
 
 /**
  * A DeploymentScanner built on the ProfileService and MainDeployer. This
@@ -60,7 +59,7 @@
    private static final Logger log = Logger.getLogger(HDScanner.class);
    // Private Data --------------------------------------------------
    /** The MainDeployer used to deploy modifications */
-   private MainDeployer mainDeployer;
+   private MainDeployerAdapter deployer;
    /** The controller */
    private KernelController controller;
 
@@ -87,9 +86,9 @@
    
    // Attributes ----------------------------------------------------
 
-   public void setMainDeployer(MainDeployer deployer)
+   public void setDeployer(MainDeployerAdapter deployer)
    {
-      this.mainDeployer = deployer;
+      this.deployer = deployer;
    }
 
    public KernelController getController()
@@ -277,17 +276,15 @@
          Collection<ModificationInfo> modifiedDeployments = activeProfile.getModifiedDeployments();
          for(ModificationInfo info : modifiedDeployments)
          {
-            VFSDeployment ctx = info.getDeployment();
+            ProfileDeployment ctx = info.getDeployment();
             switch( info.getStatus() )
             {
                case ADDED:
-                  mainDeployer.addDeployment(ctx);
-                  break;
                case MODIFIED:
-                  mainDeployer.addDeployment(ctx);
+                  deployer.addDeployment(ctx);
                   break;
                case REMOVED:
-                  mainDeployer.removeDeployment(ctx.getName());
+                  deployer.removeDeployment(ctx.getName());
                   break;
             }
          }
@@ -302,20 +299,20 @@
          if( modified )
          {
             // Current workaround for JBAS-4206
-            ClassLoader oldTCL = Thread.currentThread().getContextClassLoader();
-            ClassLoader tcl = getTCL(firstProfile);
+//            ClassLoader oldTCL = Thread.currentThread().getContextClassLoader();
+//            ClassLoader tcl = getTCL(firstProfile);
             try
             {
-               if (tcl != null)
-                  Thread.currentThread().setContextClassLoader(tcl);
-               mainDeployer.process();
+//               if (tcl != null)
+//                  Thread.currentThread().setContextClassLoader(tcl);
+               deployer.process();
                // Can be nulled by a shutdown
-               if(mainDeployer != null)
-                  mainDeployer.checkComplete();
+               if(deployer != null)
+                  deployer.checkComplete();
             }
             finally
             {
-               Thread.currentThread().setContextClassLoader(oldTCL);
+//               Thread.currentThread().setContextClassLoader(oldTCL);
             }
          }
       }
@@ -346,32 +343,32 @@
    /**
     * Current workaround for JBAS-4206
     */
-   private ClassLoader getTCL(Profile activeProfile)
-      throws Exception
-   {
-      MainDeployerStructure structure = (MainDeployerStructure) mainDeployer;
-      Collection<VFSDeployment> ctxs = activeProfile.getDeployments();
-      if (ctxs != null && ctxs.isEmpty() == false)
-      {
-         for (VFSDeployment deployment : ctxs)
-         {
-            DeploymentUnit unit = structure.getDeploymentUnit(deployment.getName());
-            if (unit != null)
-            {
-               try
-               {
-                  ClassLoader cl = unit.getClassLoader();
-                  if (cl != null)
-                     return cl;
-               }
-               catch (Exception ignored)
-               {
-               }
-            }
-            
-         }
-      }
-      log.warn("No bootstrap deployments? profile=" + activeProfile);
-      return null;
-   }
+//   private ClassLoader getTCL(Profile activeProfile)
+//      throws Exception
+//   {
+//      MainDeployerStructure structure = (MainDeployerStructure) mainDeployer;
+//      Collection<VFSDeployment> ctxs = activeProfile.getDeployments();
+//      if (ctxs != null && ctxs.isEmpty() == false)
+//      {
+//         for (VFSDeployment deployment : ctxs)
+//         {
+//            DeploymentUnit unit = structure.getDeploymentUnit(deployment.getName());
+//            if (unit != null)
+//            {
+//               try
+//               {
+//                  ClassLoader cl = unit.getClassLoader();
+//                  if (cl != null)
+//                     return cl;
+//               }
+//               catch (Exception ignored)
+//               {
+//               }
+//            }
+//            
+//         }
+//      }
+//      log.warn("No bootstrap deployments? profile=" + activeProfile);
+//      return null;
+//   }
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -34,13 +34,14 @@
 import java.util.List;
 import java.util.Set;
 
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.spi.attachments.MutableAttachments;
 import org.jboss.deployers.spi.structure.ClassPathEntry;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaData;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
 import org.jboss.logging.Logger;
@@ -49,6 +50,7 @@
 import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.profileservice.spi.AttachmentStore;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
 import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
 import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
@@ -132,6 +134,18 @@
       this.serializer = serializer;
    }
    
+   public Deployment createMCDeployment(ProfileDeployment profileDeployment) throws Exception
+   {
+      if(profileDeployment.getRoot() == null)
+      {
+         return new AbstractDeployment(profileDeployment.getName());
+      }
+      else
+      {
+         return deploymentFactory.createVFSDeployment(profileDeployment.getRoot());
+      }
+   }
+   
    /**
     * Create a VFSDeployment with predetermined managed object.
     * 
@@ -139,20 +153,24 @@
     * @param phase the deployment phase
     * @return the VFSDeployment
     */
-   public VFSDeployment loadDeploymentData(VirtualFile file) throws Exception
+   public Deployment loadDeploymentData(ProfileDeployment profileDeployment) throws Exception
    {
-      if(file == null)
-         throw new IllegalArgumentException("Cannot create a deployment for a null file.");
+      if(profileDeployment == null)
+         throw new IllegalArgumentException("Null profile deployment.");
       
       boolean trace = log.isTraceEnabled();
+      
       // Create VFS deployment
-      VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
-      if(trace)
+      Deployment deployment = createMCDeployment(profileDeployment);
+      if(log.isTraceEnabled())
          log.trace("Created deployment: " + deployment);
-
+      
+      // TODO also handle normal Deployments
+      if(profileDeployment.getRoot() == null)
+         return deployment;
+      
       // simpleName + hash
-      String deploymentPath = createRelativeDeploymentPath(deployment);
-      
+      String deploymentPath = createRelativeDeploymentPath(profileDeployment);
       if(trace)
          log.trace("trying to load attachment from relative path: " + deploymentPath);
       
@@ -172,7 +190,7 @@
          // If the deployment has changes we skip restoring the persisted metadata.
          // TODO delete attachments ?
          // TODO check metadata locations
-         if(attachPredeterminedObject(file, attachmentMetaData) == false)
+         if(attachPredeterminedObject(profileDeployment.getRoot(), attachmentMetaData) == false)
          {
             log.debug("Not using the persisted metadata, as the deployment was modified.");
             return deployment;
@@ -180,7 +198,7 @@
       }
       catch(IOException e)
       {
-         log.error("failed to get LastModified date for file, not using persisted metadata: "+ file.getPathName());
+         log.error("failed to get LastModified date for file, not using persisted metadata: "+ profileDeployment.getRoot().getPathName());
          return deployment;
       }
       
@@ -221,12 +239,19 @@
     * @param comp the managed component.
     * @throws Exception
     */
-   public void updateDeployment(VFSDeployment deployment, ManagedComponent comp)
+   public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp)
       throws Exception
    {
       if(deployment ==  null)
-         throw new IllegalArgumentException("VFSDeployment may not be null.");
+         throw new IllegalArgumentException("ProfileDeployment may not be null.");
       
+      if(deployment.getRoot() == null)
+      {
+         // TODO
+         log.debug("Cannot persist attachments for non VFS based deployment: " + deployment);
+         return;
+      }
+      
       if(comp == null)
          throw new IllegalArgumentException("ManagedComponent may not be null.");
       
@@ -442,7 +467,7 @@
     * @param deploymentPath the path to the attachment
     * @param attachmentMetaData the meta data
     */
-   protected void rebuildStructureContext(VFSDeployment deployment,
+   protected void rebuildStructureContext(Deployment deployment,
          String contextName,
          String deploymentPath,
          RepositoryAttachmentMetaData attachmentMetaData,
@@ -540,14 +565,18 @@
     * @return the relative name
     * @throws Exception
     */
-   protected String createRelativeDeploymentPath(VFSDeployment deployment) throws Exception
+   protected String createRelativeDeploymentPath(ProfileDeployment deployment) throws Exception
    {
       if(deployment == null)
          throw new IllegalStateException("Null deployment.");
       
-      String hash = HashGenerator.createHash(deployment);
+      // deployment URI toString
+      String pathName = deployment.getRoot().toURI().toString();
+      String fileName = deployment.getRoot().getName();
+      // Generate hash
+      String hash = HashGenerator.createHash(pathName);
       // simple name + "-" + hash
-      return deployment.getSimpleName() + "-" + hash + File.separator;
+      return fileName + "-" + hash + File.separator;
       
    }
    
@@ -670,11 +699,9 @@
        * @throws MalformedURLException
        * @throws URISyntaxException
        */
-      public static String createHash(VFSDeployment deployment)
+      public static String createHash(String pathName)
             throws NoSuchAlgorithmException, MalformedURLException, URISyntaxException
       {
-         // deployment URI toString
-         String pathName = deployment.getRoot().toURI().toString();
          // buffer
          StringBuffer buffer = new StringBuffer();
          // formatter

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -34,13 +34,13 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.profileservice.spi.AttachmentStore;
 import org.jboss.profileservice.spi.DeploymentContentFlags;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
@@ -62,7 +62,7 @@
    protected final Collection<URI> uris;
 
    /** The VFSDeployments. */
-   private Map<String, VFSDeployment> applicationCtxs = new ConcurrentHashMap<String, VFSDeployment>();
+   private Map<String, ProfileDeployment> applicationCtxs = new ConcurrentHashMap<String, ProfileDeployment>();
    
    /** The content flags. */
    private Map<String, Integer> contentFlags = new ConcurrentHashMap<String, Integer>();
@@ -141,7 +141,7 @@
       this.contentFlags.clear();
    }
    
-   public void addDeployment(String vfsPath, VFSDeployment d) throws Exception
+   public void addDeployment(String vfsPath, ProfileDeployment d) throws Exception
    {
       if(vfsPath == null)
          throw new IllegalArgumentException("Null vfsPath");
@@ -152,12 +152,12 @@
       updateLastModfied();
    }
    
-   public VFSDeployment removeDeployment(String vfsPath) throws Exception
+   public ProfileDeployment removeDeployment(String vfsPath) throws Exception
    {
       if(vfsPath == null)
          throw new IllegalArgumentException("Null vfsPath");
       
-      VFSDeployment deployment = this.applicationCtxs.remove(vfsPath);
+      ProfileDeployment deployment = this.applicationCtxs.remove(vfsPath);
       if(deployment != null)
          updateLastModfied();
       return deployment;
@@ -175,7 +175,7 @@
       addedDeployments(added, applicationDir);
       for (VirtualFile vf : added)
       {
-         VFSDeployment vfCtx = loadDeploymentData(vf);
+         ProfileDeployment vfCtx = loadDeploymentData(vf);
          addDeployment(vfCtx.getName(), vfCtx);
       }
    }
@@ -225,24 +225,29 @@
       }      
    }
 
-   public VFSDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+   public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
    {
       if(vfsPath == null)
          throw new IllegalArgumentException("Null vfsPath");
       
       boolean trace = log.isTraceEnabled();
-      VFSDeployment ctx = this.applicationCtxs.get(vfsPath);
+      ProfileDeployment ctx = this.applicationCtxs.get(vfsPath);
       // TODO should a lookup of the simple name really be done here ? 
       if(ctx == null)
       {
-         // Try to find the simple name
+         // Try to find the deployment based on the file name.
          if(trace)
-            log.trace("Failed to find application for: "+vfsPath+", scanning for simple name");
-         for(VFSDeployment deployment : applicationCtxs.values())
+            log.trace("Failed to find application for: "+ vfsPath +", trying to match filename.");
+         for(ProfileDeployment deployment : applicationCtxs.values())
          {
+            // Skip deployment with no vfs root.
+            if(deployment.getRoot() == null)
+               continue;
+            // Get the filename
+            String fileName = deployment.getRoot().getName(); 
             if(trace)
-               log.trace("Checking: "+deployment.getSimpleName());
-            if(deployment.getSimpleName().equals(vfsPath))
+               log.trace("Checking: "+fileName);
+            if(fileName.equals(vfsPath))
             {
                if(trace)
                   log.trace("Matched to simple name of deployment:"+deployment);
@@ -264,7 +269,7 @@
       return this.applicationCtxs.keySet();
    }
 
-   public Collection<VFSDeployment> getDeployments()
+   public Collection<ProfileDeployment> getDeployments()
    {
       return this.applicationCtxs.values();
    }
@@ -356,12 +361,12 @@
       return flags;
    }
 
-   protected VFSDeployment loadDeploymentData(VirtualFile vf) throws Exception
+   protected ProfileDeployment loadDeploymentData(VirtualFile vf) throws Exception
    {
-      return attachmentStore.loadDeploymentData(vf);
+      return new AbstractProfileDeployment(vf);
    }
    
-   public void updateDeployment(VFSDeployment d, ManagedComponent comp) throws Exception
+   public void updateDeployment(ProfileDeployment d, ManagedComponent comp) throws Exception
    {
       if(d == null)
          throw new IllegalArgumentException("Null deployment");

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.system.server.profileservice.repository;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The profile deployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileDeployment implements ProfileDeployment
+{
+   
+   /** The name. */
+   private String name;
+   
+   /** The vfs root. */
+   private VirtualFile root;
+
+   /** The attachments. */
+   private Map<String, Object> attachments = new ConcurrentHashMap<String, Object>();
+   
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -2600392045205267112L;
+   
+   /**
+    * Get the vfs file name safely.
+    * @see VFSDeployment
+    * 
+    * @param root the virtual file
+    * @return the name
+    */
+   static final String safeVirtualFileName(VirtualFile root)
+   {
+      if (root == null)
+         throw new IllegalArgumentException("Null root");
+
+      try
+      {
+         return root.toURI().toString();
+      }
+      catch (Exception e)
+      {
+         return root.getName();
+      }
+   }
+   
+   public AbstractProfileDeployment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+      this.name = name;
+   }
+   
+   public AbstractProfileDeployment(VirtualFile root)
+   {
+      this(safeVirtualFileName(root));
+      this.root = root;
+   }
+
+   /**
+    * Get the deployment name.
+    * 
+    * @return the name
+    */
+   public String getName()
+   {
+      return this.name;
+   }
+
+   /**
+    * Get the root of the deployment.
+    * 
+    * @return the root, or null if it's not a VFS deployment.
+    */
+   public VirtualFile getRoot()
+   {
+      return this.root;
+   }
+   
+   /**
+    * Get attachment.
+    * 
+    * @param name the name of the attachment
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public Object getAttachment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      
+      return this.attachments.get(name);
+   }
+
+   /**
+    * Add attachment.
+    *
+    * @param name the name of the attachment
+    * @param attachment the attachment
+    * @return any previous attachment
+    * 
+    * @throws IllegalArgumentException for a null name or attachment
+    */
+   public Object addAttachment(String name, Object attachment)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      if(attachment == null)
+         throw new IllegalArgumentException("Null attachment.");
+      
+      return this.attachments.put(name, attachment);
+   }
+   
+   /**
+    * Get all attachments.
+    * 
+    * @return the attachments
+    */
+   public Map<String, Object> getAttachments()
+   {
+      return Collections.unmodifiableMap(this.attachments);
+   }
+   
+   public String toString()
+   {
+      return "AbstractProfileDeployment(" + root != null ? root.getName() : name + ")";
+   }
+   
+}

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -61,7 +61,6 @@
       return createProfile(key, metaData, Collections.EMPTY_LIST);
    }
    
-   
    public Profile createProfile(ProfileKey key, ProfileMetaData metaData, List<ProfileKey> subProfiles) throws Exception
    {
       if(key == null)

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -40,7 +40,6 @@
 import org.jboss.dependency.spi.ControllerStateModel;
 import org.jboss.dependency.spi.DependencyInfo;
 import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.deployers.client.spi.main.MainDeployer;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.logging.Logger;
@@ -72,11 +71,14 @@
    private ManagementView managementView;
    
    /** The main deployer. */
-   private MainDeployer deployer;
+   private MainDeployerAdapter deployer;
    
    /** The controller. */
    private Controller controller;
    
+   /** The deploy state */
+   public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy"); 
+   
    /** The profileActions. */
    private Map<ControllerState, AbstractProfileLifeCycleAction> profileActions = new HashMap<ControllerState, AbstractProfileLifeCycleAction>();
    
@@ -91,12 +93,12 @@
       this.controller = new ScopedProfileServiceController(controller);
    }
    
-   public MainDeployer getDeployer()
+   public MainDeployerAdapter getDeployer()
    {
       return deployer;
    }
    
-   public void setDeployer(MainDeployer deployer)
+   public void setDeployer(MainDeployerAdapter deployer)
    {
       this.deployer = deployer;
    }
@@ -202,7 +204,7 @@
       
       // FIXME
       this.profileActions.put(ControllerState.CREATE, new ProfileCreateAction());
-      this.profileActions.put(ControllerState.START, new ProfileDeployAction(deployer));
+      this.profileActions.put(DEPLOY_STATE, new ProfileDeployAction(deployer));
       this.profileActions.put(ControllerState.INSTALLED, new ProfileInstallAction());
    }
    
@@ -406,8 +408,10 @@
    {
       if (ctx.getState().equals(ControllerState.ERROR))
       {
-         String error = ctx.getName() + " -> " + ctx.getError().toString(); 
-         errors.add(error);
+         JBossStringBuilder builder = new JBossStringBuilder();
+         builder.append("Profile: ").append(ctx.getName());
+         builder.append(" in error due to ").append(ctx.getError().toString()); 
+         errors.add(builder.toString());
       }
       else
       {
@@ -447,7 +451,7 @@
                if (print)
                {
                   JBossStringBuilder buffer = new JBossStringBuilder();
-                  buffer.append(name).append(" -> ");
+                  buffer.append(name).append(" is missing following dependencies: ");
 
                   buffer.append(iDependOn).append('{').append(dependentState.getStateString());
                   buffer.append(':');
@@ -528,4 +532,5 @@
          activeProfiles.remove(profile.getKey());
       }
    }
+   
 }

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.system.server.profileservice.repository;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Basic ProfileDeploymentFactory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultProfileDeploymentFactory
+{
+
+   /** The instance. */
+   private static final DefaultProfileDeploymentFactory INSTANCE = new DefaultProfileDeploymentFactory();
+   
+   protected DefaultProfileDeploymentFactory()
+   {
+      //
+   }
+   
+   public static DefaultProfileDeploymentFactory getInstance()
+   {
+      return INSTANCE;
+   }
+   
+   public ProfileDeployment createProfileDeployment(String name)
+   {
+      return new AbstractProfileDeployment(name);
+   }
+   
+   public ProfileDeployment createProfileDeployment(VirtualFile vf)
+   {
+      return new AbstractProfileDeployment(vf);
+   }
+   
+}
+

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -30,11 +30,11 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.profileservice.spi.AttachmentStore;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
 import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
 import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
@@ -139,7 +139,7 @@
             // Get the deployment content
             VirtualFile vf = getDeploymentContent(deploymentName);
             // Load the deployment
-            VFSDeployment deployment = getAttachmentStore().loadDeploymentData(vf);
+            ProfileDeployment deployment = loadDeploymentData(vf);
             // Add the deployment
             addDeployment(deployment.getName(), deployment);
          }

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.system.server.profileservice.repository;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.profileservice.spi.AttachmentStore;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * A basic adapter for the MainDeployer.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MainDeployerAdapter
+{
+   
+   /** The main deployer. */
+   private MainDeployer mainDeployer;
+   
+   /** The attachment store. */
+   private AttachmentStore store;
+   
+   public AttachmentStore getAttachmentStore()
+   {
+      return store;
+   }
+   
+   public void setAttachmentStore(AttachmentStore store)
+   {
+      this.store = store;
+   }
+   
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+   
+   public void setMainDeployer(MainDeployer mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+   
+   public void create() throws Exception
+   {
+      // Sanity check
+      if(mainDeployer == null)
+         throw new IllegalStateException("Null mainDeployer");
+      if(store == null)
+         throw new IllegalStateException("Null attachment store.");
+   }
+   
+   /**
+    * Add a deployment.
+    * 
+    * @param deployment the profile deployment.
+    * @throws Exception
+    */
+   public void addDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("Null deployment.");
+   
+      Deployment d = loadDeploymentData(deployment);
+      mainDeployer.addDeployment(d);
+   }
+   
+   /**
+    * Remove a deployment.
+    * 
+    * @param name the deployment name.
+    * @throws DeploymentException
+    */
+   public void removeDeployment(String name) throws DeploymentException
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+      
+      this.mainDeployer.removeDeployment(name);
+   }
+   
+   public void removeDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("Null deployment");
+      
+      removeDeployment(deployment.getName());  
+   }
+   
+   /**
+    * Process...
+    *
+    */
+   public void process()
+   {
+      this.mainDeployer.process();
+   }
+   
+   /**
+    * CheckComplete
+    * 
+    * @throws DeploymentException
+    */
+   public void checkComplete() throws DeploymentException
+   {
+      this.mainDeployer.checkComplete();
+   }
+ 
+   /**
+    * Create a MC deployment and load the persisted attachment data.
+    * 
+    * @param deployment the profile deployment.
+    * @return the MC deployment.
+    * @throws Exception
+    */
+   protected Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
+   {
+      return store.loadDeploymentData(deployment);
+   }
+   
+}
+

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -39,10 +39,10 @@
 
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
 import org.jboss.profileservice.spi.DeploymentContentFlags;
 import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileDeployment;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
 import org.jboss.virtual.VFS;
@@ -181,7 +181,7 @@
    public synchronized Collection<ModificationInfo> getModifiedDeployments() throws Exception
    {
       ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
-      Collection<VFSDeployment> apps = getDeployments();
+      Collection<ProfileDeployment> apps = getDeployments();
       boolean trace = log.isTraceEnabled();
       if (trace)
          log.trace("Checking applications for modifications");
@@ -192,11 +192,11 @@
       {
          if (apps != null)
          {
-            Iterator<VFSDeployment> iter = apps.iterator();
+            Iterator<ProfileDeployment> iter = apps.iterator();
             int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
             while (iter.hasNext())
             {
-               VFSDeployment ctx = iter.next();
+               ProfileDeployment ctx = iter.next();
                VirtualFile root = ctx.getRoot();
                String name = root.getPathName();
                // Ignore locked or disabled applications
@@ -226,7 +226,7 @@
                   if (trace)
                      log.trace(name + " was modified: " + rootLastModified);
                   // Need to create a duplicate ctx
-                  VFSDeployment ctx2 = loadDeploymentData(root);
+                  ProfileDeployment ctx2 = loadDeploymentData(root);
                   ModificationInfo info = new ModificationInfo(ctx2, rootLastModified, ModifyStatus.MODIFIED);
                   modified.add(info);
                }
@@ -245,7 +245,7 @@
                         log.trace("Ignoring locked application: " + vf);
                      continue;
                   }
-                  VFSDeployment ctx = loadDeploymentData(vf);
+                  ProfileDeployment ctx = loadDeploymentData(vf);
                   ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
                   modified.add(info);
                   addDeployment(ctx.getName(), ctx);
@@ -345,9 +345,9 @@
       return hasBeenModified;
    }
 
-   public VFSDeployment removeDeployment(String vfsPath) throws Exception
+   public ProfileDeployment removeDeployment(String vfsPath) throws Exception
    {
-      VFSDeployment vfsDeployment = getDeployment(vfsPath);
+      ProfileDeployment vfsDeployment = getDeployment(vfsPath);
       VirtualFile root = vfsDeployment.getRoot();
       if(root.delete() == false)
          throw new IOException("Failed to delete: " + root);
@@ -375,7 +375,7 @@
       if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
          return null;
 
-      return (VFSDeploymentContext)deploymentContext;
+      return (VFSDeploymentContext) deploymentContext;
    }
 
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -31,6 +31,13 @@
  */
 public class ProfileCreateAction extends AbstractProfileLifeCycleAction
 {
+   /** The instance. */
+   private static final AbstractProfileLifeCycleAction INSTANCE = new ProfileCreateAction();
+   
+   public static AbstractProfileLifeCycleAction getInstance()
+   {
+      return INSTANCE;
+   }
 
    @Override
    public void install(Profile profile) throws Exception 

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -23,9 +23,8 @@
 
 import java.util.Collection;
 
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
 
 /**
  * deploy/undeploy action. This deploys/undeploys the profile deployments
@@ -37,10 +36,10 @@
 public class ProfileDeployAction extends AbstractProfileLifeCycleAction
 {
 
-   /** The mainDeployer. */
-   private MainDeployer deployer;
+   /** The profile deployment deployer. */
+   private MainDeployerAdapter deployer;
    
-   public ProfileDeployAction(MainDeployer deployer)
+   public ProfileDeployAction(MainDeployerAdapter deployer)
    {
       if(deployer == null)
          throw new IllegalArgumentException("Null deployer");
@@ -50,11 +49,11 @@
    @Override
    public void install(Profile profile) throws Exception
    {
-      Collection<VFSDeployment> deployments = profile.getDeployments();
+      Collection<ProfileDeployment> deployments = profile.getDeployments();
       if (deployments != null && !deployments.isEmpty())
       {
          // Add deployments
-         for (VFSDeployment deployment : profile.getDeployments())
+         for (ProfileDeployment deployment : profile.getDeployments())
             deployer.addDeployment(deployment);
          // deploy
          deployer.process();
@@ -67,11 +66,11 @@
    public void uninstall(Profile profile) throws Exception
    {
       // Handle deployments
-      Collection<VFSDeployment> deployments = profile.getDeployments();
+      Collection<ProfileDeployment> deployments = profile.getDeployments();
       if (deployments != null && !deployments.isEmpty())
       {
          // remove deployments
-         for (VFSDeployment deployment : profile.getDeployments())
+         for (ProfileDeployment deployment : profile.getDeployments())
          {
             try
             {

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -21,8 +21,11 @@
  */ 
 package org.jboss.system.server.profileservice.repository;
 
+import static org.jboss.system.server.profileservice.repository.AbstractProfileService.DEPLOY_STATE;
+
 import org.jboss.dependency.plugins.AbstractController;
 import org.jboss.dependency.plugins.ScopedController;
+import org.jboss.dependency.spi.ControllerState;
 import org.jboss.metadata.spi.scope.CommonLevels;
 import org.jboss.metadata.spi.scope.ScopeKey;
 
@@ -38,6 +41,8 @@
       setScopeKey(new ScopeKey(CommonLevels.SUBSYSTEM, "Profile"));
       setParentController(parentController);
       setUnderlyingController(this);
+      getParentController().addController(this);
+      addState(DEPLOY_STATE, ControllerState.INSTALLED);
    }
 
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -33,8 +33,8 @@
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
-import org.jboss.system.server.profile.repository.metadata.FilteredProfileSourceMetaData;
-import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.FilteredProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileMetaData;
 import org.jboss.system.server.profile.repository.metadata.ProfilesMetaData;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
@@ -74,8 +74,8 @@
    {
       // Add schema bindings
       resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
-      resolver.addClassBinding("urn:jboss:profileservice:source:filtered:1.0", FilteredProfileSourceMetaData.class);
-      resolver.addClassBinding("urn:jboss:profileservice:source:hotdeployment:1.0", HotDeploymentProfileSourceMetaData.class);
+      resolver.addClassBinding("urn:jboss:profileservice:profile:filtered:1.0", FilteredProfileMetaData.class);
+      resolver.addClassBinding("urn:jboss:profileservice:profile:hotdeployment:1.0", HotDeploymentProfileMetaData.class);
    }
    
    public XmlProfileFactory(URI[] profileDirectories) throws Exception

Modified: trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile	2009-02-01 14:47:55 UTC (rev 83748)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <profiles 
-	xmlns="urn:jboss:profileservice:profiles:1.0">
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="metadata-deployers">
 
 	<profile name="metadata-deployer-beans">
 		<profile-source>

Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -23,11 +23,12 @@
 
 import java.net.URI;
 
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+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.managed.api.ManagedComponent;
 import org.jboss.profileservice.spi.AttachmentStore;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.profileservice.spi.ProfileDeployment;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -43,12 +44,18 @@
       return null;
    }
 
-   public VFSDeployment loadDeploymentData(VirtualFile vfsPath) throws Exception
+   public Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
    {
-      return factory.createVFSDeployment(vfsPath);
+      if(deployment == null)
+         throw new IllegalArgumentException("Null deployment");
+      
+      if(deployment.getRoot() == null)
+         return new AbstractDeployment(deployment.getName());
+      else
+         return factory.createVFSDeployment(deployment.getRoot());
    }
 
-   public void updateDeployment(VFSDeployment deployment, ManagedComponent comp) throws Exception
+   public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception
    {
       // nothing
    }

Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java	2009-02-01 14:47:37 UTC (rev 83747)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java	2009-02-01 14:47:55 UTC (rev 83748)
@@ -32,7 +32,9 @@
 import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
 import org.jboss.system.server.profileservice.repository.AbstractProfileService;
 import org.jboss.system.server.profileservice.repository.FilteredDeploymentRepositoryFactory;
+import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
 import org.jboss.system.server.profileservice.repository.XmlProfileFactory;
+import org.jboss.test.server.profileservice.support.MockAttachmentStore;
 import org.jboss.test.server.profileservice.support.MockMainDeployer;
 import org.jboss.virtual.plugins.context.jar.JarUtils;
 
@@ -55,9 +57,12 @@
       super.setUp();
       // Create profile service
       MockMainDeployer mainDeployer = new MockMainDeployer();
+      MainDeployerAdapter adapter = new MainDeployerAdapter();
+      adapter.setMainDeployer(mainDeployer);
+      adapter.setAttachmentStore(new MockAttachmentStore());
       AbstractController parentController = new AbstractController();
       AbstractProfileService profileService = new AbstractProfileService(parentController);
-      profileService.setDeployer(mainDeployer);
+      profileService.setDeployer(adapter);
       // 
       profileService.create();
       this.profileService = profileService;




More information about the jboss-cvs-commits mailing list