felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1575414 - /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java
Date Fri, 07 Mar 2014 21:34:18 GMT
Author: pderop
Date: Fri Mar  7 21:34:17 2014
New Revision: 1575414

URL: http://svn.apache.org/r1575414
Log:
added isInstantiated()

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java?rev=1575414&r1=1575413&r2=1575414&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/ComponentImpl.java Fri
Mar  7 21:34:17 2014
@@ -21,6 +21,7 @@ import org.osgi.framework.ServiceRegistr
 
 import dm.Component;
 import dm.ComponentState;
+import static dm.ComponentState.*;
 import dm.ComponentStateListener;
 import dm.Dependency;
 import dm.DependencyManager;
@@ -239,33 +240,33 @@ public class ComponentImpl implements Co
 
 	/** Based on the current state, calculate the new state. */
 	private ComponentState calculateNewState(ComponentState currentState) {
-		if (currentState == ComponentState.INACTIVE) {
+		if (currentState == INACTIVE) {
 			if (m_isStarted) {
-				return ComponentState.WAITING_FOR_REQUIRED;
+				return WAITING_FOR_REQUIRED;
 			}
 		}
-		if (currentState == ComponentState.WAITING_FOR_REQUIRED) {
+		if (currentState == WAITING_FOR_REQUIRED) {
 			if (!m_isStarted) {
-				return ComponentState.INACTIVE;
+				return INACTIVE;
 			}
 			if (allRequiredAvailable()) {
-				return ComponentState.INSTANTIATED_AND_WAITING_FOR_REQUIRED;
+				return INSTANTIATED_AND_WAITING_FOR_REQUIRED;
 			}
 		}
-		if (currentState == ComponentState.INSTANTIATED_AND_WAITING_FOR_REQUIRED) {
+		if (currentState == INSTANTIATED_AND_WAITING_FOR_REQUIRED) {
 			if (m_isStarted && allRequiredAvailable()) {
 				if (allInstanceBoundAvailable()) {
-					return ComponentState.TRACKING_OPTIONAL;
+					return TRACKING_OPTIONAL;
 				}
 				return currentState;
 			}
-			return ComponentState.WAITING_FOR_REQUIRED;
+			return WAITING_FOR_REQUIRED;
 		}
-		if (currentState == ComponentState.TRACKING_OPTIONAL) {
+		if (currentState == TRACKING_OPTIONAL) {
 			if (m_isStarted && allRequiredAvailable() && allInstanceBoundAvailable())
{
 				return currentState;
 			}
-			return ComponentState.INSTANTIATED_AND_WAITING_FOR_REQUIRED;
+			return INSTANTIATED_AND_WAITING_FOR_REQUIRED;
 		}
 		return currentState;
 	}
@@ -619,7 +620,11 @@ public class ComponentImpl implements Co
 	}
 
 	public boolean isAvailable() {
-		return m_state == ComponentState.TRACKING_OPTIONAL;
+		return m_state == TRACKING_OPTIONAL;
+	}
+	
+	public boolean isInstantiated() {
+	    return m_state == TRACKING_OPTIONAL || m_state == INSTANTIATED_AND_WAITING_FOR_REQUIRED;
 	}
 
 	@Override



Mime
View raw message