[jboss-cvs] JBossAS SVN: r59586 - in trunk/system/src: main/org/jboss/profileservice/spi and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 12 02:37:27 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-12 02:36:58 -0500 (Fri, 12 Jan 2007)
New Revision: 59586

Added:
   trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java
   trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplateInfo.java
   trunk/system/src/main/org/jboss/profileservice/spi/AttachmentsSerializer.java
   trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
Removed:
   trunk/system/src/main/org/jboss/deployers/spi/management/ManagedObject.java
   trunk/system/src/main/org/jboss/deployers/spi/management/ManagedPropertyRef.java
   trunk/system/src/main/org/jboss/profileservice/spi/ArrayType.java
   trunk/system/src/main/org/jboss/profileservice/spi/CompositeData.java
   trunk/system/src/main/org/jboss/profileservice/spi/CompositeType.java
   trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java
   trunk/system/src/main/org/jboss/profileservice/spi/OpenType.java
   trunk/system/src/main/org/jboss/profileservice/spi/PropertyInfo.java
   trunk/system/src/main/org/jboss/profileservice/spi/SimpleType.java
   trunk/system/src/main/org/jboss/system/server/profileservice/ManagementViewImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java
   trunk/system/src/tests/org/jboss/test/profileservice/
Modified:
   trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
   trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
   trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
   trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java
   trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java
   trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
   trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
   trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
   trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
Log:
Refactor the profile service apis to support a persistent repository

Copied: trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java (from rev 59405, trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java)
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java	2007-01-08 06:09:29 UTC (rev 59405)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplate.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,42 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.deployers.spi.management;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A DeploymentTemplate is a demplate for creating a DeploymentContext given
+ * a set of ManagedProperty representing the template properties
+ * to set in the resulting deployment.
+ * 
+ * TODO: this needs to be fleshed out in terms of the various pieces, raw deployment
+ * files, ManagedObjects, etc. 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentTemplate
+{
+   public DeploymentTemplateInfo getInfo();
+   VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values)
+      throws Exception;
+}

Added: trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplateInfo.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplateInfo.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplateInfo.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.deployers.spi.management;
+
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ * The exportable information for a DeploymentTemplate.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentTemplateInfo
+{
+   public String getName();
+   public String getDescription();
+   public Set<ManagedProperty> getProperties();
+}


Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/DeploymentTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Deleted: trunk/system/src/main/org/jboss/deployers/spi/management/ManagedObject.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagedObject.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagedObject.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.deployers.spi.management;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.profileservice.spi.PropertyInfo;
-
-/**
- * A collection of the properties making up a deployment managed object
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ManagedObject
-   implements Serializable
-{
-   private static final long serialVersionUID = 1;
-
-   private ArrayList<PropertyInfo> properties = new ArrayList<PropertyInfo>();
-
-   public ManagedObject()
-   {
-   }
-
-   public List<PropertyInfo> getProperties()
-   {
-      return properties;
-   }
-
-   public boolean addPropertyRef(PropertyInfo ref)
-   {
-      return properties.add(ref);
-   }
-   public boolean removePropertyRef(PropertyInfo ref)
-   {
-      return properties.remove(ref);
-   }
-   public int getSize()
-   {
-      return properties.size();
-   }
-   public void clear()
-   {
-      properties.clear();
-   }
-}

Deleted: trunk/system/src/main/org/jboss/deployers/spi/management/ManagedPropertyRef.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagedPropertyRef.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagedPropertyRef.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.deployers.spi.management;
-
-/**
- * A management view wrapper of a bean property.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ManagedPropertyRef
-{
-   /**
-    * A namespace context that maps the managed property onto a managed view
-    * context (e.g., /, /DataSource, /DataSource/Pool).
-    */
-   private String context;
-   /**
-    * The DeploymentBean name which sources the property
-    * @return
-    */
-   private String beanName;
-   /**
-    * The DeploymentBean property name
-    */
-   private String propertyName;
-   /**
-    * An option management view description of the property
-    */
-   private String description;
-
-   /**
-    * Create a managed property ref for the indicated bean property.
-    * @param context
-    * @param beanName
-    * @param propertyName
-    * @param description
-    */
-   public ManagedPropertyRef(String context, String beanName,
-      String propertyName, String description)
-   {
-      this.context = context;
-      this.beanName = beanName;
-      this.propertyName = propertyName;
-      this.description = description;
-   }
-
-   /**
-    * @return Returns the beanName.
-    */
-   public String getBeanName()
-   {
-      return this.beanName;
-   }
-
-   /**
-    * @return Returns the context.
-    */
-   public String getContext()
-   {
-      return this.context;
-   }
-
-   /**
-    * @return Returns the description.
-    */
-   public String getDescription()
-   {
-      return this.description;
-   }
-
-   /**
-    * @return Returns the propertyName.
-    */
-   public String getPropertyName()
-   {
-      return this.propertyName;
-   }
-
-   /**
-    * Equality based on beanName + propertyName
-    */
-   public boolean equals(Object obj)
-   {
-      ManagedPropertyRef ref = (ManagedPropertyRef) obj;
-      boolean equals = beanName.equals(ref.beanName);
-      if( equals )
-      {
-         equals = propertyName.equals(ref.propertyName);
-      }
-      return equals;
-   }
-
-   /**
-    * Hash based on beanName + propertyName
-    */
-   public int hashCode()
-   {
-      return beanName.hashCode() + propertyName.hashCode();
-   }
-}

Modified: trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,9 +22,13 @@
 
 package org.jboss.deployers.spi.management;
 
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedObject;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 
 /**
  * The management view plugin spi for querying profiles for the
@@ -42,11 +46,41 @@
     * 
     * @param key - the profile containing the deployment
     * @param deploymentName - the name of deployment
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
     * @return the root management view
     * @throws NoSuchProfileException
     * @throws NoSuchDeploymentException 
     */
-   public ManagedObject getView(ProfileKey key, String deploymentName, String version)
-      throws NoSuchProfileException, NoSuchDeploymentException;
+   public ManagedObject getView(ProfileKey key, String deploymentName, DeploymentPhase phase)
+      throws NoSuchProfileException, NoSuchDeploymentException, Exception;
 
+   /**
+    * Get the registered DeploymentTemplate names.
+    * 
+    * TODO: probably needs a Map<String, DeploymentType> notion
+    * @return
+    */
+   public Set<String> getTemplateNames();
+
+   /**
+    * Get a deployment template.
+    * 
+    * @param name - the deployment name to identify the template to retrieve
+    * @return the named DeploymentTemplate
+    * @throws NoSuchDeploymentException - if there is no such deployment
+    */
+   public DeploymentTemplateInfo getTemplate(String name) throws NoSuchDeploymentException;
+
+   /**
+    * 
+    * @param key
+    * @param phase
+    * @param deploymentBaseName
+    * @param info
+    * @throws Exception
+    */
+   public void applyTemplate(ProfileKey key, DeploymentPhase phase,
+         String deploymentBaseName, DeploymentTemplateInfo info)
+         throws Exception;
 }

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/ArrayType.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ArrayType.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ArrayType.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,56 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public class ArrayType<T>
-   extends OpenType<T>
-{
-   private int dimension;
-   private OpenType<?> elementType;
-
-   public ArrayType(int dimension, OpenType<?> elementType)
-   {
-      super(elementType.getClassName(), elementType.getClassName(),
-         "Array of: "+elementType.getClassName());
-      this.dimension = dimension;
-      this.elementType = elementType;
-   }
-
-   public int getDimension()
-   {
-      return dimension;
-   }
-   public OpenType<?> getElementOpenType()
-   {
-      return elementType;
-   }
-   public boolean isValue(Object value)
-   {
-      return false;
-   }
-}

