Big refactoring, renamed "Service" to "Component" whenever it was referring to the thing that has dependencies and registers itself as a service.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@994967 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Activator.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Activator.java
index a3b2cf2..d973497 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Activator.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Activator.java
@@ -42,7 +42,7 @@
// and we'll eventually use a Null LogService Object.
boolean logActive = "true".equals(context.getProperty("dm.runtime.log"));
- dm.add(createService()
+ dm.add(createComponent()
.setImplementation(DependencyManagerRuntime.class)
.add(createServiceDependency()
.setService(LogService.class)
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
index ef85a85..60cd31b 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
/**
@@ -48,7 +48,7 @@
Dictionary<String, Object> adapterProperties = srvMeta.getDictionary(Params.properties, null);
Class<?> adapteeService = b.loadClass(srvMeta.getString(Params.adapteeService));
String adapteeFilter = srvMeta.getString(Params.adapteeFilter, null);
- Service service = dm.createAdapterService(adapteeService, adapteeFilter);
+ Component service = dm.createAdapterService(adapteeService, adapteeFilter);
service.setInterface(provides, adapterProperties);
String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
index de90fd9..752b8a6 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;
@@ -52,7 +52,7 @@
Object implClass = b.loadClass(implClassName);
String field = srvMeta.getString(Params.field, null);
String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
- Service service = dm.createAspectService(serviceInterface, serviceFilter, ranking, field)
+ Component service = dm.createAspectService(serviceInterface, serviceFilter, ranking, field)
.setServiceProperties(aspectProperties);
if (factoryMethod == null)
{
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
index 5b247ab..b914426 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
public class BundleAdapterServiceBuilder extends ServiceComponentBuilder
@@ -45,7 +45,7 @@
String[] provides = srvMeta.getStrings(Params.provides, null);
Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
- Service srv = dm.createBundleAdapterService(stateMask, filter, propagate);
+ Component srv = dm.createBundleAdapterService(stateMask, filter, propagate);
srv.setInterface(provides, properties);
String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
if (factoryMethod == null)
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DependencyManagerRuntime.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DependencyManagerRuntime.java
index e83a1aa..e363e9d 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DependencyManagerRuntime.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DependencyManagerRuntime.java
@@ -27,7 +27,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
@@ -88,8 +88,8 @@
for (DependencyManager dm: m_managers.values())
{
- List<Service> services = new ArrayList<Service>(dm.getServices());
- for (Service service: services)
+ List<Component> services = new ArrayList<Component>(dm.getServices());
+ for (Component service: services)
{
dm.remove(service);
}
@@ -159,8 +159,8 @@
DependencyManager dm = m_managers.remove(b);
if (dm != null)
{
- List<Service> services = new ArrayList(dm.getServices());
- for (Service service : services)
+ List<Component> services = new ArrayList(dm.getServices());
+ for (Component service : services)
{
m_log.log(LogService.LOG_INFO, "Runtime: Removing service: " + service);
dm.remove(service);
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
index 34a380f..8528214 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
public class FactoryConfigurationAdapterServiceBuilder extends ServiceComponentBuilder
@@ -45,7 +45,7 @@
String[] provides = srvMeta.getStrings(Params.provides, null);
Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
- Service srv = dm.createFactoryConfigurationAdapterService(factoryPid, updated, propagate);
+ Component srv = dm.createFactoryConfigurationAdapterService(factoryPid, updated, propagate);
srv.setInterface(provides, properties);
String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
if (factoryMethod == null)
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactorySet.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactorySet.java
index 12e8059..bcf5b8b 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactorySet.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactorySet.java
@@ -29,7 +29,7 @@
import org.apache.felix.dm.Dependency;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;
@@ -341,7 +341,7 @@
try
{
// Create the Service / impl
- Service s = m_dm.createService();
+ Component s = m_dm.createComponent();
Class implClass = m_bundle.loadClass(m_srvMeta.getString(Params.impl));
String factoryMethod = m_srvMeta.getString(Params.factoryMethod, null);
if (factoryMethod == null)
@@ -418,7 +418,7 @@
if (m_provide != null)
{
Dictionary settings = mergeSettings(m_serviceProperties, configuration);
- ((Service) service).setServiceProperties(settings);
+ ((Component) service).setServiceProperties(settings);
}
}
}
@@ -430,7 +430,7 @@
Object service = m_services.remove(serviceKey);
if (service != null && service != SERVICE_CREATING)
{
- m_dm.remove((Service) service);
+ m_dm.remove((Component) service);
}
}
@@ -440,9 +440,9 @@
{
for (Object service: m_services.values())
{
- if (service instanceof Service)
+ if (service instanceof Component)
{
- m_dm.remove((Service) service);
+ m_dm.remove((Component) service);
}
}
}
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
index 5d2da3c..acac992 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
public class ResourceAdapterServiceBuilder extends ServiceComponentBuilder
@@ -45,7 +45,7 @@
Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
String changed = srvMeta.getString(Params.changed, null /* no change callback if not specified explicitly */);
- Service srv = dm.createResourceAdapterService(filter, propagate, null, changed);
+ Component srv = dm.createResourceAdapterService(filter, propagate, null, changed);
srv.setInterface(provides, properties);
String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
if (factoryMethod == null)
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceBuilder.java
index 066356b..95f04c5 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceBuilder.java
@@ -24,7 +24,7 @@
import java.util.Set;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;
@@ -43,7 +43,7 @@
public void buildService(MetaData srvMeta, List<MetaData> depsMeta, Bundle b, DependencyManager dm)
throws Exception
{
- Service service = dm.createService();
+ Component service = dm.createComponent();
String factory = srvMeta.getString(Params.factorySet, null);
// Check if we must provide a Set Factory.
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceComponentBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceComponentBuilder.java
index 18b75e8..fb99b7a 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceComponentBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceComponentBuilder.java
@@ -24,7 +24,7 @@
import org.apache.felix.dm.Dependency;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -51,7 +51,7 @@
/**
* Set common Service parameters, if provided from our Component descriptor
*/
- protected void setCommonServiceParams(Service service, MetaData serviceMetaData)
+ protected void setCommonServiceParams(Component service, MetaData serviceMetaData)
throws Exception
{
String init = serviceMetaData.getString(Params.init, null);
@@ -71,7 +71,7 @@
* handled differently, and are managed by the ServiceLifecycleHandler class.
* @throws Exception
*/
- protected static void addUnamedDependencies(Bundle b, DependencyManager dm, Service s,
+ protected static void addUnamedDependencies(Bundle b, DependencyManager dm, Component s,
MetaData srvMeta, List<MetaData> depsMeta)
throws Exception
{
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java
index acc7813..2b22bdd 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java
@@ -36,7 +36,7 @@
import org.apache.felix.dm.Dependency;
import org.apache.felix.dm.DependencyManager;
import org.apache.felix.dm.ResourceDependency;
-import org.apache.felix.dm.Service;
+import org.apache.felix.dm.Component;
import org.apache.felix.dm.ServiceDependency;
import org.apache.felix.dm.TemporalServiceDependency;
import org.osgi.framework.Bundle;
@@ -118,7 +118,7 @@
* @param srvMeta The Service MetaData
* @param depMeta The Dependencies MetaData
*/
- public ServiceLifecycleHandler(Service srv, Bundle srvBundle, DependencyManager dm,
+ public ServiceLifecycleHandler(Component srv, Bundle srvBundle, DependencyManager dm,
MetaData srvMeta, List<MetaData> depMeta)
{
m_srvMeta = srvMeta;
@@ -138,7 +138,7 @@
* @param service The Annotated Service
*/
@SuppressWarnings("unchecked")
- public void init(Service service)
+ public void init(Component service)
throws Exception
{
Object serviceInstance = service.getService();
@@ -225,7 +225,7 @@
* Such extra properties takes precedence over existing service properties.
*/
@SuppressWarnings("unchecked")
- public void start(Service service)
+ public void start(Component service)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
// Check if some extra service properties are returned by start method.
@@ -288,7 +288,7 @@
* Handles the Service's stop lifecycle callback. We just invoke the service "stop" callback on
* the service instance, as well as on all eventual service composites.
*/
- public void stop(Service service)
+ public void stop(Component service)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
callbackComposites(service, m_stop);
@@ -298,7 +298,7 @@
* Handles the Service's destroy lifecycle callback. We just invoke the service "destroy" callback on
* the service instance, as well as on all eventual service composites.
*/
- public void destroy(Service service)
+ public void destroy(Component service)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
callbackComposites(service, m_destroy);
@@ -307,7 +307,7 @@
/**
* Invoke a callback on all Service compositions.
*/
- private void callbackComposites(Service service, String callback)
+ private void callbackComposites(Component service, String callback)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
Object serviceInstance = service.getService();
@@ -321,7 +321,7 @@
/**
* Invoke a callback on an Object instance.
*/
- private Object invokeMethod(Object serviceInstance, String method, DependencyManager dm, Service service)
+ private Object invokeMethod(Object serviceInstance, String method, DependencyManager dm, Component service)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
if (method != null)
@@ -330,7 +330,7 @@
{
return InvocationUtil.invokeCallbackMethod(
serviceInstance, method,
- new Class[][] { { Service.class }, {} },
+ new Class[][] { { Component.class }, {} },
new Object[][] { { service }, {} }
);
}