FELIX-3550 : Reimplement the SCR Generator

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1349822 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SCRAnnotationProcessor.java
similarity index 96%
rename from scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java
rename to scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SCRAnnotationProcessor.java
index 4cf9678..271d284 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SCRAnnotationProcessor.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin;
+package org.apache.felix.scrplugin.processing;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Modifier;
@@ -34,6 +34,14 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.felix.scr.annotations.Services;
+import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.SCRDescriptorFailureException;
+import org.apache.felix.scrplugin.annotations.AnnotationProcessor;
+import org.apache.felix.scrplugin.annotations.ClassAnnotation;
+import org.apache.felix.scrplugin.annotations.FieldAnnotation;
+import org.apache.felix.scrplugin.annotations.MethodAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedClass;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentConfigurationPolicy;
 import org.apache.felix.scrplugin.description.ComponentDescription;
@@ -47,11 +55,6 @@
 import org.apache.felix.scrplugin.description.ReferenceStrategy;
 import org.apache.felix.scrplugin.description.ServiceDescription;
 import org.apache.felix.scrplugin.description.SpecVersion;
-import org.apache.felix.scrplugin.scanner.ClassAnnotation;
-import org.apache.felix.scrplugin.scanner.FieldAnnotation;
-import org.apache.felix.scrplugin.scanner.MethodAnnotation;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
-import org.apache.felix.scrplugin.scanner.ScannedClass;
 
 /**
  * This is the processor for the Apache Felix SCR annotations.
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
similarity index 95%
rename from scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java
rename to scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
index 19c08af..7a760bd 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
@@ -16,21 +16,24 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin;
+package org.apache.felix.scrplugin.processing;
 
 import java.util.List;
 
 import org.apache.felix.scr.annotations.sling.SlingFilter;
 import org.apache.felix.scr.annotations.sling.SlingFilterScope;
 import org.apache.felix.scr.annotations.sling.SlingServlet;
+import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.SCRDescriptorFailureException;
+import org.apache.felix.scrplugin.annotations.AnnotationProcessor;
+import org.apache.felix.scrplugin.annotations.ClassAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedClass;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentConfigurationPolicy;
 import org.apache.felix.scrplugin.description.ComponentDescription;
 import org.apache.felix.scrplugin.description.PropertyDescription;
 import org.apache.felix.scrplugin.description.PropertyType;
 import org.apache.felix.scrplugin.description.ServiceDescription;
-import org.apache.felix.scrplugin.scanner.ClassAnnotation;
-import org.apache.felix.scrplugin.scanner.ScannedClass;
 
 /**
  * This is the processor for the Apache Felix Sling annotations.
diff --git a/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.AnnotationProcessor b/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.AnnotationProcessor
deleted file mode 100644
index ab7e308..0000000
--- a/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.AnnotationProcessor
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.felix.scrplugin.SCRAnnotationProcessor
-org.apache.felix.scrplugin.SlingAnnotationProcessor
diff --git a/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.annotations.AnnotationProcessor b/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.annotations.AnnotationProcessor
new file mode 100644
index 0000000..03d6402
--- /dev/null
+++ b/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.annotations.AnnotationProcessor
@@ -0,0 +1,2 @@
+org.apache.felix.scrplugin.processing.SCRAnnotationProcessor
+org.apache.felix.scrplugin.processing.SlingAnnotationProcessor
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Options.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Options.java
index bc5e041..d282e93 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Options.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Options.java
@@ -23,7 +23,9 @@
 
 import org.apache.felix.scrplugin.description.SpecVersion;
 
-
+/**
+ * Options for the {@link SCRDescriptorGenerator}
+ */
 public class Options {
 
     private boolean generateAccessors = true;
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Project.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Project.java
index 91e4658..fba1fb0 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Project.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Project.java
@@ -21,8 +21,10 @@
 import java.io.File;
 import java.util.Collection;
 
-import org.apache.felix.scrplugin.scanner.Source;
 
+/**
+ * Project description for the {@link SCRDescriptorGenerator}
+ */
 public class Project {
 
     private Collection<Source> sources;
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Result.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Result.java
index 5ebe459..f38a4f9 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Result.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Result.java
@@ -22,7 +22,7 @@
 
 
 /**
- * The result of the generation.
+ * The result of the {@link SCRDescriptorGenerator}.
  */
 public class Result {
 
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
index 83d5d45..2642a2e 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.felix.scrplugin.annotations.AnnotationProcessor;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentDescription;
 import org.apache.felix.scrplugin.description.PropertyDescription;
@@ -43,7 +44,6 @@
 import org.apache.felix.scrplugin.om.Component;
 import org.apache.felix.scrplugin.om.Components;
 import org.apache.felix.scrplugin.om.Context;
-import org.apache.felix.scrplugin.om.Implementation;
 import org.apache.felix.scrplugin.om.Interface;
 import org.apache.felix.scrplugin.om.Property;
 import org.apache.felix.scrplugin.om.Reference;
@@ -411,10 +411,6 @@
             ocd = null;
         }
 
-        // Create implementation object
-        final Implementation impl = new Implementation(desc.getDescribedClass().getName());
-        comp.setImplementation(impl);
-
         final Map<String, Reference> allReferences = new HashMap<String, Reference>();
         final Map<String, Property> allProperties = new HashMap<String, Property>();
 
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/Source.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Source.java
similarity index 96%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/Source.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Source.java
index 166b55c..afa2d32 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/Source.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/Source.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin;
 
 import java.io.File;
 
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/AnnotationProcessor.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/AnnotationProcessor.java
similarity index 78%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/AnnotationProcessor.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/AnnotationProcessor.java
index 376df37..90a67dd 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/AnnotationProcessor.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/AnnotationProcessor.java
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin;
+package org.apache.felix.scrplugin.annotations;
 
+import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.SCRDescriptorFailureException;
 import org.apache.felix.scrplugin.description.ClassDescription;
-import org.apache.felix.scrplugin.scanner.ScannedClass;
 
 /**
  * This service provides a plugin for annotation processing. Custom tags
@@ -30,13 +31,15 @@
 public interface AnnotationProcessor {
 
     /**
-     * Processes annotations from the provided list and adds objects
-     * to the object model based on the read annotations.
+     * Processes annotations from the provided scanned class and adds
+     * descriptions to the object model based on the read annotations.
+     *
      * If this service processes an annotation, it should remove this
      * annotation from the provided list to avoid duplicate processing
-     * by other processors.
+     * by other processors (with higher ranking)
+     *
      * @param scannedClass The scanned class.
-     * @param describedClass The descriptions.
+     * @param describedClass The description container.
      */
     void process(final ScannedClass scannedClass,
             final ClassDescription describedClass)
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ClassAnnotation.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ClassAnnotation.java
similarity index 90%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ClassAnnotation.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ClassAnnotation.java
index 176db6a..1658211 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ClassAnnotation.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ClassAnnotation.java
@@ -16,12 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin.annotations;
 
 import java.util.Map;
 
+/**
+ * A class annotation
+ */
 public class ClassAnnotation extends ScannedAnnotation {
 
+    /**
+     * Constructor.
+     */
     public ClassAnnotation(final String name, final Map<String, Object> values) {
         super(name, values);
     }
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/FieldAnnotation.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/FieldAnnotation.java
similarity index 84%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/FieldAnnotation.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/FieldAnnotation.java
index 79c7b87..a256529 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/FieldAnnotation.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/FieldAnnotation.java
@@ -16,30 +16,45 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin.annotations;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.Map;
 
-import org.apache.felix.scrplugin.SCRDescriptorException;
 import org.apache.felix.scrplugin.SCRDescriptorFailureException;
 
+/**
+ * A field annotation
+ */
 public class FieldAnnotation extends ScannedAnnotation {
 
+    /**
+     * Corresponding field in the class.
+     */
     private final Field annotatedField;
 
+    /**
+     * Constructor.
+     */
     public FieldAnnotation(final String name, final Map<String, Object> values, final Field f) {
         super(name, values);
         this.annotatedField = f;
     }
 
+    /**
+     * Get the annotated field.
+     */
     public Field getAnnotatedField() {
         return this.annotatedField;
     }
 
+    /**
+     * Get the initial value of the value if this is a static field.
+     * @throws SCRDescriptorFailureException
+     */
     public Object getAnnotatedFieldValue()
-    throws SCRDescriptorFailureException, SCRDescriptorException {
+    throws SCRDescriptorFailureException {
         if ( Modifier.isStatic(annotatedField.getModifiers()) ) {
             try {
                 final Object value = annotatedField.get(null);
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/MethodAnnotation.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/MethodAnnotation.java
similarity index 87%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/MethodAnnotation.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/MethodAnnotation.java
index 5f25a13..f555421 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/MethodAnnotation.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/MethodAnnotation.java
@@ -16,20 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin.annotations;
 
 import java.lang.reflect.Method;
 import java.util.Map;
 
+/**
+ * A method annotation
+ */
 public class MethodAnnotation extends ScannedAnnotation {
 
+    /** The annotated method. */
     private final Method method;
 
+    /**
+     * Constructor
+     */
     public MethodAnnotation(final String name, final Map<String, Object> values, final Method m) {
         super(name, values);
         this.method = m;
     }
 
+    /**
+     * Get the annotated method.
+     */
     public Method getAnnotatedMethod() {
         return this.method;
     }
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedAnnotation.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedAnnotation.java
similarity index 71%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedAnnotation.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedAnnotation.java
index 72ac56e..1a0c495 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedAnnotation.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedAnnotation.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin.annotations;
 
 import java.util.Map;
 
@@ -50,6 +50,14 @@
     }
 
     /**
+     * Get the simple name of the annotation
+     */
+    public String getSimpleName() {
+        final int pos = name.lastIndexOf('.');
+        return name.substring(pos + 1);
+    }
+
+    /**
      * Get a property value of the annotation.
      * @param paramName The property name.
      * @return The value of the property or <code>null</code>
@@ -61,6 +69,12 @@
         return null;
     }
 
+    /**
+     * Get a boolean value of the annotation
+     * @param name The property name
+     * @param defaultValue A default value if the property is not set
+     * @return The property value or the default value.
+     */
     public boolean getBooleanValue(final String name, final boolean defaultValue) {
         final Object val = this.getValue(name);
         if ( val != null ) {
@@ -69,6 +83,12 @@
         return defaultValue;
     }
 
+    /**
+     * Get an integer value of the annotation
+     * @param name The property name
+     * @param defaultValue A default value if the property is not set
+     * @return The property value or the default value.
+     */
     public int getIntegerValue(final String name, final int defaultValue) {
         final Object val = this.getValue(name);
         if ( val != null ) {
@@ -77,6 +97,12 @@
         return defaultValue;
     }
 
+    /**
+     * Get a long value of the annotation
+     * @param name The property name
+     * @param defaultValue A default value if the property is not set
+     * @return The property value or the default value.
+     */
     public long getLongValue(final String name, final long defaultValue) {
         final Object val = this.getValue(name);
         if ( val != null ) {
@@ -85,6 +111,12 @@
         return defaultValue;
     }
 
+    /**
+     * Get a string value of the annotation
+     * @param name The property name
+     * @param defaultValue A default value if the property is not set
+     * @return The property value or the default value.
+     */
     public String getStringValue(final String name, final String defaultValue) {
         final Object val = this.getValue(name);
         if ( val != null && val.toString().trim().length() > 0 ) {
@@ -93,6 +125,12 @@
         return defaultValue;
     }
 
+    /**
+     * Get an enumeration value of the annotation
+     * @param name The property name
+     * @param defaultValue A default value if the property is not set
+     * @return The property value or the default value.
+     */
     public String getEnumValue(final String name, final String defaultValue) {
         final Object val = this.getValue(name);
         if ( val != null ) {
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedClass.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedClass.java
similarity index 72%
rename from scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedClass.java
rename to scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedClass.java
index 93f1b1b..f201d9c 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/scanner/ScannedClass.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/annotations/ScannedClass.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.scrplugin.scanner;
+package org.apache.felix.scrplugin.annotations;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -34,6 +34,11 @@
     /** The scanned class. */
     private final Class<?> scannedClass;
 
+    /**
+     * Constructor
+     * @param desc List of found annotations.
+     * @param scannedClass The scanned class.
+     */
     public ScannedClass(final List<ScannedAnnotation> desc, final Class<?> scannedClass) {
         this.descriptions.addAll(desc);
         this.scannedClass = scannedClass;
@@ -47,14 +52,30 @@
         return this.scannedClass;
     }
 
+    /**
+     * Mark an annotation as processed.
+     * A processed annotation will be removed from the list of annotations.
+     * @param desc The annotation.
+     */
     public void processed(final ScannedAnnotation desc) {
         this.descriptions.remove(desc);
     }
 
+    /**
+     * Mark several annotations as processed.
+     * A processed annotation will be removed from the list of annotations.
+     * @param desc The annotation.
+     */
     public void processed(final Collection<? extends ScannedAnnotation> desc) {
         this.descriptions.removeAll(desc);
     }
 
+    /**
+     * Get all class annotations
+     * @param name The name of the class annotation or <code>null</code>
+     * for all class annotations.
+     * @return A list of matching annotations or an empty list.
+     */
     public List<ClassAnnotation> getClassAnnotations(final String name) {
         final List<ClassAnnotation> list = new ArrayList<ClassAnnotation>();
         for(final ScannedAnnotation desc : descriptions ) {
@@ -67,6 +88,12 @@
         return list;
     }
 
+    /**
+     * Get all field annotations
+     * @param name The name of the field annotation or <code>null</code>
+     * for all field annotations.
+     * @return A list of matching annotations or an empty list.
+     */
     public List<FieldAnnotation> getFieldAnnotations(final String name) {
         final List<FieldAnnotation> list = new ArrayList<FieldAnnotation>();
         for(final ScannedAnnotation desc : descriptions ) {
@@ -79,6 +106,12 @@
         return list;
     }
 
+    /**
+     * Get all method annotations
+     * @param name The name of the method annotation or <code>null</code>
+     * for all method annotations.
+     * @return A list of matching annotations or an empty list.
+     */
     public List<MethodAnnotation> getMethodAnnotations(final String name) {
         final List<MethodAnnotation> list = new ArrayList<MethodAnnotation>();
         for(final ScannedAnnotation desc : descriptions ) {
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
index 7854d20..b275ff9 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
@@ -18,7 +18,7 @@
  */
 package org.apache.felix.scrplugin.description;
 
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 
 /**
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
index b7a67a8..0a5dcea 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
@@ -18,7 +18,7 @@
  */
 package org.apache.felix.scrplugin.description;
 
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 /**
  * <code>ComponentDescription</code> is a described component.
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
index 9b6ecee..e9bacb0 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
@@ -20,7 +20,7 @@
 
 import java.util.Arrays;
 
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 
 /**
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
index b11e7de..03d8b09 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
@@ -20,7 +20,7 @@
 
 import java.lang.reflect.Field;
 
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 /**
  * A <code>ReferenceDescription</code> describes a reference
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
index 7ee3647..21d0576 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
@@ -21,7 +21,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 /**
  * If a component is a service, the {@link ClassDescription} should
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/AnnotationProcessorManager.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/AnnotationProcessorManager.java
index 2e1c74e..d2cfa75 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/AnnotationProcessorManager.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/AnnotationProcessorManager.java
@@ -29,11 +29,11 @@
 
 import javax.imageio.spi.ServiceRegistry;
 
-import org.apache.felix.scrplugin.AnnotationProcessor;
 import org.apache.felix.scrplugin.SCRDescriptorException;
 import org.apache.felix.scrplugin.SCRDescriptorFailureException;
+import org.apache.felix.scrplugin.annotations.AnnotationProcessor;
+import org.apache.felix.scrplugin.annotations.ScannedClass;
 import org.apache.felix.scrplugin.description.ClassDescription;
-import org.apache.felix.scrplugin.scanner.ScannedClass;
 
 
 /**
@@ -88,7 +88,7 @@
     }
 
     /**
-     * @see org.apache.felix.scrplugin.AnnotationProcessor#process(org.apache.felix.scrplugin.scanner.ScannedClass, org.apache.felix.scrplugin.description.ClassDescription)
+     * @see org.apache.felix.scrplugin.annotations.AnnotationProcessor#process(org.apache.felix.scrplugin.annotations.ScannedClass, org.apache.felix.scrplugin.description.ClassDescription)
      */
     public void process(final ScannedClass scannedClass,
             final ClassDescription describedClass)
@@ -99,7 +99,7 @@
     }
 
     /**
-     * @see org.apache.felix.scrplugin.AnnotationProcessor#getRanking()
+     * @see org.apache.felix.scrplugin.annotations.AnnotationProcessor#getRanking()
      */
     public int getRanking() {
         return 0;
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
index fb62805..50f21f8 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
@@ -41,19 +41,19 @@
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
-import org.apache.felix.scrplugin.AnnotationProcessor;
 import org.apache.felix.scrplugin.Log;
 import org.apache.felix.scrplugin.Project;
 import org.apache.felix.scrplugin.SCRDescriptorException;
 import org.apache.felix.scrplugin.SCRDescriptorFailureException;
+import org.apache.felix.scrplugin.Source;
+import org.apache.felix.scrplugin.annotations.AnnotationProcessor;
+import org.apache.felix.scrplugin.annotations.ClassAnnotation;
+import org.apache.felix.scrplugin.annotations.FieldAnnotation;
+import org.apache.felix.scrplugin.annotations.MethodAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedClass;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentDescription;
-import org.apache.felix.scrplugin.scanner.ClassAnnotation;
-import org.apache.felix.scrplugin.scanner.FieldAnnotation;
-import org.apache.felix.scrplugin.scanner.MethodAnnotation;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
-import org.apache.felix.scrplugin.scanner.ScannedClass;
-import org.apache.felix.scrplugin.scanner.Source;
 import org.apache.felix.scrplugin.xml.ComponentDescriptorIO;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.Type;
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/AbstractObject.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/AbstractObject.java
index 9f7d05c..bc8fa38 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/AbstractObject.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/AbstractObject.java
@@ -18,28 +18,32 @@
  */
 package org.apache.felix.scrplugin.om;
 
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 import org.apache.felix.scrplugin.helper.IssueLog;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
 
 /**
  * The <code>AbstractObject</code> is the base class for the all classes of the scr om.
  */
 public abstract class AbstractObject {
 
-    private final String annotationName;
+    private final String annotationPrefix;
 
     private final String sourceLocation;
 
     protected AbstractObject(final ScannedAnnotation annotation, final String sourceLocation) {
-        this.annotationName = (annotation != null ? annotation.getName() : "<unknown>");
+        if ( annotation == null ) {
+            this.annotationPrefix = "";
+        } else {
+            this.annotationPrefix = "@" + annotation.getSimpleName()  + " : ";
+        }
         this.sourceLocation = sourceLocation;
     }
 
     protected void logWarn(IssueLog iLog, String message) {
-        iLog.addWarning("@" + this.annotationName + ": " + message, sourceLocation);
+        iLog.addWarning(this.annotationPrefix + message, sourceLocation);
     }
 
     protected void logError(IssueLog iLog, String message) {
-        iLog.addError("@" + this.annotationName + ": " + message, sourceLocation);
+        iLog.addError(this.annotationPrefix + message, sourceLocation);
     }
 }
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Component.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Component.java
index 2c18d80..909a3f1 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Component.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Component.java
@@ -25,10 +25,10 @@
 import java.util.List;
 
 import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentConfigurationPolicy;
 import org.apache.felix.scrplugin.description.SpecVersion;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
 
 /**
  * <code>Component</code> is a described component.
@@ -48,9 +48,6 @@
     /** The factory. */
     protected String factory;
 
-    /** The implementation. */
-    protected Implementation implementation;
-
     /** All properties. */
     protected List<Property> properties = new ArrayList<Property>();
 
@@ -160,14 +157,6 @@
         this.immediate = immediate;
     }
 
-    public Implementation getImplementation() {
-        return this.implementation;
-    }
-
-    public void setImplementation(Implementation implementation) {
-        this.implementation = implementation;
-    }
-
     public Service getService() {
         return this.service;
     }
@@ -521,7 +510,7 @@
                         + (activate != null ? ", activate=" + activate : "")
                         + (deactivate != null ? ", deactivate=" + deactivate : "")
                         + (modified != null ? ", modified=" + modified : "") + ", specVersion=" + specVersion
-                        + ", implementation=" + implementation + ", service=" + service + ", properties=" + properties
+                        + ", service=" + service + ", properties=" + properties
                         + ", references=" + references + ")";
     }
 }
\ No newline at end of file
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Implementation.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Implementation.java
deleted file mode 100644
index bcbe387..0000000
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Implementation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.scrplugin.om;
-
-/**
- * <code>Implementation</code>
- * 
- * contains the class name implementing the component.
- */
-public class Implementation {
-
-    /** The class name. */
-    private final String className;
-
-    public Implementation(final String name) {
-        this.className = name;
-    }
-
-    public String getClassName() {
-        return this.className;
-    }
-}
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Interface.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Interface.java
index d53d80f..4fba368 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Interface.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Interface.java
@@ -19,7 +19,7 @@
 package org.apache.felix.scrplugin.om;
 
 import org.apache.felix.scrplugin.SCRDescriptorException;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 
 /**
  * <code>Interface</code>
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Property.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Property.java
index a26c5a4..022fead 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Property.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Property.java
@@ -18,9 +18,9 @@
  */
 package org.apache.felix.scrplugin.om;
 
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 import org.apache.felix.scrplugin.description.PropertyType;
 import org.apache.felix.scrplugin.description.SpecVersion;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
 
 /**
  * <code>Property.java</code>...
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
index 4cff9a4..3f175a6 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
@@ -24,12 +24,12 @@
 import java.util.Map;
 
 import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.annotations.ScannedAnnotation;
 import org.apache.felix.scrplugin.description.ReferenceCardinality;
 import org.apache.felix.scrplugin.description.ReferencePolicy;
 import org.apache.felix.scrplugin.description.ReferenceStrategy;
 import org.apache.felix.scrplugin.description.SpecVersion;
 import org.apache.felix.scrplugin.helper.StringUtils;
-import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
 
 /**
  * <code>Reference.java</code>...
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
index 32d6db5..33d1c97 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
@@ -43,7 +43,6 @@
 import org.apache.felix.scrplugin.helper.IssueLog;
 import org.apache.felix.scrplugin.om.Component;
 import org.apache.felix.scrplugin.om.Components;
-import org.apache.felix.scrplugin.om.Implementation;
 import org.apache.felix.scrplugin.om.Interface;
 import org.apache.felix.scrplugin.om.Property;
 import org.apache.felix.scrplugin.om.Reference;
@@ -226,7 +225,7 @@
         IOUtils.indent(contentHandler, 1);
         contentHandler.startElement(namespace, ComponentDescriptorIO.COMPONENT, ComponentDescriptorIO.COMPONENT_QNAME, ai);
         IOUtils.newline(contentHandler);
-        generateXML(component.getImplementation(), contentHandler);
+        generateImplementationXML(component, contentHandler);
         if (component.getService() != null) {
             generateXML(component.getService(), contentHandler);
         }
@@ -252,9 +251,9 @@
      * @param contentHandler
      * @throws SAXException
      */
-    protected static void generateXML(Implementation implementation, ContentHandler contentHandler) throws SAXException {
+    protected static void generateImplementationXML(Component component, ContentHandler contentHandler) throws SAXException {
         final AttributesImpl ai = new AttributesImpl();
-        IOUtils.addAttribute(ai, "class", implementation.getClassName());
+        IOUtils.addAttribute(ai, "class", component.getClassDescription().getDescribedClass().getName());
         IOUtils.indent(contentHandler, 2);
         contentHandler.startElement(INNER_NAMESPACE_URI, ComponentDescriptorIO.IMPLEMENTATION,
                         ComponentDescriptorIO.IMPLEMENTATION_QNAME, ai);
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
index 3d8b1f6..6c45835 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
@@ -26,8 +26,8 @@
 import java.util.List;
 
 import org.apache.felix.scrplugin.Log;
+import org.apache.felix.scrplugin.Source;
 import org.apache.felix.scrplugin.helper.StringUtils;
-import org.apache.felix.scrplugin.scanner.Source;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.DirectoryScanner;
diff --git a/scrplugin/scrtask/src/main/java/org/apache/felix/scrplugin/ant/SCRDescriptorTask.java b/scrplugin/scrtask/src/main/java/org/apache/felix/scrplugin/ant/SCRDescriptorTask.java
index 194c475..ea301d0 100644
--- a/scrplugin/scrtask/src/main/java/org/apache/felix/scrplugin/ant/SCRDescriptorTask.java
+++ b/scrplugin/scrtask/src/main/java/org/apache/felix/scrplugin/ant/SCRDescriptorTask.java
@@ -25,8 +25,8 @@
 import org.apache.felix.scrplugin.SCRDescriptorException;
 import org.apache.felix.scrplugin.SCRDescriptorFailureException;
 import org.apache.felix.scrplugin.SCRDescriptorGenerator;
+import org.apache.felix.scrplugin.Source;
 import org.apache.felix.scrplugin.description.SpecVersion;
-import org.apache.felix.scrplugin.scanner.Source;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Location;
 import org.apache.tools.ant.Project;