[jboss-cvs] JBossAS SVN: r80836 - in trunk: profileservice/src/main/org/jboss/profileservice/management/upload and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 12 00:28:09 EST 2008


Author: scott.stark at jboss.org
Date: 2008-11-12 00:28:08 -0500 (Wed, 12 Nov 2008)
New Revision: 80836

Modified:
   trunk/profileservice/src/main/org/jboss/profileservice/management/messages.properties
   trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
   trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
   trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
Log:
JBAS-5370, improve logging and state checking

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/messages.properties
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/messages.properties	2008-11-12 05:17:42 UTC (rev 80835)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/messages.properties	2008-11-12 05:28:08 UTC (rev 80836)
@@ -1,5 +1,6 @@
 # 
 ManagementView.NoSuchProfileException=Failed to find profile for key: {0}
+ManagementView.NoProfileLoadedException=No profile has been loaded, use loadProfile(ProfileKey, boolean)
 ManagementView.NoSuchDeploymentException=Failed to find deployment for name: {0}
 ManagementView.MainDeployerRemoveException=MainDeployer failed to remove deployment for name: {0}
 ManagementView.NoSuchTemplate=Failed to find template for: {0}

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java	2008-11-12 05:17:42 UTC (rev 80835)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java	2008-11-12 05:28:08 UTC (rev 80836)
@@ -123,12 +123,22 @@
    }
 
    public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL)
+      throws Exception
    {
       return distribute(name, phase, contentURL, true);
    }
 
    public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL, boolean copyContent)
+      throws Exception
    {
+      if(activeProfile == null)
+      {
+         formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
+         Object[] args = {};
+         String msg = formatter.format(args);
+         throw new NoSuchProfileException(msg);
+      }
+
       List<DeploymentTarget> targets = getDeploymentTargets();
       SerializableDeploymentID deployment = new SerializableDeploymentID(name, phase, contentURL.toString());
       deployment.setContentURL(contentURL);
@@ -147,7 +157,8 @@
       return false;
    }
 
-   public void loadProfile(ProfileKey key, boolean allowHotDeployments) throws Exception
+   public void loadProfile(ProfileKey key, boolean allowHotDeployments)
+      throws Exception
    {
       activeProfile = ps.getProfile(key);
       if( activeProfile == null )
@@ -157,9 +168,11 @@
          String msg = formatter.format(args);
          throw new NoSuchProfileException(msg);
       }
+      log.debug("Loading profile, key: "+key+", allowHotDeployments: "+allowHotDeployments);
       activeProfile.enableModifiedDeploymentChecks(allowHotDeployments);
       // Set the deployment repository on the handler
       DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
+      log.debug("DeploymentRepository for profile: "+repository);
       deployHandler.setDeploymentRepository(repository);
    }
 
@@ -174,12 +187,22 @@
          String msg = formatter.format(args);
          throw new NoSuchProfileException(msg);
       }
+      log.debug("Releasing profile, key: "+key);
       activeProfile.enableModifiedDeploymentChecks(allowHotDeployments);
       deployHandler.setDeploymentRepository(null);
    }
 
    public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL)
+      throws Exception
    {
+      if(activeProfile == null)
+      {
+         formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
+         Object[] args = {};
+         String msg = formatter.format(args);
+         throw new NoSuchProfileException(msg);
+      }
+
       List<DeploymentTarget> targets = getDeploymentTargets();
       SerializableDeploymentID deployment = new SerializableDeploymentID(name, phase, null);
       return new DeploymentProgressImpl(targets, deployment, CommandType.REDEPLOY);
@@ -206,7 +229,16 @@
    }
 
    protected DeploymentProgress doProgress(CommandType type, DeploymentPhase phase, String... names)
+      throws Exception
    {
+      if(activeProfile == null)
+      {
+         formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
+         Object[] args = {};
+         String msg = formatter.format(args);
+         throw new NoSuchProfileException(msg);
+      }
+
       if (names == null || names.length == 0)
          log.warn("Null or empty names.");
 

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java	2008-11-12 05:17:42 UTC (rev 80835)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java	2008-11-12 05:28:08 UTC (rev 80836)
@@ -70,6 +70,7 @@
    }
    public void setDeploymentRepository(DeploymentRepository deploymentRepository)
    {
+      log.debug("setDeploymentRepository, "+deploymentRepository);
       this.deploymentRepository = deploymentRepository;
    }
 

Modified: trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java	2008-11-12 05:17:42 UTC (rev 80835)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/deploy/DeploymentManager.java	2008-11-12 05:28:08 UTC (rev 80836)
@@ -64,7 +64,8 @@
     * @return DeploymentProgress progress object for the deployment
     */
    @Deprecated
-   public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL);
+   public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL)
+      throws Exception;
 
    /**
     * Add raw deployment content to the profile.
@@ -75,7 +76,9 @@
     * @param copyContent should we copy content or just reference it
     * @return DeploymentProgress progress object for the deployment
     */
-   public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL, boolean copyContent);
+   public DeploymentProgress distribute(String name, DeploymentPhase phase,
+         URL contentURL, boolean copyContent)
+      throws Exception;
 
    /**
     * Map from the external name passed to distribute to the uploaded
@@ -103,7 +106,8 @@
     * @param contentURL deployment's url
     * @return a DeploymentProgress used to run and track the redeploy progress.
     */
-   public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL);
+   public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL)
+      throws Exception;
 
    /**
     * Prepare a set of deployments through their dependency analysis phase.
@@ -113,7 +117,8 @@
     * @return a DeploymentProgress used to run and track the prepare progress.
     * @throws Exception for any error
     */
-   public DeploymentProgress prepare(DeploymentPhase phase, String... names) throws Exception;
+   public DeploymentProgress prepare(DeploymentPhase phase, String... names)
+      throws Exception;
 
    /**
     * Start a previously distributed deployment.
@@ -123,7 +128,8 @@
     * @return a DeploymentProgress used to run and track the start progress.
     * @throws Exception for any error
     */
-   public DeploymentProgress start(DeploymentPhase phase, String... names) throws Exception;
+   public DeploymentProgress start(DeploymentPhase phase, String... names)
+      throws Exception;
 
    /**
     * Stop a previously started deployment.
@@ -133,7 +139,8 @@
     * @return a DeploymentProgress used to run and track the stop progress.
     * @throws Exception for any error
     */
-   public DeploymentProgress stop(DeploymentPhase phase, String... names) throws Exception;
+   public DeploymentProgress stop(DeploymentPhase phase, String... names)
+      throws Exception;
 
    /**
     * Undeploy a previously distributed deployment.
@@ -143,5 +150,6 @@
     * @return a DeploymentProgress used to run and track the prepare progress.
     * @throws Exception for any error
     */
-   public DeploymentProgress undeploy(DeploymentPhase phase, String... names) throws Exception;
+   public DeploymentProgress undeploy(DeploymentPhase phase, String... names)
+      throws Exception;
 }

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java	2008-11-12 05:17:42 UTC (rev 80835)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java	2008-11-12 05:28:08 UTC (rev 80836)
@@ -153,6 +153,7 @@
    }
    
    protected String[] distribute(DeploymentManager deployMgr, String name, URL contentURL)
+      throws Exception
    {
       DeploymentProgress progress = deployMgr.distribute(name, DeploymentPhase.APPLICATION, contentURL, true);
       getLog().debug("distribute: "+ contentURL);




More information about the jboss-cvs-commits mailing list