[Jboss-cvs] JBossAS SVN: r57037 - branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 21 00:38:28 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-21 00:38:26 -0400 (Thu, 21 Sep 2006)
New Revision: 57037

Modified:
   branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
Log:
Integrate the incomplete deployment error reporting.

Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-09-21 04:17:36 UTC (rev 57036)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2006-09-21 04:38:26 UTC (rev 57037)
@@ -27,6 +27,10 @@
 
 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
 import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.IncompleteDeploymentException;
+import org.jboss.deployers.spi.IncompleteDeployments;
+import org.jboss.deployers.spi.IncompleteDeploymentsBuilder;
 import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.kernel.Kernel;
@@ -60,6 +64,9 @@
    /** The kernel deployer used to load the server deployers */
    protected BasicXMLDeployer kernelDeployer;
 
+   /** The controller */
+   protected KernelController controller;
+   
    /** The server MainDeployer */
    protected MainDeployer mainDeployer;
 
@@ -215,7 +222,7 @@
       }
 
       Kernel kernel = getKernel();
-      KernelController controller = kernel.getController();
+      controller = kernel.getController();
 
       // Register the Server instance in the kernel
       if (server != null)
@@ -225,7 +232,7 @@
       }
 
       // Validate that everything is ok
-      kernelDeployer.validate();
+      checkIncomplete();
 
       // Get the beans TODO injection!
       profileService = getBean(controller, "ProfileService", ProfileService.class);
@@ -234,7 +241,18 @@
       log.debug("Using MainDeployer: " + mainDeployer);
 
       // Load the profile beans
-      loadProfile(profileName);
+      try
+      {
+         loadProfile(profileName);
+      }
+      catch (IncompleteDeploymentException e)
+      {
+         log.error("Failed to load profile: " + e.getMessage());
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to load profile: ", e);
+      }
    }
 
    /**
@@ -324,6 +342,7 @@
             first = d;
       }
       deployer.process();
+      checkIncomplete();
 
       ClassLoader cl = first.getClassLoader();
       Thread thread = Thread.currentThread();
@@ -338,16 +357,30 @@
          for (DeploymentContext d : profileDeployers)
             deployer.addDeploymentContext(d);
          deployer.process();
+         checkIncomplete();
 
          // Deploy the profile deployments
          Collection<DeploymentContext> profileDeployments = profile.getDeployments();
          for (DeploymentContext d : profileDeployments)
             deployer.addDeploymentContext(d);
          deployer.process();
+         checkIncomplete();
       }
       finally
       {
          thread.setContextClassLoader(old);
       }
    }
+   
+   /**
+    * Check whether we are incomplete
+    * 
+    * @throws DeploymentException the deployment exception
+    */
+   protected void checkIncomplete() throws DeploymentException
+   {
+      IncompleteDeployments incomplete = IncompleteDeploymentsBuilder.build(mainDeployer, controller);
+      if (incomplete.isIncomplete())
+         throw new IncompleteDeploymentException(incomplete);
+   }
 }




More information about the jboss-cvs-commits mailing list