added comments
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@926396 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceConsumer.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceConsumer.java
index 9adf699..61f7a57 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceConsumer.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceConsumer.java
@@ -27,6 +27,9 @@
import org.apache.felix.dm.resources.Resource;
import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
+/**
+ * A Component which has a resource dependency.
+ */
@Service
public class ResourceConsumer
{
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceProvider.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceProvider.java
index 1d702aa..2976f1b 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceProvider.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ResourceProvider.java
@@ -34,8 +34,10 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
+/**
+ * Provides some simple resources.
+ */
@Service
public class ResourceProvider
{
@@ -63,10 +65,15 @@
};
} };
+ /**
+ * Handles a new Resource consumer
+ * @param serviceProperties
+ * @param handler
+ */
@ServiceDependency(removed = "remove", required=false)
- public void add(ServiceReference ref, ResourceHandler handler)
+ public void add(Map serviceProperties, ResourceHandler handler)
{
- String filterString = (String) ref.getProperty("filter");
+ String filterString = (String) serviceProperties.get("filter");
Filter filter;
try
{
@@ -90,7 +97,11 @@
}
}
- public void remove(ServiceReference ref, ResourceHandler handler)
+ /**
+ * Remove a Resource consumer.
+ * @param handler
+ */
+ public void remove(ResourceHandler handler)
{
Filter filter;
synchronized (m_handlers)
@@ -111,6 +122,10 @@
}
}
+ /**
+ * Our component is being destroyed: notify all our registered Resource consumers that we don't
+ * provide our Resources anymore.
+ */
@Destroy
public void destroy()
{
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceConsumer.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceConsumer.java
index 611d9fe..8d51610 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceConsumer.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceConsumer.java
@@ -23,6 +23,10 @@
import org.apache.felix.dm.annotation.api.Start;
import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
+/**
+ * A Component with a dependency over the ServiceInterface, which is actually provided
+ * by a ResourceAdapter.
+ */
@Service
public class ServiceConsumer
{
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceInterface.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceInterface.java
index 1d238da..4422aa0 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceInterface.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceInterface.java
@@ -18,6 +18,9 @@
*/
package org.apache.felix.dm.test.bundle.annotation.resource;
+/**
+ * A Service provided the ServiceProvider, which is a ResourceAdapter.
+ */
public interface ServiceInterface extends Runnable
{
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceProvider.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceProvider.java
index 4939414..ba1c68f 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceProvider.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/resource/ServiceProvider.java
@@ -26,6 +26,9 @@
import org.apache.felix.dm.resources.Resource;
import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
+/**
+ * Our ServiceInterface provider, which service is activated by a ResourceAdapter.
+ */
@ResourceAdapterService(
filter = "(&(path=/test)(name=test1.txt)(repository=TestRepository))",
properties = {@Property(name="foo", value="bar")},