changeset 1365:bfe135192880

Consumers should not implement a Service Reviewed-by: neugens, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-November/008830.html
author Omair Majid <omajid@redhat.com>
date Mon, 25 Nov 2013 18:59:50 -0500
parents de7fe0a6a382
children ad1f6b074c0c
files annotations/src/main/java/com/redhat/thermostat/annotations/ExtensionPoint.java annotations/src/main/java/com/redhat/thermostat/annotations/Service.java
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/annotations/src/main/java/com/redhat/thermostat/annotations/ExtensionPoint.java	Mon Nov 25 15:44:21 2013 -0500
+++ b/annotations/src/main/java/com/redhat/thermostat/annotations/ExtensionPoint.java	Mon Nov 25 18:59:50 2013 -0500
@@ -49,6 +49,8 @@
  * {@link BundleContext#registerService}.
  * <p>
  * This is the whiteboard pattern.
+ *
+ * @see Service
  */
 @Documented
 @Retention(RetentionPolicy.SOURCE)
--- a/annotations/src/main/java/com/redhat/thermostat/annotations/Service.java	Mon Nov 25 15:44:21 2013 -0500
+++ b/annotations/src/main/java/com/redhat/thermostat/annotations/Service.java	Mon Nov 25 18:59:50 2013 -0500
@@ -48,8 +48,19 @@
  * {@link BundleContext#getService(ServiceReference)} or
  * {@link OSGIUtils#getService(Class)}.
  * <p>
+ * The annotation is meant for service providers that wish to export a new
+ * service via OSGi and not consumers, hence consumers must not mark their
+ * classes or interfaces as {@code @Service}, nor directly extend the classes or
+ * implement the interfaces marked as @Service. Only the bundle(s) that
+ * publishes the service interface/class should do that.
+ * <p>
+ * Consumers wanting to extend functionality should make use of
+ * {@code @ExtensionPoint}s instead.
+ * <p>
  * This does not infer any behaviour on a class; this is for documentation
  * purposes only.
+ *
+ * @see ExtensionPoint
  */
 @Documented
 @Retention(RetentionPolicy.SOURCE)