[jboss-cvs] JBossAS SVN: r83397 - trunk/system/src/main/org/jboss/system/server/profileservice/repository.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Jan 25 07:02:12 EST 2009
Author: emuckenhuber
Date: 2009-01-25 07:02:11 -0500 (Sun, 25 Jan 2009)
New Revision: 83397
Modified:
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java
Log:
update profile validation and some cleanup
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java 2009-01-24 12:01:20 UTC (rev 83396)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java 2009-01-25 12:02:11 UTC (rev 83397)
@@ -133,6 +133,14 @@
throw new IllegalStateException("Null attachment store.");
}
+ public void unload()
+ {
+ // Unload
+ this.applicationCtxs.clear();
+ this.applicationVFCache.clear();
+ this.contentFlags.clear();
+ }
+
public void addDeployment(String vfsPath, VFSDeployment d) throws Exception
{
this.applicationCtxs.put(vfsPath, d);
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java 2009-01-24 12:01:20 UTC (rev 83396)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java 2009-01-25 12:02:11 UTC (rev 83397)
@@ -147,9 +147,7 @@
AbstractProfile profile = new AbstractProfile(repository, key);
// Copy the sub-profile keys
- List<ProfileKey> sub = new ArrayList<ProfileKey>();
- sub.addAll(subProfiles);
- profile.setSubProfiles(sub);
+ profile.setSubProfiles(new ArrayList<ProfileKey>(subProfiles));
// Add to the profileMap
profiles.put(key, profile);
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-01-24 12:01:20 UTC (rev 83396)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-01-25 12:02:11 UTC (rev 83397)
@@ -284,11 +284,11 @@
{
//
Set<String> errors = new HashSet<String>();
- Set<String> incomplete = new HashSet<String>();
+ Map<Object, String> map = new HashMap<Object, String>();
// Validate the context, with it's dependencies
- internalValidateContext(context, errors, incomplete);
+ internalValidateContext(context, errors, map);
// Create and throw the Exception
- logErrors(errors, incomplete);
+ logErrors(errors, map.values());
}
public void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
@@ -391,13 +391,13 @@
/**
* Validate the context and create the error messages if needed.
*
- * TODO this only checks for NOT FOUND dependencies.
+ * TODO maybe recurse into dependent contexts.
*
* @param ctx the context to validate
* @param errors a set of errors
* @param incomplete a set of incomplete contexts
*/
- protected void internalValidateContext(ControllerContext ctx, Set<String> errors, Set<String> incomplete)
+ protected void internalValidateContext(ControllerContext ctx, Set<String> errors, Map<Object, String> incomplete)
{
if (ctx.getState().equals(ControllerState.ERROR))
{
@@ -407,6 +407,9 @@
else
{
Object name = ctx.getName();
+ if(incomplete.containsKey(name))
+ return;
+
DependencyInfo dependsInfo = ctx.getDependencyInfo();
Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
for (DependencyItem item : depends)
@@ -415,20 +418,32 @@
if (dependentState == null)
dependentState = ControllerState.INSTALLED;
+ ControllerState otherState = null;
ControllerContext other = null;
Object iDependOn = item.getIDependOn();
+
if (name.equals(iDependOn) == false)
{
if (iDependOn != null)
{
other = controller.getContext(iDependOn, null);
+ if (other != null)
+ otherState = other.getState();
}
- if(other == null)
+ boolean print = true;
+ if (otherState != null && otherState.equals(ControllerState.ERROR) == false)
{
+ ControllerStateModel states = controller.getStates();
+ if (states.isBeforeState(otherState, dependentState) == false)
+ print = false;
+ }
+
+ if (print)
+ {
JBossStringBuilder buffer = new JBossStringBuilder();
buffer.append(name).append(" -> ");
-
+
buffer.append(iDependOn).append('{').append(dependentState.getStateString());
buffer.append(':');
if (iDependOn == null)
@@ -437,20 +452,22 @@
}
else
{
- buffer.append("** NOT FOUND **");
+ if (other == null)
+ buffer.append("** NOT FOUND **");
+ else
+ buffer.append(otherState.getStateString());
}
buffer.append('}');
-
- // Add to incomplete list
- incomplete.add(buffer.toString());
+
+ // Add Error message and check other context.
+ incomplete.put(name, buffer.toString());
+ if(other!= null && incomplete.containsKey(other) == false)
+ {
+ internalValidateContext(other, errors, incomplete);
+ }
}
- else
- {
- // If there is a known context, see why it's not working
- internalValidateContext(other, errors, incomplete);
- }
}
- }
+ }
}
}
@@ -462,7 +479,7 @@
* @param incomplete a set of missing dependencies
* @throws Exception in case there are errors or missing dependencies
*/
- protected void logErrors(Set<String> errors, Set<String> incomplete) throws Exception
+ protected void logErrors(Set<String> errors, Collection<String> incomplete) throws Exception
{
if(errors.isEmpty() && incomplete.isEmpty())
return;
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java 2009-01-24 12:01:20 UTC (rev 83396)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java 2009-01-25 12:02:11 UTC (rev 83397)
@@ -109,6 +109,13 @@
updateLastModfied();
}
+ @Override
+ public void unload()
+ {
+ super.unload();
+ this.lastModifiedCache.clear();
+ }
+
public String addDeploymentContent(String vfsPath, InputStream contentIS) throws IOException
{
boolean trace = log.isTraceEnabled();
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java 2009-01-24 12:01:20 UTC (rev 83396)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java 2009-01-25 12:02:11 UTC (rev 83397)
@@ -73,7 +73,6 @@
getDependencyInfo().addIDependOn(createDependencyItem(key, iDependOn));
}
}
-
}
private DependencyItem createDependencyItem(ProfileKey key, ProfileKey iDependOn)
More information about the jboss-cvs-commits
mailing list