Fix issue Felix-834.
Provides annotations for the whiteboard, extender and event admin handlers.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@720508 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
index 9410430..fdd3ba2 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/CustomAnnotationVisitor.java
@@ -34,7 +34,7 @@
     //TODO manage enum annotations.

     

     /**

-     * PArent element.

+     * Parent element.

      */

     private Element m_elem;

 

@@ -54,22 +54,29 @@
      * Is the custom annotation a first-order annotation.

      */

     private boolean m_root;

+    

+    /**

+     * Is the visit annotation a class annotation?

+     */

+    private boolean m_classAnnotation;

 

     /**

-     * MEtadata collector.

+     * Metadata collector.

      */

     private MetadataCollector m_collector;

     

     /**

      * Constructor.

-     * @param elem : parent element

-     * @param collector : metadata collector

-     * @param root : is the annotation a root

+     * @param elem the parent element

+     * @param collector the metadata collector

+     * @param root is the annotation a root

+     * @param clazz the annotation is a class annotation.

      */

-    public CustomAnnotationVisitor(Element elem, MetadataCollector collector, boolean root) {

+    public CustomAnnotationVisitor(Element elem, MetadataCollector collector, boolean root, boolean clazz) {

         m_elem = elem;

         m_root = root;

         m_collector = collector;

+        m_classAnnotation = clazz;

     }

     

     /**

@@ -98,17 +105,7 @@
         String namespace = s.substring(0, index);

         return new Element(name, namespace);

     }

-    

-    /**

-     * Build the element object from the given descriptor.

-     * @param desc : annotation descriptor

-     * @return the package of the annotation

-     */

-    public static String getPackage(String desc) {

-        String s = (desc.replace('/', '.')).substring(1, desc.length() - 1);

-        int index = s.lastIndexOf('.');

-        return s.substring(0, index);

-    }

+

 

     /**

      * Visit a 'simple' annotation attribute.

@@ -155,7 +152,7 @@
         // Sub annotations are mapped to sub-elements

         Element elem = buildElement(arg1);

         m_elem.addElement(elem);

-        return new CustomAnnotationVisitor(elem, m_collector, false);

+        return new CustomAnnotationVisitor(elem, m_collector, false, false);

     }

 

     /**

@@ -189,7 +186,7 @@
             if (m_id != null) {

                 m_collector.getIds().put(m_id, m_elem);

             } else {

-                if (! m_collector.getIds().containsKey(m_elem.getNameSpace())) {

+                if (! m_collector.getIds().containsKey(m_elem.getNameSpace()) && m_classAnnotation) {

                     // If the namespace is not already used, add the annotation as the

                     // root element of this namespace.

                     m_collector.getIds().put(m_elem.getNameSpace(), m_elem);

@@ -257,7 +254,7 @@
             // Sub annotations are map to sub-elements

             Element elem = buildElement(arg1);

             m_elem.addElement(elem);

-            return new CustomAnnotationVisitor(elem, m_collector, false);

+            return new CustomAnnotationVisitor(elem, m_collector, false, false);

         }

 

         /**

diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
index bc9014c..a181605 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/FieldCollector.java
@@ -94,7 +94,7 @@
         if (CustomAnnotationVisitor.isCustomAnnotation(arg0)) {

             Element elem = CustomAnnotationVisitor.buildElement(arg0);

             elem.addAttribute(new Attribute("field", m_field)); // Add a field attribute

-            return new CustomAnnotationVisitor(elem, m_collector, true);

+            return new CustomAnnotationVisitor(elem, m_collector, true, false);

         }

         

         return null;

diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
index 11d0603..7874b9f 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
@@ -96,7 +96,7 @@
     
     /**
      * Visit class annotations.
-     * This method detects @component, @provides and @Element annotations.
+     * This method detects @component and @provides annotations.
      * @param desc : annotation descriptor.
      * @param visible : is the annotation visible at runtime.
      * @return the annotation visitor.
@@ -118,7 +118,7 @@
         
         if (CustomAnnotationVisitor.isCustomAnnotation(desc)) {
             Element elem = CustomAnnotationVisitor.buildElement(desc);
-            return new CustomAnnotationVisitor(elem, this, true);
+            return new CustomAnnotationVisitor(elem, this, true, true);
         }
         
         return null;
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
index 7d20d59..b139231 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
@@ -80,7 +80,7 @@
         if (CustomAnnotationVisitor.isCustomAnnotation(arg0)) {
             Element elem = CustomAnnotationVisitor.buildElement(arg0);
             elem.addAttribute(new Attribute("method", m_name));
-            return new CustomAnnotationVisitor(elem, m_collector, true);
+            return new CustomAnnotationVisitor(elem, m_collector, true, false);
         }
         
         return null;
diff --git a/ipojo/manipulator/src/main/resources/event-admin.xsd b/ipojo/manipulator/src/main/resources/event-admin.xsd
index 78406b3..b9c8271 100644
--- a/ipojo/manipulator/src/main/resources/event-admin.xsd
+++ b/ipojo/manipulator/src/main/resources/event-admin.xsd
@@ -16,8 +16,8 @@
 	specific language governing permissions and limitations
 	under the License.
 -->
-<xs:schema targetNamespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler"
-	xmlns="org.apache.felix.ipojo.handlers.event.EventAdminHandler"
+<xs:schema targetNamespace="org.apache.felix.ipojo.handlers.event"
+	xmlns="org.apache.felix.ipojo.handlers.event"
 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
 	elementFormDefault="qualified">	
 
diff --git a/ipojo/manipulator/src/main/resources/whiteboard-pattern.xsd b/ipojo/manipulator/src/main/resources/whiteboard-pattern.xsd
index 85aad08..f02afde 100644
--- a/ipojo/manipulator/src/main/resources/whiteboard-pattern.xsd
+++ b/ipojo/manipulator/src/main/resources/whiteboard-pattern.xsd
@@ -16,8 +16,8 @@
 	specific language governing permissions and limitations
 	under the License.
 -->
-<xs:schema targetNamespace="org.apache.felix.ipojo.white-board-pattern"
-	xmlns="org.apache.felix.ipojo.white-board-pattern"
+<xs:schema targetNamespace="org.apache.felix.ipojo.whiteboard"
+	xmlns="org.apache.felix.ipojo.whiteboard"
 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
 	elementFormDefault="qualified">
 	<xs:element name="wbp" type="WBPType"></xs:element>