added factory and factoryMethod attributes in AspectService annotation

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@918879 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
index ea8b242..5836e4f 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
@@ -62,4 +62,18 @@
      * @return the ranking of this aspect
      */
     int ranking();
+    
+    /**
+     * Returns the Class of the class which acts as a factory for this Service. The default method
+     * factory name is "create". If you need to invoke another method, then you can use the 
+     * <code>factoryMethod</code> attribute.
+     * @return the factory Class name.
+     */
+    Class<?> factory() default Object.class;
+
+    /**
+     * Returns the method name of the factory class which will create our Service instance.
+     * @return the factory method name.
+     */
+    String factoryMethod() default "";
 }
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
index 43f6f4a..db8754d 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
@@ -610,6 +610,12 @@
         // Register previously parsed Init/Start/Stop/Destroy/Composition annotations
         addInitStartStopDestroyCompositionParams(info);
         
+        // factory attribute
+        info.addClassParam(annotation, Params.factory, null);
+
+        // factoryMethod attribute
+        info.addParam(annotation, Params.factoryMethod, null);
+        
         // Parse service filter
         String filter = annotation.get(Params.filter.toString());
         if (filter != null) {