commit | a83c25a13bbd599e42344bbfea0f724f636ce595 | [log] [tgz] |
---|---|---|
author | Marcel Offermans <marrs@apache.org> | Tue Dec 22 13:38:38 2009 +0000 |
committer | Marcel Offermans <marrs@apache.org> | Tue Dec 22 13:38:38 2009 +0000 |
tree | fcbb59352dbf11ab07880d2fd870459979467e4f | |
parent | a66b9bf6af09b68bcde2138e90d37fdd769de150 [diff] |
added a method to specify a service dependency that is based only on a filter condition git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@893164 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java index 0539dcd..2e877e4 100644 --- a/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java +++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java
@@ -47,6 +47,16 @@ * @return this service dependency */ ServiceDependency setService(Class serviceName, String serviceFilter); + + /** + * Sets the filter for the services that should be tracked. Any service object + * matching the filter will be returned, without any additional filter on the + * class. + * + * @param serviceFilter the filter condition + * @return this service dependency + */ + ServiceDependency setService(String serviceFilter); /** * Sets the name of the service that should be tracked. You can either specify
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java index 3c25769..9eeff70 100644 --- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java +++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java
@@ -545,6 +545,20 @@ m_trackedServiceReference = null; return this; } + + public synchronized ServiceDependency setService(String serviceFilter) { + ensureNotActive(); + if (serviceFilter == null) { + throw new IllegalArgumentException("Service filter cannot be null."); + } + m_trackedServiceName = Object.class; + if (serviceFilter != null) { + m_trackedServiceFilterUnmodified = serviceFilter; + m_trackedServiceFilter = serviceFilter; + } + m_trackedServiceReference = null; + return this; + } /** * Sets the name of the service that should be tracked. You can either specify