[jboss-cvs] system2/src/main/org/jboss/system/server/profile/basic ...

Scott Stark scott.stark at jboss.com
Wed Jul 12 05:07:49 EDT 2006


  User: starksm 
  Date: 06/07/12 05:07:49

  Modified:    src/main/org/jboss/system/server/profile/basic 
                        ProfileImpl.java
  Log:
  Maintain a mapping of the deployment/names
  
  Revision  Changes    Path
  1.3       +26 -14    system2/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ProfileImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/system2/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ProfileImpl.java	9 Jul 2006 23:45:53 -0000	1.2
  +++ ProfileImpl.java	12 Jul 2006 09:07:49 -0000	1.3
  @@ -21,29 +21,43 @@
    */
   package org.jboss.system.server.profile.basic;
   
  -import java.util.ArrayList;
  +import java.io.File;
  +import java.util.HashMap;
   import java.util.Map;
   
  -import org.jboss.deployers.plugins.DeploymentImpl;
   import org.jboss.deployers.spi.Deployment;
   import org.jboss.profileservice.spi.DeploymentTemplate;
   import org.jboss.profileservice.spi.NoSuchDeploymentException;
   import org.jboss.profileservice.spi.Profile;
  +import org.jboss.util.JBossObject;
   
   /**
  - * A basic profile implementation that uses the filesystem to store
  + * A basic profile implementation that uses the filesystem to store deployments
  + * and admin metadata.
  + * 
  + * TODO: this needs to be converted to a read/write VFS implementation.
    * 
    * @author Scott.Stark at jboss.org
    * @version $Revision$
    */
  -public class ProfileImpl implements Profile
  +public class ProfileImpl extends JBossObject
  +   implements Profile
   {
      private String name;
  -   private ArrayList<DeploymentImpl> deployments = new ArrayList<DeploymentImpl>();
  +   /** The directory containing the profiles */
  +   private File profileRoot;
  +   private HashMap<String,Deployment> deployments = new HashMap<String,Deployment>();
   
  -   public ProfileImpl(String name)
  +   public ProfileImpl(String profileRoot, String name)
      {
         this.name = name;
  +      this.profileRoot = new File(profileRoot);
  +      log.info("Using profile root:"+this.profileRoot.getAbsolutePath());
  +   }
  +
  +   public String getName()
  +   {
  +      return name;
      }
   
      public String getVersion()
  @@ -61,27 +75,25 @@
   
      public void addDeployment(Deployment d)
      {
  -      // TODO Auto-generated method stub
  -
  +      deployments.put(d.getName(), d);
      }
   
      public void removeDeployment(String name)
      {
  -      // TODO Auto-generated method stub
  -
  +      deployments.remove(name);
      }
   
      public Deployment getDeployment(String name)
            throws NoSuchDeploymentException
      {
  -      // TODO Auto-generated method stub
  -      return null;
  +      Deployment deployment = deployments.get(name);
  +      return deployment;
      }
   
      public Deployment[] getDeployments()
      {
         Deployment[] tmp = new Deployment[deployments.size()];
  -      deployments.toArray(tmp);
  +      deployments.values().toArray(tmp);
         return tmp;
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list