Added: trunk/system/src/main/org/jboss/profileservice/spi/AttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/AttachmentsSerializer.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/AttachmentsSerializer.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.spi;
+
+import java.util.Map;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+
+/**
+ * An interface that allows externalization of the attachment
+ * serialization details.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface AttachmentsSerializer
+{
+   public void saveAttachments(DeploymentContext ctx) throws Exception;
+   public Map<String, Object> loadAttachments(DeploymentContext ctx) throws Exception;
+}


Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/AttachmentsSerializer.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/CompositeData.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/CompositeData.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/CompositeData.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,40 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-import java.util.Collection;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public interface CompositeData
-{
-   public CompositeType getCompositeType();
-   public Object get(String key);
-   public Object[] getAll(String[] keys);
-   public boolean containsKey(String key);
-   public boolean containsValue(Object value);
-   public Collection<?> values();
-}

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/CompositeType.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/CompositeType.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/CompositeType.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,61 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public class CompositeType<T>
-   extends OpenType<T>
-{
-   public CompositeType(String typeName, String description,
-      String[] itemNames, String[] itemDescriptions, OpenType<T>[] itemTypes)
-   {
-      super(CompositeData.class.getName(), typeName, description);
-   }
-   public String getDescription(String itemName)
-   {
-      return null;
-   }
-   public boolean containsKey(String itemName)
-   {
-      return false;
-   }
-   public OpenType<?> getType(String itemName)
-   {
-      return null;
-   }
-   public Set<String> keySet()
-   {
-      return new HashSet<String>();
-   }
-   public boolean isValue(Object obj)
-   {
-      return false;
-   }
-}

Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,14 +22,13 @@
 package org.jboss.profileservice.spi;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URI;
 import java.util.Collection;
 import java.util.zip.ZipInputStream;
 
 import org.jboss.deployers.spi.attachments.Attachments;
 import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 
 /**
  * An interface for managing the contents of a Profile.
@@ -39,44 +38,73 @@
  */
 public interface DeploymentRepository
 {
-   public URI getBootstrapURI();
-   public void setBootstrapURI(URI uri);
-   public URI getDeployersURI();
-   public void setDeployersURI(URI uri);
-   public URI getDeploymentURI();
-   public void setDeploymentURI(URI rootURI);
+   public void create() throws Exception;
+   public void load() throws Exception;
+   public void remove() throws Exception;
 
+   public URI getDeploymentURI(DeploymentPhase phase);
+   public void setDeploymentURI(URI uri, DeploymentPhase phase);
+
+   public Collection<String> getDeploymentNames();
+   public Collection<String> getDeploymentNames(DeploymentPhase phase);
+
+
    // Upload a raw deployment
-   public VirtualFile addDeploymentFile(String name, ZipInputStream contentIS)
+   public void addDeploymentContent(String name, ZipInputStream contentIS, DeploymentPhase phase)
       throws IOException;
-   // Get the raw deployment
-   public VirtualFile getDeploymentFile(String name);
 
-   // Bootstrap
-   public void addBootstrap(String vfsPath, DeploymentContext ctx)
-      throws IOException;
-   public DeploymentContext getBootstrap(String vfsPath);
-   public Collection<DeploymentContext> getBootstraps();
-   public void removeBootstrap(String vfsPath)
-      throws IOException;
+   /**
+    * Add a deployment
+    * 
+    * @param d the deployment
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    */
+   public void addDeployment(String vfsPath, DeploymentContext d, DeploymentPhase phase)
+      throws Exception;
+   public void updateDeployment(String vfsPath, DeploymentContext d, DeploymentPhase phase)
+      throws Exception;
+   /**
+    * Get a named deployment.
+    * 
+    * @param name - the deployment name
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    * @return the named bootstrap
+    * @throws NoSuchDeploymentException - if there is no such bootstrap
+    * @throws IOException 
+    */
+   public DeploymentContext getDeployment(String name, DeploymentPhase phase)
+      throws NoSuchDeploymentException, Exception;
 
-   // Deployers
-   public void addDeployer(String vfsPath, DeploymentContext ctx)
-      throws IOException;
-   public DeploymentContext getDeployer(String vfsPath);
-   public Collection<DeploymentContext> getDeployers();
-   public void removeDeployer(String vfsPath)
-      throws IOException;
+   /**
+    * Remove a deployment
+    * 
+    * @param name - the deployment name
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    */
+   public void removeDeployment(String vfsPath, DeploymentPhase phase)
+      throws Exception;
 
-   // Deployments
-   public void addDeployment(String vfsPath, DeploymentContext ctx)
-      throws IOException;
-   public DeploymentContext getDeployment(String vfsPath);
-   public void removeDeployment(String vfsPath)
-      throws IOException;
-   public Collection<DeploymentContext> getDeployments();
+   /**
+    * Get all deployments for the given phase defined in this profile
+    * 
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    * @return the bootstrap instances in this profile.
+    */
+   public Collection<DeploymentContext> getDeployments(DeploymentPhase phase)
+      throws Exception;
+   /**
+    * Get all deployments defined in this profile
+    * 
+    * @return the deployment instances in this profile.
+    */
+   public Collection<DeploymentContext> getDeployments()
+      throws Exception;
 
    // Managed object attachments for a deployment
    public void addManagedObject(String vfsPath, Attachments edits)
-      throws IOException;
+      throws Exception;
 }

Added: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.spi;
+
+/**
+ * A factory for DeploymentRepository
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface DeploymentRepositoryFactory
+{
+   public DeploymentRepository getDeploymentRepository(ProfileKey key);
+}


Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentTemplate.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,39 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-import java.util.Set;
-
-import org.jboss.deployers.spi.structure.DeploymentContext;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public interface DeploymentTemplate
-{
-   String getName();
-   Set<PropertyInfo> getProperties();
-   DeploymentContext expand(Set<PropertyInfo> values);
-}

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/OpenType.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/OpenType.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/OpenType.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,56 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public abstract class OpenType<T>
-{
-   private String className;
-   private String typeName;
-   private String description;
-   protected OpenType(String className, String typeName, String description)
-   {
-      this.className = className;
-      this.typeName = typeName;
-      this.description = description;
-   }
-
-   public String getClassName()
-   {
-      return className;
-   }
-   public String getTypeName()
-   {
-      return typeName;
-   }
-   public String getDescription()
-   {
-      return description;
-   }
-   
-   public abstract boolean isValue(Object value);
-}

Modified: trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -25,6 +25,7 @@
 import java.util.Map;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * A profile represents a named collection of deployments on a server
@@ -34,116 +35,111 @@
  */
 public interface Profile
 {
+   /** The class of deployment */
+   public enum DeploymentPhase {
+      /** A deployment loaded during the server bootstrap phase */
+      BOOTSTRAP,
+      /** An mc/service deployment for a Deployer to be loaded after the BOOTSTRAP phase */
+      DEPLOYER,
+      /** Any deployment content to be loaded after the DEPLOYER phase */
+      APPLICATION
+   };
+
    /**
     * The x.y.z version of the profile
     * 
-    * @return the version
+    * @return the version if known, null if its unspecified.
     */
    String getVersion();
 
    /**
-    * Get a deployment template.
-    * 
-    * @param name - the deployment name to identify the template to retrieve
-    * @return the named DeploymentTemplate
-    * @throws NoSuchDeploymentException - if there is no such deployment
-    */
-   DeploymentTemplate getTemplate(String name) throws NoSuchDeploymentException;
+    * Get the names of the deployments in the profile
+    * @return names of deployments
+        */
+   public Collection<String> getDeploymentNames();
 
    /**
-    * Add a bootstrap
-    * 
-    * @param d the bootstrap
-    */
-   void addBootstrap(DeploymentContext d) throws Exception;
+    * Get the names of the deployments for the given phase defined in this profile
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    * @return names of deployments
+        */
+   public Collection<String> getDeploymentNames(DeploymentPhase phase);
 
    /**
-    * Remove a bootstrap
+    * Get the root for deployments of the given phase.
     * 
-    * @param name the name
+    * @param phase
+    * @return the VirtualFile directory that contains deployments of the
+    * given phase.
     */
-   void removeBootstrap(String name) throws Exception;
+   public VirtualFile getRootFile(DeploymentPhase phase)
+      throws Exception;
 
    /**
-    * Get a named bootstrap.
+    * Add a deployment
     * 
-    * @param name - the bootstrap name
-    * @return the named bootstrap
-    * @throws NoSuchDeploymentException - if there is no such bootstrap
+    * @param d the deployment
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
     */
-   DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException;
-
+   public void addDeployment(DeploymentContext d, DeploymentPhase phase)
+      throws Exception;
    /**
-    * Get all bootstraps defined in this profile
+    * Update a deployment. This can be used to save attachments, other
+    * metadata of the deployment.
     * 
-    * @return the bootstrap instances in this profile.
-    */
-   Collection<DeploymentContext> getBootstraps();
-
-   /**
-    * Add a deployer
-    * 
-    * @param d the deployer
-    */
-   void addDeployer(DeploymentContext d) throws Exception;
-
-   /**
-    * Remove a deployer
-    * 
-    * @param name the name
-    */
-   void removeDeployer(String name) throws Exception;
-
-   /**
-    * Get a named deployer.
-    * 
-    * @param name - the deployer name 
-    * @return the named Deployer
-    * @throws NoSuchDeploymentException - if there is no such deployer
-    */
-   DeploymentContext getDeployer(String name) throws NoSuchDeploymentException;
-
-   /**
-    * Get all deployer defined in this profile
-    * 
-    * @return the deployer instances in this profile.
-    */
-   Collection<DeploymentContext> getDeployers();
-
-   /**
-    * Add a deployment
-    * 
     * @param d the deployment
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    * @throws Exception
     */
-   void addDeployment(DeploymentContext d) throws Exception;
+   public void updateDeployment(DeploymentContext d, DeploymentPhase phase)
+      throws Exception;
 
    /**
     * Remove a deployment
-    * 
-    * @param name the name
-    */
-   void removeDeployment(String name) throws Exception;
+        * 
+        * @param name the name
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+        */
+   public void removeDeployment(String name, DeploymentPhase phase)
+      throws Exception;
 
    /**
     * Get a named deployment.
-    * 
+        * 
     * @param name - the deployment name
-    * @return the named Deployment
-    * @throws NoSuchDeploymentException - if there is no such deployment
-    */
-   DeploymentContext getDeployment(String name) throws NoSuchDeploymentException;
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+        * @return the named bootstrap
+        * @throws NoSuchDeploymentException - if there is no such bootstrap
+        */
+   public DeploymentContext getDeployment(String name, DeploymentPhase phase)
+      throws Exception, NoSuchDeploymentException;
 
    /**
+    * @param phase - the phase of the deployment as it relates to when the
+    * deployment is loaded
+    * @return the bootstrap instances in this profile.
+        */
+   public Collection<DeploymentContext> getDeployments(DeploymentPhase phase)
+      throws Exception;
+
+   /**
     * Get all deployments defined in this profile
     * 
     * @return the deployment instances in this profile.
     */
-   Collection<DeploymentContext> getDeployments();
+   public Collection<DeploymentContext> getDeployments()
+      throws Exception;
 
    /**
     * Get the config
     * 
     * @return the config
     */
-   Map<String, Object> getConfig();
+   public Map<String, Object> getConfig();
+
 }

Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileRepository.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.spi;
 
 import java.io.IOException;
+import java.util.Collection;
 
 /**
  * An interface for obtaining DeploymentRepository for a Profile.
@@ -32,6 +33,12 @@
 public interface ProfileRepository
 {
    /**
+    * Get the keys for all known profiles
+    * @return keys for all known profiles
+    */
+   public Collection<ProfileKey> getProfileKeys();
+
+   /**
     * Create a new DeploymentRepository for a profile.
     * 
     * @param key - the key for the Profile to create the DeploymentRepository for.
@@ -40,7 +47,7 @@
     *    already exists
     */
    public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
