[jboss-cvs] JBossAS SVN: r104428 - trunk/system/src/main/java/org/jboss/system/server/profileservice/bootstrap.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 4 09:40:13 EDT 2010


Author: emuckenhuber
Date: 2010-05-04 09:40:12 -0400 (Tue, 04 May 2010)
New Revision: 104428

Modified:
   trunk/system/src/main/java/org/jboss/system/server/profileservice/bootstrap/BasicProfileServiceBootstrap.java
Log:
add ProfilesMetaDataFactory, remove class dependency on the deployers.

Modified: trunk/system/src/main/java/org/jboss/system/server/profileservice/bootstrap/BasicProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/java/org/jboss/system/server/profileservice/bootstrap/BasicProfileServiceBootstrap.java	2010-05-04 13:39:33 UTC (rev 104427)
+++ trunk/system/src/main/java/org/jboss/system/server/profileservice/bootstrap/BasicProfileServiceBootstrap.java	2010-05-04 13:40:12 UTC (rev 104428)
@@ -21,6 +21,7 @@
 */
 package org.jboss.system.server.profileservice.bootstrap;
 
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -29,7 +30,6 @@
 import org.jboss.bootstrap.api.as.config.JBossASBasedServerConfig;
 import org.jboss.bootstrap.spi.as.JBossASBootstrap;
 import org.jboss.bootstrap.spi.as.server.MCJBossASBasedServerProvider;
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
 import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
@@ -39,10 +39,12 @@
 import org.jboss.profileservice.domain.ManagementDomainMetaData;
 import org.jboss.profileservice.domain.ServerMetaData;
 import org.jboss.profileservice.domain.spi.DomainMetaDataFragment;
+import org.jboss.profileservice.metadata.ProfilesMetaDataFactory;
 import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
 import org.jboss.profileservice.profile.metadata.FeatureCapability;
 import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
 import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
 import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
 
 /**
@@ -58,9 +60,11 @@
    /** Default domain name, since we don't have a domain right now. */
    private static final String DOMAIN_NAME = ProfileKey.DEFAULT;
    
+   private URL profilesLocation; 
+   
    /** The domain meta data. */
    private AbstractDomainMetaData domainMetaData;
-   
+
    /** The profile meta data factory. */
    private DomainMetaDataFragment profileFactory;
    
@@ -96,6 +100,16 @@
       this.hdScannerFactory = hdScannerFactory;
    }
    
+   public URL getProfilesLocation()
+   {
+      return profilesLocation;
+   }
+   
+   public void setProfilesLocation(URL profilesLocation)
+   {
+      this.profilesLocation = profilesLocation;
+   }
+   
    public Map<String, KernelDeployment> getBootstrapDeployments()
    {
       return bootstrapDeployments;
@@ -111,16 +125,13 @@
       try
       {
          createProfileService(domainMetaData);
+         populateProfileRepository();
          createWorkaroundProfile();
          start(domainMetaData);
          try
          {
             getConfig().getDeployerRegistry().checkAllComplete();
          }
-         catch(DeploymentException e)
-         {
-            log.warn("Failed to load profile:", e);
-         }
          catch(Exception e)
          {
             log.error("Failed to load profile:", e);
@@ -157,7 +168,7 @@
       // FIXME
       EmptyProfileMetaData metaData = new EmptyProfileMetaData("workaround");
       List<ProfileMetaDataVisitorNode> nodes = new ArrayList<ProfileMetaDataVisitorNode>();
-      nodes.add(new FeatureCapability(CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE));
+      // nodes.add(new FeatureCapability(CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE));
       nodes.add(new FeatureCapability(CommonProfileNameSpaces.FARMING_PROFILE_NAMESPACE));
       nodes.add(new FeatureCapability(CommonProfileNameSpaces.HOTDEPLOY_PROFILE_NAMESPACE));
       metaData.setFeatures(nodes);
@@ -173,5 +184,19 @@
       return domain;
    }
    
+   protected void populateProfileRepository() throws Exception
+   {
+      if(getProfilesLocation() != null)
+      {
+         ProfilesMetaDataFactory metadataFactory = new ProfilesMetaDataFactory();
+         metadataFactory.parse(getProfilesLocation());
+         Map<String, ProfileMetaData> profiles = metadataFactory.getProfiles();      
+         for(ProfileMetaData metaData : profiles.values())
+         {
+            getMetaDataRegistry().registerProfileMetaData(metaData);
+         }
+      }
+   }
+   
 }
 




More information about the jboss-cvs-commits mailing list