felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r887402 - /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
Date Fri, 04 Dec 2009 22:40:06 GMT
Author: pderop
Date: Fri Dec  4 22:40:05 2009
New Revision: 887402

URL: http://svn.apache.org/viewvc?rev=887402&view=rev
Log:
renamed package to org.apache.felix.dm.impl; invoke start/stop methods on dependencies through
the DependancyActivation interface; reworked API in order to avoid exposing implementation
methods from end user interfaces

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java?rev=887402&r1=887401&r2=887402&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
Fri Dec  4 22:40:05 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dependencymanager.impl;
+package org.apache.felix.dm.impl;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -33,18 +33,19 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.felix.dependencymanager.Dependency;
-import org.apache.felix.dependencymanager.DependencyManager;
-import org.apache.felix.dependencymanager.DependencyService;
-import org.apache.felix.dependencymanager.Service;
-import org.apache.felix.dependencymanager.ServiceStateListener;
-import org.apache.felix.dependencymanager.dependencies.BundleDependency;
-import org.apache.felix.dependencymanager.dependencies.ConfigurationDependency;
-import org.apache.felix.dependencymanager.dependencies.ResourceDependency;
-import org.apache.felix.dependencymanager.dependencies.ServiceDependency;
-import org.apache.felix.dependencymanager.management.ServiceComponent;
-import org.apache.felix.dependencymanager.management.ServiceComponentDependency;
-import org.apache.felix.dependencymanager.resources.Resource;
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.dependencies.Dependency;
+import org.apache.felix.dm.impl.dependencies.BundleDependencyImpl;
+import org.apache.felix.dm.impl.dependencies.ConfigurationDependencyImpl;
+import org.apache.felix.dm.impl.dependencies.DependencyActivation;
+import org.apache.felix.dm.impl.dependencies.DependencyService;
+import org.apache.felix.dm.impl.dependencies.ResourceDependencyImpl;
+import org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl;
+import org.apache.felix.dm.management.ServiceComponent;
+import org.apache.felix.dm.management.ServiceComponentDependency;
+import org.apache.felix.dm.resources.Resource;
+import org.apache.felix.dm.service.Service;
+import org.apache.felix.dm.service.ServiceStateListener;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -235,7 +236,7 @@
             m_dependencies.add(dependency);
         }
         if (oldState.isAllRequiredAvailable() || (oldState.isWaitingForRequired() &&
dependency.isRequired())) {
-        	dependency.start(this);
+        	((DependencyActivation) dependency).start(this);
         }
         synchronized (m_dependencies) {
             newState = new State((List) m_dependencies.clone(), !oldState.isInactive(), m_isInstantiated,
m_isBound);
@@ -260,7 +261,7 @@
             m_dependencies.remove(dependency);
         }
         if (oldState.isAllRequiredAvailable() || (oldState.isWaitingForRequired() &&
dependency.isRequired())) {
-        	dependency.stop(this);
+        	((DependencyActivation) dependency).stop(this);
         }
         synchronized (m_dependencies) {
             newState = new State((List) m_dependencies.clone(), !oldState.isInactive(), m_isInstantiated,
m_isBound);
@@ -613,7 +614,7 @@
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
             if (!dependency.isRequired()) {
-                dependency.start(this);
+                ((DependencyActivation) dependency).start(this);
             }
         }
     }
@@ -623,7 +624,7 @@
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
             if (!dependency.isRequired()) {
-                dependency.stop(this);
+                ((DependencyActivation) dependency).stop(this);
             }
         }
     }
@@ -633,7 +634,7 @@
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
             if (dependency.isRequired()) {
-                dependency.start(this);
+                ((DependencyActivation) dependency).start(this);
             }
         }
     }
@@ -643,7 +644,7 @@
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
             if (dependency.isRequired()) {
-                dependency.stop(this);
+                ((DependencyActivation) dependency).stop(this);
             }
         }
     }