-      throws IOException;
+      throws Exception;
 
    /**
     * Get the DeploymentRepository for the given profile key.
@@ -50,7 +57,7 @@
     * @throws NoSuchProfileException thrown if there is no such profile.
     */
    public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
-      throws IOException, NoSuchProfileException;
+      throws Exception, NoSuchProfileException;
 
    /**
     * Remove the DeploymentRepository for the given profile key.
@@ -59,5 +66,5 @@
     * @throws NoSuchProfileException thrown if there is no such profile.
     */
    public void removeProfileDeploymentRepository(ProfileKey key)
-      throws IOException, NoSuchProfileException;
+      throws Exception, NoSuchProfileException;
 }

Modified: trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/ProfileService.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,6 +22,8 @@
 
 package org.jboss.profileservice.spi;
 
+import java.util.Collection;
+
 import org.jboss.deployers.spi.management.ManagementView;
 
 /**
@@ -46,7 +48,7 @@
     * Get the keys for all known profiles
     * @return keys for all known profiles
     */
-   public ProfileKey[] getProfileKeys();
+   public Collection<ProfileKey> getProfileKeys();
 
    /**
     * Obtain the profile for the key.
@@ -55,7 +57,7 @@
     * @return the matching profile.
     * @throws NoSuchProfileException
     */
-   public Profile getProfile(ProfileKey key, String version)
+   public Profile getProfile(ProfileKey key)
       throws NoSuchProfileException;
 
    /**
@@ -74,9 +76,9 @@
    public ManagementView getViewManager();
 
    // Admin of profiles @todo could be an option plugin
-   public Profile newProfile(ProfileKey key, String version)
+   public Profile newProfile(ProfileKey key)
       throws Exception;
-   public void removeProfile(ProfileKey key, String version)
+   public void removeProfile(ProfileKey key)
       throws Exception;
 
 }

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/PropertyInfo.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/PropertyInfo.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/PropertyInfo.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,57 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-import java.util.Set;
-
-/**
- * Modelled after the JMX OpenMBeanParameterInfo
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface PropertyInfo
-{
-   public String getName();
-   public String getDescription();
-   public Set<?> getLegalValues();
-   public Comparable<?> getMinValue();
-   public Comparable<?> getMaxValue();
-   public boolean isValue(Object obj);
-   public OpenType<?> getOpenType();
-   public Object getFieldValue(String fieldName);
-   public void setFields(String[] fieldNames, Object[] fieldValues);    
-
-   /**
-    * Get the current property value. Must interact with the
-    * Policy somehow.
-    * @return current property value.
-    */
-   public Object getValue();
-
-   /**
-    * Set the current property value. Must interact with the
-    * Policy somehow.
-    * @param value - current property value.
-    */
-   public void setValue(Object value);
-}

Deleted: trunk/system/src/main/org/jboss/profileservice/spi/SimpleType.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/SimpleType.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/profileservice/spi/SimpleType.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,47 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-
-package org.jboss.profileservice.spi;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-
-public final class SimpleType<T>
-   extends OpenType<T>
-{
-   public static final SimpleType<Void> VOID = new SimpleType<Void>(Void.class);
-
-   public static final SimpleType<String> STRING = new SimpleType<String>(String.class);
-
-   public static final SimpleType<Boolean> BOOLEAN = new SimpleType<Boolean>(Boolean.class);
-
-   private SimpleType(Class<T> valueClass)
-   {
-      super(valueClass.getName(), valueClass.getName(), valueClass.getName());
-   }
-   public boolean isValue(Object obj)
-   {
-      return false;
-   }
-}

Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -24,20 +24,23 @@
 import java.io.File;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.profileservice.spi.DeploymentTemplate;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.util.JBossObject;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 
 /**
- * A basic profile implementation that uses the filesystem to store deployments
- * and admin metadata.
+ * A basic profile implementation that uses in memory store for the applications.
+ * This has to be populated by some other components.
  * 
- * TODO: this needs to be converted to a read/write VFS implementation.
+ * @see VFSScanner and subclasses for an example usage.
  * 
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
@@ -50,7 +53,7 @@
    /** The directory containing the profiles */
    private File profileRoot;
    private LinkedHashMap<String,DeploymentContext> bootstraps = new LinkedHashMap<String,DeploymentContext>();
-   private LinkedHashMap<String,DeploymentContext> deployments = new LinkedHashMap<String,DeploymentContext>();
+   private LinkedHashMap<String,DeploymentContext> applications = new LinkedHashMap<String,DeploymentContext>();
    private LinkedHashMap<String,DeploymentContext> deployers = new LinkedHashMap<String,DeploymentContext>();
 
    public ProfileImpl(String profileRoot, String name)
@@ -67,84 +70,213 @@
 
    public String getVersion()
    {
+      return null;
+   }
+
+   /**
+    * Get the names of the applications in the profile
+    * @return names of applications
+    */
+   public Collection<String> getDeploymentNames()
+   {
+      HashSet<String> names = new HashSet<String>();
+      names.addAll(this.bootstraps.keySet());
+      names.addAll(this.deployers.keySet());
+      names.addAll(this.applications.keySet());
+      return names;
+   }
+
+   public VirtualFile getRootFile(DeploymentPhase phase)
+      throws Exception
+   {
+      VirtualFile root = VFS.getRoot(profileRoot.toURI());
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            root = root.findChild("conf");
+            break;
+         case DEPLOYER:
+            root = root.findChild("deployers");
+            break;
+         case APPLICATION:
+            root = root.findChild("deploy");
+            break;
+      }      
+      return root;
+   }
+
+   public void addDeployment(DeploymentContext d, DeploymentPhase phase)
+      throws Exception
+   {
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            this.addBootstrap(d);
+            break;
+         case DEPLOYER:
+            this.addDeployer(d);
+            break;
+         case APPLICATION:
+            this.addApplication(d);
+            break;
+      }      
+   }
+   public void updateDeployment(DeploymentContext d, DeploymentPhase phase)
+      throws Exception
+   {
+   
+   }
+
+   public DeploymentContext getDeployment(String name, DeploymentPhase phase)
+      throws NoSuchDeploymentException
+   {
+      DeploymentContext ctx = null;
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            ctx = this.getBootstrap(name);
+            break;
+         case DEPLOYER:
+            ctx = this.getDeployer(name);
+            break;
+         case APPLICATION:
+            ctx = this.getApplication(name);
+            break;
+      }
+      return ctx;
+   }
+
+   public Collection<String> getDeploymentNames(DeploymentPhase phase)
+   {
+      HashSet<String> names = new HashSet<String>();
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            names.addAll(this.bootstraps.keySet());
+            break;
+         case DEPLOYER:
+            names.addAll(this.deployers.keySet());
+            break;
+         case APPLICATION:
+            names.addAll(this.applications.keySet());
+            break;
+      }
+      return names;
+   }
+
+   public Collection<DeploymentContext> getDeployments()
+   {
+      HashSet<DeploymentContext> deployments = new HashSet<DeploymentContext>();
+      deployments.addAll(this.bootstraps.values());
+      deployments.addAll(this.deployers.values());
+      deployments.addAll(this.applications.values());
+      return Collections.unmodifiableCollection(deployments);
+   }
+
+   public Collection<DeploymentContext> getDeployments(DeploymentPhase phase)
+   {
+      Collection<DeploymentContext> ctxs = null;
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            ctxs = this.getBootstraps();
+            break;
+         case DEPLOYER:
+            ctxs = this.getDeployers();
+            break;
+         case APPLICATION:
+            ctxs = this.getApplications();
+            break;
+      }
+      return ctxs;
+   }
+
+   public void removeDeployment(String name, DeploymentPhase phase)
+      throws Exception
+   {
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            this.removeBootstrap(name);
+            break;
+         case DEPLOYER:
+            this.removeDeployer(name);
+            break;
+         case APPLICATION:
+            this.removeApplication(name);
+            break;
+      }
+   }
+
+   public Map<String, Object> getConfig()
+   {
       // TODO Auto-generated method stub
       return null;
    }
 
-   public void addBootstrap(DeploymentContext d)
+   protected void addBootstrap(DeploymentContext d)
    {
       bootstraps.put(d.getName(), d);
    }
 
-   public void removeBootstrap(String name)
+   protected void removeBootstrap(String name)
    {
       bootstraps.remove(name);
    }
 
-   public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
+   protected DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
    {
       DeploymentContext deployment = bootstraps.get(name);
       return deployment;
    }
 
-   public Collection<DeploymentContext> getBootstraps()
+   protected Collection<DeploymentContext> getBootstraps()
    {
       return Collections.unmodifiableCollection(bootstraps.values());
    }
 
-   public void addDeployer(DeploymentContext d)
+   protected void addDeployer(DeploymentContext d)
    {
       deployers.put(d.getName(), d);
    }
 
-   public void removeDeployer(String name)
+   protected void removeDeployer(String name)
    {
       deployers.remove(name);
    }
 
-   public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
+   protected DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
    {
       DeploymentContext deployment = deployers.get(name);
       return deployment;
    }
 
-   public Collection<DeploymentContext> getDeployers()
+   protected Collection<DeploymentContext> getDeployers()
    {
       return Collections.unmodifiableCollection(deployers.values());
    }
 
-   public DeploymentTemplate getTemplate(String name)
-         throws NoSuchDeploymentException
+   protected void addApplication(DeploymentContext d)
    {
-      // TODO Auto-generated method stub
-      return null;
+      applications.put(d.getName(), d);
    }
 
-   public void addDeployment(DeploymentContext d)
+   protected void removeApplication(String name)
    {
-      deployments.put(d.getName(), d);
+      applications.remove(name);
    }
 
