You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2011/01/27 22:52:12 UTC

svn commit: r1064323 - in /felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation: api/ plugin/bnd/ plugin/mvn/

Author: pderop
Date: Thu Jan 27 21:52:11 2011
New Revision: 1064323

URL: http://svn.apache.org/viewvc?rev=1064323&view=rev
Log:
Fixed javadoc. Cleaned imports.

Modified:
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Composition.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/DescriptorGenerator.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/mvn/AnnotationMojo.java

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java Thu Jan 27 21:52:11 2011
@@ -23,13 +23,37 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-
 /**
  * Annotates an Adapater Service. The adapter will be applied to any service that
  * matches the implemented interface and filter. The adapter will be registered 
  * with the specified interface and existing properties from the original service 
  * plus any extra properties you supply here. It will also inherit all dependencies, 
  * and if you declare the original service as a member it will be injected.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the AdapterService is registered into the OSGI registry each time an AdapteeService
+ * is found from the registry. The AdapterImpl class adapts the AdapteeService to the AdapterService.
+ * The AdapterService will also have a service property (param=value), and will also include eventual
+ * service properties found from the AdapteeService:<p>
+ * <blockquote>
+ * <pre>
+ * 
+ * &#64;AdapterService(adapteeService = AdapteeService.class, 
+ *                 properties={&#64;Property(name="param", value="value")})
+ * class AdapterImpl implements AdapterService
+ * {
+ *     // The service we are adapting (injected by reflection)
+ *     protected AdapteeService adaptee;
+ *   
+ *     public void doWork()
+ *     {
+ *        adaptee.mehod1();
+ *        adaptee.method2();
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
  */
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.TYPE)

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java Thu Jan 27 21:52:11 2011
@@ -28,7 +28,32 @@ import java.lang.annotation.Target;
  * matches the specified interface and filter. The aspect will be registered 
  * with the same interface and properties as the original service, plus any 
  * extra properties you supply here. It will also inherit all dependencies, 
- * and if you can declare the original service as a member it will be injected.
+ * and if you can declare the original service as a member it will be injected.<p>
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the AspectService is registered into the OSGI registry each time an InterceptedService
+ * is found from the registry. The AspectService class intercepts the InterceptedService, and decorates
+ * its "doWork()" method. This aspect uses a rank with value "10", meaning that it will intercept some
+ * other eventual aspects with lower ranks. The Aspect also uses a service property (param=value), and 
+ * include eventual service properties found from the InterceptedService:<p>
+ * <blockquote>
+ * <pre>
+ * 
+ * &#64;AspectService(ranking=10), 
+ *                properties={&#64;Property(name="param", value="value")})
+ * class AspectService implements InterceptedService
+ * {
+ *     // The service we are intercepting (injected by reflection)
+ *     protected InterceptedService intercepted;
+ *   
+ *     public void doWork()
+ *     {
+ *        intercepted.doWork();
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
  */
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.TYPE)
@@ -63,7 +88,7 @@ public @interface AspectService
     String field() default "";
     
     /**
-     * Sets the static method used to create the AspectService implementation instance. By default, the
+     * Sets the static method used to create the AspectService implementation instance. The
      * default constructor of the annotated class is used. The factoryMethod can be used to provide a specific
      * aspect implements, like a DynamicProxy.
      */

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java Thu Jan 27 21:52:11 2011
@@ -60,7 +60,7 @@ public @Retention(RetentionPolicy.CLASS)
     int stateMask() default Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE;
     
     /**
-     * Specifies if manifest headers from the bundle should be propagated to the service.
+     * Specifies if manifest headers from the bundle should be propagated to the service properties.
      */
     boolean propagate() default true;
     

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Composition.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Composition.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Composition.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Composition.java Thu Jan 27 21:52:11 2011
@@ -25,7 +25,45 @@ import java.lang.annotation.Target;
 
 /**
  * Annotates a method returning the list of objects which are part of the Service implementation.
- * Each instances will be injected with Service dependencies.
+ * Each instances will be injected with Service dependencies (attributes or callbacks), and if the 
+ * service has some annotated lifecycle callbacks (@Init/@Start/@Stop/@Destroy), then the same callbacks
+ * will be invoked on the objects which are part of the composition.<p>
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the "MyComponent" component is composed of the Helper class, which is also injected with 
+ * service dependencies. The lifecycle callbacks are also invoked in the Helper (if the Helper defines 
+ * them):<p>
+ * <blockquote>
+ * <pre>
+ *
+ * class Helper {
+ *     LogService logService; // Injected
+ *     void start() {} // lifecycle callback
+ *     void bind(OtherService otherService) {} // injected
+ * }
+ * 
+ * &#64;Component
+ * class MyComponent {
+ *     // Helper which will also be injected with our service dependencies
+ *     private Helper helper = new Helper();
+ *      
+ *     &#64;Composition
+ *     Object[] getComposition() {
+ *         return new Object[] { this, helper }; 
+ *     }
+ *
+ *     &#64;ServiceDependency
+ *     private LogService logService; // Helper.logService will be also be injected, if defined.
+ *     
+ *     &#64;Start
+ *     void start() {} // the Helper.start() method will also be called, if defined
+ *     
+ *     &#64;ServiceDependency
+ *     void bind(OtherService otherService) {} // the Helper.bind() method will also be called, if defined     
+ * }
+ * </pre>
+ * </blockquote>
  */
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.METHOD)

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java Thu Jan 27 21:52:11 2011
@@ -31,6 +31,7 @@ import org.apache.felix.dm.annotation.ap
 import org.apache.felix.dm.annotation.api.AspectService;
 import org.apache.felix.dm.annotation.api.BundleAdapterService;
 import org.apache.felix.dm.annotation.api.BundleDependency;
+import org.apache.felix.dm.annotation.api.Component;
 import org.apache.felix.dm.annotation.api.Composition;
 import org.apache.felix.dm.annotation.api.ConfigurationDependency;
 import org.apache.felix.dm.annotation.api.Destroy;
@@ -39,7 +40,6 @@ import org.apache.felix.dm.annotation.ap
 import org.apache.felix.dm.annotation.api.LifecycleController;
 import org.apache.felix.dm.annotation.api.ResourceAdapterService;
 import org.apache.felix.dm.annotation.api.ResourceDependency;
-import org.apache.felix.dm.annotation.api.Component;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
 import org.apache.felix.dm.annotation.api.Stop;

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/DescriptorGenerator.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/DescriptorGenerator.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/DescriptorGenerator.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/DescriptorGenerator.java Thu Jan 27 21:52:11 2011
@@ -27,8 +27,6 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.felix.dm.annotation.api.Component;
-
 import aQute.lib.osgi.Analyzer;
 import aQute.lib.osgi.Clazz;
 import aQute.lib.osgi.EmbeddedResource;

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/mvn/AnnotationMojo.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/mvn/AnnotationMojo.java?rev=1064323&r1=1064322&r2=1064323&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/mvn/AnnotationMojo.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/mvn/AnnotationMojo.java Thu Jan 27 21:52:11 2011
@@ -19,7 +19,6 @@
 package org.apache.felix.dm.annotation.plugin.mvn;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;