[Jboss-cvs] JBossAS SVN: r55039 - trunk/system/src/main/org/jboss/system/server/profileservice

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 2 14:43:19 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-02 14:43:17 -0400 (Wed, 02 Aug 2006)
New Revision: 55039

Modified:
   trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
Log:
Update to allow the bootstrap deployment descriptor url and resource prefix name to be set

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-08-02 16:47:02 UTC (rev 55038)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-08-02 18:43:17 UTC (rev 55039)
@@ -44,7 +44,7 @@
  */
 public class ProfileServiceBootstrap extends BasicBootstrap
 {
-   private static String DEPLOYERS_XML_NAME = "deployer-beans.xml";
+   public static String DEPLOYERS_XML_NAME = "deployer-beans.xml";
    /** The name of the profile that is being booted */
    protected String profileName;
    /** The kernel deployer used to load the server deployers */
@@ -53,6 +53,9 @@
    protected MainDeployer mainDeployer;
    /** The server ProfileService */
    protected ProfileService profileService;
+   protected String deployerBeansPrefix;
+   /** An explicit deployer-beans.xml URL to deploy */
+   protected URL bootstrapURL;
 
    public ProfileServiceBootstrap()
    {
@@ -88,7 +91,39 @@
       return kernelDeployer;
    }
 
+   public String getDeployerBeansPrefix()
+   {
+      return deployerBeansPrefix;
+   }
    /**
+    * Set the prefix to add to the DEPLOYERS_XML_NAME in order to create the
+    * classpath resource to look for bootstrap descriptors.
+    * @param prefix - the prefix for the bootstrap descriptor resource. If null
+    * or empty, a value of profileName + "/" is used.
+    */
+   public void setDeployerBeansPrefix(String prefix)
+   {
+      if( prefix != null && prefix.length() == 0 )
+         prefix = null;
+      this.deployerBeansPrefix = prefix;
+   }
+
+   public URL getBootstrapURL()
+   {
+      return bootstrapURL;
+   }
+   /**
+    * Set the explicit kernel bootstrap deployer-beans.xml URL. If set, not
+    * resource discovery will be preformed.
+    * 
+    * @param bootstrapURL - URL to the bootstrap deployer-beans.xml 
+    */
+   public void setBootstrapURL(URL bootstrapURL)
+   {
+      this.bootstrapURL = bootstrapURL;
+   }
+
+   /**
     * Boot the kernel by loading all deployer-beans.xml descriptors available
     * on the classpath.
     * 
@@ -100,23 +135,34 @@
       
       kernelDeployer = new BasicXMLDeployer(getKernel());
 
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      String bootstrapResName = profileName + "/" + DEPLOYERS_XML_NAME;
-      log.debug("Scanning for bootstrap resources: "+bootstrapResName);
-      Enumeration<URL> descriptors = cl.getResources(bootstrapResName);
-      while( descriptors.hasMoreElements() )
+      if( bootstrapURL == null )
       {
-         URL url = descriptors.nextElement();
-         deploy(url);
+	      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+	      String bootstrapResName;
+	      if( deployerBeansPrefix == null )
+		      bootstrapResName = profileName + "/" + DEPLOYERS_XML_NAME;
+	      else
+		      bootstrapResName = deployerBeansPrefix + DEPLOYERS_XML_NAME;
+	      log.debug("Scanning for bootstrap resources: "+bootstrapResName);
+	      Enumeration<URL> descriptors = cl.getResources(bootstrapResName);
+	      while( descriptors.hasMoreElements() )
+	      {
+	         URL url = descriptors.nextElement();
+	         deploy(url);
+	      }
+	
+	      String metaInfBootstrapResName = "META-INF/" + bootstrapResName;
+	      log.debug("Scanning for bootstrap resources: "+metaInfBootstrapResName);
+	      descriptors = cl.getResources(metaInfBootstrapResName);
+	      while( descriptors.hasMoreElements() )
+	      {
+	         URL url = descriptors.nextElement();
+	         deploy(url);
+	      }
       }
-
-      String metaInfBootstrapResName = "META-INF/" + bootstrapResName;
-      log.debug("Scanning for bootstrap resources: "+metaInfBootstrapResName);
-      descriptors = cl.getResources(metaInfBootstrapResName);
-      while( descriptors.hasMoreElements() )
+      else
       {
-         URL url = descriptors.nextElement();
-         deploy(url);
+    	  deploy(bootstrapURL);    	  
       }
 
       // Validate that everything is ok




More information about the jboss-cvs-commits mailing list