-   public void removeDeployment(String name)
-   {
-      deployments.remove(name);
-   }
-
-   public DeploymentContext getDeployment(String name)
+   protected DeploymentContext getApplication(String name)
          throws NoSuchDeploymentException
    {
-      DeploymentContext deployment = deployments.get(name);
+      DeploymentContext deployment = applications.get(name);
       return deployment;
    }
 
-   public Collection<DeploymentContext> getDeployments()
+   protected Collection<DeploymentContext> getApplications()
    {
-      return Collections.unmodifiableCollection(deployments.values());
+      return Collections.unmodifiableCollection(applications.values());
    }
 
-   public Map<String, Object> getConfig()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
+
 }

Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -21,20 +21,23 @@
  */
 package org.jboss.system.server.profile.repository;
 
+import java.net.URI;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Map;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentTemplate;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.util.JBossObject;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 
 /**
- * A basic profile implementation that uses the DeploymentRepository to store
+ * A profile implementation that uses the DeploymentRepository to store
  * deployments and admin metadata.
+ * 
  * @author Scott.Stark at jboss.org
  * @version $Revision:$
  */
@@ -53,12 +56,7 @@
     */
    public ProfileImpl(DeploymentRepository repository, String name)
    {
-      this(repository, name, null);
-   }
-   public ProfileImpl(DeploymentRepository repository, String name, String version)
-   {
       this.name = name;
-      this.version = version;
       this.repository = repository;
       log.info("Using repository:"+repository);
    }
@@ -72,78 +70,58 @@
    {
       return version;
    }
-   
-   public void addBootstrap(DeploymentContext d) throws Exception
+   /**
+    * Get the names of the deployments in the profile
+    * @return names of deployments
+    */
+   public Collection<String> getDeploymentNames()
    {
-      repository.addBootstrap(d.getRelativePath(), d);
+      return repository.getDeploymentNames();
    }
-   
-   public void removeBootstrap(String name) throws Exception
+   public Collection<String> getDeploymentNames(DeploymentPhase phase)
    {
-      repository.removeBootstrap(name);
+      return repository.getDeploymentNames(phase);
    }
-   
-   public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException
+
+   public VirtualFile getRootFile(DeploymentPhase phase)
+      throws Exception
    {
-      DeploymentContext deployment = repository.getBootstrap(name);
-      return deployment;
+      URI uri = repository.getDeploymentURI(phase);
+      VirtualFile root = VFS.getRoot(uri);
+      return root;
    }
-   
-   public Collection<DeploymentContext> getBootstraps()
-   {
-      return Collections.unmodifiableCollection(repository.getBootstraps());
-   }
 
-   public void addDeployer(DeploymentContext d) throws Exception
+   public Collection<DeploymentContext> getDeployments(DeploymentPhase phase)
+      throws Exception
    {
-      repository.addDeployer(d.getRelativePath(), d);
+      return repository.getDeployments(phase);
    }
-   
-   public void removeDeployer(String name) throws Exception
+   public Collection<DeploymentContext> getDeployments()
+      throws Exception
    {
-      repository.removeDeployer(name);
+      return repository.getDeployments();
    }
-   
-   public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException
+   public void addDeployment(DeploymentContext d, DeploymentPhase phase)
+       throws Exception
    {
-      DeploymentContext deployment = repository.getDeployer(name);
-      return deployment;
+      repository.addDeployment(d.getRelativePath(), d, phase);
    }
-   
-   public Collection<DeploymentContext> getDeployers()
+   public void updateDeployment(DeploymentContext d, DeploymentPhase phase)
+       throws Exception
    {
-      return Collections.unmodifiableCollection(repository.getDeployers());
+      repository.updateDeployment(d.getRelativePath(), d, phase);
    }
-   
-   public DeploymentTemplate getTemplate(String name)
-         throws NoSuchDeploymentException
+   public DeploymentContext getDeployment(String name, DeploymentPhase phase)
+       throws Exception, NoSuchDeploymentException
    {
-      // TODO Auto-generated method stub
-      return null;
+      return repository.getDeployment(name, phase);
    }
-   
-   public void addDeployment(DeploymentContext d) throws Exception
+   public void removeDeployment(String name, DeploymentPhase phase)
+      throws Exception
    {
-      repository.addDeployment(d.getRelativePath(), d);
+      repository.removeDeployment(name, phase);
    }
-   
-   public void removeDeployment(String name) throws Exception
-   {
-      repository.removeDeployment(name);
-   }
-   
-   public DeploymentContext getDeployment(String name)
-         throws NoSuchDeploymentException
-   {
-      DeploymentContext deployment = repository.getDeployment(name);
-      return deployment;
-   }
 
