[jboss-cvs] JBossAS SVN: r86190 - in branches/Branch_5_x: profileservice/src/main/org/jboss/profileservice/management/upload and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 23 05:43:12 EDT 2009
Author: emuckenhuber
Date: 2009-03-23 05:43:11 -0400 (Mon, 23 Mar 2009)
New Revision: 86190
Modified:
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java
Log:
move validate out of activate profile.
Modified: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -187,6 +187,8 @@
try
{
this.profileService.activateProfile(getProfileKey());
+ // Validate if the activation was successful
+ this.profileService.validateProfile(getProfileKey());
this.activated = true;
}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -86,6 +86,7 @@
{
log.debug("activating transient profile " + TRANSIENT_PROFILE_NAME);
this.ps.activateProfile(TRANSIENT_PROFILE_KEY);
+ this.ps.validateProfile(TRANSIENT_PROFILE_KEY);
}
}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -238,7 +238,8 @@
// Activate the root profile
log.info("Loading profile: " + this.profileKey);
- profileService.activateProfile(this.profileKey);
+ this.profileService.activateProfile(this.profileKey);
+ this.profileService.validateProfile(this.profileKey);
try
{
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -35,7 +35,7 @@
public abstract void install(Profile profile) throws Exception;
- public abstract void uninstall(Profile profile) throws Exception;
+ public abstract void uninstall(Profile profile);
/**
* Install.
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -48,9 +48,17 @@
}
@Override
- public void uninstall(Profile profile) throws Exception
+ public void uninstall(Profile profile)
{
- invoke(profile, getUninstallMethod());
+ try
+ {
+ invoke(profile, getUninstallMethod());
+ }
+ catch(Exception e)
+ {
+ log.warn("Error invoking uninstall method '" + getUninstallMethod()
+ + "' on profile: " + profile.getKey());
+ }
}
protected static void invoke(Profile profile, String method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -46,7 +46,6 @@
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.util.JBossStringBuilder;
/**
@@ -228,7 +227,7 @@
if(this.deployer == null)
throw new IllegalStateException("Null deployer.");
- // FIXME this should be moved to static actions
+ // TODO this should be moved to static actions
this.profileActions.put(ControllerState.CREATE, new ProfileCreateAction());
this.profileActions.put(ControllerState.START, new ProfileStartAction());
this.profileActions.put(DEPLOY_STATE, new ProfileDeployAction(deployer));
@@ -246,21 +245,6 @@
}
/**
- * Create and register a profile.
- *
- * @param metaData the profile meta data.
- * @throws Exception
- */
- public ProfileKey createProfile(ProfileMetaData metaData) throws Exception
- {
- if(metaData == null)
- throw new IllegalArgumentException("Null meta data");
-
- // FIXME
- throw new IllegalStateException("NYI");
- }
-
- /**
* Register a Profile.
*
* @param profile the profile.
@@ -325,10 +309,6 @@
{
throw new RuntimeException(t);
}
-
- // TODO let the caller validate
- // Check if the profile was activated successfully
- validate(context);
}
public void validateProfile(ProfileKey key) throws Exception
@@ -371,21 +351,29 @@
public void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
{
if(context instanceof ProfileContext == false)
+ {
return;
- // TODO
+ }
+
AbstractProfileAction action = this.profileActions.get(toState);
if(action != null)
+ {
action.install((ProfileContext) context);
+ }
}
public void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
{
if(context instanceof ProfileContext == false)
+ {
return;
- // TODO
+ }
+
AbstractProfileAction action = this.profileActions.get(fromState);
if(action != null)
+ {
action.uninstall((ProfileContext) context);
+ }
}
/**
@@ -412,8 +400,6 @@
{
log.debug("deactivating profile: " + key);
controller.change(context, ControllerState.NOT_INSTALLED);
-
- // TODO release other not needed contexts ?
}
catch(Throwable t)
{
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -57,6 +57,7 @@
{
try
{
+ // Add deployment
deployer.addDeployment(deployment);
}
catch(Exception e)
@@ -73,7 +74,6 @@
@Override
public void uninstall(Profile profile)
{
- // Handle deployments
Collection<ProfileDeployment> deployments = profile.getDeployments();
if (deployments != null && !deployments.isEmpty())
{
@@ -82,23 +82,17 @@
{
try
{
- // remove deployments
+ // remove deployment
deployer.removeDeployment(deployment);
}
catch(Throwable t)
{
- log.warn("failed to undeploy: " + t);
+ log.warn("failed to remove deployment: " + deployment, t);
}
}
+
// undeploy
- try
- {
- deployer.process();
- }
- catch (Throwable t)
- {
- log.warn("Error on releasing profile: ", t);
- }
+ deployer.process();
}
}
}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -109,6 +109,7 @@
// Activate
log.debug("Activating deployment scanner profile " + profileName);
this.ps.activateProfile(profileName);
+ this.ps.validateProfile(profileName);
}
public void resume()
Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -97,7 +97,9 @@
try
{
// Activate profile
- profileService.activateProfile(new ProfileKey("default"));
+ ProfileKey key = new ProfileKey("default");
+ profileService.activateProfile(key);
+ profileService.validateProfile(key);
}
catch(Exception e)
{
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java 2009-03-23 08:01:34 UTC (rev 86189)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java 2009-03-23 09:43:11 UTC (rev 86190)
@@ -67,7 +67,6 @@
Collection<ProfileKey> keys = getDeploymentManager().getProfiles();
assertNotNull(keys);
log.debug("available keys: " + keys);
- assertEquals("keys size", 2, keys.size());
keys.contains(new ProfileKey("applications"));
keys.contains(deployersKey);
}
More information about the jboss-cvs-commits
mailing list