@@ -781,8 +782,8 @@
 		addTo(properties, m_serviceProperties);
 		for (int i = 0; i < m_dependencies.size(); i++) {
 			Dependency d = (Dependency) m_dependencies.get(i);
-			if (d instanceof ConfigurationDependency) {
-				ConfigurationDependency cd = (ConfigurationDependency) d;
+			if (d instanceof ConfigurationDependencyImpl) {
+				ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) d;
 				if (cd.isPropagated()) {
 					Dictionary dict = cd.getConfiguration();
 					addTo(properties, dict);
@@ -817,16 +818,16 @@
     }
 
     private void updateInstance(Dependency dependency) {
-        if (dependency instanceof ServiceDependency) {
-            ServiceDependency sd = (ServiceDependency) dependency;
+        if (dependency instanceof ServiceDependencyImpl) {
+            ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
             // update the dependency in the service instance (it will use
             // a null object if necessary)
             if (sd.isAutoConfig()) {
                 configureImplementation(sd.getInterface(), sd.getService(), sd.getAutoConfigName());
             }
         }
-        else if (dependency instanceof ConfigurationDependency) {
-        	ConfigurationDependency cd = (ConfigurationDependency) dependency;
+        else if (dependency instanceof ConfigurationDependencyImpl) {
+        	ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) dependency;
         	if (cd.isPropagated()) {
         		// change service properties accordingly, but only if the service was already registered
         	    if (m_registration != null) {
@@ -835,14 +836,14 @@
         	    }
         	}
         }
-        else if (dependency instanceof BundleDependency) {
-            BundleDependency bd = (BundleDependency) dependency;
+        else if (dependency instanceof BundleDependencyImpl) {
+            BundleDependencyImpl bd = (BundleDependencyImpl) dependency;
             if (bd.isAutoConfig()) {
                 configureImplementation(Bundle.class, bd.getBundle()); // TODO support AutoConfigName
             }
         }
-        else if (dependency instanceof ResourceDependency) {
-            ResourceDependency rd = (ResourceDependency) dependency;
+        else if (dependency instanceof ResourceDependencyImpl) {
+            ResourceDependencyImpl rd = (ResourceDependencyImpl) dependency;
             if (rd.isAutoConfig()) {
                 configureImplementation(Resource.class, rd.getResource()); // TODO support
AutoConfigName
             }
@@ -922,8 +923,8 @@
         Iterator i = state.getDependencies().iterator();
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
-            if (dependency instanceof ServiceDependency) {
-                ServiceDependency sd = (ServiceDependency) dependency;
+            if (dependency instanceof ServiceDependencyImpl) {
+                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
                 if (sd.isAutoConfig()) {
                     if (sd.isRequired()) {
                         configureImplementation(sd.getInterface(), sd.getService(), sd.getAutoConfigName());
@@ -939,8 +940,8 @@
                     sd.invokeAdded(this, sd.lookupServiceReference(), sd.lookupService());
                 }
             }
-            else if (dependency instanceof BundleDependency) {
-                BundleDependency bd = (BundleDependency) dependency;
+            else if (dependency instanceof BundleDependencyImpl) {
+                BundleDependencyImpl bd = (BundleDependencyImpl) dependency;
                 if (bd.isAutoConfig()) {
                     if (bd.isRequired()) {
                         configureImplementation(Bundle.class, bd.getBundle()); // TODO AutoConfigName
support
@@ -957,8 +958,8 @@
                     bd.invokeAdded(this, bd.getBundle());
                 }
             }
-            else if (dependency instanceof ResourceDependency) {
-                ResourceDependency bd = (ResourceDependency) dependency;
+            else if (dependency instanceof ResourceDependencyImpl) {
+                ResourceDependencyImpl bd = (ResourceDependencyImpl) dependency;
                 if (bd.isAutoConfig()) {
                     if (bd.isRequired()) {
                         configureImplementation(Resource.class, bd.getResource()); // TODO
AutoConfigName support
@@ -975,8 +976,8 @@
                     bd.invokeAdded(this, bd.getResource());
                 }
             }
-            else if (dependency instanceof ConfigurationDependency) {
-                ConfigurationDependency cd = (ConfigurationDependency) dependency;
+            else if (dependency instanceof ConfigurationDependencyImpl) {
+                ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) dependency;
                 // for configuration dependencies, we invoke updated
                 try {
                     cd.invokeUpdate(this, this.getService(), cd.getConfiguration());
@@ -995,8 +996,8 @@
         Iterator i = state.getDependencies().iterator();
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
-            if (dependency instanceof ServiceDependency) {
-                ServiceDependency sd = (ServiceDependency) dependency;
+            if (dependency instanceof ServiceDependencyImpl) {
+                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
                 // for required dependencies, we invoke any callbacks here
                 if (sd.isRequired()) {
                     sd.invokeRemoved(this, sd.lookupServiceReference(), sd.lookupService());



Mime
View raw message