-   public Collection<DeploymentContext> getDeployments()
-   {
-      return Collections.unmodifiableCollection(repository.getDeployments());
-   }
-   
    public Map<String, Object> getConfig()
    {
       // TODO Auto-generated method stub

Deleted: trunk/system/src/main/org/jboss/system/server/profileservice/ManagementViewImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ManagementViewImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ManagementViewImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,66 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, 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.system.server.profileservice;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.deployers.spi.management.ManagedObject;
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileService;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ManagementViewImpl
-   implements ManagementView
-{
-   private ProfileService ps;
-
-   ManagementViewImpl(ProfileService ps)
-   {
-      this.ps = ps;
-   }
-
-   public ManagedObject getView(ProfileKey key, String deploymentName, String version)
-      throws NoSuchProfileException, NoSuchDeploymentException
-   {
-      Profile profile = ps.getProfile(key, version);
-      DeploymentContext d = profile.getDeployment(deploymentName);
-      // TODO ManagedObject mo = d.getManagedObject();
-      // return mo;
-      return null;
-   }
-
-   public void setView(ProfileKey key, String deploymentName, HashMap<String, PropertyInfo> view)
-      throws NoSuchProfileException, IOException
-   {
-   }
-}

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -31,6 +31,7 @@
 import org.jboss.deployers.spi.IncompleteDeploymentException;
 import org.jboss.deployers.spi.IncompleteDeployments;
 import org.jboss.deployers.spi.IncompleteDeploymentsBuilder;
+import org.jboss.deployers.spi.deployer.Deployer;
 import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.kernel.Kernel;
@@ -40,6 +41,7 @@
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.system.server.Server;
 
 /**
@@ -328,21 +330,26 @@
 
       // Load the named profile
       ProfileKey key = new ProfileKey(name);
-      Profile profile = ps.getProfile(key, null);
+      Profile profile = ps.getProfile(key);
 
       // HACK
       DeploymentContext first = null;
       
       // Deploy the bootstrap
-      Collection<DeploymentContext> boostraps = profile.getBootstraps();
+      Collection<DeploymentContext> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
       for (DeploymentContext d : boostraps)
       {
          deployer.addDeploymentContext(d);
          if (first == null)
             first = d;
       }
-      deployer.process();
+      Collection<DeploymentContext> ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
       checkIncomplete();
+      for (DeploymentContext d : ctxs)
+      {
+         profile.updateDeployment(d, DeploymentPhase.BOOTSTRAP);
+      }
+      deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
 
       Thread thread = Thread.currentThread();
       ClassLoader old = thread.getContextClassLoader();
@@ -353,18 +360,28 @@
       {
          
          // Deploy the profile deployers
-         Collection<DeploymentContext> profileDeployers = profile.getDeployers();
+         Collection<DeploymentContext> profileDeployers = profile.getDeployments(DeploymentPhase.DEPLOYER);
          for (DeploymentContext d : profileDeployers)
             deployer.addDeploymentContext(d);
-         deployer.process();
+         ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
          checkIncomplete();
+         for (DeploymentContext d : ctxs)
+         {
+            profile.updateDeployment(d, DeploymentPhase.DEPLOYER);
+         }
+         deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
 
          // Deploy the profile deployments
-         Collection<DeploymentContext> profileDeployments = profile.getDeployments();
+         Collection<DeploymentContext> profileDeployments = profile.getDeployments(DeploymentPhase.APPLICATION);
          for (DeploymentContext d : profileDeployments)
             deployer.addDeploymentContext(d);
-         deployer.process();
+         ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
          checkIncomplete();
+         for (DeploymentContext d : ctxs)
+         {
+            profile.updateDeployment(d, DeploymentPhase.APPLICATION);
+         }
+         deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
       }
       finally
       {

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -24,6 +24,7 @@
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -37,13 +38,13 @@
    protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
    {
       DeploymentContext deployment = new AbstractDeploymentContext(file);
-      if( profile.getBootstrap(deployment.getName()) == null )
-         profile.addBootstrap(deployment);
+      if( profile.getDeployment(deployment.getName(), DeploymentPhase.BOOTSTRAP) == null )
+            profile.addDeployment(deployment, DeploymentPhase.BOOTSTRAP);
       return deployment;
    }
 
    protected void remove(Profile profile, String name) throws Exception
    {
-      profile.removeBootstrap(name);
+      profile.removeDeployment(name, DeploymentPhase.BOOTSTRAP);
    }
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -24,6 +24,7 @@
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -37,13 +38,13 @@
    protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
    {
       DeploymentContext deployment = new AbstractDeploymentContext(file);
-      if( profile.getDeployer(deployment.getName()) == null )
-         profile.addDeployer(deployment);
+      if( profile.getDeployment(deployment.getName(), DeploymentPhase.DEPLOYER) == null )
+         profile.addDeployment(deployment, DeploymentPhase.DEPLOYER);
       return deployment;
    }
-
+   
    protected void remove(Profile profile, String name) throws Exception
    {
-      profile.removeDeployer(name);
+      profile.removeDeployment(name, DeploymentPhase.DEPLOYER);
    }
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -24,6 +24,7 @@
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -37,13 +38,14 @@
    protected DeploymentContext add(Profile profile, VirtualFile file) throws Exception
    {
       DeploymentContext deployment = new AbstractDeploymentContext(file);
-      if( profile.getDeployment(deployment.getName()) == null )
-         profile.addDeployment(deployment);
+      if( profile.getDeployment(deployment.getName(), DeploymentPhase.APPLICATION) == null )
+         profile.addDeployment(deployment, DeploymentPhase.APPLICATION);
       return deployment;
    }
-
+   
    protected void remove(Profile profile, String name) throws Exception
    {
-      profile.removeDeployment(name);
+      profile.removeDeployment(name, DeploymentPhase.APPLICATION);
    }
 }
+

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -567,7 +567,7 @@
       DeploymentContext deployment = null;
       try
       {
-         Profile profile = profileService.getProfile(profileKey, null);
+         Profile profile = profileService.getProfile(profileKey);
          deployment = add(profile, component);
       }
       catch (Exception e)
@@ -618,7 +618,7 @@
             log.trace("Undeploying: " + component);
          }
          String name = deployedSet.remove(component);         
-         Profile profile = profileService.getProfile(profileKey, null);
+         Profile profile = profileService.getProfile(profileKey);
          remove(profile, name);
       }
       catch (Exception e)

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/basic/ProfileServiceImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,6 +22,8 @@
 package org.jboss.system.server.profileservice.basic;
 
 import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
 
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.profileservice.spi.NoSuchProfileException;
@@ -81,16 +83,17 @@
       return domains;
    }
 
-   public ProfileKey[] getProfileKeys()
+   public Collection<ProfileKey> getProfileKeys()
    {
-      ProfileKey[] keys = {new ProfileKey(null)};
+      Collection<ProfileKey> keys = new HashSet<ProfileKey>();
+      keys.add(new ProfileKey(null));
       return keys;
    }
 
    /**
     * Always returns the default profile.
     */
-   public Profile getProfile(ProfileKey key, String version)
+   public Profile getProfile(ProfileKey key)
       throws NoSuchProfileException
    {
       return defaultImpl;
@@ -113,12 +116,12 @@
    }
 
    // Admin of profiles @todo could be an option plugin
-   public Profile newProfile(ProfileKey key, String version)
+   public Profile newProfile(ProfileKey key)
    {
       return new ProfileImpl(profileRoot, name);
    }
 
-   public void removeProfile(ProfileKey key, String version)
+   public void removeProfile(ProfileKey key)
       throws NoSuchProfileException
    {
    }

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.profileservice.spi.AttachmentsSerializer;
+
+/**
+ * A base AttachmentsSerializer that uses a file system based store.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public abstract class AbstractFileAttachmentsSerializer
+   implements AttachmentsSerializer
+{
+   /** The deployment pre-processed attachments store dir */
+   private File attachmentsStoreDir;
+
+   public File getAttachmentsStoreDir()
+   {
+      return attachmentsStoreDir;
+   }
+   public void setAttachmentsStoreDir(File attachmentsStoreDir)
+   {
+      this.attachmentsStoreDir = attachmentsStoreDir;
+   }
+
+   public Map<String, Object> loadAttachments(DeploymentContext ctx) throws Exception
+   {
+      if( attachmentsStoreDir == null )
+         throw new IllegalStateException("attachmentsStoreDir has not been set");
+
+      String vfsPath = ctx.getRelativePath();
+      if( vfsPath.length() == 0 )
+         vfsPath = ctx.getSimpleName();
+      vfsPath += ".attachments";
+      File attachmentsStore = new File(attachmentsStoreDir, vfsPath);
+      if( attachmentsStore.exists() == false )
+      {
+         return null;
+      }
+
+      return loadAttachments(attachmentsStore, ctx);
+   }
+
+   public void saveAttachments(DeploymentContext ctx) throws Exception
+   {
+      if( attachmentsStoreDir == null )
+         throw new IllegalStateException("attachmentsStoreDir has not been set");
+
+      String vfsPath = ctx.getRelativePath();
+      if( vfsPath.length() == 0 )
+         vfsPath = ctx.getSimpleName();
+      vfsPath += ".attachments";
+      File attachmentsStore = new File(attachmentsStoreDir, vfsPath);
+      if( attachmentsStoreDir.exists() == false )
+      {
+         if( attachmentsStoreDir.mkdirs() == false )
+            throw new IOException("Failed to create attachmentsStoreDir: "+attachmentsStoreDir.getAbsolutePath());
+      }
+
+      saveAttachments(attachmentsStore, ctx);
+   }
+
+   protected abstract Map<String, Object> loadAttachments(File attachmentsStore, DeploymentContext ctx)
+      throws Exception;
+   protected abstract void saveAttachments(File attachmentsStore, DeploymentContext ctx)
+      throws Exception;
+}


Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Copied: trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java (from rev 59405, trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java)
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java	2007-01-08 06:09:29 UTC (rev 59405)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+
+/**
+ * An implementation of ProfileRepository that uses the following
+ * file system structure for storing deployments and admin
+ * edits.
+ * 
+ * root-file
+ * + server/{name}/bootstrap - bootstrap beans/services
+ * + server/{name}/deployers - profile deployers
+ * + server/{name}/deploy - installed deployments
+ * + server/{name}/apps - post install deployments
+ * + server/{name}/admin - admin edits to deployments
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class FileProfileRepository
+   implements ProfileRepository
+{
+   private File root;
+   DeploymentRepositoryFactory repositoryFactory;
+   private MainDeployer mainDeployer;
+
+   public FileProfileRepository()
+   {
+      this(null);
+   }
+   public FileProfileRepository(File root)
+   {
+      this.root = root;
+   }
+
+   public DeploymentRepositoryFactory getRepositoryFactory()
+   {
+      return repositoryFactory;
+   }
+   public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
+   {
+      this.repositoryFactory = repositoryFactory;
+   }
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+   public void setMainDeployer(MainDeployer mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+
+   /**
+    * Get the server profile store root directory.
+    * @return the server profile root directory containing the
+    * available profiles.
+    */
+   public File getStoreRoot()
+   {
+      return root;
+   }
+   /**
+    * Set the profiles store root.
+    * @param root - the server profile root directory containing the
+    * available profiles.
+    */
+   public void setStoreRoot(File root)
+   {
+      this.root = root;
+   }
+
+   /**
+    * Get the keys for all known profiles. This lists the root store to
+    * obtain the server profiles.
+    * @return keys for all known profiles
+    */
+   public Collection<ProfileKey> getProfileKeys()
+   {
+      Collection<ProfileKey> keys = new HashSet<ProfileKey>();
+      for(File profile : root.listFiles())
+      {
+         keys.add(new ProfileKey(profile.getName()));
+      }
+      return keys;
+   }
+
+   /**
+    * 
+    */
+   public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
+      throws Exception
+   {
+      DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+      repository.create();
+      return repository;
+   }
+
+   /**
+    * Load an existing profile deployment repository.
+    */
+   public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
+      throws Exception, NoSuchProfileException
+   {
+      DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+      repository.load();
+      return repository;
+   }
+
+   public void removeProfileDeploymentRepository(ProfileKey key)
+      throws Exception, NoSuchProfileException
+   {      
+      DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+      repository.remove();  
+   }
+
+}

Deleted: trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/FileProfleRepository.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * 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.system.server.profileservice.repository;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileRepository;
-
-/**
- * An implementation of ProfileRepository that uses the following
- * file system structure for storing deployments and admin
- * edits.
- * 
- * root-file
- * + server/{name}/conf/bootstrap.xml - the bootstrap beans
- * + server/{name}/deployers - profile deployers
- * + server/{name}/deploy - installed deployments
- * + server/{name}/apps - post install deployments
- * + server/{name}/admin - admin edits to deployments
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class FileProfleRepository implements ProfileRepository
-{
-   private File root;
-
-   public FileProfleRepository(File root)
-   {
-      this.root = root;
-   }
-
-   public File getRoot()
-   {
-      return root;
-   }
-
-   public DeploymentRepository createProfileDeploymentRepository(ProfileKey key) throws IOException
-   {
-      SerializableDeploymentRepository repository = new SerializableDeploymentRepository(root, key);
-      repository.create();
-      return repository;
-   }
-
-   public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
-      throws IOException, NoSuchProfileException
-   {
-      SerializableDeploymentRepository repository = new SerializableDeploymentRepository(root, key);
-      repository.load();
-      return repository;
-   }
-
-   public void removeProfileDeploymentRepository(ProfileKey key) throws IOException, NoSuchProfileException
-   {      
-      SerializableDeploymentRepository repository = new SerializableDeploymentRepository(root, key);
-      repository.remove();  
-   }
-
-}

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Map;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+
+/**
+ * Standard java serialization to a file.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class JavaSerializationAttachmentsSerializer
+   extends AbstractFileAttachmentsSerializer
+{
+
+   protected Map<String, Object> loadAttachments(File attachmentsStore, DeploymentContext ctx)
+      throws Exception
+   {
+      FileInputStream fis = new FileInputStream(attachmentsStore);
+      ObjectInputStream ois = new ObjectInputStream(fis);
+      Map<String, Object> map = (Map<String, Object>) ois.readObject();
+      ois.close();
+      fis.close();
+      return map;
+   }
+
+   protected void saveAttachments(File attachmentsStore, DeploymentContext ctx)
+      throws Exception
+   {
+      Attachments transientAttachments = ctx.getTransientManagedObjects();
+      Map<String, Object> map = transientAttachments.getAttachments();
+      FileOutputStream fos = new FileOutputStream(attachmentsStore);
+      ObjectOutputStream oos = new ObjectOutputStream(fos);
+      oos.writeObject(map);
+      oos.close();
+      fos.close();
+   }
+
+}


Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,8 +22,10 @@
 package org.jboss.system.server.profileservice.repository;
 
 import java.io.IOException;
+import java.util.Collection;
 
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.logging.Logger;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.Profile;
@@ -43,14 +45,19 @@
 public class ProfileServiceImpl
    implements ProfileService
 {
+   private static final Logger log = Logger.getLogger(ProfileServiceImpl.class);
    /** The name of the profile to use */
    private String name;
