Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBJ Hargrave2017-01-13 18:53:47 +0000
committerThomas Watson2017-06-16 12:38:08 +0000
commitc1ecdc3a36ce9346772eb2f51f5317257eaab41d (patch)
treeada03c90d24d6fd4e0430bef749a3a0782bae84c /bundles/org.eclipse.osgi/osgi/src/org
parentde784fbaff9c43ad3d05aa77c72c8ced459b0596 (diff)
downloadrt.equinox.framework-c1ecdc3a36ce9346772eb2f51f5317257eaab41d.tar.gz
rt.equinox.framework-c1ecdc3a36ce9346772eb2f51f5317257eaab41d.tar.xz
rt.equinox.framework-c1ecdc3a36ce9346772eb2f51f5317257eaab41d.zip
service registry: Add new ServiceReference.getProperties() method
OSGi added a new getProperties() method to ServiceReference so that a copy of the service’s properties can be obtained.
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi/src/org')
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
index d561e9049..a5717304f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
@@ -181,4 +181,34 @@ public interface ServiceReference<S> extends Comparable<Object> {
*/
@Override
public int compareTo(Object reference);
+
+ /**
+ * Returns a copy of the properties of the service referenced by this
+ * {@code ServiceReference} object.
+ * <p>
+ * This method will continue to return the properties after the service has
+ * been unregistered. This is so references to unregistered services (for
+ * example, {@code ServiceReference} objects stored in the log) can still be
+ * interrogated.
+ * <p>
+ * The returned {@code Dictionary} object:
+ * <ul>
+ * <li>Must map property values by using property keys in a
+ * <i>case-insensitive manner</i>.</li>
+ * <li>Must return property keys is a <i>case-preserving</i> manner. This
+ * means that the keys must have the same case as the corresponding key in
+ * the properties {@code Dictionary} that was passed to the
+ * {@link BundleContext#registerService(String[],Object,Dictionary)} or
+ * {@link ServiceRegistration#setProperties(Dictionary)} methods.</li>
+ * <li>Is the property of the caller and can be modified by the caller but
+ * any changes are not reflected in the properties of the service.
+ * {@link ServiceRegistration#setProperties(Dictionary)} must be called to
+ * modify the properties of the service.</li>
+ * </ul>
+ *
+ * @return A copy of the properties of the service referenced by this
+ * {@code ServiceReference} object
+ * @since 1.9
+ */
+ public Dictionary<String,Object> getProperties();
}

Back to the top