[jboss-cvs] JBossAS SVN: r95830 - in projects/kernel/trunk: dependency/src/main/java/org/jboss/dependency/spi and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 30 10:41:00 EDT 2009
Author: kabir.khan at jboss.com
Date: 2009-10-30 10:41:00 -0400 (Fri, 30 Oct 2009)
New Revision: 95830
Added:
projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/ListControllerStateModel.java
projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java
projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerReportingTestCase.java
Modified:
projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java
projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/spi/ControllerStateModel.java
projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerStateModelTestCase.java
projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerTestSuite.java
projects/kernel/trunk/kernel/.classpath
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/AbstractKernelController.java
projects/kernel/trunk/weld-int/.classpath
Log:
[JBKERNEL-57] Optimize usage of controller state model
Modified: projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java
===================================================================
--- projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -31,7 +31,6 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
@@ -64,7 +63,7 @@
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision$
*/
-public class AbstractController extends JBossObject implements Controller, ControllerStateModel, GraphController, AbstractControllerMBean, AsynchronousController
+public class AbstractController extends JBossObject implements Controller, GraphController, AbstractControllerMBean, AsynchronousController
{
/** The lock */
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
@@ -77,9 +76,8 @@
/** Whether we are shutdown */
private boolean shutdown = false;
- /** The states in order List<ControllerState> */
- private List<ControllerState> states = new CopyOnWriteArrayList<ControllerState>();
-
+ private ControllerStateModel stateModel = new MapControllerStateModel();
+
/** All contexts by name Map<Object, ControllerContext> */
private Map<Object, ControllerContext> allContexts = new ConcurrentHashMap<Object, ControllerContext>();
@@ -290,20 +288,11 @@
lockWrite();
try
{
- if (states.contains(state))
- return;
-
- if (before == null)
+ if (stateModel.addState(state, before))
{
- states.add(state);
+ Set<ControllerContext> contexts = new CopyOnWriteArraySet<ControllerContext>();
+ contextsByState.put(state, contexts);
}
- else
- {
- states.add(getStateIndex(before), state);
- }
-
- Set<ControllerContext> contexts = new CopyOnWriteArraySet<ControllerContext>();
- contextsByState.put(state, contexts);
}
finally
{
@@ -485,10 +474,14 @@
try
{
LinkedHashSet<ControllerContext> result = new LinkedHashSet<ControllerContext>();
- for (int i = states.size()-1; i>=0; --i)
+ ListIterator<ControllerState> it = stateModel.listIteraror();
+ if (it.hasNext())
{
- ControllerState state = states.get(i);
- result.addAll(getContextsByState(state));
+ result.addAll(getContextsByState(it.next()));
+ while (it.hasPrevious())
+ {
+ result.addAll(getContextsByState(it.previous()));
+ }
}
result.addAll(errorContexts.values());
return result;
@@ -508,7 +501,7 @@
try
{
ControllerContext result = getRegisteredControllerContext(name, false);
- if (result != null && state != null && isBeforeState(result.getState(), state))
+ if (result != null && state != null && stateModel.isBeforeState(result.getState(), state))
{
return null;
}
@@ -531,9 +524,12 @@
try
{
Set<ControllerContext> result = new HashSet<ControllerContext>(errorContexts.values());
- for (int i = 0; ControllerState.INSTALLED.equals(states.get(i)) == false; ++i)
+ for (ControllerState state : stateModel)
{
- Set<ControllerContext> stateContexts = getContextsByState(states.get(i));
+ if (ControllerState.INSTALLED.equals(state))
+ break;
+
+ Set<ControllerContext> stateContexts = getContextsByState(state);
result.addAll(stateContexts);
}
return result;
@@ -546,7 +542,7 @@
public ControllerStateModel getStates()
{
- return this;
+ return stateModel;
}
public Set<ControllerContext> getContextsByState(ControllerState state)
@@ -847,13 +843,10 @@
{
checkShutdown();
- ControllerState fromState = context.getState();
- int currentIndex = states.indexOf(fromState);
- int requiredIndex = states.indexOf(state);
- if (requiredIndex == -1)
+ if (!stateModel.isValidState(state))
throw new IllegalArgumentException("Unknown state: " + state);
- if (currentIndex == requiredIndex)
+ if (context.getState().equals(state))
{
if (trace)
log.trace("No change required toState=" + state.getStateString() + " " + context.toShortString());
@@ -865,14 +858,13 @@
context.setRequiredState(state);
- if (currentIndex < requiredIndex)
+ if (stateModel.isBeforeState(context.getState(), state))
resolveContexts(trace);
else
{
- while (currentIndex > requiredIndex)
+ while (stateModel.isAfterState(context.getState(), state))
{
uninstallContext(context, trace);
- currentIndex = states.indexOf(context.getState());
}
}
}
@@ -934,7 +926,7 @@
Controller fromController = context.getController();
Set<ControllerContext> fromContexts = null;
- int currentIndex = -1;
+ ControllerState toState = null;
if (ControllerState.ERROR.equals(fromState))
{
errorContexts.remove(context);
@@ -962,18 +954,19 @@
Set<ControllerContext> notInstalled = fromController.getContextsByState(ControllerState.NOT_INSTALLED);
notInstalled.add(context);
context.setState(ControllerState.NOT_INSTALLED);
+ return true;
}
else
{
- currentIndex = states.indexOf(fromState);
+ //currentIndex = states.indexOf(fromState);
fromContexts = fromController.getContextsByState(fromState);
if (fromContexts.contains(context) == false)
throw new IllegalStateException("Context not found in previous state (" + fromState + "): " + context.toShortString());
+ toState = stateModel.getNextState(fromState);
+ if (toState == null)
+ throw new IllegalStateException("No state after " + toState);
}
- int toIndex = currentIndex + 1;
- ControllerState toState = states.get(toIndex);
-
unlockWrite();
Throwable error = null;
try
@@ -1024,10 +1017,9 @@
{
onDemandEnabled = false;
resolutions = false;
- for (int i = 0; i < states.size() - 1; ++i)
+ for (ControllerState fromState : stateModel)
{
- ControllerState fromState = states.get(i);
- ControllerState toState = states.get(i + 1);
+ ControllerState toState = stateModel.getNextState(fromState);
if (resolveContexts(fromState, toState, trace))
{
resolutions = true;
@@ -1038,10 +1030,9 @@
if (trace)
{
- for (int i = 0; i < states.size() - 1; ++i)
+ for (ControllerState state : stateModel)
{
- ControllerState state = states.get(i);
- ControllerState nextState = states.get(i + 1);
+ ControllerState nextState = stateModel.getNextState(state);
Set<ControllerContext> stillUnresolved = getContextsByState(state);
if (stillUnresolved.isEmpty() == false)
{
@@ -1303,19 +1294,18 @@
*/
protected void uninstallContext(ControllerContext context, ControllerState toState, boolean trace)
{
- int targetState = states.indexOf(toState);
- if (targetState == -1)
- log.error("INTERNAL ERROR: unknown state " + toState + " states=" + states, new Exception("STACKTRACE"));
+ if (!stateModel.isValidState(toState))
+ log.error("INTERNAL ERROR: unknown state " + toState + " states=" + stateModel, new Exception("STACKTRACE"));
while (true)
{
ControllerState fromState = context.getState();
if (ControllerState.ERROR.equals(fromState))
return;
- int currentState = states.indexOf(fromState);
- if (currentState == -1)
+ if (!stateModel.isValidState(fromState))
log.error("INTERNAL ERROR: current state not found: " + context.toShortString(), new Exception("STACKTRACE"));
- if (targetState > currentState)
+
+ if (stateModel.isAfterState(toState, fromState))
return;
else
uninstallContext(context, trace);
@@ -1376,7 +1366,7 @@
if (!selfDependency)
{
contextsInstalledByExecutor.interruptTaskAndBlock(dependent, this);
- if (isBeforeState(dependent.getState(), whenRequired) == false)
+ if (stateModel.isBeforeState(dependent.getState(), whenRequired) == false)
{
uninstallContext(dependent, whenRequired, trace);
}
@@ -1403,18 +1393,14 @@
if (ControllerState.ERROR.equals(fromState))
return;
- // Calculate the previous state
- int currentIndex = states.indexOf(fromState);
- int toIndex = currentIndex - 1;
- if (toIndex < 0)
+ ControllerState toState = stateModel.getPreviousState(fromState);
+ if (toState == null)
{
// This is hack, we signal true uninstalled status by putting it in the error state
context.setState(ControllerState.ERROR);
return;
}
- ControllerState toState = states.get(toIndex);
-
unlockWrite();
try
{
@@ -1492,9 +1478,10 @@
continue;
}
- int requiredIndex = states.indexOf(item.getWhenRequired());
- int actualIndex = states.indexOf(dependsContext.getState());
- if (requiredIndex <= actualIndex)
+ ControllerState requiredState = item.getWhenRequired();
+ ControllerState actualState = dependsContext.getState();
+
+ if (requiredState.equals(actualState) || stateModel.isBeforeState(requiredState, actualState))
{
isRequired = true;
break;
@@ -1503,9 +1490,7 @@
if (!isRequired)
{
//For some reason uninstallContext() uninstalls to the state below the passed in one, add one
- int index = states.indexOf(ControllerMode.ON_DEMAND.getRequiredState());
- index++;
- ControllerState state = states.get(index);
+ ControllerState state = stateModel.getNextState(ControllerMode.ON_DEMAND.getRequiredState());
uninstallContext(other, state, trace);
}
}
@@ -1772,7 +1757,7 @@
*/
protected void handleUninstallLifecycleCallbacks(ControllerContext context, ControllerState state) throws Throwable
{
- ControllerState oldState = getNextState(state);
+ ControllerState oldState = stateModel.getNextState(state);
handleLifecycleCallbacks(context, oldState, false);
}
@@ -1911,7 +1896,7 @@
if (ControllerMode.DISABLED.equals(mode))
return false;
- return isBeforeState(context.getState(), context.getRequiredState());
+ return stateModel.isBeforeState(context.getState(), context.getRequiredState());
}
/**
@@ -2186,40 +2171,6 @@
}
}
- public ListIterator<ControllerState> listIteraror()
- {
- return states.listIterator(states.size() - 1);
- }
-
- public ControllerState getPreviousState(ControllerState state)
- {
- return getState(getStateIndex(state) - 1);
- }
-
- public ControllerState getNextState(ControllerState state)
- {
- return getState(getStateIndex(state) + 1);
- }
-
- public boolean isBeforeState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex < referenceIndex;
- }
-
- public boolean isAfterState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex > referenceIndex;
- }
-
- public Iterator<ControllerState> iterator()
- {
- return states.iterator();
- }
-
public boolean isAsynchronousInstallInProgress(ControllerContext context)
{
if (context.getMode() != ControllerMode.ASYNCHRONOUS)
@@ -2229,53 +2180,6 @@
}
/**
- * Get the state index.
- *
- * @param state the state
- * @return state index
- */
- protected int getStateIndex(ControllerState state)
- {
- return getStateIndex(state, false);
- }
-
- /**
- * Get the state index.
- *
- * You have allow not found flag in case
- * error state is passed in, which is legal.
- *
- * @param state the state
- * @param allowNotFound allow not found state
- * @return state index
- */
- protected int getStateIndex(ControllerState state, boolean allowNotFound)
- {
- if (state == null)
- throw new IllegalArgumentException("Null state");
-
- int stateIndex = states.indexOf(state);
- if (stateIndex < 0 && allowNotFound == false)
- throw new IllegalArgumentException("No such state " + state + " in states " + states);
-
- return stateIndex;
- }
-
- /**
- * Get the controller state form index.
- *
- * @param index the state index
- * @return controller state
- */
- protected ControllerState getState(int index)
- {
- if (index < 0 || index >= states.size())
- return null;
- else
- return states.get(index);
- }
-
- /**
* A task being handled asyynchronously by the executor
*
*/
@@ -2429,17 +2333,15 @@
{
boolean stateChanged = false;
- int currentIndex = states.indexOf(context.getState());
- int requiredIndex = states.indexOf(context.getRequiredState());
- if (requiredIndex == -1)
+ if (!stateModel.isValidState(context.getRequiredState()))
throw new IllegalArgumentException("Unknown state: " + context.getRequiredState());
boolean resolved = true;
- while(resolved && currentIndex < requiredIndex && !interrupted)
+ while(resolved && stateModel.isBeforeState(context.getState(), context.getRequiredState()) && !interrupted)
{
resolved = false;
- ControllerState toState = states.get(currentIndex + 1);
+ ControllerState toState = stateModel.getNextState(context.getState());
if (advance(context))
{
try
@@ -2464,7 +2366,6 @@
if (resolved)
{
stateChanged = true;
- currentIndex = states.indexOf(context.getState());
}
}
}
@@ -2576,6 +2477,5 @@
}
}
}
-
}
}
Added: projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/ListControllerStateModel.java
===================================================================
--- projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/ListControllerStateModel.java (rev 0)
+++ projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/ListControllerStateModel.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -0,0 +1,151 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ControllerStateModel;
+
+/**
+ * The legacy list based ControllerStateModel implementation
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ListControllerStateModel implements ControllerStateModel
+{
+ /** The states in order List<ControllerState> */
+ private List<ControllerState> states = new CopyOnWriteArrayList<ControllerState>();
+
+ public boolean addState(ControllerState state, ControllerState before)
+ {
+ if (states.contains(state))
+ return false;
+
+ if (before == null)
+ {
+ states.add(state);
+ }
+ else
+ {
+ states.add(getStateIndex(before), state);
+ }
+ return true;
+ }
+
+ /**
+ * Get the state index.
+ *
+ * @param state the state
+ * @return state index
+ */
+ protected int getStateIndex(ControllerState state)
+ {
+ return getStateIndex(state, false);
+ }
+
+ /**
+ * Get the state index.
+ *
+ * You have allow not found flag in case
+ * error state is passed in, which is legal.
+ *
+ * @param state the state
+ * @param allowNotFound allow not found state
+ * @return state index
+ */
+ protected int getStateIndex(ControllerState state, boolean allowNotFound)
+ {
+ if (state == null)
+ throw new IllegalArgumentException("Null state");
+
+ int stateIndex = states.indexOf(state);
+ if (stateIndex < 0 && allowNotFound == false)
+ throw new IllegalArgumentException("No such state " + state + " in states " + states);
+
+ return stateIndex;
+ }
+
+ /**
+ * Get the controller state form index.
+ *
+ * @param index the state index
+ * @return controller state
+ */
+ protected ControllerState getState(int index)
+ {
+ if (index < 0 || index >= states.size())
+ return null;
+ else
+ return states.get(index);
+ }
+
+ public ControllerState getPreviousState(ControllerState state)
+ {
+ return getState(getStateIndex(state) - 1);
+ }
+
+ public ControllerState getNextState(ControllerState state)
+ {
+ return getState(getStateIndex(state) + 1);
+ }
+
+ public boolean isBeforeState(ControllerState state, ControllerState reference)
+ {
+ int stateIndex = getStateIndex(state, true);
+ int referenceIndex = getStateIndex(reference, true);
+ return stateIndex < referenceIndex;
+ }
+
+ public boolean isAfterState(ControllerState state, ControllerState reference)
+ {
+ int stateIndex = getStateIndex(state, true);
+ int referenceIndex = getStateIndex(reference, true);
+ return stateIndex > referenceIndex;
+ }
+
+ public Iterator<ControllerState> iterator()
+ {
+ return states.iterator();
+ }
+
+ public ListIterator<ControllerState> listIteraror()
+ {
+ return states.listIterator(states.size() - 1);
+ }
+
+ public boolean isValidState(ControllerState state)
+ {
+ return states.indexOf(state) >= 0;
+ }
+
+ public ControllerState getInitialState()
+ {
+ if (states.size() == 0)
+ throw new IllegalStateException("No intial state");
+ return states.get(0);
+ }
+}
Added: projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java
===================================================================
--- projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java (rev 0)
+++ projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/plugins/MapControllerStateModel.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -0,0 +1,264 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.dependency.plugins;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ControllerStateModel;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MapControllerStateModel implements ControllerStateModel
+{
+ private volatile ControllerStateWrapper first;
+ private volatile ControllerStateWrapper last;
+ private final Map<ControllerState, ControllerStateWrapper> states = new ConcurrentHashMap<ControllerState, ControllerStateWrapper>();
+
+ /** Thread-safe list for obtaining the iterators */
+ private final List<ControllerState> stateList = new CopyOnWriteArrayList<ControllerState>();
+
+ /**
+ * Add a state.
+ * Synchronized so that only one state can be added at a time.
+ *
+ * @param state The state to add
+ * @param before The state to add the new state before, or null to add the new state at the end
+ * @throws IllegalArgumentException if before is not null and does not exist
+ */
+ public synchronized boolean addState(ControllerState state, ControllerState before)
+ {
+ if (states.containsKey(state))
+ return false;
+
+ //Work out the values for the new state and create it
+ ControllerStateWrapper previous = null;
+ ControllerStateWrapper next = null;
+ int index = 0;
+ if (before == null)
+ {
+ next = null;
+ previous = last;
+ index = last == null ? 0 : last.getIndex() + 1;
+ }
+ else
+ {
+ next = getState(before);
+ previous = next.getBefore();
+ index = next.getIndex();
+ }
+ ControllerStateWrapper newState = new ControllerStateWrapper(state, index, previous, next);
+
+
+ //Add the state so that calls to isValid() can return successfully
+ states.put(state, newState);
+ stateList.add(index, state);
+ if (previous == null)
+ first = newState;
+ if (next == null)
+ last = newState;
+
+ if (next != null)
+ {
+ //Increment the subsequent state indices in reverse order so that isBeforeState() and isAfterState() are still valid
+ //(apart from newState and next, which will be valid once the loop completes)
+ ControllerStateWrapper current = last;
+ while (current != null)
+ {
+ current.incrementIndex();
+ if (current == next)
+ break;
+ current = current.getBefore();
+ }
+ }
+
+ //Update the previous and next states to point to the new state so that getNextState() and getPreviousState()
+ //pick up the new state. Do next first so that we don't have the possibility of installing to the new state
+ //without uninstalling from it
+ if (next != null)
+ next.setBefore(newState);
+ if (previous != null)
+ previous.setAfter(newState);
+ return true;
+ }
+
+ protected ControllerStateWrapper getState(ControllerState state)
+ {
+ return getState(state, false);
+ }
+
+ protected ControllerStateWrapper getState(ControllerState state, boolean allowNotFound)
+ {
+ if (state == null)
+ throw new IllegalArgumentException("Null state");
+
+ ControllerStateWrapper found = states.get(state);
+ if (found == null && !allowNotFound)
+ throw new IllegalArgumentException("No such state " + state + " in states " + states);
+
+ return found;
+ }
+
+ protected int getStateIndex(ControllerState state)
+ {
+ return getStateIndex(state, false);
+ }
+
+ protected int getStateIndex(ControllerState state, boolean allowNotFound)
+ {
+ ControllerStateWrapper stateWrapper = getState(state, allowNotFound);
+ return stateWrapper == null ? -1 : stateWrapper.getIndex();
+ }
+
+ public ControllerState getPreviousState(ControllerState state)
+ {
+ ControllerStateWrapper previous = getState(state).getBefore();
+ return previous == null ? null : previous.getState();
+ }
+
+ public ControllerState getNextState(ControllerState state)
+ {
+ ControllerStateWrapper next = getState(state).getAfter();
+ return next == null ? null : next.getState();
+ }
+
+ public boolean isBeforeState(ControllerState state, ControllerState reference)
+ {
+ int stateIndex = getStateIndex(state, true);
+ int referenceIndex = getStateIndex(reference, true);
+ return stateIndex < referenceIndex;
+ }
+
+ public boolean isAfterState(ControllerState state, ControllerState reference)
+ {
+ int stateIndex = getStateIndex(state, true);
+ int referenceIndex = getStateIndex(reference, true);
+ return stateIndex > referenceIndex;
+ }
+
+ public Iterator<ControllerState> iterator()
+ {
+ return stateList.iterator();
+ }
+
+ public ListIterator<ControllerState> listIteraror()
+ {
+ return stateList.listIterator(states.size() - 1);
+ }
+
+ public boolean isValidState(ControllerState state)
+ {
+ return states.containsKey(state);
+ }
+
+
+ public ControllerState getInitialState()
+ {
+ ControllerStateWrapper result = first;
+ if (result == null)
+ throw new IllegalStateException("No initial state");
+ return result.getState();
+ }
+
+ private static class ControllerStateWrapper
+ {
+ final ControllerState state;
+ volatile int index;
+ volatile ControllerStateWrapper before;
+ volatile ControllerStateWrapper after;
+
+ ControllerStateWrapper(ControllerState state)
+ {
+ this.state = state;
+ }
+
+ public ControllerStateWrapper(ControllerState state, int index, ControllerStateWrapper before, ControllerStateWrapper after)
+ {
+ this(state);
+ this.index = index;
+ this.before = before;
+ this.after = after;
+ }
+
+ int getIndex()
+ {
+ return index;
+ }
+
+ void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ void incrementIndex()
+ {
+ this.index++;
+ }
+
+ ControllerStateWrapper getBefore()
+ {
+ return before;
+ }
+
+ void setBefore(ControllerStateWrapper before)
+ {
+ this.before = before;
+ }
+
+ ControllerStateWrapper getAfter()
+ {
+ return after;
+ }
+
+ void setAfter(ControllerStateWrapper after)
+ {
+ this.after = after;
+ }
+
+ ControllerState getState()
+ {
+ return state;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ControllerStateWrapper:state=" + state + "; index=" + index + "; before=" + itemAsString(before) + "; after=" + itemAsString(after);
+ }
+
+ String itemAsString(ControllerStateWrapper item)
+ {
+ if (item == null)
+ return "null";
+ return item.getState().toString();
+ }
+ }
+}
+
Modified: projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/spi/ControllerStateModel.java
===================================================================
--- projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/spi/ControllerStateModel.java 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/dependency/src/main/java/org/jboss/dependency/spi/ControllerStateModel.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -32,6 +32,23 @@
public interface ControllerStateModel extends Iterable<ControllerState>
{
/**
+ * Add a state to the model
+ *
+ * @param state The state to add
+ * @param before The exisiting state to add this state before
+ * @return true if the state was added, false if the state already existed and therefore was not added
+ * @throws IllegalArgumentException if the before state did not exist
+ */
+ boolean addState(ControllerState state, ControllerState before);
+
+ /**
+ * Returns the first state in the state model
+ *
+ * @return the first state or null if the state model is empty
+ */
+ ControllerState getInitialState();
+
+ /**
* Get the list iterator.
*
* The list iterator cursor should be
@@ -83,4 +100,12 @@
* @return true if state is after reference
*/
boolean isAfterState(ControllerState state, ControllerState reference);
+
+ /**
+ * Checks if a state is valid
+ *
+ * @param state the state we are checking
+ * @return true if the state is valid
+ */
+ boolean isValidState(ControllerState state);
}
Added: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerReportingTestCase.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerReportingTestCase.java (rev 0)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerReportingTestCase.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -0,0 +1,111 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.dependency.controller.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.dependency.controller.support.TestDelegate;
+
+/**
+ * A BasicDependencyTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 60558 $
+ */
+public class ControllerReportingTestCase extends AbstractDependencyTest
+{
+ ControllerState postInstall = new ControllerState("POST_INSTALL");
+
+ ControllerState[] states = new ControllerState[]{ControllerState.NOT_INSTALLED,
+ ControllerState.PRE_INSTALL,
+ ControllerState.DESCRIBED,
+ ControllerState.INSTANTIATED,
+ ControllerState.CONFIGURED,
+ ControllerState.CREATE,
+ ControllerState.START,
+ ControllerState.INSTALLED,
+ postInstall};
+
+ public static Test suite()
+ {
+ return suite(ControllerReportingTestCase.class);
+ }
+
+ public ControllerReportingTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testReportingMethods() throws Throwable
+ {
+ controller.addState(postInstall, null);
+
+ ControllerContext context = assertInstall(getTestDelegate());
+
+ for (int i = states.length - 1 ; i >= 0 ; i--)
+ {
+ changeStateAndCheck(context, states[i]);
+ }
+
+ }
+
+ private void changeStateAndCheck(ControllerContext context, ControllerState expected) throws Throwable
+ {
+ System.out.println("State " + expected);
+ controller.change(context, expected);
+ assertContext(context, expected);
+
+ if (expected.equals(ControllerState.INSTALLED) || expected.equals(postInstall))
+ {
+ assertFalse(controller.getNotInstalled().contains(context));
+ assertEquals(context, controller.getInstalledContext(context.getName()));
+ }
+ else
+ {
+ assertTrue(expected.toString(), controller.getNotInstalled().contains(context));
+ assertNull(expected.toString(), controller.getInstalledContext(context.getName()));
+ }
+
+ for (int i = 0 ; i < states.length ; i++)
+ {
+ Set<ControllerContext> found = controller.getContextsByState(states[i]);
+ if (expected.equals(states[i]))
+ {
+ assertEquals(expected.toString(), 1, found.size());
+ assertTrue(expected.toString(), found.contains(context));
+ }
+ else
+ {
+ assertEquals(expected.toString(), 0, found.size());
+ }
+ }
+ }
+
+ protected TestDelegate getTestDelegate()
+ {
+ return new TestDelegate("Name1");
+ }
+}
Modified: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerStateModelTestCase.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerStateModelTestCase.java 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerStateModelTestCase.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -22,15 +22,12 @@
package org.jboss.test.dependency.controller.test;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.concurrent.CopyOnWriteArrayList;
import junit.framework.Test;
+import org.jboss.dependency.plugins.ListControllerStateModel;
+import org.jboss.dependency.plugins.MapControllerStateModel;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.dependency.spi.ControllerStateModel;
@@ -57,27 +54,37 @@
{
super(name);
}
-
+ public void testMapControllerStateModel() throws Exception
+ {
+ runControllerStateModelTest(ControllerStateModelFactory.MAP);
+ }
public void testExistingControllerStateModel() throws Exception
{
runControllerStateModelTest(ControllerStateModelFactory.EXISITING);
}
- public void testMapControllerStateModel() throws Exception
- {
- runControllerStateModelTest(ControllerStateModelFactory.MAP);
- }
-
private void runControllerStateModelTest(ControllerStateModelFactory factory)
{
- ControllerStateModelAdapter model = factory.createControllerStateModel();
+ ControllerStateModel model = factory.createControllerStateModel();
+ try
+ {
+ model.getInitialState();
+ fail("No initial state");
+ }
+ catch(Exception expected)
+ {
+ }
model.addState(ControllerState.DESCRIBED, null);
- model.addState(ControllerState.INSTANTIATED, null);
+ assertEquals(ControllerState.DESCRIBED, model.getInitialState());
+
model.addState(ControllerState.CONFIGURED, null);
+ assertEquals(ControllerState.DESCRIBED, model.getInitialState());
+
model.addState(ControllerState.INSTALLED, null);
+ assertEquals(ControllerState.DESCRIBED, model.getInitialState());
try
{
model.addState(ControllerState.START, ControllerState.NOT_INSTALLED);
@@ -87,8 +94,12 @@
{
}
model.addState(ControllerState.PRE_INSTALL, ControllerState.DESCRIBED);
+ assertEquals(ControllerState.PRE_INSTALL, model.getInitialState());
+ model.addState(ControllerState.INSTANTIATED, ControllerState.CONFIGURED);
+ assertEquals(ControllerState.PRE_INSTALL, model.getInitialState());
+
assertEquals(ControllerState.DESCRIBED, model.getNextState(ControllerState.PRE_INSTALL));
assertEquals(ControllerState.INSTANTIATED, model.getNextState(ControllerState.DESCRIBED));
assertEquals(ControllerState.CONFIGURED, model.getNextState(ControllerState.INSTANTIATED));
@@ -196,21 +207,21 @@
}
- public void testBenchmarkExistingControllerStateModel() throws Throwable
- {
- benchmarkControllerStateModel(ControllerStateModelFactory.EXISITING);
- }
-
public void testBenchmarkMapControllerStateModel() throws Throwable
{
benchmarkControllerStateModel(ControllerStateModelFactory.MAP);
}
+ public void testBenchmarkExistingControllerStateModel() throws Throwable
+ {
+ benchmarkControllerStateModel(ControllerStateModelFactory.EXISITING);
+ }
+
public void benchmarkControllerStateModel(ControllerStateModelFactory factory) throws Throwable
{
int counter = 0;
- ControllerStateModelAdapter model = factory.createControllerStateModel();
+ ControllerStateModel model = factory.createControllerStateModel();
ControllerState[] states = new ControllerState[NUM_STATES];
for (int i = 0 ; i < NUM_STATES ; i++)
@@ -299,13 +310,13 @@
private interface ControllerStateModelFactory
{
- ControllerStateModelAdapter createControllerStateModel();
+ ControllerStateModel createControllerStateModel();
ControllerStateModelFactory EXISITING = new ControllerStateModelFactory()
{
- public ControllerStateModelAdapter createControllerStateModel()
+ public ControllerStateModel createControllerStateModel()
{
- return new ExistingControllerStateModel();
+ return new ListControllerStateModel();
}
@Override
@@ -317,7 +328,7 @@
ControllerStateModelFactory MAP = new ControllerStateModelFactory()
{
- public ControllerStateModelAdapter createControllerStateModel()
+ public ControllerStateModel createControllerStateModel()
{
return new MapControllerStateModel();
}
@@ -330,290 +341,4 @@
};
}
-
- private abstract static class ControllerStateModelAdapter implements ControllerStateModel
- {
- public abstract void addState(ControllerState state, ControllerState before);
- }
-
- private static class ExistingControllerStateModel extends ControllerStateModelAdapter
- {
- /** The states in order List<ControllerState> */
- private List<ControllerState> states = new CopyOnWriteArrayList<ControllerState>();
-
- public void addState(ControllerState state, ControllerState before)
- {
- if (states.contains(state))
- return;
-
- if (before == null)
- {
- states.add(state);
- }
- else
- {
- states.add(getStateIndex(before), state);
- }
- }
-
- protected int getStateIndex(ControllerState state)
- {
- return getStateIndex(state, false);
- }
-
- protected int getStateIndex(ControllerState state, boolean allowNotFound)
- {
- if (state == null)
- throw new IllegalArgumentException("Null state");
-
- int stateIndex = states.indexOf(state);
- if (stateIndex < 0 && allowNotFound == false)
- throw new IllegalArgumentException("No such state " + state + " in states " + states);
-
- return stateIndex;
- }
-
- protected ControllerState getState(int index)
- {
- if (index < 0 || index >= states.size())
- return null;
- else
- return states.get(index);
- }
-
- public ControllerState getPreviousState(ControllerState state)
- {
- return getState(getStateIndex(state) - 1);
- }
-
- public ControllerState getNextState(ControllerState state)
- {
- return getState(getStateIndex(state) + 1);
- }
-
- public boolean isBeforeState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex < referenceIndex;
- }
-
- public boolean isAfterState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex > referenceIndex;
- }
-
- public Iterator<ControllerState> iterator()
- {
- return states.iterator();
- }
-
- public ListIterator<ControllerState> listIteraror()
- {
- return states.listIterator(states.size() - 1);
- }
- }
-
-
- private static class MapControllerStateModel extends ControllerStateModelAdapter
- {
- ControllerStateWrapper first;
- ControllerStateWrapper last;
- private Map<ControllerState, ControllerStateWrapper> states = new HashMap<ControllerState, ControllerStateWrapper>();
-
- public void addState(ControllerState state, ControllerState before)
- {
- if (states.containsKey(state))
- return;
-
- if (before == null)
- {
- ControllerStateWrapper newState = new ControllerStateWrapper(state);
- ControllerStateWrapper previous = last;
- if (previous != null)
- {
- newState.setIndex(previous.getIndex() + 1);
- previous.setAfter(newState);
- newState.setBefore(previous);
- }
- else
- {
- newState.setIndex(0);
- }
- last = newState;
- states.put(state, newState);
- }
- else
- {
- ControllerStateWrapper next = getState(before);
- if (next == null)
- throw new IllegalArgumentException("No such state " + state + " in states " + states);
-
- ControllerStateWrapper newState = new ControllerStateWrapper(state);
- newState.setIndex(next.getIndex());
- newState.setAfter(next);
- newState.setBefore(next.getBefore());
- next.setBefore(newState);
- if (newState.getBefore() == null)
- first = newState;
-
- while (next != null)
- {
- next.incrementIndex();
- next = next.getAfter();
- }
-
- states.put(state, newState);
- }
- }
-
-
- protected ControllerStateWrapper getState(ControllerState state)
- {
- return getState(state, false);
- }
-
- protected ControllerStateWrapper getState(ControllerState state, boolean allowNotFound)
- {
- if (state == null)
- throw new IllegalArgumentException("Null state");
-
- ControllerStateWrapper found = states.get(state);
- if (found == null && !allowNotFound)
- throw new IllegalArgumentException("No such state " + state + " in states " + states);
-
- return found;
- }
-
- protected int getStateIndex(ControllerState state)
- {
- return getStateIndex(state, false);
- }
-
- protected int getStateIndex(ControllerState state, boolean allowNotFound)
- {
- ControllerStateWrapper stateWrapper = getState(state, allowNotFound);
- return stateWrapper == null ? -1 : stateWrapper.getIndex();
- }
-
- public ControllerState getPreviousState(ControllerState state)
- {
- ControllerStateWrapper previous = getState(state).getBefore();
- return previous == null ? null : previous.getState();
- }
-
- public ControllerState getNextState(ControllerState state)
- {
- ControllerStateWrapper next = getState(state).getAfter();
- return next == null ? null : next.getState();
- }
-
- public boolean isBeforeState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex < referenceIndex;
- }
-
- public boolean isAfterState(ControllerState state, ControllerState reference)
- {
- int stateIndex = getStateIndex(state, true);
- int referenceIndex = getStateIndex(reference, true);
- return stateIndex > referenceIndex;
- }
-
- public Iterator<ControllerState> iterator()
- {
- return new StateIterator(first);
- }
-
- public ListIterator<ControllerState> listIteraror()
- {
- return null;//states.listIterator(states.size() - 1);
- }
-
- private static class StateIterator implements Iterator<ControllerState>
- {
- ControllerStateWrapper current;
-
- public StateIterator(ControllerStateWrapper current)
- {
- this.current = current;
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException("Remove not allowed on ControllerStateModel");
- }
-
- public ControllerState next()
- {
- if (current == null)
- throw new NoSuchElementException();
- ControllerState state = current.getState();
- current = current.getAfter();
- return state;
- }
-
- public boolean hasNext()
- {
- return current != null;
- }
- }
-
- private static class ControllerStateWrapper
- {
- final ControllerState state;
- int index;
- ControllerStateWrapper before;
- ControllerStateWrapper after;
-
- public ControllerStateWrapper(ControllerState state)
- {
- this.state = state;
- }
-
- public int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public void incrementIndex()
- {
- this.index++;
- }
-
- public ControllerStateWrapper getBefore()
- {
- return before;
- }
-
- public void setBefore(ControllerStateWrapper before)
- {
- this.before = before;
- }
-
- public ControllerStateWrapper getAfter()
- {
- return after;
- }
-
- public void setAfter(ControllerStateWrapper after)
- {
- this.after = after;
- }
-
- public ControllerState getState()
- {
- return state;
- }
- }
- }
}
Modified: projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerTestSuite.java
===================================================================
--- projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerTestSuite.java 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/dependency/src/test/java/org/jboss/test/dependency/controller/test/ControllerTestSuite.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -65,6 +65,8 @@
suite.addTest(ShutdownControllerTestCase.suite());
suite.addTest(StateConsistencyUnitTestCase.suite());
suite.addTest(StatelessControllerTestCase.suite());
+ suite.addTest(ControllerReportingTestCase.suite());
+ suite.addTest(ControllerStateModelTestCase.suite());
return suite;
}
Modified: projects/kernel/trunk/kernel/.classpath
===================================================================
--- projects/kernel/trunk/kernel/.classpath 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/kernel/.classpath 2009-10-30 14:41:00 UTC (rev 95830)
@@ -1,32 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.0.3.CP01/byteman-1.0.3.CP01.jar"/>
- <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA-sources.jar"/>
- <classpathentry kind="src" path="/jboss-dependency"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.2.GA/jboss-mdr-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.2.GA/jboss-mdr-2.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.2-SNAPSHOT/jbossxb-2.0.2-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.2-SNAPSHOT/jbossxb-2.0.2-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-</classpath>
\ No newline at end of file
+ <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.0.3.CP01/byteman-1.0.3.CP01.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA-sources.jar"/>
+ <classpathentry kind="src" path="/jboss-dependency"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.2.GA/jboss-mdr-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.2.GA/jboss-mdr-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.2-SNAPSHOT/jbossxb-2.0.2-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.2-SNAPSHOT/jbossxb-2.0.2-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="eclipse-targer"/>
+</classpath>
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/AbstractKernelController.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/AbstractKernelController.java 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/AbstractKernelController.java 2009-10-30 14:41:00 UTC (rev 95830)
@@ -319,7 +319,7 @@
Set<KernelControllerContext> kccs = new HashSet<KernelControllerContext>();
for(KernelControllerContext context : contexts)
{
- if (isBeforeState(context.getState(), state) == false)
+ if (getStates().isBeforeState(context.getState(), state) == false)
kccs.add(context);
}
return Collections.unmodifiableSet(kccs);
Modified: projects/kernel/trunk/weld-int/.classpath
===================================================================
--- projects/kernel/trunk/weld-int/.classpath 2009-10-30 14:31:09 UTC (rev 95829)
+++ projects/kernel/trunk/weld-int/.classpath 2009-10-30 14:41:00 UTC (rev 95830)
@@ -25,7 +25,6 @@
<classpathentry kind="var" path="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar" sourcepath="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/glassfish/web/el-impl/2.1.2-b04/el-impl-2.1.2-b04.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/google/collections/google-collections/1.0-rc2/google-collections-1.0-rc2.jar" sourcepath="M2_REPO/com/google/collections/google-collections/1.0-rc2/google-collections-1.0-rc2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.4/htmlunit-2.4.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.4/htmlunit-2.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.4/htmlunit-core-js-2.4.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.4/htmlunit-core-js-2.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA-sources.jar"/>
@@ -57,11 +56,9 @@
<classpathentry kind="var" path="M2_REPO/xalan/serializer/2.7.1/serializer-2.7.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/slf4j/slf4j-jboss-logging/1.0.2.GA/slf4j-jboss-logging-1.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/slf4j/slf4j-jboss-logging/1.0.2.GA/slf4j-jboss-logging-1.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-api/1.0-SNAPSHOT/weld-api-1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/weld/weld-api/1.0-SNAPSHOT/weld-api-1.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-core/1.0.0-SNAPSHOT/weld-core-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/weld/weld-core/1.0.0-SNAPSHOT/weld-core-1.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-core/1.0.0-SNAPSHOT/weld-core-1.0.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-core-test/1.0.0-SNAPSHOT/weld-core-test-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/weld/weld-core-test/1.0.0-SNAPSHOT/weld-core-test-1.0.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-logging/1.0.0-SNAPSHOT/weld-logging-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/weld/weld-logging/1.0.0-SNAPSHOT/weld-logging-1.0.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-spi/1.0-SNAPSHOT/weld-spi-1.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/weld/weld-spi/1.0-SNAPSHOT/weld-spi-1.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/weld/weld-spi/1.0-SNAPSHOT/weld-spi-1.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar" sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar" sourcepath="M2_REPO/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1-sources.jar"/>
More information about the jboss-cvs-commits
mailing list