-   /** The version of the profile to use */
-   private String version;
+   /** The profile repository plugin */
    private ProfileRepository profileRepository;
+   /** The deployment repository plugin for the current profile */
    private DeploymentRepository deploymentRepository;
+   /** The active profile */
    private Profile profile;
+   /** The management view for the active profile */
    private ManagementView mgtView;
+   /** The version of the profile to use */
+   private String version;
 
    public ProfileServiceImpl(String name) throws IOException
    {
@@ -108,26 +115,34 @@
          ProfileKey key = new ProfileKey(name);
          deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
       }
-      profile = new ProfileImpl(deploymentRepository, name, version);
+      log.info("Loading profile: "+name+" from: "+deploymentRepository);
+      profile = new ProfileImpl(deploymentRepository, name);
    }
 
    // ProfileService implementation --------------------
+   /**
+    * There is only the default domain (ProfileKey.DEFAULT)
+    */
    public String[] getDomains()
    {
       String[] domains = {ProfileKey.DEFAULT};
       return domains;
    }
 
-   public ProfileKey[] getProfileKeys()
+   /**
+    * Get the keys for all known profiles
+    * @return keys for all known profiles
+    */
+   public Collection<ProfileKey> getProfileKeys()
    {
-      ProfileKey[] keys = {new ProfileKey(name)};
+      Collection<ProfileKey> keys = profileRepository.getProfileKeys();
       return keys;
    }
 
    /**
     * Always returns the default profile.
     */
-   public Profile getProfile(ProfileKey key, String version)
+   public Profile getProfile(ProfileKey key)
       throws NoSuchProfileException
    {
       return profile;
@@ -149,15 +164,15 @@
       this.mgtView = mgtView;
    }
 
-   public Profile newProfile(ProfileKey key, String version)
+   public Profile newProfile(ProfileKey key)
       throws Exception
    {
       DeploymentRepository repo = profileRepository.createProfileDeploymentRepository(key);
-      return new ProfileImpl(repo, key.getName(), version);
+      return new ProfileImpl(repo, key.getName());
    }
 
-   public void removeProfile(ProfileKey key, String version)
-      throws IOException, NoSuchProfileException
+   public void removeProfile(ProfileKey key)
+      throws Exception, NoSuchProfileException
    {
       profileRepository.removeProfileDeploymentRepository(key);
    }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -22,14 +22,14 @@
 package org.jboss.system.server.profileservice.repository;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,12 +37,14 @@
 
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.AttachmentsSerializer;
 import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.util.file.Files;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
@@ -51,36 +53,42 @@
  * An implementation of DeploymentRepository that relies on java
  * serialization to store contents on the file system.
  * 
- * root-file
- * + server/{name}/conf/bootstrap.xml - the bootstrap beans
- * + server/{name}/deployers - profile deployers
- * + server/{name}/deploy - installed deployments
- * + server/{name}/apps - post install deployments
- * + server/{name}/admin - admin edits to deployments
+ * + root/{name}/bootstrap - the bootstrap beans
+ * + root/{name}/deployers - profile deployers
+ * + root/{name}/deploy - installed deployments
+ * + root/{name}/apps - post install deployments
+ * + root/{name}/profile/ctxs - pre-processed 
+ * + root/{name}/profile/edits - admin edits to deployments
  * 
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public class SerializableDeploymentRepository implements DeploymentRepository
+public class SerializableDeploymentRepository
+   implements DeploymentRepository
 {
    private static final Logger log = Logger.getLogger(SerializableDeploymentRepository.class);
 
-   private MainDeployer mainDeployer;
-   /** */
+   /** The server root container the deployments */
    private File root;
-   private File confDir;
+   /** The bootstrap jboss-service.xml dir */
+   private File bootstrapDir;
+   /** The server static libraries */
    private File libDir;
+   /** The deployers phase deployments dir */
    private File deployersDir;
-   private File deployDir;
-   private File deploymentCtxDir;
+   /** The application phase deployments dir */
+   private File applicationDir;
+   /** The deployment post edit */
    private File adminEditsRoot;
+   /** The profile key this repository is associated with */
    private ProfileKey key;
-   private LinkedHashMap<String,DeploymentContext> bootstraps = new LinkedHashMap<String,DeploymentContext>();
-   private LinkedHashMap<String,DeploymentContext> deployments = new LinkedHashMap<String,DeploymentContext>();
-   private LinkedHashMap<String,DeploymentContext> deployers = new LinkedHashMap<String,DeploymentContext>();
+   /** The bootstrap DeploymentContexts */
    private LinkedHashMap<String,DeploymentContext> bootstrapCtxs = new LinkedHashMap<String,DeploymentContext>();
-   private LinkedHashMap<String,DeploymentContext> deploymentCtxs = new LinkedHashMap<String,DeploymentContext>();
+   /** The deployer DeploymentContexts */
    private LinkedHashMap<String,DeploymentContext> deployerCtxs = new LinkedHashMap<String,DeploymentContext>();
+   /** The application DeploymentContexts */
+   private LinkedHashMap<String,DeploymentContext> applicationCtxs = new LinkedHashMap<String,DeploymentContext>();
+   private AttachmentsSerializer serializer;
 
    public SerializableDeploymentRepository(File root, ProfileKey key)
    {
@@ -88,17 +96,195 @@
       this.key = key;
    }
 
-   void create() throws IOException
+   public AttachmentsSerializer getSerializer()
    {
-      File profileRoot = new File(root, "server/"+key.getName());
+      return serializer;
+   }
+   public void setSerializer(AttachmentsSerializer serializer)
+   {
+      this.serializer = serializer;
+   }
+
+   public boolean exists()
+   {
+      File profileRoot = new File(root, key.getName());
+      return profileRoot.exists();
+   }
+
+   public URI getDeploymentURI(DeploymentPhase phase)
+   {
+      URI uri = null;
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            uri = this.getBootstrapURI();
+            break;
+         case DEPLOYER:
+            uri = this.getDeployersURI();
+            break;
+         case APPLICATION:
+            uri = this.getApplicationURI();
+            break;
+      }
+      return uri;
+   }
+   public void setDeploymentURI(URI uri, DeploymentPhase phase)
+   {
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            this.setBootstrapURI(uri);
+            break;
+         case DEPLOYER:
+            this.setDeployersURI(uri);
+            break;
+         case APPLICATION:
+            this.setApplicationURI(uri);
+            break;
+      }
+   }
+   public Collection<String> getDeploymentNames()
+   {
+      HashSet<String> names = new HashSet<String>();
+      names.addAll(bootstrapCtxs.keySet());
+      names.addAll(deployerCtxs.keySet());
+      names.addAll(applicationCtxs.keySet());
+      return names;
+   }
+   public Collection<String> getDeploymentNames(DeploymentPhase phase)
+   {
+      HashSet<String> names = new HashSet<String>();
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            names.addAll(this.bootstrapCtxs.keySet());
+            break;
+         case DEPLOYER:
+            names.addAll(this.deployerCtxs.keySet());
+            break;
+         case APPLICATION:
+            names.addAll(this.applicationCtxs.keySet());
+            break;
+      }
+      return names;      
+   }
+   public void addDeploymentContent(String name, ZipInputStream contentIS, DeploymentPhase phase)
+      throws IOException
+   {
+   }
+   public void addDeployment(String vfsPath, DeploymentContext d, DeploymentPhase phase)
+      throws Exception
+   {
+      switch( phase )
+       {
+          case BOOTSTRAP:
+             this.addBootstrap(vfsPath, d);
+             break;
+          case DEPLOYER:
+             this.addDeployer(vfsPath, d);
+             break;
+          case APPLICATION:
+             this.addApplication(vfsPath, d);
+             break;
+       }
+   }
+   public void updateDeployment(String vfsPath, DeploymentContext d, DeploymentPhase phase)
+      throws Exception
+   {
+      Attachments pmos = d.getPredeterminedManagedObjects();
+      if( pmos != null && pmos.hasAttachments() == true )
+         return;
+      this.saveAttachments(d);
+   }
+   public DeploymentContext getDeployment(String name, DeploymentPhase phase)
+      throws Exception, NoSuchDeploymentException
+   {
+      DeploymentContext ctx = null;
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            ctx = this.getBootstrap(name);
+            break;
+         case DEPLOYER:
+            ctx = this.getDeployer(name);
+            break;
+         case APPLICATION:
+            ctx = this.getApplication(name);
+            break;
+      }
+      if( ctx != null )
+         loadAttachments(ctx);
+      return ctx;
+   }
+   public Collection<DeploymentContext> getDeployments()
+   {
+      HashSet<DeploymentContext> deployments = new HashSet<DeploymentContext>();
+      deployments.addAll(this.bootstrapCtxs.values());
+      deployments.addAll(this.deployerCtxs.values());
+      deployments.addAll(this.applicationCtxs.values());
+      return Collections.unmodifiableCollection(deployments);
+   }
+   public Collection<DeploymentContext> getDeployments(DeploymentPhase phase)
+      throws Exception
+   {
+      Collection<DeploymentContext> ctxs = null;
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            ctxs = this.getBootstraps();
+            break;
+         case DEPLOYER:
+            ctxs = this.getDeployers();
+            break;
+         case APPLICATION:
+            ctxs = this.getApplications();
+            break;
+      }
+      return ctxs;
+   }
+   public void removeDeployment(String name, DeploymentPhase phase)
+      throws Exception
+   {
+      switch( phase )
+      {
+         case BOOTSTRAP:
+            this.removeBootstrap(name);
+            break;
+         case DEPLOYER:
+            this.removeDeployer(name);
+            break;
+         case APPLICATION:
+            this.removeApplication(name);
+            break;
+      }
+   }
+   public String toString()
+   {
+      StringBuilder tmp = new StringBuilder(super.toString());
+      tmp.append("(root=");
+      tmp.append(root);
+      tmp.append(", key=");
+      tmp.append(key);
+      tmp.append(")");
+      return tmp.toString();
+   }
+
+   /**
+    * Create a profile deployment repository
+    * 
+    * @throws IOException
+    */
+   public void create() throws Exception
+   {
+      File profileRoot = new File(root, key.getName());
       if( profileRoot.exists() == true )
          throw new IOException("Profile root already exists: "+profileRoot);
       if( profileRoot.mkdirs() == false )
          throw new IOException("Failed to create profile root: "+profileRoot);
-      // server/{name}/conf
-      confDir = new File(profileRoot, "conf");
-      if( confDir.mkdirs() == false )
-         throw new IOException("Failed to create profile conf dir: "+confDir);
+      // server/{name}/bootstrap
+      bootstrapDir = new File(profileRoot, "bootstrap");
+      if( bootstrapDir.mkdirs() == false )
+         throw new IOException("Failed to create profile bootstrap dir: "+bootstrapDir);
 
       // server/{name}/deployers
       deployersDir = new File(profileRoot, "deployers");
@@ -106,16 +292,13 @@
          throw new IOException("Failed to create profile deployers dir: "+deployersDir);
 
       // server/{name}/deploy
-      deployDir = new File(profileRoot, "deploy");
-      if( deployDir.mkdirs() == false )
-         throw new IOException("Failed to create profile deploy dir: "+deployDir);
+      applicationDir = new File(profileRoot, "deploy");
+      if( applicationDir.mkdirs() == false )
+         throw new IOException("Failed to create profile deploy dir: "+applicationDir);
       // server/{name}/lib
       libDir = new File(profileRoot, "lib");
       if( libDir.mkdirs() == false )
          throw new IOException("Failed to create profile lib dir: "+libDir);
-      deploymentCtxDir = new File(profileRoot, "profile/ctxs");
-      if( deploymentCtxDir.mkdirs() == false )
-         throw new IOException("Failed to create profile metaData dir: "+deploymentCtxDir);
 
       adminEditsRoot = new File(profileRoot, "profile/edits");
       if( adminEditsRoot.mkdirs() == false )
@@ -128,15 +311,18 @@
     * @throws IOException
     * @throws NoSuchProfileException
     */
-   void load() throws IOException, NoSuchProfileException
+   public void load() throws Exception, NoSuchProfileException
    {
-      File profileRoot = new File(root, "server/"+key.getName());
+      if( serializer == null )
+         throw new IllegalStateException("serializer has not been set");
+
+      File profileRoot = new File(root, key.getName());
       if( profileRoot.exists() == false )
          throw new NoSuchProfileException("Profile root does not exists: "+profileRoot);
-      // server/{name}/conf
-      confDir = new File(profileRoot, "conf");
-      if( confDir.exists() == false )
-         throw new FileNotFoundException("Profile contains no conf dir: "+confDir);
+      // server/{name}/bootstrap
+      bootstrapDir = new File(profileRoot, "bootstrap");
+      if( bootstrapDir.exists() == false )
+         throw new FileNotFoundException("Profile contains no bootstrap dir: "+bootstrapDir);
 
       // server/{name}/deployers
       deployersDir = new File(profileRoot, "deployers");
@@ -144,58 +330,37 @@
          throw new FileNotFoundException("Profile contains no deployers dir: "+deployersDir);
 
       // server/{name}/deploy
-      deployDir = new File(profileRoot, "deploy");
-      if( deployDir.exists() == false )
-         throw new FileNotFoundException("Profile contains no deploy dir: "+deployDir);
+      applicationDir = new File(profileRoot, "deploy");
+      if( applicationDir.exists() == false )
+         throw new FileNotFoundException("Profile contains no deploy dir: "+applicationDir);
 
-      deploymentCtxDir = new File(profileRoot, "profile/ctxs");
-      if( deploymentCtxDir.exists() == false )
-      {
-         if( deploymentCtxDir.mkdirs() == false )
-            throw new IOException("Failed to create profile metaData dir: "+deploymentCtxDir);
-      }
-
       adminEditsRoot = new File(profileRoot, "profile/edits");
 
-      VFS confVFS = VFS.getVFS(confDir.toURI());
-      loadBootstraps(confVFS.getRoot());
+      VFS bootstrapVFS = VFS.getVFS(bootstrapDir.toURI());
+      loadBootstraps(bootstrapVFS.getRoot());
       VFS deployersVFS = VFS.getVFS(deployersDir.toURI());
       loadDeployers(deployersVFS.getRoot());
-      VFS deployVFS = VFS.getVFS(deployDir.toURI());
-      loadDeployers(deployVFS.getRoot());
+      VFS deployVFS = VFS.getVFS(applicationDir.toURI());
+      loadApplications(deployVFS.getRoot());
    }
 
    /**
-    * 
+    * Remove the contents of the profile repository
     * @throws IOException
     * @throws NoSuchProfileException
     */
-   void remove() throws IOException, NoSuchProfileException
+   public void remove() throws IOException, NoSuchProfileException
    {
-      File profileRoot = new File(root, "server/"+key.getName());
-      if( profileRoot.exists() == true )
-         throw new NoSuchProfileException("Profile root alread exists: "+profileRoot);
-      //
+      File profileRoot = new File(root, key.getName());
       Files.delete(profileRoot);
    }
 
-   public boolean exists()
+   protected void addBootstrap(String vfsPath, DeploymentContext ctx)
+      throws Exception
    {
-      File profileRoot = new File(root, "server/"+key.getName());
-      return profileRoot.exists();
-   }
-
-   public VirtualFile addDeploymentFile(String name, ZipInputStream contentIS)
-      throws IOException
-   {
-      return null;
-   }
-
-   public void addBootstrap(String vfsPath, DeploymentContext ctx)
-      throws IOException
-   {
+      this.bootstrapCtxs.put(vfsPath, ctx);
       // Write out the base transient metadata
-      saveAttachments(vfsPath, ctx);
+      saveAttachments(ctx);
    }
 
    // Managed object attachments for a deployment
@@ -211,199 +376,165 @@
       fos.close();
    }
 
