[jboss-cvs] JBossAS SVN: r81380 - in trunk: server/src/etc/conf/default/bootstrap and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 20 19:30:27 EST 2008


Author: scott.stark at jboss.org
Date: 2008-11-20 19:30:27 -0500 (Thu, 20 Nov 2008)
New Revision: 81380

Modified:
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   trunk/server/src/etc/conf/default/bootstrap/profile-repository.xml
   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/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/repository/RepositoryAdminAdaptor.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
Log:
JBAS-6223, externalize the attachments root location
JBAS-6199, Updates for profileservice spi

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -1023,11 +1023,8 @@
       }
       
       
-      // Wrap 
-      Map<String, Object> metaDataAttachment = Collections.singletonMap(ManagedComponent.class.getName(), (Object) serverComp);
-      
       // Update the repository deployment attachments
-      activeProfile.updateDeployment(compDeployment, phase, metaDataAttachment);
+      activeProfile.updateDeployment(compDeployment, phase, serverComp);
    }
 
    /**

Modified: trunk/server/src/etc/conf/default/bootstrap/profile-repository.xml
===================================================================
--- trunk/server/src/etc/conf/default/bootstrap/profile-repository.xml	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/server/src/etc/conf/default/bootstrap/profile-repository.xml	2008-11-21 00:30:27 UTC (rev 81380)
@@ -26,6 +26,7 @@
     </bean>
    <bean name="SerializableDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.SerializableDeploymentRepositoryFactory">
       <property name="storeRoot">${jboss.server.base.dir}</property>
+      <property name="attachmentsRoot">${jboss.server.data.dir}/attachments</property>
       <property name="applicationURIs">
          <array elementClass="java.net.URI">
             <value>${jboss.server.home.url}deploy</value>

Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -23,15 +23,14 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Serializable;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Collection;
-import java.util.Map;
 import java.util.Set;
 
 import org.jboss.deployers.spi.attachments.Attachments;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.virtual.VirtualFile;
 
@@ -40,13 +39,36 @@
  * 
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
- * @version $Revision:$
+ * @version $Revision$
  */
 public interface DeploymentRepository
 {
+   /**
+    * Get the path 
+    * @return
+    */
+   public String getAttachmentsRoot();
+   public void setAttachmentsRoot(String root);
+
+   /**
+    * Create the repository
+    * @throws Exception
+    */
    public void create() throws Exception;
+   /**
+    * Load the repository contents
+    * @throws Exception
+    */
    public void load() throws Exception;
+   /**
+    * Delete the repository
+    * @throws Exception
+    */
    public void remove() throws Exception;
+   /**
+    * Get the time any contents were last modified
+    * @return
+    */
    public long getLastModified();
 
    public URI getDeploymentURI(DeploymentPhase phase);
@@ -171,12 +193,13 @@
     * 
     * @param vfsPath - the vfs path relative to the phase root for the deployment
     * @param phase - the deployment phase
-    * @param attachments - the attachments that have been modified
+    * @param comp - the ManagedComponent that has been modified
     * @throws Exception
     */
    public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments)
+      ManagedComponent comp)
       throws Exception;
+
    /**
     * Get a named deployment.
     * 


Property changes on: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -26,6 +26,9 @@
 import java.util.Set;
 
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.virtual.VirtualFile;
 
@@ -100,11 +103,11 @@
     * @param d the deployment
     * @param phase - the phase of the deployment as it relates to when the
     * deployment is loaded
-    * @param attachments - the attachments that have been modified
+    * @param comp - the ManagedComponent that has been modified
     * @throws Exception for any error
     */
    void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments)
+      ManagedComponent comp)
       throws Exception;
 
    /**

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	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -34,6 +34,7 @@
 
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.profileservice.spi.ModificationInfo;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
@@ -149,7 +150,7 @@
       this.lastModified = System.currentTimeMillis();
    }
    public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments)
+         ManagedComponent comp)
       throws Exception
    {
    

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	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -28,6 +28,7 @@
 import java.util.Set;
 
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.ModificationInfo;
@@ -44,7 +45,7 @@
  * deployments and admin metadata.
  * 
  * @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
  */
 public class ProfileImpl extends JBossObject
    implements Profile
@@ -146,10 +147,10 @@
       repository.addDeployment(name, d, phase);
    }
    public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments)
+         ManagedComponent mo)
        throws Exception
    {
-      repository.updateDeployment(d, phase, attachments);
+      repository.updateDeployment(d, phase, mo);
    }
    public VFSDeployment getDeployment(String name, DeploymentPhase phase)
        throws Exception, NoSuchDeploymentException


