[jboss-cvs] JBossAS SVN: r84950 - in trunk: system/src/main/org/jboss/system/server/profileservice/repository and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 2 05:50:10 EST 2009


Author: emuckenhuber
Date: 2009-03-02 05:50:10 -0500 (Mon, 02 Mar 2009)
New Revision: 84950

Modified:
   trunk/profileservice/src/resources/profileservice-jboss-beans.xml
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java
Log:
[JBAS-6525] introduce a applications profile

Modified: trunk/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-jboss-beans.xml	2009-03-02 10:48:44 UTC (rev 84949)
+++ trunk/profileservice/src/resources/profileservice-jboss-beans.xml	2009-03-02 10:50:10 UTC (rev 84950)
@@ -104,6 +104,11 @@
        </constructor>
     </bean>
     
+    <!-- The default applications profile key -->
+    <bean name="ApplicationsProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
+		<constructor><parameter><inject bean="BootstrapProfileFactory" property="applicationsName" /></parameter></constructor>
+	</bean>
+	
     <!--
         The ManagementView plugin
     -->
@@ -122,7 +127,7 @@
         <property name="profileService"><inject bean="ProfileService"/></property>
        	<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
        	<property name="deploymentManager"><inject bean="DeploymentManager"/></property>
-        <property name="defaultProfileKey"><inject bean="DefaultProfileKey"/></property>
+        <property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
         <property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
         <property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
         <property name="bootstrapManagedDeployments"><inject bean="ProfileServiceBootstrap" property="bootstrapMDs"/></property>
@@ -146,7 +151,7 @@
                 <null/>
             </parameter>
         </uninstall>
-        <property name="defaultProfileKey"><inject bean="DefaultProfileKey"/></property>
+        <property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
         <property name="profileService"><inject bean="ProfileService"/></property>
         <property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
         <property name="remotingSubsystem">DeploymentManager</property>

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java	2009-03-02 10:48:44 UTC (rev 84949)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java	2009-03-02 10:50:10 UTC (rev 84950)
@@ -25,6 +25,7 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.jboss.profileservice.spi.ProfileKey;
@@ -49,11 +50,14 @@
 {
 
    /** The bootstrap profile name. */
-   private static final String BOOTSTRAP_NAME = "bootstrap";
+   private String bootstrapName = "bootstrap";
    
    /** The deployers profile name. */
-   private static final String DEPLOYERS_NAME = "deployers";
+   private String deployersName = "deployers";
    
+   /** The applications profile name. */
+   private String applicationsName = "applications";
+   
    /** The bootstrap uri. */
    private URI bootstrapURI;
    
@@ -66,6 +70,36 @@
    /** The application uris. */
    private List<URI> applicationURIs;
 
+   public String getBootstrapName()
+   {
+      return bootstrapName;
+   }
+   
+   public void setBootstrapName(String bootstrapName)
+   {
+      this.bootstrapName = bootstrapName;
+   }
+   
+   public String getDeployersName()
+   {
+      return deployersName;
+   }
+   
+   public void setDeployersName(String deployersName)
+   {
+      this.deployersName = deployersName;
+   }
+   
+   public String getApplicationsName()
+   {
+      return applicationsName;
+   }
+   
+   public void setApplicationsName(String applicationsName)
+   {
+      this.applicationsName = applicationsName;
+   }
+   
    public URI getBootstrapURI()
    {
       return bootstrapURI;
@@ -98,6 +132,8 @@
 
    public List<URI> getApplicationURIs()
    {
+      if(applicationURIs == null)
+         return Collections.emptyList();
       return applicationURIs;
    }
    
@@ -106,19 +142,6 @@
       this.applicationURIs = applicationURIs;
    }
    
-   /**
-    * The template root is used by the ManagementView and points
-    * to the first applicationURI - by default the deploy/ directory.
-    * 
-    * @return the template root.
-    */
-   public URI getTemplateRoot()
-   {
-      if(this.applicationURIs.size() == 0)
-         throw new IllegalStateException("No application uris defined.");
-      return this.applicationURIs.get(0);
-   }
-   
    public void create() throws Exception
    {
       // Sanity checks
@@ -143,22 +166,30 @@
          throw new IllegalArgumentException("Null root profile key.");
       
       // Create bootstrap profile meta data
-      ProfileKey bootstrapKey = new ProfileKey(BOOTSTRAP_NAME);
+      ProfileKey bootstrapKey = new ProfileKey(bootstrapName);
       ProfileMetaData bootstrap = createProfileMetaData(
-            BOOTSTRAP_NAME, false, new URI[] { bootstrapURI }, new String[0]);
+            bootstrapName, false, new URI[] { bootstrapURI }, new String[0]);
       addProfile(bootstrapKey, bootstrap);
       
       // Create deployers profile meta data
-      ProfileKey deployersKey = new ProfileKey(DEPLOYERS_NAME);
+      ProfileKey deployersKey = new ProfileKey(deployersName);
       ProfileMetaData deployers = createProfileMetaData(
-            DEPLOYERS_NAME, false, new URI[] { deployersURI }, new String[] { BOOTSTRAP_NAME });
+            deployersName, false, new URI[] { deployersURI }, new String[] { bootstrapName });
       addProfile(deployersKey, deployers);
 
-      // Create root profile;
-      URI[] rootURIs = applicationURIs.toArray(new URI[applicationURIs.size()]);
-      String[] rootSubProfiles = new String[] { BOOTSTRAP_NAME, DEPLOYERS_NAME };
+      // Create applications profile meta data
+      ProfileKey applicationsKey = new ProfileKey(applicationsName);
+      URI[] applicationURIs = getApplicationURIs().toArray(new URI[getApplicationURIs().size()]);
+      String[] applicationsSubProfiles = new String[] { bootstrapName, deployersName };
+      ProfileMetaData applications = createProfileMetaData(
+            applicationsName, true, applicationURIs, applicationsSubProfiles);
+      // Add to profile map
+      addProfile(applicationsKey, applications);
+      
+      // Create empty root profile;
+      String[] rootSubProfiles = new String[] { applicationsName };
       ProfileMetaData root = createProfileMetaData(
-            rootKey.getName(), true, rootURIs, rootSubProfiles);
+            rootKey.getName(), false, new URI[0], rootSubProfiles);
       // Add to profile map
       addProfile(rootKey, root);
    }




More information about the jboss-cvs-commits mailing list