-   public void addDeployer(String vfsPath, DeploymentContext ctx) throws IOException
+   protected void addDeployer(String vfsPath, DeploymentContext ctx)
+      throws Exception
    {
+      this.deployerCtxs.put(vfsPath, ctx);
+      // Write out the base transient metadata
+      saveAttachments(ctx);
    }
 
-   public void addDeployment(String vfsPath, DeploymentContext ctx) throws IOException
+   protected void addApplication(String vfsPath, DeploymentContext ctx)
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      
+      this.applicationCtxs.put(vfsPath, ctx);
+      // Write out the base transient metadata
+      saveAttachments(ctx);
    }
 
-   public DeploymentContext getBootstrap(String vfsPath)
+   protected DeploymentContext getBootstrap(String vfsPath)
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      DeploymentContext ctx = bootstrapCtxs.get(vfsPath);
+      if( ctx == null )
+         throw new NoSuchDeploymentException(vfsPath);
+      this.loadAttachments(ctx);
+      return ctx;
    }
 
-   public Collection<DeploymentContext> getBootstraps()
+   protected Collection<DeploymentContext> getBootstraps()
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      Collection<DeploymentContext> ctxs = bootstrapCtxs.values();
+      for(DeploymentContext ctx : ctxs)
+      {
+         this.loadAttachments(ctx);         
+      }
+      return ctxs;
    }
 
-   public URI getBootstrapURI()
+   protected URI getBootstrapURI()
    {
-      // TODO Auto-generated method stub
-      return null;
+      return bootstrapDir.toURI();
    }
-
-   public DeploymentContext getDeployer(String vfsPath)
+   protected URI getDeployersURI()
    {
-      // TODO Auto-generated method stub
-      return null;
+      return deployersDir.toURI();
    }
-
-   public Collection<DeploymentContext> getDeployers()
+   protected URI getApplicationURI()
    {
-      // TODO Auto-generated method stub
-      return null;
+      return applicationDir.toURI();
    }
 
-   public URI getDeployersURI()
+   protected DeploymentContext getDeployer(String vfsPath)
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      DeploymentContext ctx = deployerCtxs.get(vfsPath);
+      if( ctx == null )
+         throw new NoSuchDeploymentException(vfsPath);
+      this.loadAttachments(ctx);
+      return ctx;
    }
 
-   public DeploymentContext getDeployment(String vfsPath)
+   protected Collection<DeploymentContext> getDeployers()
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      Collection<DeploymentContext> ctxs = deployerCtxs.values();
+      for(DeploymentContext ctx : ctxs)
+      {
+         this.loadAttachments(ctx);         
+      }
+      return ctxs;
    }
 
-   public VirtualFile getDeploymentFile(String name)
+   protected DeploymentContext getApplication(String vfsPath)
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      DeploymentContext ctx = applicationCtxs.get(vfsPath);
+      if( ctx == null )
+         throw new NoSuchDeploymentException(vfsPath);
+      this.loadAttachments(ctx);
+      return ctx;
    }
 
-   public Collection<DeploymentContext> getDeployments()
+   protected Collection<DeploymentContext> getApplications()
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      return null;
+      Collection<DeploymentContext> ctxs = applicationCtxs.values();
+      for(DeploymentContext ctx : ctxs)
+      {
+         this.loadAttachments(ctx);         
+      }
+      return ctxs;
    }
 