Property changes on: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -24,18 +24,16 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Serializable;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
-import java.util.zip.ZipInputStream;
 
 import org.jboss.deployers.spi.attachments.Attachments;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.ModificationInfo;
@@ -82,6 +80,20 @@
    /** The last time the profile was modified */
    private long lastModified;
 
+   
+   public String getAttachmentsRoot()
+   {
+      String path = null;
+      if(adminEditsRoot != null)
+         path = adminEditsRoot.getAbsolutePath();
+      return path;
+   }
+
+   public void setAttachmentsRoot(String root)
+   {
+      adminEditsRoot = new File(root);
+   }
+
    public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
       throws Exception
    {
@@ -207,8 +219,9 @@
          throw new IOException("Failed to create profile lib dir: "+libDir);
       delegate.addRepository(libDir.toURI());
 
-      adminEditsRoot = new File(profileRoot, "profile/edits");
-      if( adminEditsRoot.mkdirs() == false )
+      if(adminEditsRoot == null)
+         setAttachmentsRoot(profileRoot.getAbsolutePath()+"/attachments");
+      if( adminEditsRoot.exists() == false && adminEditsRoot.mkdirs() == false )
          throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
       delegate.addRepository(adminEditsRoot.toURI());
       lastModified = System.currentTimeMillis();
@@ -494,7 +507,7 @@
    }
 
    public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments)
+         ManagedComponent comp)
       throws Exception
    {      
    }

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	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -50,6 +50,7 @@
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedCommon;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.profileservice.spi.AttachmentsSerializer;
@@ -151,6 +152,18 @@
       return profileRoot.exists();
    }
 
+   public String getAttachmentsRoot()
+   {
+      String path = null;
+      if(adminEditsRoot != null)
+         path = adminEditsRoot.getAbsolutePath();
+      return path;
+   }
+   public void setAttachmentsRoot(String root)
+   {
+      adminEditsRoot = new File(root);
+   }
+
    public long getLastModified()
    {
       return this.lastModified;
@@ -661,8 +674,9 @@
       if( libDir.mkdirs() == false )
          throw new IOException("Failed to create profile lib dir: "+libDir);
 
-      adminEditsRoot = new File(profileRoot, "attachments");
-      if( adminEditsRoot.mkdirs() == false )
+      if(adminEditsRoot == null)
+         setAttachmentsRoot(profileRoot.getAbsolutePath() +  "/attachments");
+      if( adminEditsRoot.exists() == false && adminEditsRoot.mkdirs() == false )
          throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
    }
 
@@ -1059,13 +1073,12 @@
     * TODO Map<String, Object should not be required ?
     */
    public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
-         Map<String, Object> attachments) throws Exception
+         ManagedComponent comp) throws Exception
    {
-      ManagedComponent comp = (ManagedComponent) attachments.get(ManagedComponent.class.getName());
       if(comp != null)
       {
          // update component
-         updateDeployment(d, phase, comp);
+         super.updateDeployment(d, phase, comp);
          // Update last moidfied
          this.lastModified = System.currentTimeMillis();
       }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java	2008-11-20 23:42:09 UTC (rev 81379)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java	2008-11-21 00:30:27 UTC (rev 81380)
@@ -40,8 +40,10 @@
 public class SerializableDeploymentRepositoryFactory
    implements DeploymentRepositoryFactory
 {
-   /** The server root container the deployments */
+   /** The server root containing the deployments */
    private File root;
+   /** The root location for admin edits */
+   private String attachmentsRoot;
    /** The URIs for the application deployments */
    private URI[] appURIs = {};
    /** The attachment serializer */
@@ -69,7 +71,14 @@
    {
       this.root = root;
    }
-
+   public String getAttachmentsRoot()
+   {
+      return attachmentsRoot;
+   }
+   public void setAttachmentsRoot(String attachmentsRoot)
+   {
+      this.attachmentsRoot = attachmentsRoot;
+   }
    public URI[] getApplicationURIs()
    {
       return appURIs;
@@ -110,6 +119,7 @@
       if(dr == null)
       {
          SerializableDeploymentRepository repo = new SerializableDeploymentRepository(root, appURIs, key);
+         repo.setAttachmentsRoot(attachmentsRoot);
          repo.setSerializer(serializer);
          repo.setMainDeployer(mainDeployer);
          profileRepositories.put(key, repo);




More information about the jboss-cvs-commits mailing list