-   public URI getDeploymentURI()
+   protected void removeBootstrap(String vfsPath) throws IOException
    {
-      // TODO Auto-generated method stub
-      return null;
+      File bootstrapFile = new File(bootstrapDir, vfsPath);
+      if( bootstrapFile.delete() == false )
+         throw new IOException("Failed to delete: "+bootstrapFile);
    }
-
-   public void removeBootstrap(String vfsPath) throws IOException
+   protected void removeDeployer(String vfsPath) throws IOException
    {
-      // TODO Auto-generated method stub
-      
+      File deployerFile = new File(deployersDir, vfsPath);
+      if( Files.delete(deployerFile) == false )
+         throw new IOException("Failed to delete: "+deployerFile);
    }
-
-   public void removeDeployer(String vfsPath) throws IOException
+   protected void removeApplication(String vfsPath) throws IOException
    {
-      // TODO Auto-generated method stub
-      
+      File deploymentFile = new File(applicationDir, vfsPath);
+      if( Files.delete(deploymentFile) == false )
+         throw new IOException("Failed to delete: "+deploymentFile);
    }
-
-   public void removeDeployment(String vfsPath) throws IOException
+   protected void setBootstrapURI(URI uri)
    {
-      // TODO Auto-generated method stub
-      
+      bootstrapDir = new File(uri);
    }
-
-   public void setBootstrapURI(URI uri)
+   protected void setDeployersURI(URI uri)
    {
-      // TODO Auto-generated method stub
-      
+      deployersDir = new File(uri);
    }
-
-   public void setDeployersURI(URI uri)
+   protected void setApplicationURI(URI uri)
    {
-      // TODO Auto-generated method stub
-      
+      applicationDir = new File(uri);
    }
 
-   public void setDeploymentURI(URI rootURI)
+   private void saveAttachments(DeploymentContext ctx)
+      throws Exception
    {
-      // TODO Auto-generated method stub
-      
-   }
-
-   private void saveAttachments(String vfsPath, DeploymentContext ctx)
-      throws IOException
-   {
       // Write out the base transient metadata
-      Attachments transientAttachments = ctx.getTransientAttachments();
-      if( transientAttachments.getAttachments().size() > 0 )
-      {
-         Map<String, Object> map = transientAttachments.getAttachments();
-         File attachments = new File(deploymentCtxDir, vfsPath+".transientAttachments");
-         FileOutputStream fos = new FileOutputStream(attachments);
-         ObjectOutputStream oos = new ObjectOutputStream(fos);
-         oos.writeObject(map);
-         oos.close();
-         fos.close();
-      }
-
-      // Write out the base transient managed objects
-      Attachments transientManagedObjects = ctx.getTransientManagedObjects();
-      if( transientManagedObjects.getAttachments().size() > 0 )
-      {
-         Map<String, Object> map = transientManagedObjects.getAttachments();
-         File attachments = new File(deploymentCtxDir, vfsPath+".transientManagedObjects");
-         FileOutputStream fos = new FileOutputStream(attachments);
-         ObjectOutputStream oos = new ObjectOutputStream(fos);
-         oos.writeObject(map);
-         oos.close();
-         fos.close();
-      }
+      serializer.saveAttachments(ctx);
    }
 
-   private void loadAttachments(String vfsPath, DeploymentContext ctx)
-      throws ClassNotFoundException, IOException
+   private void loadAttachments(DeploymentContext ctx)
+      throws Exception
    {
-      File transientAttachments = new File(deploymentCtxDir, vfsPath+".transientAttachments");
-      if( transientAttachments.exists() )
+      Map<String, Object> map = serializer.loadAttachments(ctx);
+      if( map != null )
       {
-         FileInputStream fis = new FileInputStream(transientAttachments);
-         ObjectInputStream ois = new ObjectInputStream(fis);
-         Map<String, Object> map = (Map<String, Object>) ois.readObject();
-         ois.close();
-         fis.close();
          for(String key : map.keySet())
          {
             Object value = map.get(key);
             ctx.getTransientAttachments().addAttachment(key, value);
          }
       }
-
-      File transientManagedObjects = new File(deploymentCtxDir, vfsPath+".transientManagedObjects");
-      if( transientManagedObjects.exists() )
-      {
-         FileInputStream fis = new FileInputStream(transientManagedObjects);
-         ObjectInputStream ois = new ObjectInputStream(fis);
-         Map<String, Object> map = (Map<String, Object>) ois.readObject();
-         ois.close();
-         fis.close();
-         for(String key : map.keySet())
-         {
-            Object value = map.get(key);
-            ctx.getTransientManagedObjects().addAttachment(key, value);
-         }         
-      }
    }
 
    /**
-    * Load the know bootstrap descriptors under confDir, bootstrap-beans.xml
-    * and jboss-service.xml. The jboss-service.xml is optional.
+    * Load the bootstrap descriptors under bootstrapDir:
     * 
-    * @param confDir
+    * @param bootstrapDir
     * @throws IOException
     */
-   private void loadBootstraps(VirtualFile confDir)
+   private void loadBootstraps(VirtualFile bootstrapDir)
       throws IOException
    {
-      VirtualFile bootstrapBeans = confDir.findChild("bootstrap-beans.xml");
-      DeploymentContext bootstrapBeansCtx = loadDeploymentData(bootstrapBeans);
-      bootstrapCtxs.put(bootstrapBeans.getPathName(), bootstrapBeansCtx);
-      try
+      List<VirtualFile> children = bootstrapDir.getChildren();
+      for(VirtualFile vf : children)
       {
-         VirtualFile jbossService = confDir.findChild("jboss-service.xml");
-         DeploymentContext jbossServiceCtx = loadDeploymentData(bootstrapBeans);
-         bootstrapCtxs.put(jbossService.getPathName(), jbossServiceCtx);
+         DeploymentContext vfCtx = loadDeploymentData(vf);
+         bootstrapCtxs.put(vf.getPathName(), vfCtx);       
       }
-      catch(IOException e)
-      {
-         log.debug("No jboss-service.xml bootstrap found", e);
-      }
    }
 
    /**
@@ -419,24 +550,24 @@
       for(VirtualFile vf : children)
       {
          DeploymentContext vfCtx = loadDeploymentData(vf);
-         bootstrapCtxs.put(vf.getPathName(), vfCtx);         
+         deployerCtxs.put(vf.getPathName(), vfCtx);       
       }
    }
 
    /**
-    * Load all the deployments under the deployersDir.
+    * Load all the applications under the applicationDir.
     * 
-    * @param deployDir
+    * @param applicationDir
     * @throws IOException
     */
-   private void loadDeployments(VirtualFile deployDir)
+   private void loadApplications(VirtualFile applicationDir)
       throws IOException
    {
-      List<VirtualFile> children = deployDir.getChildren();
+      List<VirtualFile> children = applicationDir.getChildren();
       for(VirtualFile vf : children)
       {
          DeploymentContext vfCtx = loadDeploymentData(vf);
-         bootstrapCtxs.put(vf.getPathName(), vfCtx);         
+         applicationCtxs.put(vf.getPathName(), vfCtx);         
       }
    }
 

Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+
+import org.jboss.profileservice.spi.AttachmentsSerializer;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * Factory for SerializableDeploymentRepository
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class SerializableDeploymentRepositoryFactory
+   implements DeploymentRepositoryFactory
+{
+   /** The server root container the deployments */
+   private File root;
+   private AttachmentsSerializer serializer;
+
+   /**
+    * Get the server profile store root directory.
+    * @return the server profile root directory containing the
+    * available profiles.
+    */
+   public File getStoreRoot()
+   {
+      return root;
+   }
+   /**
+    * Set the profiles store root.
+    * @param root - the server profile root directory containing the
+    * available profiles.
+    */
+   public void setStoreRoot(File root)
+   {
+      this.root = root;
+   }
+
+   public AttachmentsSerializer getSerializer()
+   {
+      return serializer;
+   }
+
+   public void setSerializer(AttachmentsSerializer serializer)
+   {
+      this.serializer = serializer;
+   }
+
+   public DeploymentRepository getDeploymentRepository(ProfileKey key)
+   {
+      SerializableDeploymentRepository repo = new SerializableDeploymentRepository(root, key);
+      repo.setSerializer(serializer);
+      return repo;
+   }
+
+}


Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java	2007-01-12 07:36:41 UTC (rev 59585)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java	2007-01-12 07:36:58 UTC (rev 59586)
@@ -31,6 +31,7 @@
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 import org.jboss.system.server.profileservice.ProfileServiceBootstrap;
 import org.jboss.test.BaseTestCase;
 import org.jboss.virtual.VFS;
@@ -71,21 +72,21 @@
       psb.bootstrap();
       ProfileService ps = psb.getProfileService();
       ProfileKey defaultKey = new ProfileKey("default");
-      Profile profile = ps.getProfile(defaultKey, null);
-      DeploymentContext testBeans = profile.getDeployment("test-beans.xml");
+      Profile profile = ps.getProfile(defaultKey);
+      DeploymentContext testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
       if( testBeans == null )
       {
          if( profile == null )
-            profile = ps.newProfile(defaultKey, null);
+            profile = ps.newProfile(defaultKey);
          MainDeployer deployer = psb.getMainDeployer();
          VFS vfs = VFS.getVFS(resourcesDir);
          VirtualFile file = vfs.findChildFromRoot("deploy/beans/test-beans.xml");
          testBeans = new AbstractDeploymentContext(file);
          deployer.addDeploymentContext(testBeans);
-         profile.addDeployment(testBeans);
+         profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
       }
       // Validate the deployment
-      testBeans = profile.getDeployment("test-beans.xml");
+      testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
       assertNotNull(testBeans);
       // TODO String type = testBeans.getType();
       // assertEquals("Deployment type is beans", "beans", type);




More information about the jboss-cvs-commits mailing list