A bunch of cosmetic fixes.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@702202 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java b/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
index f210976..d88bfde 100644
--- a/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
+++ b/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
@@ -1,154 +1,154 @@
-/* 

- * 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.ipojo.task;

-

-import java.io.File;

-

-import org.apache.felix.ipojo.manipulator.Pojoization;

-import org.apache.tools.ant.BuildException;

-import org.apache.tools.ant.Task;

-

-/**

- * iPOJO Ant Task. This Ant task manipulates an input bundle.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class IPojoTask extends Task {

-    

-    /** Metadata file. */

-    private File m_metadata;

-    

-    /** Input bundle. */

-    private File m_input;

-    

-    /** Output bundle. */

-    private File m_output;

-

-    /** Flag describing if we need to ignore annotation of not. */

-    private boolean m_ignoreAnnotations = false;

-    

-    /**

-     * Set the metadata file.

-     * @param meta : the metadata file.

-     */

-    public void setMetadata(File meta) {

-        m_metadata = meta;

-    }

-    

-    /**

-     * Set the input bundle.

-     * @param in : the input bundle

-     */

-    public void setInput(File in) {

-        m_input = in;

-    }

-    

-    /**

-     * Set the output bundle.

-     * @param out : the output bundle

-     */

-    public void setOutput(File out) {

-        m_output = out;

-    }

-    

-    /**

-     * Set if we need to ignore annotations or not.

-     * @param flag : true if we need to ignore annotations.

-     */

-    public void setIgnoreAnnotations(boolean flag) {

-        m_ignoreAnnotations = flag;

-    }

-    

-    /**

-     * Execute the Ant Task.

-     * @see org.apache.tools.ant.Task#execute()

-     */

-    public void execute() {

-        

-        if (m_input == null) {

-            throw new BuildException("No input bundle specified");

-        }

-        if (!m_input.exists()) {

-            throw new BuildException("The input bundle " + m_input.getAbsolutePath() + " does not exist");

-        }

-        

-        log("Input Bundle File : " + m_input.getAbsolutePath());

-        

-        // Get metadata file

-        if (m_metadata == null) {

-            m_metadata = new File("./metadata.xml");

-            if (!m_metadata.exists()) {

-             // Verify if annotations are ignored

-                if (m_ignoreAnnotations) {

-                    log("No metadata file found & ignore annotations : nothing to do");

-                    return;

-                } else {

-                    log("No metadata file found - try to use only annotations");

-                    m_metadata = null;

-                }

-            } else {

-                log("Metadata File : " + m_metadata.getAbsolutePath());

-            }

-        } else {

-            // Metadata file is specified, check existence

-            if (!m_metadata.exists()) {

-                throw new BuildException("No metadata file found - the file " + m_metadata.getAbsolutePath() + " does not exist");

-            } else {

-                log("Metadata File : " + m_metadata.getAbsolutePath());

-            }

-        }

-

-        log("Start bundle manipulation");

-        

-        if (m_output == null) {

-            m_output = new File("./_out.jar");

-        }

-        

-        if (m_output.exists()) {

-            boolean r = m_output.delete();

-            if (!r) { throw new BuildException("The file " + m_output.getAbsolutePath() + " cannot be deleted"); }

-        }

-        

-        Pojoization pojo = new Pojoization();

-        if (! m_ignoreAnnotations) {

-            pojo.setAnnotationProcessing();

-        }

-        pojo.pojoization(m_input, m_output, m_metadata);

-        for (int i = 0; i < pojo.getWarnings().size(); i++) {

-            log((String) pojo.getWarnings().get(i));

-        }

-        if (pojo.getErrors().size() > 0) { throw new BuildException((String) pojo.getErrors().get(0)); }

-        

-        String out;

-        if (m_output.getName().equals("_out.jar")) {

-            m_input.delete();

-            m_output.renameTo(m_input);

-            out = m_input.getAbsolutePath();

-        } else {

-            out = m_output.getAbsolutePath();

-        }

-        

-        log("Bundle manipulation - SUCCESS");

-        log("Output File : " + out);

-        

-    }

-    

-    

-

-}

-

+/* 
+ * 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.ipojo.task;
+
+import java.io.File;
+
+import org.apache.felix.ipojo.manipulator.Pojoization;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * iPOJO Ant Task. This Ant task manipulates an input bundle.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class IPojoTask extends Task {
+    
+    /** Metadata file. */
+    private File m_metadata;
+    
+    /** Input bundle. */
+    private File m_input;
+    
+    /** Output bundle. */
+    private File m_output;
+
+    /** Flag describing if we need to ignore annotation of not. */
+    private boolean m_ignoreAnnotations = false;
+    
+    /**
+     * Set the metadata file.
+     * @param meta : the metadata file.
+     */
+    public void setMetadata(File meta) {
+        m_metadata = meta;
+    }
+    
+    /**
+     * Set the input bundle.
+     * @param in : the input bundle
+     */
+    public void setInput(File in) {
+        m_input = in;
+    }
+    
+    /**
+     * Set the output bundle.
+     * @param out : the output bundle
+     */
+    public void setOutput(File out) {
+        m_output = out;
+    }
+    
+    /**
+     * Set if we need to ignore annotations or not.
+     * @param flag : true if we need to ignore annotations.
+     */
+    public void setIgnoreAnnotations(boolean flag) {
+        m_ignoreAnnotations = flag;
+    }
+    
+    /**
+     * Execute the Ant Task.
+     * @see org.apache.tools.ant.Task#execute()
+     */
+    public void execute() {
+        
+        if (m_input == null) {
+            throw new BuildException("No input bundle specified");
+        }
+        if (!m_input.exists()) {
+            throw new BuildException("The input bundle " + m_input.getAbsolutePath() + " does not exist");
+        }
+        
+        log("Input bundle file : " + m_input.getAbsolutePath());
+        
+        // Get metadata file
+        if (m_metadata == null) {
+            m_metadata = new File("./metadata.xml");
+            if (!m_metadata.exists()) {
+             // Verify if annotations are ignored
+                if (m_ignoreAnnotations) {
+                    log("No metadata file found & annotations ignored : nothing to do");
+                    return;
+                } else {
+                    log("No metadata file found - trying to use only annotations");
+                    m_metadata = null;
+                }
+            } else {
+                log("Metadata file : " + m_metadata.getAbsolutePath());
+            }
+        } else {
+            // Metadata file is specified, check existence
+            if (!m_metadata.exists()) {
+                throw new BuildException("No metadata file found - the file " + m_metadata.getAbsolutePath() + " does not exist");
+            } else {
+                log("Metadata file : " + m_metadata.getAbsolutePath());
+            }
+        }
+
+        log("Start bundle manipulation");
+        
+        if (m_output == null) {
+            m_output = new File("./_out.jar");
+        }
+        
+        if (m_output.exists()) {
+            boolean r = m_output.delete();
+            if (!r) { throw new BuildException("The file " + m_output.getAbsolutePath() + " cannot be deleted"); }
+        }
+        
+        Pojoization pojo = new Pojoization();
+        if (! m_ignoreAnnotations) {
+            pojo.setAnnotationProcessing();
+        }
+        pojo.pojoization(m_input, m_output, m_metadata);
+        for (int i = 0; i < pojo.getWarnings().size(); i++) {
+            log((String) pojo.getWarnings().get(i));
+        }
+        if (pojo.getErrors().size() > 0) { throw new BuildException((String) pojo.getErrors().get(0)); }
+        
+        String out;
+        if (m_output.getName().equals("_out.jar")) {
+            m_input.delete();
+            m_output.renameTo(m_input);
+            out = m_input.getAbsolutePath();
+        } else {
+            out = m_output.getAbsolutePath();
+        }
+        
+        log("Bundle manipulation - SUCCESS");
+        log("Output file : " + out);
+        
+    }
+    
+    
+
+}
+
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
index a9d1319..aa29369 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
@@ -95,7 +95,7 @@
     }
 
     /**
-     * Create a instance manager factory.
+     * Creates a instance manager factory.
      * @param context the bundle context
      * @param element the metadata of the component to create
      * @throws ConfigurationException if element describing the factory is malformed.
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
index 85b35f7..502a0d7 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
@@ -1,68 +1,64 @@
-/* 

- * 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.ipojo.handlers.event;

-

-/**

- * Utility methods.

- * 

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class EventUtil {

-

-    /**

-     * Test that the given topic match with the given topic pattern.

-     * 

-     * @param topic :

-     *            topic to test.

-     * @param topicPattern :

-     *            topic pattern

-     * @return true if it matches.

-     */

-    public static boolean matches(String topic, String topicPattern) {

-        if (topicPattern.equals("*")) {

-            return true;

-        }

-        int star;

-        if ((star = topicPattern.indexOf("*")) > 0) {

-            return topic.startsWith(topicPattern.substring(0, star - 1));

-        } else {

-            return topic.equals(topicPattern);

-        }

-    }

-

-    /**

-     * Test that the given topic match with the given topic patterns.

-     * 

-     * @param topic :

-     *            topic to test.

-     * @param topicPatterns :

-     *            topic patterns

-     * @return true if it matches.

-     */

-    public static boolean matches(String topic, String[] topicPatterns) {

-        int n = topicPatterns.length;

-        for (int i = 0; i < n; i++) {

-            if (matches(topic, topicPatterns[i])) {

-                return true;

-            }

-        }

-        return false;

-    }

-

-}

+/* 
+ * 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.ipojo.handlers.event;
+
+/**
+ * Utility methods.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class EventUtil {
+
+    /**
+     * Tests that the given topic match with the given topic pattern.
+     * 
+     * @param topic the topic to test
+     * @param topicPattern the topic pattern
+     * @return true if it matches.
+     */
+    public static boolean matches(String topic, String topicPattern) {
+        if (topicPattern.equals("*")) {
+            return true;
+        }
+        int star;
+        if ((star = topicPattern.indexOf("*")) > 0) {
+            return topic.startsWith(topicPattern.substring(0, star - 1));
+        } else {
+            return topic.equals(topicPattern);
+        }
+    }
+
+    /**
+     * Tests that the given topic match with the given topic patterns.
+     * 
+     * @param topic the topic to test
+     * @param topicPatterns the topic patterns
+     * @return true if it matches.
+     */
+    public static boolean matches(String topic, String[] topicPatterns) {
+        int n = topicPatterns.length;
+        for (int i = 0; i < n; i++) {
+            if (matches(topic, topicPatterns[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
index 8a0f973..962a536 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
@@ -42,27 +42,27 @@
 public class EventAdminPublisherHandler extends PrimitiveHandler {
 
     /**
-     * Handler Namespace.
+     * The handler Namespace.
      */
     public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";
 
     /**
-     * Names of instance configuration properties.
+     * The names of instance configuration properties.
      */
     public static final String TOPICS_PROPERTY = "event.topics";
 
     /**
-     * Prefix for logged messages.
+     * The prefix for logged messages.
      */
     private static final String LOG_PREFIX = "EVENT ADMIN PUBLISHER HANDLER : ";
 
     /**
-     * The Instance Manager.
+     * The instance manager.
      */
     private InstanceManager m_manager;
 
     /**
-     * The current Event Admin service.
+     * The current EventAdmin service.
      */
     private EventAdmin m_ea;
 
@@ -72,14 +72,11 @@
     private Map m_publishersByField = new Hashtable();
 
     /**
-     * Initialize the component type.
+     * Initializes the component type.
      * 
-     * @param cd :
-     *            component type description to populate.
-     * @param metadata :
-     *            component type metadata.
-     * @throws ConfigurationException :
-     *             metadata are incorrect.
+     * @param cd the component type description to populate
+     * @param metadata the component type metadata
+     * @throws ConfigurationException if the given metadata is incorrect.
      * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription,
      *      org.apache.felix.ipojo.metadata.Element)
      */
@@ -109,7 +106,7 @@
                 EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata(
                         publishers[i]);
                 String name = publisherMetadata.getName();
-                info(LOG_PREFIX + "checking publisher " + name);
+                info(LOG_PREFIX + "Checking publisher " + name);
 
                 // Check field existence and type
                 String field = publisherMetadata.getField();
@@ -135,19 +132,16 @@
                 fieldSet.add(field);
             }
         } else {
-            info(LOG_PREFIX + "no publisher to check");
+            info(LOG_PREFIX + "No publisher to check");
         }
     }
 
     /**
      * Constructor.
      * 
-     * @param metadata :
-     *            component type metadata
-     * @param conf :
-     *            instance configuration
-     * @throws ConfigurationException :
-     *             one event publication is not correct
+     * @param metadata the component type metadata
+     * @param conf the instance configuration
+     * @throws ConfigurationException if one event publication is not correct
      * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager,
      *      org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
      */
@@ -173,7 +167,7 @@
                 EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata(
                         publishers[i]);
                 String name = publisherMetadata.getName();
-                info(LOG_PREFIX + "configuring publisher " + name);
+                info(LOG_PREFIX + "Configuring publisher " + name);
 
                 // Get the topic instance configuration if redefined
                 String topicsString = (instanceTopics != null) ? (String) instanceTopics
@@ -204,12 +198,12 @@
                 m_manager.register(fieldMetadata, this);
             }
         } else {
-            info(LOG_PREFIX + "no publisher to configure");
+            info(LOG_PREFIX + "No publisher to configure");
         }
     }
 
     /**
-     * Start the handler instance.
+     * Starts the handler instance.
      * 
      * This method does nothing.
      */
@@ -218,7 +212,7 @@
     }
 
     /**
-     * Stop the handler instance.
+     * Stops the handler instance.
      * 
      * This method does nothing.
      */
@@ -230,12 +224,9 @@
      * Field interceptor callback. This method is called when the component
      * attempt to one of its Publisher field.
      * 
-     * @param pojo
-     *            the accessed field
-     * @param fieldName
-     *            the name of the accessed field
-     * @param value
-     *            the value of the field (useless here)
+     * @param pojo the accessed field
+     * @param fieldName the name of the accessed field
+     * @param value the value of the field (useless here)
      * 
      * @return the Publisher associated with the accessed field's name
      */
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
index 620bf20..9746d92 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
@@ -98,13 +98,10 @@
     private final String m_dataKey;
 
     /**
-     * Construct a publisher from its metadata description.
+     * Constructs a publisher from its metadata description.
      * 
-     * @param publisher :
-     *            publisher metadata description.
-     * @throws ConfigurationException
-     *             if the configuration of the component or the instance is
-     *             invalid.
+     * @param publisher the publisher metadata description.
+     * @throws ConfigurationException if the configuration of the component or the instance is invalid.
      */
     public EventAdminPublisherMetadata(Element publisher)
         throws ConfigurationException {
@@ -174,13 +171,10 @@
     }
 
     /**
-     * Set the topics attribute of the publisher.
+     * Sets the topics attribute of the publisher.
      * 
-     * @param topicsString
-     *            the comma separated list of the topics on which events are
-     *            sent
-     * @throws ConfigurationException
-     *             the specified topic string is malformed
+     * @param topicsString the comma separated list of the topics on which events are sent
+     * @throws ConfigurationException the specified topic string is malformed
      */
     public void setTopics(String topicsString)
         throws ConfigurationException {
@@ -199,10 +193,9 @@
     }
 
     /**
-     * Check that the required instance configurable attributes are all set.
+     * Checks that the required instance configurable attributes are all set.
      * 
-     * @throws ConfigurationException
-     *             if a required attribute is missing
+     * @throws ConfigurationException if a required attribute is missing
      */
     public void check()
         throws ConfigurationException {
@@ -214,7 +207,7 @@
     }
 
     /**
-     * Get the name attribute of the publisher.
+     * Gets the name attribute of the publisher.
      * 
      * @return the name
      */
@@ -223,7 +216,7 @@
     }
 
     /**
-     * Get the field attribute of the publisher.
+     * Gets the field attribute of the publisher.
      * 
      * @return the field
      */
@@ -232,7 +225,7 @@
     }
 
     /**
-     * Get the topics attribute of the publisher.
+     * Gets the topics attribute of the publisher.
      * 
      * @return the topics
      */
@@ -241,18 +234,18 @@
     }
 
     /**
-     * Get the synchronous attribute of the publisher.
+     * Gets the synchronous attribute of the publisher.
      * 
-     * @return the synchronous
+     * @return the synchronous mode
      */
     public boolean isSynchronous() {
         return m_synchronous;
     }
 
     /**
-     * Get the dataKey attribute of the publisher.
+     * Gets the dataKey attribute of the publisher.
      * 
-     * @return the dataKey
+     * @return the data key
      */
     public String getDataKey() {
         return m_dataKey;
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
index c9cdfdb..8c79e5c 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
@@ -1,47 +1,45 @@
-/* 

- * 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.ipojo.handlers.event.publisher;

-

-import java.util.Dictionary;

-

-/**

- * An Publisher is the interface between the EventAdminPublisherHandler and a

- * component instance. The POJO can send event through the handler by calling a

- * {@code send} method.

- * 

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public interface Publisher {

-

-    /**

-     * Send an event with the specified content.

-     * 

-     * @param content

-     *            the content of the event

-     */

-    void send(Dictionary content);

-

-    /**

-     * Send a data event.

-     * 

-     * @param o

-     *            the data to send

-     */

-    void sendData(Object o);

-}

+/* 
+ * 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.ipojo.handlers.event.publisher;
+
+import java.util.Dictionary;
+
+/**
+ * An Publisher is the interface between the EventAdminPublisherHandler and a
+ * component instance. The POJO can send event through the handler by calling a
+ * {@code send} method.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface Publisher {
+
+    /**
+     * Sends an event with the specified content.
+     * 
+     * @param content the content of the event
+     */
+    void send(Dictionary content);
+
+    /**
+     * Sends a data event.
+     * 
+     * @param o the data to send
+     */
+    void sendData(Object o);
+}
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
index 17c068f..8a2d6c5 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
@@ -62,19 +62,14 @@
     private final String m_instanceName;
 
     /**
-     * Construct an Publisher with given parameters.
+     * Constructs an Publisher with given parameters.
      * 
-     * @param handler
-     *            the handler that will manage this publisher
-     * @param topics
-     *            the topics on which events are sent
-     * @param synchronous
-     *            the sending mode of events
-     * @param dataKey
-     *            The key, in the content of the event, where user data are
+     * @param handler the handler that will manage this publisher
+     * @param topics the topics on which events are sent
+     * @param synchronous the sending mode of events
+     * @param dataKey The key, in the content of the event, where user data are
      *            stored (may be {@code null})
-     * @param instanceName
-     *            the name of the instance creating this publisher.
+     * @param instanceName the name of the instance creating this publisher.
      */
     public PublisherImpl(EventAdminPublisherHandler handler, String[] topics,
             boolean synchronous, String dataKey, String instanceName) {
@@ -88,10 +83,9 @@
     }
 
     /**
-     * Send an event with the specified content.
+     * Sends an event with the specified content.
      * 
-     * @param content
-     *            the content of the event
+     * @param content the content of the event
      */
     public void send(Dictionary content) {
         // Add instance information in the event
@@ -110,10 +104,9 @@
     }
 
     /**
-     * Send a data event.
+     * Sends a data event.
      * 
-     * @param object
-     *            the data to send
+     * @param object the data to send
      */
     public void sendData(Object object) {
         // Construct the content of the event with the given object
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
index ba81c2a..92e69ae 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
@@ -52,7 +52,7 @@
         EventHandler {
 
     /**
-     * Handler Namespace.
+     * The handler namespace.
      */
     public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";
 
@@ -69,44 +69,41 @@
     public static final String FILTER_PROPERTY = "event.filter";
 
     /**
-     * Prefix for logged messages.
+     * The prefix for logged messages.
      */
     private static final String LOG_PREFIX = "EVENT ADMIN SUBSCRIBER HANDLER : ";
 
     /**
-     * Instance Manager.
+     * The instance manager.
      */
     private InstanceManager m_manager;
 
     /**
-     * List of subscriber accessible by name.
+     * The list of subscriber accessible by name.
      */
     private Map m_subscribersByName = new HashMap();
 
     /**
-     * List of callbacks accessible by subscribers' names.
+     * The list of callbacks accessible by subscribers' names.
      */
     private Map m_callbacksByName = new Hashtable();
 
     /**
-     * iPOJO Properties representing all the topics.
+     * The iPOJO properties representing all the topics.
      */
     private String[] m_topics;
 
     /**
-     * Listen received events ?
+     * Listening to received events ?
      */
     private boolean m_isListening;
 
     /**
-     * Initialize the component type.
+     * Initializes the component type.
      * 
-     * @param cd :
-     *            component type description to populate.
-     * @param metadata :
-     *            component type metadata.
-     * @throws ConfigurationException :
-     *             metadata are incorrect.
+     * @param cd component type description to populate.
+     * @param metadata component type metadata.
+     * @throws ConfigurationException if the metadata are incorrect.
      * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription,
      *      org.apache.felix.ipojo.metadata.Element)
      */
@@ -140,7 +137,7 @@
                         getFactory().getBundleContext(), subscribers[i]);
 
                 String name = subscriberMetadata.getName();
-                info(LOG_PREFIX + "checking subscriber " + name);
+                info(LOG_PREFIX + "Checking subscriber " + name);
 
                 // Determine the event callback prototype
                 PojoMetadata pojoMetadata = getPojoMetadata();
@@ -179,19 +176,16 @@
                 nameSet.add(name);
             }
         } else {
-            info(LOG_PREFIX + "no subscriber to check");
+            info(LOG_PREFIX + "No subscriber to check");
         }
     }
 
     /**
      * Constructor.
      * 
-     * @param metadata :
-     *            component type metadata
-     * @param conf :
-     *            instance configuration
-     * @throws ConfigurationException :
-     *             one event subscription is not correct
+     * @param metadata the omponent type metadata
+     * @param conf the instance configuration
+     * @throws ConfigurationException if one event subscription is not correct
      * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager,
      *      org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
      */
@@ -221,7 +215,7 @@
                 EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata(
                         m_manager.getContext(), subscribers[i]);
                 String name = subscriberMetadata.getName();
-                info(LOG_PREFIX + "configuring subscriber " + name);
+                info(LOG_PREFIX + "Configuring subscriber " + name);
 
                 // Get the topics instance configuration if redefined
                 String topicsString = (instanceTopics != null) ? (String) instanceTopics
@@ -277,7 +271,7 @@
             }
 
         } else {
-            info(LOG_PREFIX + "no subscriber to configure");
+            info(LOG_PREFIX + "No subscriber to configure");
         }
     }
 
@@ -306,10 +300,9 @@
      **************************************************************************/
 
     /**
-     * Receive an event. The event is dispatch to attached subscribers.
+     * Receives an event. The event is dispatch to attached subscribers.
      * 
-     * @param event :
-     *            the received event.
+     * @param event the received event.
      * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
      */
     public void handleEvent(Event event) {
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
index 01567e3..c26d227 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
@@ -113,11 +113,9 @@
     /**
      * Constructor.
      * 
-     * @param bundleContext : bundle context of the managed instance.
-     * @param subscriber : subscriber metadata.
-     * @throws ConfigurationException
-     *             if the configuration of the component or the instance is
-     *             invalid.
+     * @param bundleContext the bundle context of the managed instance.
+     * @param subscriber the subscriber metadata.
+     * @throws ConfigurationException if the configuration of the component or the instance is invalid.
      */
     public EventAdminSubscriberMetadata(BundleContext bundleContext,
             Element subscriber)
@@ -200,12 +198,10 @@
     }
 
     /**
-     * Set the topics attribute of the subscriber.
+     * Sets the topics attribute of the subscriber.
      * 
-     * @param topicsString
-     *            the comma separated list of the topics to listen
-     * @throws ConfigurationException
-     *             the specified topic list is malformed
+     * @param topicsString the comma separated list of the topics to listen
+     * @throws ConfigurationException if  the specified topic list is malformed
      */
     public void setTopics(String topicsString)
         throws ConfigurationException {
@@ -223,11 +219,10 @@
     }
 
     /**
-     * Set the filter attribute of the subscriber.
+     * Sets the filter attribute of the subscriber.
      * 
-     * @param filterString
-     *            the string representation of the event filter
-     * @throws ConfigurationException : the LDAP filter is malformed
+     * @param filterString the string representation of the event filter
+     * @throws ConfigurationException if the LDAP filter is malformed
      */
     public void setFilter(String filterString)
         throws ConfigurationException {
@@ -239,10 +234,9 @@
     }
 
     /**
-     * Check that the required instance configurable attributes are all set.
+     * Checks that the required instance configurable attributes are all set.
      * 
-     * @throws ConfigurationException
-     *             if a required attribute is missing
+     * @throws ConfigurationException if a required attribute is missing
      */
     public void check()
         throws ConfigurationException {
@@ -254,7 +248,7 @@
     }
 
     /**
-     * Get the name attribute of the subscriber.
+     * Gets the name attribute of the subscriber.
      * 
      * @return the name
      */
@@ -263,7 +257,7 @@
     }
 
     /**
-     * Get the topics attribute of the subscriber.
+     * Gets the topics attribute of the subscriber.
      * 
      * @return the topics
      */
@@ -272,7 +266,7 @@
     }
 
     /**
-     * Get the callback attribute of the subscriber.
+     * Gets the callback attribute of the subscriber.
      * 
      * @return the callback
      */
@@ -281,7 +275,7 @@
     }
 
     /**
-     * Get the data key attribute of the subscriber.
+     * Gets the data key attribute of the subscriber.
      * 
      * @return the dataKey
      */
@@ -290,7 +284,7 @@
     }
 
     /**
-     * Get the data type attribute of the subscriber.
+     * Gets the data type attribute of the subscriber.
      * 
      * @return the dataType
      */
@@ -299,7 +293,7 @@
     }
 
     /**
-     * Get the filter attribute of the subscriber.
+     * Gets the filter attribute of the subscriber.
      * 
      * @return the filter
      */
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java
index a693023..b3a3572 100644
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java
+++ b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java
@@ -1,154 +1,154 @@
-/* 

- * 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.ipojo.handler.extender;

-

-import java.util.HashSet;

-import java.util.Set;

-import org.osgi.framework.Bundle;

-import org.osgi.framework.BundleContext;

-import org.osgi.framework.BundleEvent;

-import org.osgi.framework.SynchronousBundleListener;

-

-/**

- * This is a very simple bundle tracker utility class that tracks active

- * bundles. The tracker must be given a bundle context upon creation,

- * which it uses to listen for bundle events. The bundle tracker must be

- * opened to track objects and closed when it is no longer needed. This

- * class is abstract, which means in order to use it you must create a

- * subclass of it. Subclasses must implement the <tt>addedBundle()</tt>

- * and <tt>removedBundle()</tt> methods, which can be used to perform some

- * custom action upon the activation or deactivation of bundles. Since this

- * tracker is quite simple, its concurrency control approach is also

- * simplistic. This means that subclasses should take great care to ensure

- * that their <tt>addedBundle()</tt> and <tt>removedBundle()</tt> methods

- * are very simple and do not do anything to change the state of any bundles.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- **/

-public abstract class BundleTracker {

-    /**

-     * Set of tracked bundles.

-     */

-    final Set m_bundleSet = new HashSet();

-

-    /**

-     * Bundle context.

-     */

-    final BundleContext m_context;

-

-    /**

-     * Synchronous bundle listener.

-     */

-    final SynchronousBundleListener m_listener;

-

-    /**

-     * Flag indicating if the tracking is open.

-     */

-    boolean m_open;

-

-    /**

-     * Constructs a bundle tracker object that will use the specified

-     * bundle context.

-     * @param context The bundle context to use to track bundles.

-     **/

-    public BundleTracker(BundleContext context) {

-        m_context = context;

-        m_listener = new SynchronousBundleListener() {

-            public void bundleChanged(BundleEvent evt) {

-                synchronized (BundleTracker.this) {

-                    if (!m_open) { return; }

-

-                    if (evt.getType() == BundleEvent.STARTED) {

-                        if (!m_bundleSet.contains(evt.getBundle())) {

-                            m_bundleSet.add(evt.getBundle());

-                            addedBundle(evt.getBundle());

-                        }

-                    } else if (evt.getType() == BundleEvent.STOPPED) {

-                        if (m_bundleSet.contains(evt.getBundle())) {

-                            m_bundleSet.remove(evt.getBundle());

-                            removedBundle(evt.getBundle());

-                        }

-                    }

-                }

-            }

-        };

-    }

-

-    /**

-     * Returns the current set of active bundles.

-     * @return The current set of active bundles.

-     **/

-    public synchronized Bundle[] getBundles() {

-        return (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);

-    }

-

-    /**

-     * Call this method to start the tracking of active bundles.

-     **/

-    public synchronized void open() {

-        if (!m_open) {

-            m_open = true;

-

-            m_context.addBundleListener(m_listener);

-

-            Bundle[] bundles = m_context.getBundles();

-            for (int i = 0; i < bundles.length; i++) {

-                if (bundles[i].getState() == Bundle.ACTIVE) {

-                    m_bundleSet.add(bundles[i]);

-                    addedBundle(bundles[i]);

-                }

-            }

-        }

-    }

-

-    /**

-     * Call this method to stop the tracking of active bundles.

-     **/

-    public synchronized void close() {

-        if (m_open) {

-            m_open = false;

-

-            m_context.removeBundleListener(m_listener);

-

-            Bundle[] bundles = (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);

-            for (int i = 0; i < bundles.length; i++) {

-                if (m_bundleSet.remove(bundles[i])) {

-                    removedBundle(bundles[i]);

-                }

-            }

-        }

-    }

-

-    /**

-     * Subclasses must implement this method; it can be used to perform

-     * actions upon the activation of a bundle. Subclasses should keep

-     * this method implementation as simple as possible and should not

-     * cause the change in any bundle state to avoid concurrency issues.

-     * @param bundle The bundle being added to the active set.

-     **/

-    protected abstract void addedBundle(Bundle bundle);

-

-    /**

-     * Subclasses must implement this method; it can be used to perform

-     * actions upon the deactivation of a bundle. Subclasses should keep

-     * this method implementation as simple as possible and should not

-     * cause the change in any bundle state to avoid concurrency issues.

-     * @param bundle The bundle being removed from the active set.

-     **/

-    protected abstract void removedBundle(Bundle bundle);

-}

+/* 
+ * 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.ipojo.handler.extender;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+
+/**
+ * This is a very simple bundle tracker utility class that tracks active
+ * bundles. The tracker must be given a bundle context upon creation,
+ * which it uses to listen for bundle events. The bundle tracker must be
+ * opened to track objects and closed when it is no longer needed. This
+ * class is abstract, which means in order to use it you must create a
+ * subclass of it. Subclasses must implement the <tt>addedBundle()</tt>
+ * and <tt>removedBundle()</tt> methods, which can be used to perform some
+ * custom action upon the activation or deactivation of bundles. Since this
+ * tracker is quite simple, its concurrency control approach is also
+ * simplistic. This means that subclasses should take great care to ensure
+ * that their <tt>addedBundle()</tt> and <tt>removedBundle()</tt> methods
+ * are very simple and do not do anything to change the state of any bundles.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ **/
+public abstract class BundleTracker {
+    /**
+     * Set of tracked bundles.
+     */
+    final Set m_bundleSet = new HashSet();
+
+    /**
+     * Bundle context.
+     */
+    final BundleContext m_context;
+
+    /**
+     * Synchronous bundle listener.
+     */
+    final SynchronousBundleListener m_listener;
+
+    /**
+     * Flag indicating if the tracking is open.
+     */
+    boolean m_open;
+
+    /**
+     * Constructs a bundle tracker object that will use the specified
+     * bundle context.
+     * @param context the bundle context to use to track bundles.
+     **/
+    public BundleTracker(BundleContext context) {
+        m_context = context;
+        m_listener = new SynchronousBundleListener() {
+            public void bundleChanged(BundleEvent evt) {
+                synchronized (BundleTracker.this) {
+                    if (!m_open) { return; }
+
+                    if (evt.getType() == BundleEvent.STARTED) {
+                        if (!m_bundleSet.contains(evt.getBundle())) {
+                            m_bundleSet.add(evt.getBundle());
+                            addedBundle(evt.getBundle());
+                        }
+                    } else if (evt.getType() == BundleEvent.STOPPED) {
+                        if (m_bundleSet.contains(evt.getBundle())) {
+                            m_bundleSet.remove(evt.getBundle());
+                            removedBundle(evt.getBundle());
+                        }
+                    }
+                }
+            }
+        };
+    }
+
+    /**
+     * Returns the current set of active bundles.
+     * @return the current set of active bundles.
+     **/
+    public synchronized Bundle[] getBundles() {
+        return (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);
+    }
+
+    /**
+     * Call this method to start the tracking of active bundles.
+     **/
+    public synchronized void open() {
+        if (!m_open) {
+            m_open = true;
+
+            m_context.addBundleListener(m_listener);
+
+            Bundle[] bundles = m_context.getBundles();
+            for (int i = 0; i < bundles.length; i++) {
+                if (bundles[i].getState() == Bundle.ACTIVE) {
+                    m_bundleSet.add(bundles[i]);
+                    addedBundle(bundles[i]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Call this method to stop the tracking of active bundles.
+     **/
+    public synchronized void close() {
+        if (m_open) {
+            m_open = false;
+
+            m_context.removeBundleListener(m_listener);
+
+            Bundle[] bundles = (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);
+            for (int i = 0; i < bundles.length; i++) {
+                if (m_bundleSet.remove(bundles[i])) {
+                    removedBundle(bundles[i]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Subclasses must implement this method; it can be used to perform
+     * actions upon the activation of a bundle. Subclasses should keep
+     * this method implementation as simple as possible and should not
+     * cause the change in any bundle state to avoid concurrency issues.
+     * @param bundle the bundle being added to the active set.
+     **/
+    protected abstract void addedBundle(Bundle bundle);
+
+    /**
+     * Subclasses must implement this method; it can be used to perform
+     * actions upon the deactivation of a bundle. Subclasses should keep
+     * this method implementation as simple as possible and should not
+     * cause the change in any bundle state to avoid concurrency issues.
+     * @param bundle the bundle being removed from the active set.
+     **/
+    protected abstract void removedBundle(Bundle bundle);
+}
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java
index fe8cea3..5d01869 100644
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java
+++ b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java
@@ -1,135 +1,135 @@
-/* 

- * 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.ipojo.handler.extender;

-

-import java.lang.reflect.InvocationTargetException;

-import java.util.Dictionary;

-import java.util.HashSet;

-import java.util.Set;

-

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.util.Callback;

-import org.osgi.framework.Bundle;

-

-/**

- * Track and manage extensions.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class ExtenderManager extends BundleTracker {

-    

-    /**

-     * Looked extension.

-     */

-    private String m_extension;

-    

-    /**

-     * OnArrival method. 

-     */

-    private Callback m_onArrival;

-    

-    /**

-     * OnDeparture method. 

-     */

-    private Callback m_onDeparture;

-    

-    /**

-     * Attached handler. 

-     */

-    private PrimitiveHandler m_handler;

-    

-    /**

-     * Set of managed bundles.

-     */

-    private Set m_bundles = new HashSet();

-    

-    /**

-     * Constructor.

-     * @param handler : attached handler.

-     * @param extension : looked extension.

-     * @param bind : onArrival method

-     * @param unbind : onDeparture method.

-     */

-    public ExtenderManager(ExtenderModelHandler handler, String extension, String bind, String unbind) {

-        super(handler.getInstanceManager().getContext());

-        m_handler = handler;

-        m_onArrival = new Callback(bind, new Class[] {Bundle.class, String.class}, false, m_handler.getInstanceManager());

-        m_onDeparture = new Callback(unbind, new Class[] {Bundle.class}, false, m_handler.getInstanceManager());

-        m_extension = extension;

-    }

-

-

-    /**

-     * A bundle arrives.

-     * Checks if the bundle match with the looked extension, if so call the arrival callback.

-     * @param bundle : arriving bundle.

-     * @see org.apache.felix.ipojo.handler.extender.BundleTracker#addedBundle(org.osgi.framework.Bundle)

-     */

-    protected void addedBundle(Bundle bundle) {

-        Dictionary headers = bundle.getHeaders();

-        String header = (String) headers.get(m_extension);

-        if (header != null) {

-            synchronized (this) {

-                m_bundles.add(bundle);

-            }

-            try { // Call the callback outside the synchronized block.

-                m_onArrival.call(new Object[] {bundle, header});

-            } catch (NoSuchMethodException e) {

-                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);

-                m_handler.getInstanceManager().stop();

-            } catch (IllegalAccessException e) {

-                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be called", e);

-                m_handler.getInstanceManager().stop();

-            } catch (InvocationTargetException e) {

-                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException());

-                m_handler.getInstanceManager().stop();

-            }

-        }

-    }

-

-    /**

-     * A bundle is stopping.

-     * Check if the bundle was managed, if so call the remove departure callback.

-     * @param bundle : leaving bundle.

-     * @see org.apache.felix.ipojo.handler.extender.BundleTracker#removedBundle(org.osgi.framework.Bundle)

-     */

-    protected void removedBundle(Bundle bundle) {

-        boolean contained;

-        synchronized (this) {

-            contained = m_bundles.remove(bundle); // Stack confinement

-        }

-        

-        if (contained) {

-            try {

-                m_onDeparture.call(new Object[] {bundle});

-            } catch (NoSuchMethodException e) {

-                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);

-                m_handler.getInstanceManager().stop();

-            } catch (IllegalAccessException e) {

-                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be called", e);

-                m_handler.getInstanceManager().stop();

-            } catch (InvocationTargetException e) {

-                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());

-                m_handler.getInstanceManager().stop();

-            }

-        }

-    }

-

-    

-

-}

+/* 
+ * 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.ipojo.handler.extender;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.util.Callback;
+import org.osgi.framework.Bundle;
+
+/**
+ * Track and manage extensions.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ExtenderManager extends BundleTracker {
+    
+    /**
+     * Looked extension.
+     */
+    private String m_extension;
+    
+    /**
+     * OnArrival method. 
+     */
+    private Callback m_onArrival;
+    
+    /**
+     * OnDeparture method. 
+     */
+    private Callback m_onDeparture;
+    
+    /**
+     * Attached handler. 
+     */
+    private PrimitiveHandler m_handler;
+    
+    /**
+     * Set of managed bundles.
+     */
+    private Set m_bundles = new HashSet();
+    
+    /**
+     * Constructor.
+     * @param handler the attached handler.
+     * @param extension the looked extension.
+     * @param bind the onArrival method
+     * @param unbind the onDeparture method.
+     */
+    public ExtenderManager(ExtenderModelHandler handler, String extension, String bind, String unbind) {
+        super(handler.getInstanceManager().getContext());
+        m_handler = handler;
+        m_onArrival = new Callback(bind, new Class[] {Bundle.class, String.class}, false, m_handler.getInstanceManager());
+        m_onDeparture = new Callback(unbind, new Class[] {Bundle.class}, false, m_handler.getInstanceManager());
+        m_extension = extension;
+    }
+
+
+    /**
+     * A bundle arrives.
+     * Checks if the bundle match with the looked extension, if so call the arrival callback.
+     * @param bundle the arriving bundle.
+     * @see org.apache.felix.ipojo.handler.extender.BundleTracker#addedBundle(org.osgi.framework.Bundle)
+     */
+    protected void addedBundle(Bundle bundle) {
+        Dictionary headers = bundle.getHeaders();
+        String header = (String) headers.get(m_extension);
+        if (header != null) {
+            synchronized (this) {
+                m_bundles.add(bundle);
+            }
+            try { // Call the callback outside the synchronized block.
+                m_onArrival.call(new Object[] {bundle, header});
+            } catch (NoSuchMethodException e) {
+                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);
+                m_handler.getInstanceManager().stop();
+            } catch (IllegalAccessException e) {
+                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be called", e);
+                m_handler.getInstanceManager().stop();
+            } catch (InvocationTargetException e) {
+                m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException());
+                m_handler.getInstanceManager().stop();
+            }
+        }
+    }
+
+    /**
+     * A bundle is stopping.
+     * Check if the bundle was managed, if so call the remove departure callback.
+     * @param bundle the leaving bundle.
+     * @see org.apache.felix.ipojo.handler.extender.BundleTracker#removedBundle(org.osgi.framework.Bundle)
+     */
+    protected void removedBundle(Bundle bundle) {
+        boolean contained;
+        synchronized (this) {
+            contained = m_bundles.remove(bundle); // Stack confinement
+        }
+        
+        if (contained) {
+            try {
+                m_onDeparture.call(new Object[] {bundle});
+            } catch (NoSuchMethodException e) {
+                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);
+                m_handler.getInstanceManager().stop();
+            } catch (IllegalAccessException e) {
+                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be called", e);
+                m_handler.getInstanceManager().stop();
+            } catch (InvocationTargetException e) {
+                m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());
+                m_handler.getInstanceManager().stop();
+            }
+        }
+    }
+
+    
+
+}
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java
index 0f51828..ec4356d 100644
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java
+++ b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java
@@ -1,95 +1,95 @@
-/* 

- * 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.ipojo.handler.extender;

-

-import java.util.ArrayList;

-import java.util.Dictionary;

-import java.util.List;

-

-import org.apache.felix.ipojo.ConfigurationException;

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.metadata.Element;

-

-/**

- * Handler automating extender pattern. The component using this handler is notified 

- * when an handler with a special manifest extension is detected, the component is notified.

- * When a managed handler leaves, the component is also notified.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class ExtenderModelHandler extends PrimitiveHandler {

-    

-    /**

-     * Handler namespace.

-     */

-    public static final String NAMESPACE = "org.apache.felix.ipojo.extender";

-    

-    /**

-     * Extension manager list.

-     * Immutable once set.

-     */

-    private List m_managers = new ArrayList(1);

-

-    /**

-     * Configure method.

-     * @param elem : component type element.

-     * @param dict : instance configuration.

-     * @throws ConfigurationException : the configuration is not valid.

-     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

-     */

-    public void configure(Element elem, Dictionary dict) throws ConfigurationException {

-        Element[] elems = elem.getElements("extender", NAMESPACE);

-        for (int i = 0; i < elems.length; i++) {

-            String extension = elems[i].getAttribute("extension");

-            String onArrival = elems[i].getAttribute("onArrival");

-            String onDeparture = elems[i].getAttribute("onDeparture");

-            

-            if (extension == null) {

-                throw new ConfigurationException("The extender element requires an 'extender' attribute");

-            }

-            if (onArrival == null || onDeparture == null) {

-                throw new ConfigurationException("The extender element requires the onArrival and onDeparture attributes");

-            }

-            

-            ExtenderManager wbm = new ExtenderManager(this, extension, onArrival, onDeparture);

-            m_managers.add(wbm);

-        }

-        

-    }

-

-    /**

-     * Start the handler.

-     * @see org.apache.felix.ipojo.Handler#start()

-     */

-    public void start() {

-        for (int i = 0; i < m_managers.size(); i++) {

-            ((ExtenderManager) m_managers.get(i)).open();

-        }

-    }

-

-    /**

-     * Stop the handler.

-     * @see org.apache.felix.ipojo.Handler#stop()

-     */

-    public void stop() {

-        for (int i = 0; i < m_managers.size(); i++) {

-            ((ExtenderManager) m_managers.get(i)).close();

-        } 

-    }

-

-}

+/* 
+ * 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.ipojo.handler.extender;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.metadata.Element;
+
+/**
+ * Handler automating extender pattern. The component using this handler is notified 
+ * when an handler with a special manifest extension is detected, the component is notified.
+ * When a managed handler leaves, the component is also notified.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ExtenderModelHandler extends PrimitiveHandler {
+    
+    /**
+     * The handler namespace.
+     */
+    public static final String NAMESPACE = "org.apache.felix.ipojo.extender";
+    
+    /**
+     * The extension manager list.
+     * Immutable once set.
+     */
+    private List m_managers = new ArrayList(1);
+
+    /**
+     * Configures the handler.
+     * @param elem the component type element.
+     * @param dict the instance configuration.
+     * @throws ConfigurationException if the configuration is not valid.
+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
+     */
+    public void configure(Element elem, Dictionary dict) throws ConfigurationException {
+        Element[] elems = elem.getElements("extender", NAMESPACE);
+        for (int i = 0; i < elems.length; i++) {
+            String extension = elems[i].getAttribute("extension");
+            String onArrival = elems[i].getAttribute("onArrival");
+            String onDeparture = elems[i].getAttribute("onDeparture");
+            
+            if (extension == null) {
+                throw new ConfigurationException("The extender element requires an 'extender' attribute");
+            }
+            if (onArrival == null || onDeparture == null) {
+                throw new ConfigurationException("The extender element requires the 'onArrival' and 'onDeparture' attributes");
+            }
+            
+            ExtenderManager wbm = new ExtenderManager(this, extension, onArrival, onDeparture);
+            m_managers.add(wbm);
+        }
+        
+    }
+
+    /**
+     * Starts the handler.
+     * @see org.apache.felix.ipojo.Handler#start()
+     */
+    public void start() {
+        for (int i = 0; i < m_managers.size(); i++) {
+            ((ExtenderManager) m_managers.get(i)).open();
+        }
+    }
+
+    /**
+     * Stops the handler.
+     * @see org.apache.felix.ipojo.Handler#stop()
+     */
+    public void stop() {
+        for (int i = 0; i < m_managers.size(); i++) {
+            ((ExtenderManager) m_managers.get(i)).close();
+        } 
+    }
+
+}
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
index 0585e05..a7f8a79 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
@@ -54,37 +54,35 @@
         DynamicMBean {
 
     /**
-     * InstanceManager: use to store the InstanceManager instance.
+     * The instance manager. Used to store the InstanceManager instance.
      */
     protected final InstanceManager m_instanceManager;
 
     /**
-     * JmxConfigDFieldMap : store the data extracted from metadata.xml.
+     * The JmxConfigDFieldMap. Stors the data extracted from metadata.xml.
      */
     private JmxConfigFieldMap m_configMap;
 
     /**
-     * MBeanInfo : class wich store the MBean Informations.
+     * The MBeanInfo. The class storing the MBean Informations.
      */
     private MBeanInfo m_mBeanInfo;
 
     /**
-     * String : constant which store the name of the class.
+     * The class name. Constant storing the name of the class.
      */
     private String m_className = this.getClass().getName();
 
     /**
-     * sequenceNumber : use to calculate unique id to notification.
+     * The sequence number. Used to calculate unique id to notification.
      */
     private int m_sequenceNumber = 0;
 
     /**
-     * DynamicMBeanImpl : constructor.
+     * Constructor.
      * 
-     * @param properties
-     *            : data extracted from metadat.xml file
-     * @param instanceManager
-     *            : InstanceManager instance
+     * @param properties the data extracted from metadat.xml file
+     * @param instanceManager the InstanceManager instance
      */
     public DynamicMBeanImpl(JmxConfigFieldMap properties,
             InstanceManager instanceManager) {
@@ -94,16 +92,12 @@
     }
 
     /**
-     * getAttribute implements from JMX. get the value of the required attribute
+     * Gets the value of the required attribute.
      * 
-     * @param arg0
-     *            name of required attribute
-     * @throws AttributeNotFoundException
-     *             : if the attribute doesn't exist
-     * @throws MBeanException
-     *             :
-     * @throws ReflectionException
-     *             :
+     * @param arg0 the name of required attribute
+     * @throws AttributeNotFoundException if the attribute doesn't exist
+     * @throws MBeanException if something bad occures
+     * @throws ReflectionException if something bad occures
      * @return the object attribute
      */
     public Object getAttribute(String arg0) throws AttributeNotFoundException,
@@ -118,10 +112,9 @@
     }
 
     /**
-     * getAttributes : implement from JMX. get values of reuqired attributes
+     * Gets values of required attributes.
      * 
-     * @param attributeNames
-     *            : names of the required attributes
+     * @param attributeNames the names of the required attributes
      * @return return the list of the attribute
      */
     public AttributeList getAttributes(String[] attributeNames) {
@@ -145,7 +138,7 @@
     }
 
     /**
-     * getMBeanInfo : return the MBean Class builded.
+     * Returns the MBean Class builded.
      * 
      * @return return MBeanInfo class constructed by buildMBeanInfo
      */
@@ -154,19 +147,14 @@
     }
 
     /**
-     * invoke : invoke the required method on the targeted POJO.
+     * Invokes the required method on the targeted POJO.
      * 
-     * @param operationName
-     *            : name of the method called
-     * @param params
-     *            : parameters given to the method
-     * @param signature
-     *            : determine which method called
-     * @return Object : the object return by the method
-     * @throws MBeanException
-     *             :
-     * @throws ReflectionException
-     *             :
+     * @param operationName the name of the method called
+     * @param params the parameters given to the method
+     * @param signature the determine which method called
+     * @return the object return by the method
+     * @throws MBeanException if something bad occures
+     * @throws ReflectionException if something bad occures
      */
     public Object invoke(String operationName, Object[] params,
             String[] signature) throws MBeanException, ReflectionException {
@@ -198,18 +186,13 @@
     }
 
     /**
-     * setAttribute : change specified attribute value.
+     * Changes specified attribute value.
      * 
-     * @param attribute
-     *            : attribute with new value to be changed
-     * @throws AttributeNotFoundException
-     *             : if the requiered attribute was not found
-     * @throws InvalidAttributeValueException
-     *             : the value is inccorrect type
-     * @throws MBeanException
-     *             :
-     * @throws ReflectionException
-     *             :
+     * @param attribute the attribute with new value to be changed
+     * @throws AttributeNotFoundException if the required attribute was not found
+     * @throws InvalidAttributeValueException if the value is inccorrect type
+     * @throws MBeanException if something bad occures
+     * @throws ReflectionException if something bad occures
      */
     public void setAttribute(Attribute attribute)
         throws AttributeNotFoundException, InvalidAttributeValueException,
@@ -243,7 +226,7 @@
         }
         if (!propertyField.isWritable()) {
             throw new InvalidAttributeValueException("Attribute " + name
-                    + " can not be setted");
+                    + " can not be set");
         }
 
         if (value == null) {
@@ -270,11 +253,10 @@
     }
 
     /**
-     * setAttributes : change all the attributes value.
+     * Changes all the attributes value.
      * 
-     * @param attributes
-     *            : list of attribute value to be changed
-     * @return AttributeList : list of new attribute
+     * @param attributes the list of attribute value to be changed
+     * @return the list of new attribute
      */
     public AttributeList setAttributes(AttributeList attributes) {
 
@@ -308,8 +290,8 @@
     }
 
     /**
-     * buildMBeanInfo : build the MBean information on initialization. this
-     * value don't change after
+     * Builds the MBean information on initialization. This
+     * value doesn't change further.
      */
     private void buildMBeanInfo() {
         String dDescription = m_configMap.getDecription();
@@ -379,10 +361,9 @@
     }
 
     /**
-     * getNotificationInfo : get the notification informations (use by JMX).
+     * Gets the notification informations (use by JMX).
      * 
-     * @return MBeanNotificationInfo[] : structure which describe the
-     *         notifications
+     * @return the structure which describe the notifications
      */
     public MBeanNotificationInfo[] getNotificationInfo() {
         MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
@@ -404,18 +385,13 @@
     }
 
     /**
-     * sendNotification : send a notification to a subscriver.
+     * Sends a notification to a subscriber.
      * 
-     * @param msg
-     *            : msg to send
-     * @param attributeName
-     *            : name of the attribute
-     * @param attributeType
-     *            : type of the attribute
-     * @param oldValue
-     *            : oldvalue of the attribute
-     * @param newValue
-     *            : new value of the attribute
+     * @param msg the msg to send
+     * @param attributeName the name of the attribute
+     * @param attributeType the type of the attribute
+     * @param oldValue the old value of the attribute
+     * @param newValue the new value of the attribute
      */
     public void sendNotification(String msg, String attributeName,
             String attributeType, Object oldValue, Object newValue) {
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
index 5ec9066..c3c9dd3 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
@@ -38,41 +38,35 @@
         MBeanRegistration {
 
     /**
-     * preRegister method of MBeanRegistration interface.
+     * The preRegister method of MBeanRegistration interface.
      */
     private MethodMetadata m_preRegisterMeth;
     /**
-     * postRegister method of MBeanRegistration interface.
+     * The postRegister method of MBeanRegistration interface.
      */
     private MethodMetadata m_postRegisterMeth;
     /**
-     * preDeregister method of MBeanRegistration interface.
+     * The preDeregister method of MBeanRegistration interface.
      */
     private MethodMetadata m_preDeregisterMeth;
     /**
-     * postDeregister method of MBeanRegistration interface.
+     * The postDeregister method of MBeanRegistration interface.
      */
     private MethodMetadata m_postDeregisterMeth;
     /**
-     * Effective name of the MBean.
+     * The effective name of the MBean.
      */
     private ObjectName m_objName;
 
     /**
      * Constructs a new DynamicMBeanWRegisterImpl.
      * 
-     * @param properties
-     *            data extracted from the metadata.xml
-     * @param instanceManager
-     *            the instance manager
-     * @param preRegisterMeth
-     *            the method to call before MBean registration
-     * @param postRegisterMeth
-     *            the method to call after MBean registration
-     * @param preDeregisterMeth
-     *            the method to call before MBean deregistration
-     * @param postDeregisterMeth
-     *            the method to call after MBean registration
+     * @param properties the data extracted from the metadata.xml
+     * @param instanceManager the instance manager
+     * @param preRegisterMeth the method to call before MBean registration
+     * @param postRegisterMeth the method to call after MBean registration
+     * @param preDeregisterMeth the method to call before MBean deregistration
+     * @param postDeregisterMeth the method to call after MBean registration
      */
     public DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties,
             InstanceManager instanceManager, MethodMetadata preRegisterMeth,
@@ -87,7 +81,7 @@
     }
 
     /**
-     * Return the MBean name used to register it.
+     * Returns the MBean name used to register it.
      * 
      * @return the MBean name used to register it.
      */
@@ -98,13 +92,9 @@
     /**
      * This method is executed before the MBean registration.
      * 
-     * @param server
-     *            the server on which the MBean will be registered
-     * @param name
-     *            the name of the MBean to expose
-     * @throws Exception
-     *             This exception will be caught by the MBean server and
-     *             re-thrown as an MBeanRegistrationException.
+     * @param server the server on which the MBean will be registered
+     * @param name the name of the MBean to expose
+     * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.
      * @return the name with which the MBean will be registered
      */
     public ObjectName preRegister(MBeanServer server, ObjectName name)
@@ -117,9 +107,7 @@
     /**
      * This method is executed after the MBean registration.
      * 
-     * @param registrationDone
-     *            Indicates whether or not the MBean has been successfully
-     *            registered in the MBean server.
+     * @param registrationDone indicates whether or not the MBean has been successfully registered in the MBean server.
      */
     public void postRegister(Boolean registrationDone) {
         callMethod(m_postRegisterMeth, MBeanHandler.POST_REGISTER_METH_NAME,
@@ -129,9 +117,7 @@
     /**
      * This method is before after the MBean deregistration.
      * 
-     * @throws Exception
-     *             This exception will be caught by the MBean server and
-     *             re-thrown as an MBeanRegistrationException.
+     * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.
      */
     public void preDeregister() throws Exception {
         callMethod(m_preDeregisterMeth, MBeanHandler.PRE_DEREGISTER_METH_NAME,
@@ -149,14 +135,10 @@
     /**
      * Private method used to execute a given callback.
      * 
-     * @param methodMetadata
-     *            the metadata description of the callback
-     * @param methodName
-     *            the name of the callback
-     * @param params
-     *            the parameters of the callback
-     * @return the object eventually returned by the callback, or null if
-     *         nothing's returned
+     * @param methodMetadata  the metadata description of the callback
+     * @param methodName the name of the callback
+     * @param params the parameters of the callback
+     * @return the object eventually returned by the callback, or null if nothing's returned
      */
     private Object callMethod(MethodMetadata methodMetadata, String methodName,
             Object[] params) {
@@ -169,7 +151,7 @@
             }
         } catch (NoSuchMethodException e) {
             // should never happen : method exists
-            System.err.println("No such method!: " + methodName);
+            System.err.println("No such method : " + methodName);
             e.printStackTrace();
         } catch (IllegalAccessException e) {
             System.err.println("Illegal Access Exception");
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
index 4942971..a5b1955 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
@@ -35,10 +35,9 @@
     private MBeanHandler m_handler;
 
     /**
-     * Construct a new handler description for the given handler.
+     * Constructs a new handler description for the given handler.
      * 
-     * @param handler
-     *            the handler to describe
+     * @param handler the handler to describe
      */
     public JMXHandlerDescription(MBeanHandler handler) {
         super(handler);
@@ -46,7 +45,7 @@
     }
 
     /**
-     * Get handler information.
+     * Gets handler information.
      * 
      * @return the handler information.
      */
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
index d689cbb..56f436a 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
@@ -33,64 +33,61 @@
 public class JmxConfigFieldMap {
 
     /**
-     * m_properties : use to store the attributes exposed.
+     * The exposed attributes.
      */
     private Map < String, PropertyField > m_properties = new HashMap < String, PropertyField >();
     /**
-     * m_methods : use to store the methods exposed.
+     * The exposed methods.
      */
     private Map < String, MethodField[] > m_methods = new HashMap < String, MethodField[] >();
     /**
-     * m_notification : use to store the notification allowed.
+     * The allowed notifications.
      */
     private Map < String, NotificationField > m_notifications = new HashMap < String, NotificationField >();
     /**
-     * m_description : description of the Mbean.
+     * The description of the Mbean.
      */
     private String m_description;
 
     /**
-     * JmxConfigFieldMap : constructor.
+     * Constructor.
      */
     public JmxConfigFieldMap() {
 
     }
 
     /**
-     * getDescription : get the descritpion of the MBean.
+     * Gets the description of the MBean.
      * 
-     * @return String : Decription of the MBean
+     * @return the description of the MBean
      */
     public String getDecription() {
         return m_description;
     }
 
     /**
-     * setDescription : set the descritpion of the MBean.
+     * Sets the description of the MBean.
      * 
-     * @param description
-     *            : String which describe the Mbean
+     * @param description a String which describes the Mbean
      */
     public void setDescription(String description) {
         this.m_description = description;
     }
 
     /**
-     * addPropertyFromName : add a new attribute exposed in the Mbean.
+     * Adds a new attribute exposed in the Mbean.
      * 
-     * @param name
-     *            : name of the new property
-     * @param propertyField
-     *            : Field which describe the property
+     * @param name the name of the new property
+     * @param propertyField the field which describes the property
      */
     public void addPropertyFromName(String name, PropertyField propertyField) {
         m_properties.put(name, propertyField);
     }
 
     /**
-     * getProperties : get all of the properties exposed.
+     * Gets all of the properties exposed.
      * 
-     * @return : collection of all properties
+     * @return the collection of all properties
      */
     public Collection < PropertyField > getProperties() {
         if (m_properties != null) {
@@ -101,11 +98,10 @@
     }
 
     /**
-     * getPropertyFromName : get the property by the name.
+     * Gets the property by the name.
      * 
-     * @param name
-     *            : name of the requiered property
-     * @return PropertyField : the field requiered or null if is not found
+     * @param name the name of the required property
+     * @return the field required or null if is not found
      */
     public PropertyField getPropertyFromName(String name) {
         PropertyField prop = m_properties.get(name);
@@ -113,11 +109,10 @@
     }
 
     /**
-     * getPropertyFromField : get the property by the field.
+     * Gets the property by the field.
      * 
-     * @param field
-     *            : the requiered field
-     * @return PropertyField :
+     * @param field the required field
+     * @return the property by the field
      */
     public PropertyField getPropertyFromField(String field) {
         PropertyField property = null;
@@ -126,7 +121,7 @@
             PropertyField p = it.next();
             if (p.getField().compareTo(field) == 0) {
                 if (property != null) {
-                    System.err.println("a field already exist");
+                    System.err.println("a field already exists");
                 } else {
                     property = p;
                 }
@@ -136,12 +131,10 @@
     }
 
     /**
-     * addMethodFromName : add a new method descriptor from its name.
+     * Adds a new method descriptor from its name.
      * 
-     * @param name
-     *            : name of the method
-     * @param methodField
-     *            : descritpion of the method
+     * @param name the name of the method
+     * @param methodField the description of the method
      */
     public void addMethodFromName(String name, MethodField methodField) {
         MethodField[] mf;
@@ -160,13 +153,10 @@
     }
 
     /**
-     * addMethodFromName : add new methods descriptors from one name. (the
-     * method muste have the same name but different signature).
+     * Adds new methods descriptors from one name. (the method must have the same name but different signature).
      * 
-     * @param name
-     *            : name of the method
-     * @param methodsField
-     *            : descritpion of the methods
+     * @param name the name of the method
+     * @param methodsField the description of the methods
      */
     public void addMethodFromName(String name, MethodField[] methodsField) {
         MethodField[] mf;
@@ -186,12 +176,10 @@
     }
 
     /**
-     * DynamicMBeanImpl : add methods from name and erase the older if exist.
+     * Adds a method from name and erases the older if exists.
      * 
-     * @param name
-     *            : name of the method
-     * @param methodField
-     *            : method to be added
+     * @param name the name of the method
+     * @param methodField the method to be added
      */
     public void overrideMethodFromName(String name, MethodField methodField) {
         MethodField[] mf = new MethodField[1];
@@ -200,23 +188,20 @@
     }
 
     /**
-     * DynamicMBeanImpl : add methods from name and erase the older if exist.
+     * Add methods from name and erases the olders if exists.
      * 
-     * @param name
-     *            : name of the method
-     * @param methodsField
-     *            : array of methods to be added
+     * @param name the name of the method
+     * @param methodsField the array of methods to be added
      */
     public void overrideMethodFromName(String name, MethodField[] methodsField) {
         m_methods.put(name, methodsField);
     }
 
     /**
-     * getMethodFromName : return the metod(s) which are similar.
+     * Returns the method(s) with the given name.
      * 
-     * @param name
-     *            : name of requiered method
-     * @return MethodField[] : list of returned methods
+     * @param name the name of the methods
+     * @return the list of methods with the given name
      */
     public MethodField[] getMethodFromName(String name) {
         MethodField[] prop = m_methods.get(name);
@@ -224,14 +209,11 @@
     }
 
     /**
-     * getMethodFromName : get the method which the good signature.
+     * Gets the method with the good signature.
      * 
-     * @param operationName
-     *            : name of the method requiered
-     * @param signature
-     *            : signature requiered
-     * @return MethodField : the method which the same signature or null if not
-     *         found
+     * @param operationName the name of the method requiered
+     * @param signature the required signature
+     * @return the method which the same signature or null if not found
      */
     public MethodField getMethodFromName(String operationName,
             String[] signature) {
@@ -245,13 +227,11 @@
     }
 
     /**
-     * isSameSignature : compare two method signature.
+     * Compares two method signature.
      * 
-     * @param sig1
-     *            : first signature
-     * @param sig2
-     *            : second signature
-     * @return boolean : return true if the signature are similar fale else
+     * @param sig1 the first signature
+     * @param sig2 the second signature
+     * @return true if the signature are similar false otherwise
      */
     private boolean isSameSignature(String[] sig1, String[] sig2) {
         if (sig1.length != sig2.length) {
@@ -268,9 +248,9 @@
     }
 
     /**
-     * getMethods : return all methods store.
+     * Returns all methods store.
      * 
-     * @return Collection : collection of methodField[]
+     * @return the collection of methodField[]
      */
     public Collection < MethodField[] > getMethods() {
         if (m_methods != null) {
@@ -281,12 +261,10 @@
     }
 
     /**
-     * addNotificationFromName : add a notification .
+     * Adds a notification.
      * 
-     * @param name
-     *            :
-     * @param notificationField
-     *            :
+     * @param name the name of the notification
+     * @param notificationField the field involved with the notification.
      */
     public void addNotificationFromName(String name,
             NotificationField notificationField) {
@@ -294,11 +272,10 @@
     }
 
     /**
-     * getNotificationFromName : return the notification with requiered name.
+     * Returns the notification with the given name.
      * 
-     * @param name
-     *            : name requiered
-     * @return NotificationField : return the notification if exist, null else
+     * @param name the name of the notification to return
+     * @return the notification if it exists, {@code null} otherwise
      */
     public NotificationField getNotificationFromName(String name) {
         NotificationField prop = m_notifications.get(name);
@@ -306,9 +283,9 @@
     }
 
     /**
-     * getNotification : get all notifications define.
+     * Gets all notifications defined.
      * 
-     * @return Collection : return collection of NotificationField
+     * @return the collection of NotificationField
      */
     public Collection < NotificationField > getNotifications() {
         if (m_notifications != null) {
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
index aef634d..c733387 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
@@ -28,6 +28,7 @@
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
 
+import org.apache.felix.ipojo.FieldInterceptor;
 import org.apache.felix.ipojo.InstanceManager;
 import org.apache.felix.ipojo.PrimitiveHandler;
 import org.apache.felix.ipojo.architecture.HandlerDescription;
@@ -48,164 +49,156 @@
 public class MBeanHandler extends PrimitiveHandler {
 
     /**
-     * Name of the MBeanRegistration postDeregister method.
+     * The name of the MBeanRegistration postDeregister method.
      */
     public static final String POST_DEREGISTER_METH_NAME = "postDeregister";
 
     /**
-     * Name of the MBeanRegistration preDeregister method.
+     * The name of the MBeanRegistration preDeregister method.
      */
     public static final String PRE_DEREGISTER_METH_NAME = "preDeregister";
 
     /**
-     * Name of the MBeanRegistration postRegister method.
+     * The name of the MBeanRegistration postRegister method.
      */
     public static final String POST_REGISTER_METH_NAME = "postRegister";
 
     /**
-     * Name of the MBeanRegistration preRegister method.
+     * The name of the MBeanRegistration preRegister method.
      */
     public static final String PRE_REGISTER_METH_NAME = "preRegister";
 
     /**
-     * Name of the global configuration element.
+     * The name of the global configuration element.
      */
     private static final String JMX_CONFIG_ELT = "config";
 
     /**
-     * Name of the component object full name attribute.
+     * The name of the component object full name attribute.
      */
     private static final String JMX_OBJ_NAME_ELT = "objectName";
 
     /**
-     * Name of the component object name domain attribute.
+     * The name of the component object name domain attribute.
      */
     private static final String JMX_OBJ_NAME_DOMAIN_ELT = "domain";
 
     /**
-     * Name of the component object name attribute.
+     * The name of the component object name attribute.
      */
     private static final String JMX_OBJ_NAME_WO_DOMAIN_ELT = "name";
 
     /**
-     * Name of the attribute indicating if the handler uses MOSGi MBean server.
+     * The name of the attribute indicating if the handler uses MOSGi MBean server.
      */
     private static final String JMX_USES_MOSGI_ELT = "usesMOSGi";
 
     /**
-     * Name of a method element.
+     * The name of a method element.
      */
     private static final String JMX_METHOD_ELT = "method";
 
     /**
-     * Name of the property or method name attribute.
+     * The name of the property or method name attribute.
      */
     private static final String JMX_NAME_ELT = "name";
 
     /**
-     * Name of a method description attribute.
+     * The name of a method description attribute.
      */
     private static final String JMX_DESCRIPTION_ELT = "description";
 
     /**
-     * Name of a property element.
+     * The name of a property element.
      */
     private static final String JMX_PROPERTY_ELT = "property";
 
     /**
-     * Name of the field attribute.
+     * The name of the field attribute.
      */
     private static final String JMX_FIELD_ELT = "field";
 
     /**
-     * Name of the notification attribute.
+     * The name of the notification attribute.
      */
     private static final String JMX_NOTIFICATION_ELT = "notification";
 
     /**
-     * Name of the rights attribute.
+     * The name of the rights attribute.
      */
     private static final String JMX_RIGHTS_ELT = "rights";
 
     /**
-     * InstanceManager: use to store the InstanceManager instance.
+     * The instance manager. Used to store the InstanceManager instance.
      */
     private InstanceManager m_instanceManager;
     /**
-     * ServiceRegistration : use to register and unregister the Dynamic MBean.
+     * The service registration. Used to register and unregister the Dynamic MBean.
      */
     private ServiceRegistration m_serviceRegistration;
     /**
-     * JmxConfigFieldMap : use to store data when parsing metadata.xml.
+     * Stores data when parsing metadata.xml.
      */
     private JmxConfigFieldMap m_jmxConfigFieldMap;
     /**
-     * DynamicMBeanImpl : store the Dynamic MBean.
+     * Stores the Dynamic MBean.
      */
     private DynamicMBeanImpl m_MBean;
     /**
-     * String : constant which store the name of the class.
+     * Constant storing the name of the class.
      */
     private String m_namespace = "org.apache.felix.ipojo.handlers.jmx";
     /**
-     * Flag used to say if we use MOSGi framework.
+     * The flag used to inform if we use the MOSGi framework.
      */
     private boolean m_usesMOSGi = false;
     /**
-     * ObjectName used to register the MBean.
+     * The ObjectName used to register the MBean.
      */
     private ObjectName m_objectName;
     /**
-     * Flag used to say if the MBean is registered.
+     * The flag used to inform if the MBean is registered.
      */
     private boolean m_registered = false;
     /**
-     * object name specified in handler configuration. It can be null.
+     * The ObjectName specified in handler configuration. It can be null.
      */
     private String m_completeObjNameElt;
     /**
-     * object name without domain specified in handler configuration. It can be
-     * null.
+     * The ObjectName without domain specified in handler configuration. It can be null.
      */
     private String m_objNameWODomainElt;
     
     /**
-     * object name domain specified in handler configuration. It can be null.
+     * The ObjectName domain specified in handler configuration. It can be null.
      */
     private String m_domainElt;
     /**
-     * flag representing if the Pojo implements MBeanRegistration interface.
+     * The flag informing if the POJO implements the MBeanRegistration interface.
      */
     private boolean m_registerCallbacks;
     /**
-     * preRegister method of MBeanRegistration interface. It is null if pojo
-     * doesn't implement MBeanRegistration interface.
+     * The preRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
      */
     private MethodMetadata m_preRegisterMeth;
     /**
-     * postRegister method of MBeanRegistration interface. It is null if pojo
-     * doesn't implement MBeanRegistration interface.
+     * The postRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
      */
     private MethodMetadata m_postRegisterMeth;
     /**
-     * preDeregister method of MBeanRegistration interface. It is null if pojo
-     * doesn't implement MBeanRegistration interface.
+     * The preDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
      */
     private MethodMetadata m_preDeregisterMeth;
     /**
-     * postDeregister method of MBeanRegistration interface. It is null if pojo
-     * doesn't implement MBeanRegistration interface.
+     * The postDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
      */
     private MethodMetadata m_postDeregisterMeth;
 
     /**
-     * configure : construct the structure JmxConfigFieldMap.and the Dynamic
-     * Mbean.
+     * Constructs the structure JmxConfigFieldMap and the Dynamic Mbean.
      * 
-     * @param metadata
-     *            Element
-     * @param dict
-     *            Dictionary
+     * @param metadata the component metadata
+     * @param dict the instance configuration
      */
     public void configure(Element metadata, Dictionary dict) {
 
@@ -325,7 +318,7 @@
     }
 
     /**
-     * start : register the Dynamic Mbean.
+     * Registers the Dynamic Mbean.
      */
     public void start() {
         // create the corresponding MBean
@@ -383,7 +376,7 @@
     }
 
     /**
-     * Return the object name of the exposed component.
+     * Returns the object name of the exposed component.
      * 
      * @return the object name of the exposed component.
      */
@@ -415,10 +408,9 @@
     }
 
     /**
-     * Extract the package name from of given type.
+     * Extracts the package name from of given type.
      * 
-     * @param className
-     *            the type.
+     * @param className the type name.
      * @return the package name of the given type.
      */
     private String getPackageName(String className) {
@@ -433,7 +425,7 @@
     }
 
     /**
-     * stop : unregister the Dynamic Mbean.
+     * Unregisters the Dynamic Mbean.
      */
     public void stop() {
         if (m_usesMOSGi) {
@@ -457,14 +449,12 @@
     }
 
     /**
-     * setterCallback : call when a POJO member is modified externally.
+     * Called when a POJO member is modified externally.
      * 
-     * @param pojo
-     *            : the POJO object
-     * @param fieldName
-     *            : name of the modified field
-     * @param value
-     *            : new value of the field
+     * @param pojo the modified POJO object
+     * @param fieldName the name of the modified field
+     * @param value the new value of the field
+     * @see FieldInterceptor#onSet(Object, String, Object)
      */
     public void onSet(Object pojo, String fieldName, Object value) {
         // Check if the field is a configurable property
@@ -484,15 +474,13 @@
     }
 
     /**
-     * getterCallback : call when a POJO member is modified by the MBean.
+     * Called when a POJO member is read by the MBean.
      * 
-     * @param pojo
-     *            : pojo object.
-     * @param fieldName
-     *            : name of the modified field
-     * @param value
-     *            : old value of the field
-     * @return : new value of the field
+     * @param pojo the read POJO object.
+     * @param fieldName the name of the modified field
+     * @param value the old value of the field
+     * @return the (injected) value of the field
+     * @see FieldInterceptor#onGet(Object, String, Object)
      */
     public Object onGet(Object pojo, String fieldName, Object value) {
 
@@ -503,18 +491,15 @@
             m_instanceManager.onSet(pojo, fieldName, propertyField.getValue());
             return propertyField.getValue();
         }
-        // m_instanceManager.onSet(pojo, fieldName, value);
         return value;
     }
 
     /**
-     * getTypeFromAttributeField : get the type from a field name.
+     * Gets the type from a field name.
      * 
-     * @param fieldRequire
-     *            : name of the requiered field
-     * @param manipulation
-     *            : metadata extract from metadata.xml file
-     * @return : type of the field or null if it wasn't found
+     * @param fieldRequire the name of the required field
+     * @param manipulation the metadata extracted from metadata.xml file
+     * @return the type of the field or {@code null} if it wasn't found
      */
     private static String getTypeFromAttributeField(String fieldRequire,
             PojoMetadata manipulation) {
@@ -528,15 +513,12 @@
     }
 
     /**
-     * getMethodsFromName : get all the methods available which get this name.
+     * Gets all the methods available which get this name.
      * 
-     * @param methodName
-     *            : name of the requiered methods
-     * @param manipulation
-     *            : metadata extract from metadata.xml file
-     * @param description
-     *            : description which appears in jmx console
-     * @return : array of methods with the right name
+     * @param methodName the name of the required methods
+     * @param manipulation the metadata extract from metadata.xml file
+     * @param description the description which appears in JMX console
+     * @return the array of methods with the right name
      */
     private MethodField[] getMethodsFromName(String methodName,
             PojoMetadata manipulation, String description) {
@@ -560,9 +542,9 @@
     }
 
     /**
-     * Get the jmx handler description.
+     * Gets the JMX handler description.
      * 
-     * @return the jmx handler description.
+     * @return the JMX handler description.
      * @see org.apache.felix.ipojo.Handler#getDescription()
      */
     public HandlerDescription getDescription() {
@@ -570,8 +552,7 @@
     }
 
     /**
-     * Return the objectName used to register the MBean. If the MBean is not
-     * registered, return an empty string.
+     * Returns the objectName used to register the MBean. If the MBean is not registered, return an empty string.
      * 
      * @return the objectName used to register the MBean.
      * @see org.apache.felix.ipojo.Handler#getDescription()
@@ -585,7 +566,7 @@
     }
 
     /**
-     * Return true if the MBean is registered.
+     * Returns true if the MBean is registered.
      * 
      * @return true if the MBean is registered.
      */
@@ -594,20 +575,18 @@
     }
 
     /**
-     * Return true if the MBean must be registered thanks to whiteboard pattern
-     * of MOSGi.
+     * Returns true if the MBean must be registered thanks to white board pattern of MOSGi.
      * 
-     * @return true if the MBean must be registered thanks to whiteboard pattern
-     *         of MOSGi.
+     * @return {@code true} if the MBean must be registered thanks to white board pattern of MOSGi, false otherwise.
      */
     public boolean isUsesMOSGi() {
         return m_usesMOSGi;
     }
 
     /**
-     * Return true if the MOSGi framework is present on the OSGi plateforme.
+     * Returns true if the MOSGi framework is present on the OSGi platform.
      * 
-     * @return true if the MOSGi framework is present on the OSGi plateforme.
+     * @return {@code true} if the MOSGi framework is present on the OSGi platform, false otherwise.
      */
     public boolean isMOSGiExists() {
         for (Bundle bundle : m_instanceManager.getContext().getBundles()) {
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
index 9a8658e..da4da60 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
@@ -24,28 +24,26 @@
 import org.apache.felix.ipojo.parser.MethodMetadata;
 
 /**
- * this class build a method JMX description.
+ * This class builds a method JMX description.
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class MethodField {
 
     /**
-     * m_description : store the method descritpion.
+     * Stores the method description.
      */
     private String m_description;
     /**
-     * m_method : store the method properties.
+     * Stores the method properties.
      */
     private MethodMetadata m_method;
 
     /**
-     * MethodField : constructor.
+     * Constructor.
      * 
-     * @param method
-     *            : the metod properties
-     * @param description
-     *            : thes method description
+     * @param method the method properties
+     * @param description the method description
      */
     public MethodField(MethodMetadata method, String description) {
         this.m_method = method;
@@ -53,22 +51,34 @@
 
     }
 
+    /**
+     * Gets the method
+     * @return the method
+     */
     public MethodMetadata getMethod() {
         return m_method;
     }
 
+    /**
+     * Gets the description
+     * @return the description
+     */
     public String getDescription() {
         return m_description;
     }
 
+    /**
+     * Gets the name
+     * @return the name
+     */
     public String getName() {
         return m_method.getMethodName();
     }
 
     /**
-     * getParams : get the parameter in JMX format.
+     * Gets the parameter in JMX format.
      * 
-     * @return MBeanParameterInfo : return info on JMX format
+     * @return info on JMX format
      */
     public MBeanParameterInfo[] getParams() {
         MBeanParameterInfo[] mbean = new MBeanParameterInfo[m_method
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
index 96df23d..ac541c4 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
@@ -22,33 +22,30 @@
 import javax.management.MBeanNotificationInfo;
 
 /**
- * this calss build the notification descritpion structure.
+ * This class builds the notification description structure.
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class NotificationField {
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private String m_name;
     /**
-     * m_description : description of the notification.
+     * The description of the notification.
      */
     private String m_description;
     /**
-     * m_description : field of the notification.
+     * The field of the notification.
      */
     private String m_field;
 
     /**
-     * NotificationField : constructor.
+     * Constructor.
      * 
-     * @param name
-     *            : name of the notification
-     * @param field
-     *            : field which send a notification when it is modified
-     * @param description
-     *            : descritpion which appears in jmx console
+     * @param name the name of the notification
+     * @param field the field which send a notification when it is modified
+     * @param description the description which appears in JMX console
      */
 
     public NotificationField(String name, String field, String description) {
@@ -58,9 +55,9 @@
     }
 
     /**
-     * getNotificationInfo : return the MBeanNotificationInfo from this class.
+     * Returns the MBeanNotificationInfo from this class.
      * 
-     * @return : type of the field or null if it wasn't found
+     * @return the type of the field or {@code null} if it wasn't found
      */
     public MBeanNotificationInfo getNotificationInfo() {
         String[] notificationTypes = new String[1];
diff --git a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java
index cfbdf71..97271d4 100644
--- a/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java
+++ b/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java
@@ -20,48 +20,44 @@
 package org.apache.felix.ipojo.handlers.jmx;
 
 /**
- * this calss build the notification descritpion structure.
+ * This class build the notification description structure.
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class PropertyField {
 
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private String m_name;
     /**
-     * m_name : name of the notification.
+     *  The name of the notification.
      */
     private String m_field;
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private String m_rights;
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private String m_type;
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private Object m_value;
     /**
-     * m_name : name of the notification.
+     * The name of the notification.
      */
     private boolean m_notification = false;
 
     /**
-     * PropertyField : constructor.
+     * Constructor.
      * 
-     * @param name
-     *            : name of the properety
-     * @param field
-     *            : field which send a notification when it is modified
-     * @param rights
-     *            : the rights of the attribute (ie: 'r' or 'w')
-     * @param type
-     *            : the type of the attribute
+     * @param name the name of the properety
+     * @param field the field which send a notification when it is modified
+     * @param rights the rights of the attribute (ie: 'r' or 'w')
+     * @param type the type of the attribute
      */
     public PropertyField(String name, String field, String rights, String type) {
         this.setName(name);
@@ -74,69 +70,124 @@
         }
     }
 
+    /**
+     * Returns the field
+     * @return the field
+     */
     public String getField() {
         return m_field;
     }
 
+    /**
+     * Modify the field
+     * @param field the new field
+     */
     public void setField(String field) {
         this.m_field = field;
     }
 
+    /**
+     * Returns the name
+     * @return the name
+     */
     public String getName() {
         return m_name;
     }
 
+    /**
+     * Modify the name
+     * @param name the new name
+     */
     public void setName(String name) {
         this.m_name = name;
     }
 
+    /**
+     * Returns the rights
+     * @return the rights
+     */
     public String getRights() {
         return m_rights;
     }
 
+    /**
+     * Modify the rights
+     * @param rights the new rights
+     */
     public void setRights(String rights) {
         this.m_rights = rights;
     }
 
+    /**
+     * Returns the value
+     * @return the value
+     */
     public Object getValue() {
         return m_value;
     }
 
+    /**
+     * Modify the value
+     * @param value the new value
+     */
     public void setValue(Object value) {
         this.m_value = value;
     }
 
+    /**
+     * Returns the type
+     * @return the type
+     */
     public String getType() {
         return this.m_type;
     }
 
+    /**
+     * Returns the description
+     * @return the description
+     */
     public String getDescription() {
         // TODO Auto-generated method stub
         return null;
     }
 
+    /**
+     * Returns true if this property field is readable, false otherwise.
+     * @return {@code true} if this property field is readable, {@code false} otherwise.
+     */
     public boolean isReadable() {
         return this.getRights().equals("r") || this.getRights().equals("w");
     }
 
+    /**
+     * Returns true if this property field is writable, false otherwise.
+     * @return {@code true} if this property field is writable, {@code false} otherwise.
+     */
     public boolean isWritable() {
         return this.getRights().equals("w");
     }
 
+    /**
+     * Returns true if this property field is notifiable, false otherwise.
+     * @return {@code true} if this property field is notifiable, {@code false} otherwise.
+     */
     public boolean isNotifiable() {
         return this.m_notification;
     }
 
+    /**
+     * Modify the notifiability of this property field.
+     * @param value the new notifiability of this property field.
+     */
     public void setNotifiable(boolean value) {
         this.m_notification = value;
     }
 
     /**
-     * isRightsValid : return is the rights is valid or not (ie = 'r' || 'w').
+     * Is the rights is valid or not ? (ie = 'r' || 'w').
      * 
-     * @param rights
-     *            : string represents the rights
-     * @return boolean : return true if rights = 'r' or 'w'
+     * @param rights string representing the rights
+     * @return boolean : return {@code true} if rights = 'r' or 'w'
      */
     public static boolean isRightsValid(String rights) {
         return rights != null && (rights.equals("r") || rights.equals("w"));
diff --git a/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java b/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
index 328e093..916cfc8 100644
--- a/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
+++ b/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
@@ -1,297 +1,293 @@
-/* 

- * 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.ipojo.handler.temporal;

-

-import java.lang.reflect.Array;

-import java.lang.reflect.Proxy;

-

-import org.apache.felix.ipojo.FieldInterceptor;

-import org.apache.felix.ipojo.Nullable;

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.handlers.dependency.NullableObject;

-import org.apache.felix.ipojo.util.DependencyModel;

-import org.osgi.framework.BundleContext;

-import org.osgi.framework.Filter;

-import org.osgi.framework.ServiceReference;

-

-/**

- * Temporal dependency. A temporal dependency waits (block) for the availability

- * of the service. If no provider arrives in the specified among of time, a

- * runtime exception is thrown.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class TemporalDependency extends DependencyModel implements

-        FieldInterceptor {

-

-    /**

-     * Timeout.

-     */

-    private long m_timeout;

-

-    /**

-     * Default-Implementation.

-     */

-    private String m_di;

-

-    /**

-     * Nullable object / Default-Implementation instance if used.

-     */

-    private Object m_nullableObject;

-

-    /**

-     * Handler managing this dependency.

-     */

-    private PrimitiveHandler m_handler;

-

-    /**

-     * Timetout policy. Null inject null Nullable injects a nullable object or

-     * an array with a nullable object Default-Implementation inject an object

-     * created from the specified injected implementation or an array with it

-     * Empty array inject an empty array (must be an aggregate dependency) No

-     * policy (0) throw a runtime exception when the timeout occurs *

-     */

-    private int m_policy;

-

-    /**

-     * Constructor.

-     * @param spec : service specification

-     * @param agg : is the dependency aggregate ?

-     * @param filter : LDAP filter

-     * @param context : service context

-     * @param timeout : timeout

-     * @param handler : Handler managing this dependency

-     * @param defaultImpl : class used as default-implementation

-     * @param policy : onTimeout policy

-     */

-    public TemporalDependency(Class spec, boolean agg, Filter filter,

-            BundleContext context, long timeout, int policy,

-            String defaultImpl, TemporalHandler handler) {

-        super(spec, agg, true, filter, null,

-                DependencyModel.DYNAMIC_BINDING_POLICY, context, handler);

-        m_di = defaultImpl;

-        m_policy = policy;

-        m_timeout = timeout;

-        m_handler = handler;

-    }

-

-    /**

-     * The dependency has been reconfigured.

-     * @param arg0 : new service references

-     * @param arg1 : old service references

-     * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[],

-     *      org.osgi.framework.ServiceReference[])

-     */

-    public void onDependencyReconfiguration(ServiceReference[] arg0,

-            ServiceReference[] arg1) {

-        throw new UnsupportedOperationException(

-                "Reconfiguration not yet supported");

-    }

-

-    /**

-     * A provider arrives.

-     * @param arg0 : service reference of the new provider.

-     * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference)

-     */

-    public void onServiceArrival(ServiceReference arg0) {

-        // Notify if a thread is waiting.

-        synchronized (this) {

-            notifyAll();

-        }

-    }

-

-    /**

-     * A provider leaves. Nothing to do.

-     * @param arg0 : leaving service references.

-     * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)

-     */

-    public synchronized void onServiceDeparture(ServiceReference arg0) {

-    }

-

-    /**

-     * The code require a value of the monitored field. If providers are

-     * available, the method return service object(s) immediately. Else, the

-     * thread is blocked until an arrival. If no provider arrives during the

-     * among of time specified, the method throws a Runtime Exception.

-     * @param arg0 : POJO instance asking for the service

-     * @param arg1 : field name

-     * @param arg2 : previous value

-     * @return the object to inject.

-     * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object,

-     *      java.lang.String, java.lang.Object)

-     */

-    public synchronized Object onGet(Object arg0, String arg1, Object arg2) {

-        ServiceReference[] refs = getServiceReferences();

-        if (refs != null) {

-            // Immediate return.

-            if (isAggregate()) {

-                Object[] svc = (Object[]) Array.newInstance(getSpecification(),

-                        refs.length);

-                for (int i = 0; i < svc.length; i++) {

-                    svc[i] = getService(refs[i]);

-                }

-                return svc;

-            } else {

-                return getService(refs[0]);

-            }

-        } else {

-            // Begin to wait ...

-            long enter = System.currentTimeMillis();

-            boolean exhausted = false;

-            ServiceReference ref = null;

-            synchronized (this) {

-                while (getServiceReference() == null && !exhausted) {

-                    try {

-                        wait(1);

-                    } catch (InterruptedException e) {

-                        // We was interrupted ....

-                    } finally {

-                        long end = System.currentTimeMillis();

-                        exhausted = (end - enter) > m_timeout;

-                    }

-                }

-            }

-            // Check

-            if (exhausted) {

-                return onTimeout();

-            } else {

-                ref = getServiceReference();

-                if (isAggregate()) {

-                    Object[] svc = (Object[]) Array.newInstance(

-                            getSpecification(), 1);

-                    svc[0] = getService(ref);

-                    return svc;

-                } else {

-                    return getService(ref);

-                }

-            }

-        }

-    }

-

-    /**

-     * Start method.

-     * Initializes the nullable object.

-     * @see org.apache.felix.ipojo.util.DependencyModel#start()

-     */

-    public void start() {

-        super.start();

-        switch (m_policy) {

-            case TemporalHandler.NULL:

-                m_nullableObject = null;

-                break;

-            case TemporalHandler.NULLABLE:

-                // To load the proxy we use the POJO class loader. Indeed, this

-                // classloader imports iPOJO (so can access to Nullable) and has

-                // access to the service specification.

-                try {

-                    m_nullableObject = Proxy.newProxyInstance(m_handler

-                            .getInstanceManager().getClazz().getClassLoader(),

-                            new Class[] { getSpecification(), Nullable.class },

-                            new NullableObject()); // NOPMD

-                    if (isAggregate()) {

-                        Object[] array = (Object[]) Array.newInstance(

-                                getSpecification(), 1);

-                        array[0] = m_nullableObject;

-                        m_nullableObject = array;

-                    }

-                } catch (NoClassDefFoundError e) {

-                    // A NoClassDefFoundError is thrown if the specification

-                    // uses a

-                    // class not accessible by the actual instance.

-                    // It generally comes from a missing import.

-                    throw new IllegalStateException(

-                            "Cannot create the Nullable object, a referenced class cannot be loaded: "

-                                    + e.getMessage());

-                }

-

-                break;

-            case TemporalHandler.DEFAULT_IMPLEMENTATION:

-                // Create the default-implementation object.

-                try {

-                    Class clazz = m_handler.getInstanceManager().getContext()

-                            .getBundle().loadClass(m_di);

-                    m_nullableObject = clazz.newInstance();

-                } catch (IllegalAccessException e) {

-                    throw new IllegalStateException(

-                            "Cannot load the default-implementation " + m_di

-                                    + " : " + e.getMessage());

-                } catch (InstantiationException e) {

-                    throw new IllegalStateException(

-                            "Cannot load the default-implementation " + m_di

-                                    + " : " + e.getMessage());

-                } catch (ClassNotFoundException e) {

-                    throw new IllegalStateException(

-                            "Cannot load the default-implementation " + m_di

-                                    + " : " + e.getMessage());

-                }

-                if (isAggregate()) {

-                    Object[] array = (Object[]) Array.newInstance(

-                            getSpecification(), 1);

-                    array[0] = m_nullableObject;

-                    m_nullableObject = array;

-                }

-                break;

-            case TemporalHandler.EMPTY_ARRAY:

-                m_nullableObject = Array.newInstance(getSpecification(), 0);

-                break;

-            default: // Cannot occurs

-                break;

-        }

-    }

-

-    /**

-     * Stop method.

-     * Just release the reference on the nullable object.

-     * @see org.apache.felix.ipojo.util.DependencyModel#stop()

-     */

-    public void stop() {

-        super.stop();

-        m_nullableObject = null;

-    }

-

-    /**

-     * The monitored field receives a value. Nothing to do.

-     * @param arg0 : POJO setting the value.

-     * @param arg1 : field name

-     * @param arg2 : received value

-     * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object,

-     *      java.lang.String, java.lang.Object)

-     */

-    public void onSet(Object arg0, String arg1, Object arg2) {

-    }

-

-    /**

-     * Implements the timeout policy according to the specified configuration.

-     * @return the object to return when the timeout occurs.

-     */

-    private Object onTimeout() {

-        switch (m_policy) {

-            case TemporalHandler.NULL:

-            case TemporalHandler.NULLABLE:

-            case TemporalHandler.DEFAULT_IMPLEMENTATION:

-            case TemporalHandler.EMPTY_ARRAY:

-                return m_nullableObject;

-            default:

-                // Throws a runtime exception

-                throw new RuntimeException("Service "

-                        + getSpecification().getName()

-                        + " unavailable : timeout");

-        }

-    }

-

-}

+/* 
+ * 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.ipojo.handler.temporal;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Proxy;
+
+import org.apache.felix.ipojo.FieldInterceptor;
+import org.apache.felix.ipojo.Nullable;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.handlers.dependency.NullableObject;
+import org.apache.felix.ipojo.util.DependencyModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Temporal dependency. A temporal dependency waits (block) for the availability
+ * of the service. If no provider arrives in the specified among of time, a
+ * runtime exception is thrown.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TemporalDependency extends DependencyModel implements
+        FieldInterceptor {
+
+    /**
+     * The timeout.
+     */
+    private long m_timeout;
+
+    /**
+     * The default implementation.
+     */
+    private String m_di;
+
+    /**
+     * The {@link Nullable} object or Default-Implementation instance if used.
+     */
+    private Object m_nullableObject;
+
+    /**
+     * The handler managing this dependency.
+     */
+    private PrimitiveHandler m_handler;
+
+    /**
+     * The timeout policy. Null injects null, {@link Nullable} injects a nullable object or
+     * an array with a nullable object, Default-Implementation injects an object
+     * created from the specified injected implementation or an array with it
+     * Empty array inject an empty array (must be an aggregate dependency) No
+     * policy (0) throw a runtime exception when the timeout occurs *
+     */
+    private int m_policy;
+
+    /**
+     * Constructor.
+     * @param spec service specification
+     * @param agg is the dependency aggregate ?
+     * @param filter LDAP filter
+     * @param context service context
+     * @param timeout timeout
+     * @param handler Handler managing this dependency
+     * @param defaultImpl class used as default-implementation
+     * @param policy onTimeout policy
+     */
+    public TemporalDependency(Class spec, boolean agg, Filter filter,
+            BundleContext context, long timeout, int policy,
+            String defaultImpl, TemporalHandler handler) {
+        super(spec, agg, true, filter, null,
+                DependencyModel.DYNAMIC_BINDING_POLICY, context, handler);
+        m_di = defaultImpl;
+        m_policy = policy;
+        m_timeout = timeout;
+        m_handler = handler;
+    }
+
+    /**
+     * The dependency has been reconfigured.
+     * @param arg0 new service references
+     * @param arg1 old service references
+     * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[],
+     *      org.osgi.framework.ServiceReference[])
+     */
+    public void onDependencyReconfiguration(ServiceReference[] arg0,
+            ServiceReference[] arg1) {
+        throw new UnsupportedOperationException(
+                "Reconfiguration not yet supported");
+    }
+
+    /**
+     * A provider arrives.
+     * @param arg0 service reference of the new provider.
+     * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference)
+     */
+    public void onServiceArrival(ServiceReference arg0) {
+        // Notify if a thread is waiting.
+        synchronized (this) {
+            notifyAll();
+        }
+    }
+
+    /**
+     * A provider leaves. Nothing to do.
+     * @param arg0 leaving service references.
+     * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)
+     */
+    public synchronized void onServiceDeparture(ServiceReference arg0) {
+    }
+
+    /**
+     * The code require a value of the monitored field. If providers are
+     * available, the method return service object(s) immediately. Else, the
+     * thread is blocked until an arrival. If no provider arrives during the
+     * among of time specified, the method throws a Runtime Exception.
+     * @param arg0 POJO instance asking for the service
+     * @param arg1 field name
+     * @param arg2 previous value
+     * @return the object to inject.
+     * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
+     */
+    public synchronized Object onGet(Object arg0, String arg1, Object arg2) {
+        ServiceReference[] refs = getServiceReferences();
+        if (refs != null) {
+            // Immediate return.
+            if (isAggregate()) {
+                Object[] svc = (Object[]) Array.newInstance(getSpecification(),
+                        refs.length);
+                for (int i = 0; i < svc.length; i++) {
+                    svc[i] = getService(refs[i]);
+                }
+                return svc;
+            } else {
+                return getService(refs[0]);
+            }
+        } else {
+            // Begin to wait ...
+            long enter = System.currentTimeMillis();
+            boolean exhausted = false;
+            ServiceReference ref = null;
+            synchronized (this) {
+                while (getServiceReference() == null && !exhausted) {
+                    try {
+                        wait(1);
+                    } catch (InterruptedException e) {
+                        // We was interrupted ....
+                    } finally {
+                        long end = System.currentTimeMillis();
+                        exhausted = (end - enter) > m_timeout;
+                    }
+                }
+            }
+            // Check
+            if (exhausted) {
+                return onTimeout();
+            } else {
+                ref = getServiceReference();
+                if (isAggregate()) {
+                    Object[] svc = (Object[]) Array.newInstance(
+                            getSpecification(), 1);
+                    svc[0] = getService(ref);
+                    return svc;
+                } else {
+                    return getService(ref);
+                }
+            }
+        }
+    }
+
+    /**
+     * Start method. Initializes the nullable object.
+     * @see org.apache.felix.ipojo.util.DependencyModel#start()
+     */
+    public void start() {
+        super.start();
+        switch (m_policy) {
+            case TemporalHandler.NULL:
+                m_nullableObject = null;
+                break;
+            case TemporalHandler.NULLABLE:
+                // To load the proxy we use the POJO class loader. Indeed, this
+                // classloader imports iPOJO (so can access to Nullable) and has
+                // access to the service specification.
+                try {
+                    m_nullableObject = Proxy.newProxyInstance(m_handler
+                            .getInstanceManager().getClazz().getClassLoader(),
+                            new Class[] { getSpecification(), Nullable.class },
+                            new NullableObject()); // NOPMD
+                    if (isAggregate()) {
+                        Object[] array = (Object[]) Array.newInstance(
+                                getSpecification(), 1);
+                        array[0] = m_nullableObject;
+                        m_nullableObject = array;
+                    }
+                } catch (NoClassDefFoundError e) {
+                    // A NoClassDefFoundError is thrown if the specification
+                    // uses a
+                    // class not accessible by the actual instance.
+                    // It generally comes from a missing import.
+                    throw new IllegalStateException(
+                            "Cannot create the Nullable object, a referenced class cannot be loaded: "
+                                    + e.getMessage());
+                }
+
+                break;
+            case TemporalHandler.DEFAULT_IMPLEMENTATION:
+                // Create the default-implementation object.
+                try {
+                    Class clazz = m_handler.getInstanceManager().getContext()
+                            .getBundle().loadClass(m_di);
+                    m_nullableObject = clazz.newInstance();
+                } catch (IllegalAccessException e) {
+                    throw new IllegalStateException(
+                            "Cannot load the default-implementation " + m_di
+                                    + " : " + e.getMessage());
+                } catch (InstantiationException e) {
+                    throw new IllegalStateException(
+                            "Cannot load the default-implementation " + m_di
+                                    + " : " + e.getMessage());
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalStateException(
+                            "Cannot load the default-implementation " + m_di
+                                    + " : " + e.getMessage());
+                }
+                if (isAggregate()) {
+                    Object[] array = (Object[]) Array.newInstance(
+                            getSpecification(), 1);
+                    array[0] = m_nullableObject;
+                    m_nullableObject = array;
+                }
+                break;
+            case TemporalHandler.EMPTY_ARRAY:
+                m_nullableObject = Array.newInstance(getSpecification(), 0);
+                break;
+            default: // Cannot occurs
+                break;
+        }
+    }
+
+    /**
+     * Stop method. Just releases the reference on the nullable object.
+     * @see org.apache.felix.ipojo.util.DependencyModel#stop()
+     */
+    public void stop() {
+        super.stop();
+        m_nullableObject = null;
+    }
+
+    /**
+     * The monitored field receives a value. Nothing to do.
+     * @param arg0 POJO setting the value.
+     * @param arg1 field name
+     * @param arg2 received value
+     * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object, java.lang.String, java.lang.Object)
+     */
+    public void onSet(Object arg0, String arg1, Object arg2) {
+    }
+
+    /**
+     * Implements the timeout policy according to the specified configuration.
+     * @return the object to return when the timeout occurs.
+     */
+    private Object onTimeout() {
+        switch (m_policy) {
+            case TemporalHandler.NULL:
+            case TemporalHandler.NULLABLE:
+            case TemporalHandler.DEFAULT_IMPLEMENTATION:
+            case TemporalHandler.EMPTY_ARRAY:
+                return m_nullableObject;
+            default:
+                // Throws a runtime exception
+                throw new RuntimeException("Service "
+                        + getSpecification().getName()
+                        + " unavailable : timeout");
+        }
+    }
+
+}
diff --git a/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java b/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
index 0be2dbb..24708aa 100644
--- a/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
+++ b/ipojo/handler/temporal/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
@@ -1,197 +1,196 @@
-/* 

- * 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.ipojo.handler.temporal;

-

-import java.util.ArrayList;

-import java.util.Dictionary;

-import java.util.List;

-

-import org.apache.felix.ipojo.ConfigurationException;

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.metadata.Element;

-import org.apache.felix.ipojo.parser.FieldMetadata;

-import org.apache.felix.ipojo.parser.PojoMetadata;

-import org.apache.felix.ipojo.util.DependencyModel;

-import org.apache.felix.ipojo.util.DependencyStateListener;

-import org.osgi.framework.Filter;

-import org.osgi.framework.InvalidSyntaxException;

-

-/**

-* Temporal dependency handler.

-* A temporal dependency waits (block) for the availability of the service.

-* If no provider arrives in the specified among of time, a runtime exception is thrown.

-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

-*/

-public class TemporalHandler extends PrimitiveHandler implements DependencyStateListener {

-    

-    /**

-     * Default timeout if not specified.

-     */

-    public static final int DEFAULT_TIMEOUT = 3000;

-    

-    /**

-     * No policy.

-     */

-    public static final int NO_POLICY = 0;

-    /**

-     * Use a nullable object.

-     */

-    public static final int NULLABLE = 1;

-    /**

-     * Use a default-implementation object.

-     */

-    public static final int DEFAULT_IMPLEMENTATION = 2;

-    /**

-     * Use an empty array.

-     */

-    public static final int EMPTY_ARRAY = 3;

-    /**

-     * Use null. 

-     */

-    public static final int NULL = 4;

-    

-    /**

-     * Handler namespace.

-     */

-    public static final String NAMESPACE = "org.apache.felix.ipojo.handler.temporal";

-    

-    /**

-     * List of managed dependencies.

-     */

-    private List/*<deps>*/ m_dependencies = new ArrayList(1);

-

-    /**

-     * Start method. Starts managed dependencies.

-     * @see org.apache.felix.ipojo.Handler#start()

-     */

-    public void start() {

-        for (int i = 0; i < m_dependencies.size(); i++) {

-            ((TemporalDependency) m_dependencies.get(i)).start();

-        }

-    }

-    

-    /**

-     * Stop  method. Stops managed dependencies.

-     * @see org.apache.felix.ipojo.Handler#stop()

-     */

-    public void stop() {

-        for (int i = 0; i < m_dependencies.size(); i++) {

-            ((TemporalDependency) m_dependencies.get(i)).stop();

-        }

-        m_dependencies.clear();

-    }

-

-    /**

-     * Configure method.

-     * Create managed dependencies.

-     * @param meta : component type metadata.

-     * @param dictionary : instance configuration.

-     * @throws ConfigurationException : the dependency is not configured correctly

-     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

-     */

-    public void configure(Element meta, Dictionary dictionary) throws ConfigurationException {

-        PojoMetadata manipulation = getFactory().getPojoMetadata();

-        Element[] deps = meta.getElements("requires", NAMESPACE);

-        for (int i = 0; i < deps.length; i++) {

-            if (!deps[i].containsAttribute("field") || m_dependencies.contains(deps[i].getAttribute("field"))) {

-                error("One temporal dependency must be attached to a field or the field is already used");

-                return;

-            }

-            String field = deps[i].getAttribute("field");

-

-            FieldMetadata fieldmeta = manipulation.getField(field);

-            if (fieldmeta == null) {

-                error("The field " + field + " does not exist in the class " + getInstanceManager().getClassName());

-                return;

-            }             

-                        

-            String fil = deps[i].getAttribute("filter");

-            Filter filter = null; 

-            if (fil != null) {

-                try {

-                    filter = getInstanceManager().getContext().createFilter(fil);

-                } catch (InvalidSyntaxException e) {

-                    error("Cannot create the field from " + fil + ": " + e.getMessage());

-                    return;

-                }

-            }

-            

-            boolean agg = false;

-            String spec = fieldmeta.getFieldType();

-            if (spec.endsWith("[]")) {

-                agg = true;

-                spec = spec.substring(0, spec.length() - 2);

-            }

-            

-            long timeout = DEFAULT_TIMEOUT;

-            if (deps[i].containsAttribute("timeout")) {

-                String to = deps[i].getAttribute("timeout");

-                if (to.equalsIgnoreCase("infinite")  || to.equalsIgnoreCase("-1")) {

-                    timeout = Long.MAX_VALUE; // Infinite wait time ...

-                } else {

-                    timeout = new Long(deps[i].getAttribute("timeout")).longValue();

-                }

-            }

-            

-            int policy = NO_POLICY;

-            String di = null;

-            String onTimeout = deps[i].getAttribute("onTimeout");

-            if (onTimeout != null) {

-                if (onTimeout.equalsIgnoreCase("nullable")) {

-                    policy = NULLABLE;

-                } else if (onTimeout.equalsIgnoreCase("empty-array")) {

-                    policy = EMPTY_ARRAY;

-                    if (! agg) {

-                        // The empty array policy can only be used on aggregate dependencies

-                        error("Cannot use the empty array policy for " + field + " : non aggregate dependency.");

-                    }

-                } else if (onTimeout.equalsIgnoreCase("null")) {

-                    policy = NULL;

-                } else if (onTimeout.length() > 0) {

-                    di = onTimeout;

-                    policy = DEFAULT_IMPLEMENTATION;

-                }

-            }

-         

-            Class specification = DependencyModel.loadSpecification(spec, getInstanceManager().getContext());

-            TemporalDependency dep = new TemporalDependency(specification, agg, filter, getInstanceManager().getContext(), timeout, policy, di, this);

-            m_dependencies.add(dep);

-            

-            getInstanceManager().register(fieldmeta, dep);

-        }        

-    }

-

-    /**

-     * Nothing to do.

-     * A temporal dependency is always valid.

-     * @param dependencymodel : dependency.

-     * @see org.apache.felix.ipojo.util.DependencyStateListener#invalidate(org.apache.felix.ipojo.util.DependencyModel)

-     */

-    public void invalidate(DependencyModel dependencymodel) {    }

-

-    /**

-     * Nothing to do.

-     * A temporal dependency is always valid.

-     * @param dependencymodel : dependency.

-     * @see org.apache.felix.ipojo.util.DependencyStateListener#validate(org.apache.felix.ipojo.util.DependencyModel)

-     */

-    public void validate(DependencyModel dependencymodel) {    }

-    

-

-}

+/* 
+ * 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.ipojo.handler.temporal;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.FieldMetadata;
+import org.apache.felix.ipojo.parser.PojoMetadata;
+import org.apache.felix.ipojo.util.DependencyModel;
+import org.apache.felix.ipojo.util.DependencyStateListener;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+* Temporal dependency handler.
+* A temporal dependency waits (block) for the availability of the service.
+* If no provider arrives in the specified among of time, a runtime exception is thrown.
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class TemporalHandler extends PrimitiveHandler implements DependencyStateListener {
+    
+    /**
+     * Default timeout if not specified.
+     */
+    public static final int DEFAULT_TIMEOUT = 3000;
+    
+    /**
+     * No policy.
+     */
+    public static final int NO_POLICY = 0;
+    /**
+     * Uses a nullable object.
+     */
+    public static final int NULLABLE = 1;
+    /**
+     * Uses a default-implementation object.
+     */
+    public static final int DEFAULT_IMPLEMENTATION = 2;
+    /**
+     * Uses an empty array.
+     */
+    public static final int EMPTY_ARRAY = 3;
+    /**
+     * Uses {@code null}. 
+     */
+    public static final int NULL = 4;
+    
+    /**
+     * The handler namespace.
+     */
+    public static final String NAMESPACE = "org.apache.felix.ipojo.handler.temporal";
+    
+    /**
+     * The list of managed dependencies.
+     */
+    private List/*<deps>*/ m_dependencies = new ArrayList(1);
+
+    /**
+     * Start method. Starts managed dependencies.
+     * @see org.apache.felix.ipojo.Handler#start()
+     */
+    public void start() {
+        for (int i = 0; i < m_dependencies.size(); i++) {
+            ((TemporalDependency) m_dependencies.get(i)).start();
+        }
+    }
+    
+    /**
+     * Stop method. Stops managed dependencies.
+     * @see org.apache.felix.ipojo.Handler#stop()
+     */
+    public void stop() {
+        for (int i = 0; i < m_dependencies.size(); i++) {
+            ((TemporalDependency) m_dependencies.get(i)).stop();
+        }
+        m_dependencies.clear();
+    }
+
+    /**
+     * Configure method. Creates managed dependencies.
+     * @param meta the component type metadata.
+     * @param dictionary the instance configuration.
+     * @throws ConfigurationException if the dependency is not configured correctly
+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
+     */
+    public void configure(Element meta, Dictionary dictionary) throws ConfigurationException {
+        PojoMetadata manipulation = getFactory().getPojoMetadata();
+        Element[] deps = meta.getElements("requires", NAMESPACE);
+        for (int i = 0; i < deps.length; i++) {
+            if (!deps[i].containsAttribute("field") || m_dependencies.contains(deps[i].getAttribute("field"))) {
+                error("One temporal dependency must be attached to a field or the field is already used");
+                return;
+            }
+            String field = deps[i].getAttribute("field");
+
+            FieldMetadata fieldmeta = manipulation.getField(field);
+            if (fieldmeta == null) {
+                error("The field " + field + " does not exist in the class " + getInstanceManager().getClassName());
+                return;
+            }             
+                        
+            String fil = deps[i].getAttribute("filter");
+            Filter filter = null; 
+            if (fil != null) {
+                try {
+                    filter = getInstanceManager().getContext().createFilter(fil);
+                } catch (InvalidSyntaxException e) {
+                    error("Cannot create the field from " + fil + ": " + e.getMessage());
+                    return;
+                }
+            }
+            
+            boolean agg = false;
+            String spec = fieldmeta.getFieldType();
+            if (spec.endsWith("[]")) {
+                agg = true;
+                spec = spec.substring(0, spec.length() - 2);
+            }
+            
+            long timeout = DEFAULT_TIMEOUT;
+            if (deps[i].containsAttribute("timeout")) {
+                String to = deps[i].getAttribute("timeout");
+                if (to.equalsIgnoreCase("infinite")  || to.equalsIgnoreCase("-1")) {
+                    timeout = Long.MAX_VALUE; // Infinite wait time ...
+                } else {
+                    timeout = new Long(deps[i].getAttribute("timeout")).longValue();
+                }
+            }
+            
+            int policy = NO_POLICY;
+            String di = null;
+            String onTimeout = deps[i].getAttribute("onTimeout");
+            if (onTimeout != null) {
+                if (onTimeout.equalsIgnoreCase("nullable")) {
+                    policy = NULLABLE;
+                } else if (onTimeout.equalsIgnoreCase("empty-array")) {
+                    policy = EMPTY_ARRAY;
+                    if (! agg) {
+                        // The empty array policy can only be used on aggregate dependencies
+                        error("Cannot use the empty array policy for " + field + " : non aggregate dependency.");
+                    }
+                } else if (onTimeout.equalsIgnoreCase("null")) {
+                    policy = NULL;
+                } else if (onTimeout.length() > 0) {
+                    di = onTimeout;
+                    policy = DEFAULT_IMPLEMENTATION;
+                }
+            }
+         
+            Class specification = DependencyModel.loadSpecification(spec, getInstanceManager().getContext());
+            TemporalDependency dep = new TemporalDependency(specification, agg, filter, getInstanceManager().getContext(), timeout, policy, di, this);
+            m_dependencies.add(dep);
+            
+            getInstanceManager().register(fieldmeta, dep);
+        }        
+    }
+
+    /**
+     * Nothing to do.
+     * A temporal dependency is always valid.
+     * @param dependencymodel dependency.
+     * @see org.apache.felix.ipojo.util.DependencyStateListener#invalidate(org.apache.felix.ipojo.util.DependencyModel)
+     */
+    public void invalidate(DependencyModel dependencymodel) {    }
+
+    /**
+     * Nothing to do.
+     * A temporal dependency is always valid.
+     * @param dependencymodel dependency.
+     * @see org.apache.felix.ipojo.util.DependencyStateListener#validate(org.apache.felix.ipojo.util.DependencyModel)
+     */
+    public void validate(DependencyModel dependencymodel) {    }
+    
+
+}
diff --git a/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java b/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java
index d0206b5..47c34aa 100644
--- a/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java
+++ b/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java
@@ -1,173 +1,173 @@
-/* 

- * 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.ipojo.handler.wbp;

-

-import java.lang.reflect.InvocationTargetException;

-

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.util.Callback;

-import org.apache.felix.ipojo.util.Tracker;

-import org.apache.felix.ipojo.util.TrackerCustomizer;

-import org.osgi.framework.Filter;

-import org.osgi.framework.ServiceReference;

-

-/**

- * Manage a white board pattern.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class WhiteBoardManager implements TrackerCustomizer {

-    

-    /**

-     * monitored filter. 

-     */

-    private Filter m_filter;

-    

-    /**

-     * onArrival method. 

-     */

-    private Callback m_onArrival;

-    

-    /**

-     * onDeparture method. 

-     */

-    private Callback m_onDeparture;

-    

-    /**

-     * onModify method. 

-     */

-    private Callback m_onModification;

-    

-    /**

-     * Service Tracker. 

-     */

-    private Tracker m_tracker;

-    

-    /**

-     * Attached handler. 

-     */

-    private PrimitiveHandler m_handler;

-    

-    /**

-     * Constructor.

-     * @param handler : attached handler

-     * @param filter : monitored filter

-     * @param bind : onArrival method

-     * @param unbind : onDeparture method

-     * @param modification : onModify method

-     */

-    public WhiteBoardManager(WhiteBoardPatternHandler handler, Filter filter, String bind, String unbind, String modification) {

-        m_handler = handler;

-        m_onArrival = new Callback(bind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());

-        m_onDeparture = new Callback(unbind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());

-        if (modification != null) {

-            m_onModification = new Callback(modification, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());

-        }

-        m_filter = filter;

-        m_tracker = new Tracker(handler.getInstanceManager().getContext(), m_filter, this);

-    }

-    

-    /**

-     * Open the tracker.

-     */

-    public void start() {

-        m_tracker.open();

-    }

-    

-    /**

-     * Close the tracker.

-     */

-    public void stop() {

-        m_tracker.close();

-    }

-

-    /**

-     * A new service was added to the tracker.

-     * @param arg0 : service reference.

-     * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference)

-     */

-    public void addedService(ServiceReference arg0) {

-        try {

-            m_onArrival.call(new Object[] {arg0});

-        } catch (NoSuchMethodException e) {

-            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);

-            m_handler.getInstanceManager().stop();

-        } catch (IllegalAccessException e) {

-            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be invoked", e);

-            m_handler.getInstanceManager().stop();

-        } catch (InvocationTargetException e) {

-            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException());

-            m_handler.getInstanceManager().stop();

-        }

-    }

-

-    /**

-     * A new service is detected.

-     * @param arg0 : service reference

-     * @return true to add the service

-     * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference)

-     */

-    public boolean addingService(ServiceReference arg0) {

-        return true;

-    }

-

-    /**

-     * An existing service was modified.

-     * @param arg0 : service reference

-     * @param arg1 : service object (if already get)

-     * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)

-     */

-    public void modifiedService(ServiceReference arg0, Object arg1) {

-        if (m_onModification != null) {

-            try {

-                m_onModification.call(new Object[] {arg0});

-            } catch (NoSuchMethodException e) {

-                m_handler.error("The onModification method " + m_onModification.getMethod() + " does not exist in the class", e);

-                m_handler.getInstanceManager().stop();

-            } catch (IllegalAccessException e) {

-                m_handler.error("The onModification method " + m_onModification.getMethod() + " cannot be invoked", e);

-                m_handler.getInstanceManager().stop();

-            } catch (InvocationTargetException e) {

-                m_handler.error("The onModification method " + m_onModification.getMethod() + " has thrown an exception", e.getTargetException());

-                m_handler.getInstanceManager().stop();

-            }

-        }

-    }

-

-    /**

-     * A service disappears.

-     * @param arg0 : service reference

-     * @param arg1 : service object (if already get)

-     * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)

-     */

-    public void removedService(ServiceReference arg0, Object arg1) {

-        try {

-            m_onDeparture.call(new Object[] {arg0});

-        } catch (NoSuchMethodException e) {

-            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);

-            m_handler.getInstanceManager().stop();

-        } catch (IllegalAccessException e) {

-            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be invoked", e);

-            m_handler.getInstanceManager().stop();

-        } catch (InvocationTargetException e) {

-            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());

-            m_handler.getInstanceManager().stop();

-        }

-    }

-

-}

+/* 
+ * 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.ipojo.handler.wbp;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.util.Callback;
+import org.apache.felix.ipojo.util.Tracker;
+import org.apache.felix.ipojo.util.TrackerCustomizer;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Manage a white board pattern.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class WhiteBoardManager implements TrackerCustomizer {
+    
+    /**
+     * The monitored filter. 
+     */
+    private Filter m_filter;
+    
+    /**
+     * The onArrival method. 
+     */
+    private Callback m_onArrival;
+    
+    /**
+     * The onDeparture method. 
+     */
+    private Callback m_onDeparture;
+    
+    /**
+     * The onModify method. 
+     */
+    private Callback m_onModification;
+    
+    /**
+     * The service tracker. 
+     */
+    private Tracker m_tracker;
+    
+    /**
+     * The attached handler. 
+     */
+    private PrimitiveHandler m_handler;
+    
+    /**
+     * Constructor.
+     * @param handler the attached handler
+     * @param filter the monitored filter
+     * @param bind the onArrival method
+     * @param unbind the onDeparture method
+     * @param modification the onModify method
+     */
+    public WhiteBoardManager(WhiteBoardPatternHandler handler, Filter filter, String bind, String unbind, String modification) {
+        m_handler = handler;
+        m_onArrival = new Callback(bind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
+        m_onDeparture = new Callback(unbind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
+        if (modification != null) {
+            m_onModification = new Callback(modification, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
+        }
+        m_filter = filter;
+        m_tracker = new Tracker(handler.getInstanceManager().getContext(), m_filter, this);
+    }
+    
+    /**
+     * Opens the tracker.
+     */
+    public void start() {
+        m_tracker.open();
+    }
+    
+    /**
+     * Closes the tracker.
+     */
+    public void stop() {
+        m_tracker.close();
+    }
+
+    /**
+     * A new service was added to the tracker.
+     * @param arg0 the service reference.
+     * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference)
+     */
+    public void addedService(ServiceReference arg0) {
+        try {
+            m_onArrival.call(new Object[] {arg0});
+        } catch (NoSuchMethodException e) {
+            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);
+            m_handler.getInstanceManager().stop();
+        } catch (IllegalAccessException e) {
+            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be invoked", e);
+            m_handler.getInstanceManager().stop();
+        } catch (InvocationTargetException e) {
+            m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException());
+            m_handler.getInstanceManager().stop();
+        }
+    }
+
+    /**
+     * A new service is detected.
+     * @param arg0 the service reference
+     * @return {@code true} to add the service.
+     * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
+     */
+    public boolean addingService(ServiceReference arg0) {
+        return true;
+    }
+
+    /**
+     * An existing service was modified.
+     * @param arg0 the service reference
+     * @param arg1 the service object (if already get)
+     * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
+     */
+    public void modifiedService(ServiceReference arg0, Object arg1) {
+        if (m_onModification != null) {
+            try {
+                m_onModification.call(new Object[] {arg0});
+            } catch (NoSuchMethodException e) {
+                m_handler.error("The onModification method " + m_onModification.getMethod() + " does not exist in the class", e);
+                m_handler.getInstanceManager().stop();
+            } catch (IllegalAccessException e) {
+                m_handler.error("The onModification method " + m_onModification.getMethod() + " cannot be invoked", e);
+                m_handler.getInstanceManager().stop();
+            } catch (InvocationTargetException e) {
+                m_handler.error("The onModification method " + m_onModification.getMethod() + " has thrown an exception", e.getTargetException());
+                m_handler.getInstanceManager().stop();
+            }
+        }
+    }
+
+    /**
+     * A service disappears.
+     * @param arg0 the service reference
+     * @param arg1 the service object (if already get)
+     * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
+     */
+    public void removedService(ServiceReference arg0, Object arg1) {
+        try {
+            m_onDeparture.call(new Object[] {arg0});
+        } catch (NoSuchMethodException e) {
+            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);
+            m_handler.getInstanceManager().stop();
+        } catch (IllegalAccessException e) {
+            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be invoked", e);
+            m_handler.getInstanceManager().stop();
+        } catch (InvocationTargetException e) {
+            m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());
+            m_handler.getInstanceManager().stop();
+        }
+    }
+
+}
diff --git a/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java b/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java
index 4fb735b..d3d35a8 100644
--- a/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java
+++ b/ipojo/handler/whiteboard/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java
@@ -1,99 +1,99 @@
-/* 

- * 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.ipojo.handler.wbp;

-

-import java.util.ArrayList;

-import java.util.Dictionary;

-import java.util.List;

-

-import org.apache.felix.ipojo.ConfigurationException;

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.metadata.Element;

-import org.osgi.framework.InvalidSyntaxException;

-

-/**

- * White board pattern handler.

- * This handler aims to automate white board patterns by invoking callback when needed.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class WhiteBoardPatternHandler extends PrimitiveHandler {

-    

-    /**

-     * Handler namespace.

-     */

-    public static final String NAMESPACE = "org.apache.felix.ipojo.white-board-pattern";

-    

-    /**

-     * White board pattern to manage. By default just one. 

-     */

-    private List m_managers = new ArrayList(1);

-

-    /**

-     * Configure method. It will parse metadata to analyze org.apache.felix.ipojo.white-board-pattern:wbp element. 

-     * @param elem : component type description

-     * @param dict : instance description

-     * @throws ConfigurationException : occurs when the description is not valid.

-     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

-     */

-    public void configure(Element elem, Dictionary dict) throws ConfigurationException {

-        Element[] elems = elem.getElements("wbp", NAMESPACE);

-        for (int i = 0; i < elems.length; i++) {

-            String filter = elems[i].getAttribute("filter");

-            String onArrival = elems[i].getAttribute("onArrival");

-            String onDeparture = elems[i].getAttribute("onDeparture");

-            String onModification = elems[i].getAttribute("onModification");

-            

-            if (filter == null) {

-                throw new ConfigurationException("The white board pattern element requires a filter attribute");

-            }

-            if (onArrival == null || onDeparture == null) {

-                throw new ConfigurationException("The white board pattern element requires the onArrival and onDeparture attributes");

-            }

-            

-            try {

-                WhiteBoardManager wbm = new WhiteBoardManager(this, getInstanceManager().getContext().createFilter(filter), onArrival, onDeparture, onModification);

-                m_managers.add(wbm);

-            } catch (InvalidSyntaxException e) {

-                throw new ConfigurationException("The filter " + filter + " is invalid : " + e);

-            }

-        }

-        

-    }

-

-    /**

-     * Start method : start managers.

-     * @see org.apache.felix.ipojo.Handler#start()

-     */

-    public void start() {

-        for (int i = 0; i < m_managers.size(); i++) {

-            ((WhiteBoardManager) m_managers.get(i)).start();

-        }

-    }

-

-    /**

-     * Stop method : stop managers.

-     * @see org.apache.felix.ipojo.Handler#stop()

-     */

-    public void stop() {

-        for (int i = 0; i < m_managers.size(); i++) {

-            ((WhiteBoardManager) m_managers.get(i)).stop();

-        } 

-    }

-

-}

+/* 
+ * 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.ipojo.handler.wbp;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.metadata.Element;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * White board pattern handler.
+ * This handler aims to automate white board patterns by invoking callback when needed.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class WhiteBoardPatternHandler extends PrimitiveHandler {
+    
+    /**
+     * The handler namespace.
+     */
+    public static final String NAMESPACE = "org.apache.felix.ipojo.white-board-pattern";
+    
+    /**
+     * The white board pattern to manage. By default just one. 
+     */
+    private List m_managers = new ArrayList(1);
+
+    /**
+     * Configure method. Parses the metadata to analyze white-board-pattern elements. 
+     * @param elem the component type description
+     * @param dict the instance description
+     * @throws ConfigurationException if the description is not valid.
+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
+     */
+    public void configure(Element elem, Dictionary dict) throws ConfigurationException {
+        Element[] elems = elem.getElements("wbp", NAMESPACE);
+        for (int i = 0; i < elems.length; i++) {
+            String filter = elems[i].getAttribute("filter");
+            String onArrival = elems[i].getAttribute("onArrival");
+            String onDeparture = elems[i].getAttribute("onDeparture");
+            String onModification = elems[i].getAttribute("onModification");
+            
+            if (filter == null) {
+                throw new ConfigurationException("The white board pattern element requires a filter attribute");
+            }
+            if (onArrival == null || onDeparture == null) {
+                throw new ConfigurationException("The white board pattern element requires the onArrival and onDeparture attributes");
+            }
+            
+            try {
+                WhiteBoardManager wbm = new WhiteBoardManager(this, getInstanceManager().getContext().createFilter(filter), onArrival, onDeparture, onModification);
+                m_managers.add(wbm);
+            } catch (InvalidSyntaxException e) {
+                throw new ConfigurationException("The filter " + filter + " is invalid : " + e);
+            }
+        }
+        
+    }
+
+    /**
+     * Start method. Starts managers.
+     * @see org.apache.felix.ipojo.Handler#start()
+     */
+    public void start() {
+        for (int i = 0; i < m_managers.size(); i++) {
+            ((WhiteBoardManager) m_managers.get(i)).start();
+        }
+    }
+
+    /**
+     * Stop method. Stops managers.
+     * @see org.apache.felix.ipojo.Handler#stop()
+     */
+    public void stop() {
+        for (int i = 0; i < m_managers.size(); i++) {
+            ((WhiteBoardManager) m_managers.get(i)).stop();
+        } 
+    }
+
+}
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 175a286..e19d020 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
@@ -1,381 +1,381 @@
-/* 

- * 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.ipojo.manipulation.annotations;

-

-import java.util.HashMap;

-import java.util.Iterator;

-import java.util.Map;

-import java.util.Set;

-

-import org.apache.felix.ipojo.metadata.Attribute;

-import org.apache.felix.ipojo.metadata.Element;

-import org.objectweb.asm.AnnotationVisitor;

-import org.objectweb.asm.FieldVisitor;

-import org.objectweb.asm.MethodVisitor;

-import org.objectweb.asm.Opcodes;

-import org.objectweb.asm.Type;

-import org.objectweb.asm.commons.EmptyVisitor;

-

-/**

- * Collect metadata from classes by parsing annotation.

- * This class collects type (i.e.) annotations and create method & field collectors.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class MetadataCollector extends EmptyVisitor implements Opcodes {

-

-    /**

-     * Class name.

-     */

-    private String m_className;

-    

-    /**

-     * Root element of computed metadata.

-     */

-    private Element m_elem = new Element("component", "");

-    

-    /**

-     * True if the visited class is a component type declaration (i.e. contains the @component annotation).

-     */

-    private boolean m_containsAnnotation = false;

-    

-    /**

-     * Map of [element ids, element].

-     * This map is used to easily get an already created element. 

-     */

-    private Map m_ids = new HashMap();

-    

-    /**

-     * Map of [element, referto].

-     * This map is used to recreate the element hierarchie.

-     * Stored element are added under referred element. 

-     */

-    private Map m_elements = new HashMap();

-    

-    public Element getElem() {

-        return m_elem;

-    }

-    

-    public boolean isAnnotated() {

-        return m_containsAnnotation;

-    }

-    

-

-    /**

-     * Start visiting a class.

-     * Initialize the getter/setter generator, add the _cm field, add the pojo interface.

-     * @param version : class version

-     * @param access : class access

-     * @param name : class name 

-     * @param signature : class signature

-     * @param superName : class super class

-     * @param interfaces : implemented interfaces

-     * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])

-     */

-    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {

-        m_ids = new HashMap();

-        m_elements = new HashMap();

-        m_className = name;

-    }

-

-    

-    /**

-     * Visit class annotations.

-     * This method detects @component, @provides and @Element annotations.

-     * @param desc : annotation descriptor.

-     * @param visible : is the annotation visible at runtime.

-     * @return the annotation visitor.

-     * @see org.objectweb.asm.ClassAdapter#visitAnnotation(java.lang.String, boolean)

-     */

-    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {

-        // @Component

-        if (desc.equals("Lorg/apache/felix/ipojo/annotations/Component;")) {

-            // It is a component

-            m_containsAnnotation = true;

-            m_elem.addAttribute(new Attribute("className", m_className.replace('/', '.')));

-            return new ComponentVisitor();

-        }

-        

-        // @Provides

-        if (desc.equals("Lorg/apache/felix/ipojo/annotations/Provides;")) {

-            return new ProvidesVisitor();

-        }

-        

-        if (CustomAnnotationVisitor.isCustomAnnotation(desc)) {

-            Element elem = CustomAnnotationVisitor.buildElement(desc);

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

-        }

-        

-        return null;

-    }

-    

-

-

-    /**

-     * Visit a field.

-     * Call the field collector visitor.

-     * @param access : field access.

-     * @param name : field name

-     * @param desc : field descriptor

-     * @param signature : field signature

-     * @param value : field value (static field only)

-     * @return the field visitor.

-     * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)

-     */

-    public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {

-        return new FieldCollector(name, this);

-    }

-

-    /**

-     * Visit a method.

-     * Call the method collector visitor.

-     * @param access : method access

-     * @param name : method name

-     * @param desc : method descriptor

-     * @param signature : method signature

-     * @param exceptions : method exceptions

-     * @return the Method Visitor.

-     * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])

-     */

-    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {

-        return new MethodCollector(name, this);

-    }

-    

-    /**

-     * End of the visit : compute final elements.

-     * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-     */

-    public void visitEnd() {

-        // Recompute the tree

-        Set elems = getElements().keySet();

-        Iterator it = elems.iterator();

-        while (it.hasNext()) {

-            Element current = (Element) it.next();

-            String reference = (String) getElements().get(current);

-            if (reference == null) {

-                m_elem.addElement(current);

-            } else {

-                Element ref = (Element) getIds().get(reference);

-                if (ref == null) {

-                    System.err.println("The element " + reference + " is not declared - skip the element " + current.toXMLString());

-                } else {

-                    ref.addElement(current);

-                }

-            }

-        }

-    }

-

-    protected Map getIds() {

-        return m_ids;

-    }

-

-    protected Map getElements() {

-        return m_elements;

-    }

-

-    /**

-     * Parse the @provides annotation.

-     */

-    private class ProvidesVisitor extends EmptyVisitor implements AnnotationVisitor {

-        /**

-         * Provides element.

-         */

-        Element m_prov = new Element("provides", "");

-

-        /**

-         * Visit @provides annotation attributes.

-         * @param arg0 : annotation attribute name

-         * @param arg1 : annotation attribute value

-         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)

-         */

-        public void visit(String arg0, Object arg1) {

-            if (arg0.equals("factory")) {

-                m_prov.addAttribute(new Attribute("factory", arg1.toString()));

-            }

-        }

-        

-        /**

-         * Visit specifications array.

-         * @param arg0 : attribute name

-         * @return a visitor visiting each element of the array.

-         * @see org.objectweb.asm.commons.EmptyVisitor#visitArray(java.lang.String)

-         */

-        public AnnotationVisitor visitArray(String arg0) {

-            if (arg0.equals("specifications")) {

-                return new InterfaceArrayVisitor();

-            } else {

-                return null;

-            }

-        }

-        

-        /**

-         * End of the visit.

-         * Append to the parent element the computed "provides" element.

-         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-         */

-        public void visitEnd() {

-            getIds().put("provides", m_prov);

-            getElements().put(m_prov, null);

-        }

-        

-        private class InterfaceArrayVisitor extends EmptyVisitor {

-            /**

-             * List of parsed interface.

-             */

-            private String m_itfs;

-            

-            /**

-             * Visit one element of the array.

-             * @param arg0 : null

-             * @param arg1 : element value.

-             * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)

-             */

-            public void visit(String arg0, Object arg1) {

-                if (m_itfs == null) {

-                    m_itfs = "{" + ((Type) arg1).getClassName();

-                } else {

-                    m_itfs += "," + ((Type) arg1).getClassName();

-                }

-            }

-            

-            /**

-             * End of the array visit.

-             * Add the attribute to 'provides' element.

-             * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-             */

-            public void visitEnd() {

-                m_prov.addAttribute(new Attribute("interface", m_itfs + "}"));

-            }

-            

-        }

-        

-    }

-    

-    /**

-     * Parse the @component annotation.

-     */

-    private class ComponentVisitor extends EmptyVisitor implements AnnotationVisitor {

-        

-        /**

-         * Factory attribute.

-         */

-        private String m_factory;

-

-        /**

-         * Is the component an immediate component? 

-         */

-        private String m_immediate;

-        

-        /**

-         * Component name (cannot be null). 

-         */

-        private String m_name;

-        

-        /**

-         * Does the component exposes its architecture?

-         */

-        private String m_architecture;

-

-        /**

-         * Does the component propagate configuration to provided services?

-         */

-        private String m_propagation;

-        

-        /**

-         * Managed Service PID.

-         */

-        private String m_managedservice;

-        

-        /**

-         * Element properties.

-         */

-        private Element m_props;

-

-        /**

-         * Visit @component annotation attribute.

-         * @param arg0 : attribute name

-         * @param arg1 : attribute value

-         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)

-         */

-        public void visit(String arg0, Object arg1) {

-            if (arg0.equals("public_factory")) {

-                m_factory = arg1.toString();

-                return;

-            }

-            if (arg0.equals("name")) {

-                m_name = arg1.toString();

-                return;

-            }

-            if (arg0.equals("immediate")) {

-                m_immediate = arg1.toString();

-                return;

-            }

-            if (arg0.equals("architecture")) {

-                m_architecture = arg1.toString();

-                return;

-            }

-            if (arg0.equals("propagation")) {

-                m_propagation = arg1.toString();

-                return;

-            }

-            if (arg0.equals("managedservice")) {

-                m_managedservice = arg1.toString();

-                return;

-            }

-        }

-

-        /**

-         * End of the visit.

-         * Append to the "component" element computed attribute.

-         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-         */

-        public void visitEnd() { 

-            if (m_name == null) {

-                m_name = m_className.replace('/', '.');

-            }

-            m_elem.addAttribute(new Attribute("name", m_name));

-            if (m_factory != null && m_factory.equalsIgnoreCase("false")) {

-                m_elem.addAttribute(new Attribute("public", "false"));

-            } else {

-                m_elem.addAttribute(new Attribute("public", "true")); 

-            }

-            if (m_architecture != null) {

-                m_elem.addAttribute(new Attribute("architecture", m_architecture));

-            }

-            if (m_immediate != null) {

-                m_elem.addAttribute(new Attribute("immediate", m_immediate));

-            }

-            if (m_propagation != null) {

-                if (m_props == null) {

-                    m_props = new Element("properties", "");

-                    getElements().put(m_props, null);

-                    getIds().put("properties", m_props);

-                }

-                m_props.addAttribute(new Attribute("propagation", m_propagation));

-            }

-            if (m_managedservice != null) {

-                if (m_props == null) {

-                    m_props = new Element("properties", "");

-                    getElements().put(m_props, null);

-                    getIds().put("properties", m_props);

-                }

-                m_props.addAttribute(new Attribute("pid", m_managedservice));

-            }

-        }        

-    }

-}

+/* 
+ * 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.ipojo.manipulation.annotations;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.EmptyVisitor;
+
+/**
+ * Collect metadata from classes by parsing annotation.
+ * This class collects type (i.e.) annotations and create method & field collectors.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class MetadataCollector extends EmptyVisitor implements Opcodes {
+
+    /**
+     * Class name.
+     */
+    private String m_className;
+    
+    /**
+     * Root element of computed metadata.
+     */
+    private Element m_elem = new Element("component", "");
+    
+    /**
+     * True if the visited class is a component type declaration (i.e. contains the @component annotation).
+     */
+    private boolean m_containsAnnotation = false;
+    
+    /**
+     * Map of [element ids, element].
+     * This map is used to easily get an already created element. 
+     */
+    private Map m_ids = new HashMap();
+    
+    /**
+     * Map of [element, referto].
+     * This map is used to recreate the element hierarchie.
+     * Stored element are added under referred element. 
+     */
+    private Map m_elements = new HashMap();
+    
+    public Element getElem() {
+        return m_elem;
+    }
+    
+    public boolean isAnnotated() {
+        return m_containsAnnotation;
+    }
+    
+
+    /**
+     * Start visiting a class.
+     * Initialize the getter/setter generator, add the _cm field, add the pojo interface.
+     * @param version : class version
+     * @param access : class access
+     * @param name : class name 
+     * @param signature : class signature
+     * @param superName : class super class
+     * @param interfaces : implemented interfaces
+     * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+     */
+    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
+        m_ids = new HashMap();
+        m_elements = new HashMap();
+        m_className = name;
+    }
+
+    
+    /**
+     * Visit class annotations.
+     * This method detects @component, @provides and @Element annotations.
+     * @param desc : annotation descriptor.
+     * @param visible : is the annotation visible at runtime.
+     * @return the annotation visitor.
+     * @see org.objectweb.asm.ClassAdapter#visitAnnotation(java.lang.String, boolean)
+     */
+    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+        // @Component
+        if (desc.equals("Lorg/apache/felix/ipojo/annotations/Component;")) {
+            // It is a component
+            m_containsAnnotation = true;
+            m_elem.addAttribute(new Attribute("className", m_className.replace('/', '.')));
+            return new ComponentVisitor();
+        }
+        
+        // @Provides
+        if (desc.equals("Lorg/apache/felix/ipojo/annotations/Provides;")) {
+            return new ProvidesVisitor();
+        }
+        
+        if (CustomAnnotationVisitor.isCustomAnnotation(desc)) {
+            Element elem = CustomAnnotationVisitor.buildElement(desc);
+            return new CustomAnnotationVisitor(elem, this, true);
+        }
+        
+        return null;
+    }
+    
+
+
+    /**
+     * Visit a field.
+     * Call the field collector visitor.
+     * @param access : field access.
+     * @param name : field name
+     * @param desc : field descriptor
+     * @param signature : field signature
+     * @param value : field value (static field only)
+     * @return the field visitor.
+     * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
+     */
+    public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
+        return new FieldCollector(name, this);
+    }
+
+    /**
+     * Visit a method.
+     * Call the method collector visitor.
+     * @param access : method access
+     * @param name : method name
+     * @param desc : method descriptor
+     * @param signature : method signature
+     * @param exceptions : method exceptions
+     * @return the Method Visitor.
+     * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+     */
+    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+        return new MethodCollector(name, this);
+    }
+    
+    /**
+     * End of the visit : compute final elements.
+     * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+     */
+    public void visitEnd() {
+        // Recompute the tree
+        Set elems = getElements().keySet();
+        Iterator it = elems.iterator();
+        while (it.hasNext()) {
+            Element current = (Element) it.next();
+            String reference = (String) getElements().get(current);
+            if (reference == null) {
+                m_elem.addElement(current);
+            } else {
+                Element ref = (Element) getIds().get(reference);
+                if (ref == null) {
+                    System.err.println("The element " + reference + " is not declared - skipping the element " + current.toXMLString());
+                } else {
+                    ref.addElement(current);
+                }
+            }
+        }
+    }
+
+    protected Map getIds() {
+        return m_ids;
+    }
+
+    protected Map getElements() {
+        return m_elements;
+    }
+
+    /**
+     * Parse the @provides annotation.
+     */
+    private class ProvidesVisitor extends EmptyVisitor implements AnnotationVisitor {
+        /**
+         * Provides element.
+         */
+        Element m_prov = new Element("provides", "");
+
+        /**
+         * Visit @provides annotation attributes.
+         * @param arg0 : annotation attribute name
+         * @param arg1 : annotation attribute value
+         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+         */
+        public void visit(String arg0, Object arg1) {
+            if (arg0.equals("factory")) {
+                m_prov.addAttribute(new Attribute("factory", arg1.toString()));
+            }
+        }
+        
+        /**
+         * Visit specifications array.
+         * @param arg0 : attribute name
+         * @return a visitor visiting each element of the array.
+         * @see org.objectweb.asm.commons.EmptyVisitor#visitArray(java.lang.String)
+         */
+        public AnnotationVisitor visitArray(String arg0) {
+            if (arg0.equals("specifications")) {
+                return new InterfaceArrayVisitor();
+            } else {
+                return null;
+            }
+        }
+        
+        /**
+         * End of the visit.
+         * Append to the parent element the computed "provides" element.
+         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+         */
+        public void visitEnd() {
+            getIds().put("provides", m_prov);
+            getElements().put(m_prov, null);
+        }
+        
+        private class InterfaceArrayVisitor extends EmptyVisitor {
+            /**
+             * List of parsed interface.
+             */
+            private String m_itfs;
+            
+            /**
+             * Visit one element of the array.
+             * @param arg0 : null
+             * @param arg1 : element value.
+             * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+             */
+            public void visit(String arg0, Object arg1) {
+                if (m_itfs == null) {
+                    m_itfs = "{" + ((Type) arg1).getClassName();
+                } else {
+                    m_itfs += "," + ((Type) arg1).getClassName();
+                }
+            }
+            
+            /**
+             * End of the array visit.
+             * Add the attribute to 'provides' element.
+             * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+             */
+            public void visitEnd() {
+                m_prov.addAttribute(new Attribute("interface", m_itfs + "}"));
+            }
+            
+        }
+        
+    }
+    
+    /**
+     * Parse the @component annotation.
+     */
+    private class ComponentVisitor extends EmptyVisitor implements AnnotationVisitor {
+        
+        /**
+         * Factory attribute.
+         */
+        private String m_factory;
+
+        /**
+         * Is the component an immediate component? 
+         */
+        private String m_immediate;
+        
+        /**
+         * Component name (cannot be null). 
+         */
+        private String m_name;
+        
+        /**
+         * Does the component exposes its architecture?
+         */
+        private String m_architecture;
+
+        /**
+         * Does the component propagate configuration to provided services?
+         */
+        private String m_propagation;
+        
+        /**
+         * Managed Service PID.
+         */
+        private String m_managedservice;
+        
+        /**
+         * Element properties.
+         */
+        private Element m_props;
+
+        /**
+         * Visit @component annotation attribute.
+         * @param arg0 : attribute name
+         * @param arg1 : attribute value
+         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+         */
+        public void visit(String arg0, Object arg1) {
+            if (arg0.equals("public_factory")) {
+                m_factory = arg1.toString();
+                return;
+            }
+            if (arg0.equals("name")) {
+                m_name = arg1.toString();
+                return;
+            }
+            if (arg0.equals("immediate")) {
+                m_immediate = arg1.toString();
+                return;
+            }
+            if (arg0.equals("architecture")) {
+                m_architecture = arg1.toString();
+                return;
+            }
+            if (arg0.equals("propagation")) {
+                m_propagation = arg1.toString();
+                return;
+            }
+            if (arg0.equals("managedservice")) {
+                m_managedservice = arg1.toString();
+                return;
+            }
+        }
+
+        /**
+         * End of the visit.
+         * Append to the "component" element computed attribute.
+         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+         */
+        public void visitEnd() { 
+            if (m_name == null) {
+                m_name = m_className.replace('/', '.');
+            }
+            m_elem.addAttribute(new Attribute("name", m_name));
+            if (m_factory != null && m_factory.equalsIgnoreCase("false")) {
+                m_elem.addAttribute(new Attribute("public", "false"));
+            } else {
+                m_elem.addAttribute(new Attribute("public", "true")); 
+            }
+            if (m_architecture != null) {
+                m_elem.addAttribute(new Attribute("architecture", m_architecture));
+            }
+            if (m_immediate != null) {
+                m_elem.addAttribute(new Attribute("immediate", m_immediate));
+            }
+            if (m_propagation != null) {
+                if (m_props == null) {
+                    m_props = new Element("properties", "");
+                    getElements().put(m_props, null);
+                    getIds().put("properties", m_props);
+                }
+                m_props.addAttribute(new Attribute("propagation", m_propagation));
+            }
+            if (m_managedservice != null) {
+                if (m_props == null) {
+                    m_props = new Element("properties", "");
+                    getElements().put(m_props, null);
+                    getIds().put("properties", m_props);
+                }
+                m_props.addAttribute(new Attribute("pid", m_managedservice));
+            }
+        }        
+    }
+}
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 bf28d42..c489012 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
@@ -1,470 +1,470 @@
-/* 

- * 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.ipojo.manipulation.annotations;

-

-import org.apache.felix.ipojo.metadata.Attribute;

-import org.apache.felix.ipojo.metadata.Element;

-import org.objectweb.asm.AnnotationVisitor;

-import org.objectweb.asm.Type;

-import org.objectweb.asm.commons.EmptyVisitor;

-

-/**

- * This class collects method annotations, and give them to the metadata collector. 

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class MethodCollector extends EmptyVisitor {

-

-    /**

-     * Parent collector.

-     */

-    private MetadataCollector m_collector;

-    

-    /**

-     * Method name. 

-     */

-    private String m_name;

-

-    /**

-     * Constructor.

-     * @param name : name of the method.

-     * @param collector : parent collector.

-     */

-    public MethodCollector(String name, MetadataCollector collector) {

-        m_collector = collector;

-        m_name = name;

-    }

-

-    /**

-     * Visit method annotations.

-     * @param arg0 : annotation name.

-     * @param arg1 : is the annotation visible at runtime.

-     * @return the visitor paring the visited annotation.

-     * @see org.objectweb.asm.commons.EmptyVisitor#visitAnnotation(java.lang.String, boolean)

-     */

-    public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Property;")) {

-            return processProperty();

-        }

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/ServiceProperty;")) {

-            return processServiceProperty();

-        }

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Validate;")) {

-            return processValidate();

-        }

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Invalidate;")) {

-            return processInvalidate();

-        }

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Bind;")) {

-            return processBind("bind");

-        }

-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Unbind;")) {

-            return processBind("unbind");

-        }

-        

-        if (CustomAnnotationVisitor.isCustomAnnotation(arg0)) {

-            Element elem = CustomAnnotationVisitor.buildElement(arg0);

-            elem.addAttribute(new Attribute("method", m_name));

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

-        }

-        

-        return null;

-    }

-

-    /**

-     * Process @bind & @unbind.

-     * @param type : bind or unbind

-     * @return the visitor parsing @bind & @unbind annotations.

-     */

-    private AnnotationVisitor processBind(String type) {

-        return new BindAnnotationParser(m_name, type);

-    }

-

-    /**

-     * Process @validate annotation.

-     * @return null.

-     */

-    private AnnotationVisitor processValidate() {

-        Element cb = new Element("callback", "");

-        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("transition", "validate"));

-        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("method", m_name));

-        m_collector.getElements().put(cb, null);

-        return null;

-    }

-

-    /**

-     * Process @invalidate annotation.

-     * @return null.

-     */

-    private AnnotationVisitor processInvalidate() {

-        Element cb = new Element("callback", "");

-        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("transition", "invalidate"));

-        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("method", m_name));

-        m_collector.getElements().put(cb, null);

-        return null;

-    }

-

-    /**

-     * Process @serviceProperty annotation.

-     * @return the visitor parsing the visited annotation.

-     */

-    private AnnotationVisitor processServiceProperty() {

-        if (! m_collector.getIds().containsKey("provides")) {

-            System.err.println("the component does not provide services, skip ServiceProperty for " + m_name);

-            return null;

-        } else {

-            Element provides = (Element) m_collector.getIds().get("provides");

-            return new PropertyAnnotationParser(provides, m_name);

-        }

-    }

-

-    /**

-     * Process @property annotation.

-     * @return the visitor parsing the visited annotation.

-     */

-    private AnnotationVisitor processProperty() {

-        Element prop = null;

-        if (! m_collector.getIds().containsKey("properties")) {

-            prop = new Element("Properties", "");

-            m_collector.getIds().put("properties", prop);

-            m_collector.getElements().put(prop, null);

-        } else {

-            prop = (Element) m_collector.getIds().get("properties");

-        }

-        return new PropertyAnnotationParser(prop, m_name);

-    }

-

-    /**

-     * Parse @bind & @unbind annotations.

-     */

-    private final class BindAnnotationParser extends EmptyVisitor implements AnnotationVisitor {

-

-        /**

-         * Method name.

-         */

-        private String m_name;

-

-        /**

-         * Requirement filter.

-         */

-        private String m_filter;

-

-        /**

-         * Is the requirement optional?

-         */

-        private String m_optional;

-

-        /**

-         * Is the requirement aggregate?

-         */

-        private String m_aggregate;

-

-        /**

-         * Required specification. 

-         */

-        private String m_specification;

-

-        /**

-         * Requirement id.

-         */

-        private String m_id;

-

-        /**

-         * Bind or Unbind method?

-         */

-        private String m_type;

-        

-        /**

-         * Binding policy.

-         */

-        private String m_policy;

-        

-        /**

-         * Comparator.

-         */

-        private String m_comparator;

-        

-        /**

-         * From attribute.

-         */

-        private String m_from;

-

-        /**

-         * Constructor.

-         * @param bind : method name.

-         * @param type : is the callback a bind or an unbind method.

-         */

-        private BindAnnotationParser(String bind, String type) {

-            m_name = bind;

-            m_type = type;

-        }

-

-        /**

-         * Visit annotation attribute.

-         * @param arg0 : annotation name

-         * @param arg1 : annotation value

-         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)

-         */

-        public void visit(String arg0, Object arg1) {

-            if (arg0.equals("filter")) {

-                m_filter = arg1.toString();

-                return;

-            }

-            if (arg0.equals("optional")) {

-                m_optional = arg1.toString();

-                return;

-            }

-            if (arg0.equals("aggregate")) {

-                m_aggregate = arg1.toString();

-                return;

-            }

-            if (arg0.equals("specification")) {

-                m_specification = arg1.toString();

-                return;

-            }

-            if (arg0.equals("policy")) {

-                m_policy = arg1.toString();

-                return;

-            }

-            if (arg0.equals("id")) {

-                m_id = arg1.toString();

-                return;

-            }

-            if (arg0.equals("comparator")) {

-                Type type = Type.getType(arg1.toString());

-                m_comparator = type.getClassName();

-                return;

-            }

-            if (arg0.equals("from")) {

-                m_from = arg1.toString();

-                return;

-            }

-            

-        }

-

-        /**

-         * End of the visit.

-         * Create or append the requirement info to a created or already existing "requires" element.

-         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-         */

-        public void visitEnd() {

-            if (m_id == null) {

-                if (m_name.startsWith("bind")) {

-                    m_id = m_name.substring("bind".length());

-                } else if (m_name.startsWith("unbind")) {

-                    m_id = m_name.substring("unbind".length());

-                } else {

-                    System.err.println("Cannot determine the id of the bind method : " + m_name);

-                    return;

-                }

-            }

-            // Check if it is a full-determined requirement

-            Element req = (Element) m_collector.getIds().get(m_id);

-            if (req == null) {

-                // Add the complete requires

-                req = new Element("requires", "");

-                if (m_specification != null) {

-                    req.addAttribute(new Attribute("specification", m_specification));

-                }

-                if (m_aggregate != null) {

-                    req.addAttribute(new Attribute("aggregate", m_aggregate));

-                }

-                if (m_filter != null) {

-                    req.addAttribute(new Attribute("filter", m_filter));

-                }

-                if (m_optional != null) {

-                    req.addAttribute(new Attribute("optional", m_optional));

-                }

-                if (m_policy != null) {

-                    req.addAttribute(new Attribute("policy", m_policy));

-                }

-                if (m_id != null) {

-                    req.addAttribute(new Attribute("id", m_id));

-                }

-                if (m_comparator != null) {

-                    req.addAttribute(new Attribute("comparator", m_comparator));

-                }

-                if (m_from != null) {

-                    req.addAttribute(new Attribute("from", m_from));

-                }

-            } else {

-                String itf = req.getAttribute("specification");

-                String aggregate = req.getAttribute("aggregate");

-                String optional = req.getAttribute("optional");

-                String filter = req.getAttribute("filter");

-                String policy = req.getAttribute("policy");

-                String comparator = req.getAttribute("comparator");

-                String from = req.getAttribute("from");

-                if (m_specification != null) {

-                    if (itf == null) {

-                        req.addAttribute(new Attribute("specification", m_specification));

-                    } else if (! m_specification.equals(itf)) {

-                        System.err.println("The required specification is not the same than previouly : " + m_specification + " & " + itf);

-                        return;

-                    }

-                }

-                

-                if (m_optional != null) {

-                    if (optional == null) {

-                        req.addAttribute(new Attribute("optional", m_optional));

-                    } else if (! m_optional.equals(optional)) {

-                        System.err.println("The optional attribute is not always the same");

-                        return;

-                    }

-                }

-                

-                if (m_aggregate != null) {

-                    if (aggregate == null) {

-                        req.addAttribute(new Attribute("aggregate", m_aggregate));

-                    } else if (! m_aggregate.equals(aggregate)) {

-                        System.err.println("The aggregate attribute is not always the same");

-                        return;

-                    }

-                }

-                

-                if (m_filter != null) {

-                    if (filter == null) {

-                        req.addAttribute(new Attribute("filter", m_filter));

-                    } else if (! m_filter.equals(filter)) {

-                        System.err.println("The filter attribute is not always the same");

-                        return;

-                    }

-                }

-                

-                if (m_policy != null) {

-                    if (policy == null) {

-                        req.addAttribute(new Attribute("policy", m_policy));

-                    } else if (! m_policy.equals(policy)) {

-                        System.err.println("The policy attribute is not always the same");

-                        return;

-                    }

-                }

-                

-                if (m_comparator != null) {

-                    if (comparator == null) {

-                        req.addAttribute(new Attribute("comparator", m_comparator));

-                    } else if (! m_comparator.equals(comparator)) {

-                        System.err.println("The comparator attribute is not always the same");

-                        return;

-                    }

-                }

-                

-                if (m_from != null) {

-                    if (from == null) {

-                        req.addAttribute(new Attribute("from", m_from));

-                    } else if (! m_from.equals(from)) {

-                        System.err.println("The from attribute is not always the same");

-                        return;

-                    }

-                    

-                }

-                

-            }

-            Element method = new Element("callback", "");

-            method.addAttribute(new Attribute("method", m_name));

-            method.addAttribute(new Attribute("type", m_type));

-            req.addElement(method);

-            m_collector.getIds().put(m_id, req);

-            m_collector.getElements().put(req, null);

-            return;

-        }

-    }

-

-    private final class PropertyAnnotationParser extends EmptyVisitor implements AnnotationVisitor {

-

-        /**

-         * Parent element.

-         */

-        private Element m_parent;

-        

-        /**

-         * Attached method.

-         */

-        private String m_method;

-        

-        /**

-         * Property name. 

-         */

-        private String m_name;

-        

-        /**

-         * Property value. 

-         */

-        private String m_value;

-

-        /**

-         * Constructor.

-         * @param parent : parent element.

-         * @param method : attached method.

-         */

-        private PropertyAnnotationParser(Element parent, String method) {

-            m_parent = parent;

-            m_method = method;

-        }

-

-        /**

-         * Visit annotation attributes.

-         * @param arg0 : annotation name

-         * @param arg1 : annotation value

-         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)

-         */

-        public void visit(String arg0, Object arg1) {

-            if (arg0.equals("name")) {

-                m_name = arg1.toString();

-                return;

-            }

-            if (arg0.equals("value")) {

-                m_value = arg1.toString();

-                return;

-            }

-        }

-

-        /**

-         * End of the visit.

-         * Append the computed element to the parent element.

-         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()

-         */

-        public void visitEnd() {

-            if (m_name == null && m_method.startsWith("set")) {

-                m_name = m_method.substring("set".length());

-            }

-            Element[] props = m_parent.getElements("Property");

-            Element prop = null;

-            for (int i = 0; props != null && prop == null && i < props.length; i++) {

-                String name = props[i].getAttribute("name");

-                if (name != null && name.equals(m_name)) {

-                    prop = props[i];

-                }

-            }

-

-            if (prop == null) {

-                prop = new Element("property", "");

-                m_parent.addElement(prop);

-                if (m_name != null) {

-                    prop.addAttribute(new Attribute("name", m_name));

-                }

-            }

-

-            prop.addAttribute(new Attribute("method", m_method));

-            if (m_value != null) {

-                prop.addAttribute(new Attribute("value", m_value));

-            }

-

-        }

-    }

-}

+/* 
+ * 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.ipojo.manipulation.annotations;
+
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.EmptyVisitor;
+
+/**
+ * This class collects method annotations, and give them to the metadata collector. 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class MethodCollector extends EmptyVisitor {
+
+    /**
+     * Parent collector.
+     */
+    private MetadataCollector m_collector;
+    
+    /**
+     * Method name. 
+     */
+    private String m_name;
+
+    /**
+     * Constructor.
+     * @param name : name of the method.
+     * @param collector : parent collector.
+     */
+    public MethodCollector(String name, MetadataCollector collector) {
+        m_collector = collector;
+        m_name = name;
+    }
+
+    /**
+     * Visit method annotations.
+     * @param arg0 : annotation name.
+     * @param arg1 : is the annotation visible at runtime.
+     * @return the visitor paring the visited annotation.
+     * @see org.objectweb.asm.commons.EmptyVisitor#visitAnnotation(java.lang.String, boolean)
+     */
+    public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Property;")) {
+            return processProperty();
+        }
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/ServiceProperty;")) {
+            return processServiceProperty();
+        }
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Validate;")) {
+            return processValidate();
+        }
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Invalidate;")) {
+            return processInvalidate();
+        }
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Bind;")) {
+            return processBind("bind");
+        }
+        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Unbind;")) {
+            return processBind("unbind");
+        }
+        
+        if (CustomAnnotationVisitor.isCustomAnnotation(arg0)) {
+            Element elem = CustomAnnotationVisitor.buildElement(arg0);
+            elem.addAttribute(new Attribute("method", m_name));
+            return new CustomAnnotationVisitor(elem, m_collector, true);
+        }
+        
+        return null;
+    }
+
+    /**
+     * Process @bind & @unbind.
+     * @param type : bind or unbind
+     * @return the visitor parsing @bind & @unbind annotations.
+     */
+    private AnnotationVisitor processBind(String type) {
+        return new BindAnnotationParser(m_name, type);
+    }
+
+    /**
+     * Process @validate annotation.
+     * @return null.
+     */
+    private AnnotationVisitor processValidate() {
+        Element cb = new Element("callback", "");
+        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("transition", "validate"));
+        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("method", m_name));
+        m_collector.getElements().put(cb, null);
+        return null;
+    }
+
+    /**
+     * Process @invalidate annotation.
+     * @return null.
+     */
+    private AnnotationVisitor processInvalidate() {
+        Element cb = new Element("callback", "");
+        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("transition", "invalidate"));
+        cb.addAttribute(new org.apache.felix.ipojo.metadata.Attribute("method", m_name));
+        m_collector.getElements().put(cb, null);
+        return null;
+    }
+
+    /**
+     * Process @serviceProperty annotation.
+     * @return the visitor parsing the visited annotation.
+     */
+    private AnnotationVisitor processServiceProperty() {
+        if (! m_collector.getIds().containsKey("provides")) {
+            System.err.println("The component does not provide services, skipping ServiceProperty for " + m_name);
+            return null;
+        } else {
+            Element provides = (Element) m_collector.getIds().get("provides");
+            return new PropertyAnnotationParser(provides, m_name);
+        }
+    }
+
+    /**
+     * Process @property annotation.
+     * @return the visitor parsing the visited annotation.
+     */
+    private AnnotationVisitor processProperty() {
+        Element prop = null;
+        if (! m_collector.getIds().containsKey("properties")) {
+            prop = new Element("Properties", "");
+            m_collector.getIds().put("properties", prop);
+            m_collector.getElements().put(prop, null);
+        } else {
+            prop = (Element) m_collector.getIds().get("properties");
+        }
+        return new PropertyAnnotationParser(prop, m_name);
+    }
+
+    /**
+     * Parse @bind & @unbind annotations.
+     */
+    private final class BindAnnotationParser extends EmptyVisitor implements AnnotationVisitor {
+
+        /**
+         * Method name.
+         */
+        private String m_name;
+
+        /**
+         * Requirement filter.
+         */
+        private String m_filter;
+
+        /**
+         * Is the requirement optional?
+         */
+        private String m_optional;
+
+        /**
+         * Is the requirement aggregate?
+         */
+        private String m_aggregate;
+
+        /**
+         * Required specification. 
+         */
+        private String m_specification;
+
+        /**
+         * Requirement id.
+         */
+        private String m_id;
+
+        /**
+         * Bind or Unbind method?
+         */
+        private String m_type;
+        
+        /**
+         * Binding policy.
+         */
+        private String m_policy;
+        
+        /**
+         * Comparator.
+         */
+        private String m_comparator;
+        
+        /**
+         * From attribute.
+         */
+        private String m_from;
+
+        /**
+         * Constructor.
+         * @param bind : method name.
+         * @param type : is the callback a bind or an unbind method.
+         */
+        private BindAnnotationParser(String bind, String type) {
+            m_name = bind;
+            m_type = type;
+        }
+
+        /**
+         * Visit annotation attribute.
+         * @param arg0 : annotation name
+         * @param arg1 : annotation value
+         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+         */
+        public void visit(String arg0, Object arg1) {
+            if (arg0.equals("filter")) {
+                m_filter = arg1.toString();
+                return;
+            }
+            if (arg0.equals("optional")) {
+                m_optional = arg1.toString();
+                return;
+            }
+            if (arg0.equals("aggregate")) {
+                m_aggregate = arg1.toString();
+                return;
+            }
+            if (arg0.equals("specification")) {
+                m_specification = arg1.toString();
+                return;
+            }
+            if (arg0.equals("policy")) {
+                m_policy = arg1.toString();
+                return;
+            }
+            if (arg0.equals("id")) {
+                m_id = arg1.toString();
+                return;
+            }
+            if (arg0.equals("comparator")) {
+                Type type = Type.getType(arg1.toString());
+                m_comparator = type.getClassName();
+                return;
+            }
+            if (arg0.equals("from")) {
+                m_from = arg1.toString();
+                return;
+            }
+            
+        }
+
+        /**
+         * End of the visit.
+         * Create or append the requirement info to a created or already existing "requires" element.
+         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+         */
+        public void visitEnd() {
+            if (m_id == null) {
+                if (m_name.startsWith("bind")) {
+                    m_id = m_name.substring("bind".length());
+                } else if (m_name.startsWith("unbind")) {
+                    m_id = m_name.substring("unbind".length());
+                } else {
+                    System.err.println("Cannot determine the id of the bind method : " + m_name);
+                    return;
+                }
+            }
+            // Check if it is a full-determined requirement
+            Element req = (Element) m_collector.getIds().get(m_id);
+            if (req == null) {
+                // Add the complete requires
+                req = new Element("requires", "");
+                if (m_specification != null) {
+                    req.addAttribute(new Attribute("specification", m_specification));
+                }
+                if (m_aggregate != null) {
+                    req.addAttribute(new Attribute("aggregate", m_aggregate));
+                }
+                if (m_filter != null) {
+                    req.addAttribute(new Attribute("filter", m_filter));
+                }
+                if (m_optional != null) {
+                    req.addAttribute(new Attribute("optional", m_optional));
+                }
+                if (m_policy != null) {
+                    req.addAttribute(new Attribute("policy", m_policy));
+                }
+                if (m_id != null) {
+                    req.addAttribute(new Attribute("id", m_id));
+                }
+                if (m_comparator != null) {
+                    req.addAttribute(new Attribute("comparator", m_comparator));
+                }
+                if (m_from != null) {
+                    req.addAttribute(new Attribute("from", m_from));
+                }
+            } else {
+                String itf = req.getAttribute("specification");
+                String aggregate = req.getAttribute("aggregate");
+                String optional = req.getAttribute("optional");
+                String filter = req.getAttribute("filter");
+                String policy = req.getAttribute("policy");
+                String comparator = req.getAttribute("comparator");
+                String from = req.getAttribute("from");
+                if (m_specification != null) {
+                    if (itf == null) {
+                        req.addAttribute(new Attribute("specification", m_specification));
+                    } else if (! m_specification.equals(itf)) {
+                        System.err.println("The required specification is not the same as previouly : " + m_specification + " & " + itf);
+                        return;
+                    }
+                }
+                
+                if (m_optional != null) {
+                    if (optional == null) {
+                        req.addAttribute(new Attribute("optional", m_optional));
+                    } else if (! m_optional.equals(optional)) {
+                        System.err.println("The optional attribute is not always the same");
+                        return;
+                    }
+                }
+                
+                if (m_aggregate != null) {
+                    if (aggregate == null) {
+                        req.addAttribute(new Attribute("aggregate", m_aggregate));
+                    } else if (! m_aggregate.equals(aggregate)) {
+                        System.err.println("The aggregate attribute is not always the same");
+                        return;
+                    }
+                }
+                
+                if (m_filter != null) {
+                    if (filter == null) {
+                        req.addAttribute(new Attribute("filter", m_filter));
+                    } else if (! m_filter.equals(filter)) {
+                        System.err.println("The filter attribute is not always the same");
+                        return;
+                    }
+                }
+                
+                if (m_policy != null) {
+                    if (policy == null) {
+                        req.addAttribute(new Attribute("policy", m_policy));
+                    } else if (! m_policy.equals(policy)) {
+                        System.err.println("The policy attribute is not always the same");
+                        return;
+                    }
+                }
+                
+                if (m_comparator != null) {
+                    if (comparator == null) {
+                        req.addAttribute(new Attribute("comparator", m_comparator));
+                    } else if (! m_comparator.equals(comparator)) {
+                        System.err.println("The comparator attribute is not always the same");
+                        return;
+                    }
+                }
+                
+                if (m_from != null) {
+                    if (from == null) {
+                        req.addAttribute(new Attribute("from", m_from));
+                    } else if (! m_from.equals(from)) {
+                        System.err.println("The from attribute is not always the same");
+                        return;
+                    }
+                    
+                }
+                
+            }
+            Element method = new Element("callback", "");
+            method.addAttribute(new Attribute("method", m_name));
+            method.addAttribute(new Attribute("type", m_type));
+            req.addElement(method);
+            m_collector.getIds().put(m_id, req);
+            m_collector.getElements().put(req, null);
+            return;
+        }
+    }
+
+    private final class PropertyAnnotationParser extends EmptyVisitor implements AnnotationVisitor {
+
+        /**
+         * Parent element.
+         */
+        private Element m_parent;
+        
+        /**
+         * Attached method.
+         */
+        private String m_method;
+        
+        /**
+         * Property name. 
+         */
+        private String m_name;
+        
+        /**
+         * Property value. 
+         */
+        private String m_value;
+
+        /**
+         * Constructor.
+         * @param parent : parent element.
+         * @param method : attached method.
+         */
+        private PropertyAnnotationParser(Element parent, String method) {
+            m_parent = parent;
+            m_method = method;
+        }
+
+        /**
+         * Visit annotation attributes.
+         * @param arg0 : annotation name
+         * @param arg1 : annotation value
+         * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+         */
+        public void visit(String arg0, Object arg1) {
+            if (arg0.equals("name")) {
+                m_name = arg1.toString();
+                return;
+            }
+            if (arg0.equals("value")) {
+                m_value = arg1.toString();
+                return;
+            }
+        }
+
+        /**
+         * End of the visit.
+         * Append the computed element to the parent element.
+         * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+         */
+        public void visitEnd() {
+            if (m_name == null && m_method.startsWith("set")) {
+                m_name = m_method.substring("set".length());
+            }
+            Element[] props = m_parent.getElements("Property");
+            Element prop = null;
+            for (int i = 0; props != null && prop == null && i < props.length; i++) {
+                String name = props[i].getAttribute("name");
+                if (name != null && name.equals(m_name)) {
+                    prop = props[i];
+                }
+            }
+
+            if (prop == null) {
+                prop = new Element("property", "");
+                m_parent.addElement(prop);
+                if (m_name != null) {
+                    prop.addAttribute(new Attribute("name", m_name));
+                }
+            }
+
+            prop.addAttribute(new Attribute("method", m_method));
+            if (m_value != null) {
+                prop.addAttribute(new Attribute("value", m_value));
+            }
+
+        }
+    }
+}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
index 0cc1181..ee180b4 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
@@ -1,764 +1,764 @@
-/* 

- * 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.ipojo.manipulator;

-

-import java.io.File;

-import java.io.FileNotFoundException;

-import java.io.FileOutputStream;

-import java.io.IOException;

-import java.io.InputStream;

-import java.net.MalformedURLException;

-import java.net.URL;

-import java.util.ArrayList;

-import java.util.Enumeration;

-import java.util.HashMap;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-import java.util.Set;

-import java.util.TreeMap;

-import java.util.jar.Attributes;

-import java.util.jar.JarEntry;

-import java.util.jar.JarFile;

-import java.util.jar.JarOutputStream;

-import java.util.jar.Manifest;

-

-import org.apache.felix.ipojo.manipulation.InnerClassManipulator;

-import org.apache.felix.ipojo.manipulation.Manipulator;

-import org.apache.felix.ipojo.manipulation.annotations.MetadataCollector;

-import org.apache.felix.ipojo.metadata.Attribute;

-import org.apache.felix.ipojo.metadata.Element;

-import org.apache.felix.ipojo.xml.parser.ParseException;

-import org.apache.felix.ipojo.xml.parser.XMLMetadataParser;

-import org.objectweb.asm.ClassReader;

-import org.xml.sax.InputSource;

-import org.xml.sax.SAXException;

-import org.xml.sax.SAXParseException;

-import org.xml.sax.XMLReader;

-

-/**

- * Pojoization allows creating an iPOJO bundle from a "normal" bundle.  

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class Pojoization {

-

-    /**

-     * List of component types.

-     */

-    private List m_components;

-

-    /**

-     * Metadata (in internal format).

-     */

-    private Element[] m_metadata = new Element[0];

-

-    /**

-     * Errors which occur during the manipulation.

-     */

-    private List m_errors = new ArrayList();

-

-    /**

-     * Warnings which occur during the manipulation.

-     */

-    private List m_warnings = new ArrayList();

-

-    /**

-     * Class map (jar entry, byte[]).

-     */

-    private Map m_classes = new HashMap();

-

-    /**

-     * Referenced packages by the composite.

-     */

-    private List m_referredPackages;

-

-    /**

-     * Flag describing if we need of not compute annotations.

-     */

-    private boolean m_ignoreAnnotations;

-

-    /**

-     * Add an error in the error list.

-     * @param mes : error message.

-     */

-    private void error(String mes) {

-        m_errors.add(mes);

-    }

-

-    /**

-     * Add a warning in the warning list.

-     * @param mes : warning message

-     */

-    public void warn(String mes) {

-        m_warnings.add(mes);

-    }

-

-    public List getErrors() {

-        return m_errors;

-    }

-    

-    /**

-     * Activate annotation processing.

-     */

-    public void setAnnotationProcessing() {

-        m_ignoreAnnotations = false;

-    }

-

-    /**

-     * Manipulate a normal bundle.

-     * It will create an iPOJO bundle based on the given metadata file.

-     * The original and final bundle must be different.

-     * @param in : original bundle.

-     * @param out : final bundle.

-     * @param metadataFile : iPOJO metadata file (XML). 

-     */

-    public void pojoization(File in, File out, File metadataFile) {

-        // Get the metadata.xml location if not null

-        if (metadataFile != null) {

-            String path = metadataFile.getAbsolutePath();

-            if (!path.startsWith("/")) {

-                path = "/" + path;

-            }

-            m_metadata = parseXMLMetadata(path);

-            if (m_metadata == null) {

-                return;

-            }

-        }

-        

-        JarFile inputJar;

-        try {

-            inputJar = new JarFile(in);

-        } catch (IOException e) {

-            error("The input file " + in.getAbsolutePath() + " is not a Jar file");

-            return;

-        }

-

-        // Get the list of declared component

-        m_components = getDeclaredComponents(m_metadata);

-

-        // Start the manipulation

-        manipulation(inputJar, out);

-

-        // Check that all declared components are manipulated

-        for (int i = 0; i < m_components.size(); i++) {

-            ComponentInfo ci = (ComponentInfo) m_components.get(i);

-            if (!ci.m_isManipulated) {

-                error("The component " + ci.m_classname + " is declared but not in the bundle");

-            }

-        }

-    }

-

-    /**

-     * Parse the content of the input Jar file to detect annotated classes.

-     * @param inC : the class to inspect.

-     */

-    private void computeAnnotations(byte[] inC) {

-        ClassReader cr = new ClassReader(inC);

-        MetadataCollector xml = new MetadataCollector();

-        cr.accept(xml, 0);

-        if (xml.isAnnotated()) {

-            boolean toskip = false;

-            for (int i = 0; !toskip && i < m_metadata.length; i++) {

-                if (m_metadata[i].containsAttribute("name")

-                        && m_metadata[i].getAttribute("name").equalsIgnoreCase(xml.getElem().getAttribute("name"))) {

-                    toskip = true;

-                    warn("The component " + xml.getElem().getAttribute("name") + " is overriden by the metadata file");

-                }

-            }

-            if (!toskip) {

-                if (m_metadata != null || m_metadata.length != 0) {

-                    Element[] newElementsList = new Element[m_metadata.length + 1];

-                    System.arraycopy(m_metadata, 0, newElementsList, 0, m_metadata.length);

-                    newElementsList[m_metadata.length] = xml.getElem();

-                    m_metadata = newElementsList;

-                } else {

-                    m_metadata = new Element[] { xml.getElem() };

-                }

-                String name = m_metadata[m_metadata.length - 1].getAttribute("classname");

-                name = name.replace('.', '/');

-                name += ".class";

-                m_components.add(new ComponentInfo(name, m_metadata[m_metadata.length - 1]));

-            }

-        }

-    }

-

-    /**

-     * Manipulate the Bundle.

-     * @param inputJar : original bundle (JarFile)

-     * @param out : final bundle

-     */

-    private void manipulation(JarFile inputJar, File out) {

-        manipulateComponents(inputJar); // Manipulate classes

-        m_referredPackages = getReferredPackages();

-        Manifest mf = doManifest(inputJar); // Compute the manifest

-

-        // Create a new Jar file

-        FileOutputStream fos = null;

-        JarOutputStream jos = null;

-        try {

-            fos = new FileOutputStream(out);

-            jos = new JarOutputStream(fos, mf);

-        } catch (FileNotFoundException e1) {

-            error("Cannot manipulate the Jar file : the output file " + out.getAbsolutePath() + " is not found");

-            return;

-        } catch (IOException e) {

-            error("Cannot manipulate the Jar file : cannot access to " + out.getAbsolutePath());

-            return;

-        }

-

-        try {

-            // Copy classes and resources

-            Enumeration entries = inputJar.entries();

-            while (entries.hasMoreElements()) {

-                JarEntry curEntry = (JarEntry) entries.nextElement();

-                // Check if we need to manipulate the class

-                if (m_classes.containsKey(curEntry.getName())) {

-                    JarEntry je = new JarEntry(curEntry.getName());

-                    byte[] outClazz = (byte[]) m_classes.get(curEntry.getName());

-                    if (outClazz.length != 0) {

-                        jos.putNextEntry(je); // copy the entry header to jos

-                        jos.write(outClazz);

-                        jos.closeEntry();

-                    } else { // The class is already manipulated

-                        jos.putNextEntry(curEntry);

-                        InputStream currIn = inputJar.getInputStream(curEntry);

-                        int c;

-                        int i = 0;

-                        while ((c = currIn.read()) >= 0) {

-                            jos.write(c);

-                            i++;

-                        }

-                        currIn.close();

-                        jos.closeEntry();

-                    }

-                } else {

-                    // Do not copy the manifest

-                    if (!curEntry.getName().equals("META-INF/MANIFEST.MF")) {

-                        // copy the entry header to jos

-                        jos.putNextEntry(curEntry);

-                        InputStream currIn = inputJar.getInputStream(curEntry);

-                        int c;

-                        int i = 0;

-                        while ((c = currIn.read()) >= 0) {

-                            jos.write(c);

-                            i++;

-                        }

-                        currIn.close();

-                        jos.closeEntry();

-                    }

-                }

-            }

-        } catch (IOException e) {

-            error("Cannot manipulate the Jar file : " + e.getMessage());

-            return;

-        }

-

-        try {

-            inputJar.close();

-            jos.close();

-            fos.close();

-            jos = null;

-            fos = null;

-        } catch (IOException e) {

-            error("Cannot close the new Jar file : " + e.getMessage());

-            return;

-        }

-    }

-

-    /**

-     * Manipulate classes of the input Jar.

-     * @param inputJar : input bundle.

-     */

-    private void manipulateComponents(JarFile inputJar) {

-        Enumeration entries = inputJar.entries();

-        while (entries.hasMoreElements()) {

-            JarEntry curEntry = (JarEntry) entries.nextElement();

-            if (curEntry.getName().endsWith(".class")) {

-                try {

-                    InputStream currIn = inputJar.getInputStream(curEntry);

-                    byte[] in = new byte[0];

-                    int c;

-                    while ((c = currIn.read()) >= 0) {

-                        byte[] in2 = new byte[in.length + 1];

-                        System.arraycopy(in, 0, in2, 0, in.length);

-                        in2[in.length] = (byte) c;

-                        in = in2;

-                    }

-                    currIn.close();

-                    if (! m_ignoreAnnotations) {

-                        computeAnnotations(in);

-                    }

-                    // Check if we need to manipulate the class

-                    for (int i = 0; i < m_components.size(); i++) {

-                        ComponentInfo ci = (ComponentInfo) m_components.get(i);

-                        if (ci.m_classname.equals(curEntry.getName())) {

-                            byte[] outClazz = manipulateComponent(in, curEntry, ci);

-                            m_classes.put(curEntry.getName(), outClazz);

-                            

-                            // Manipulate inner classes ?

-                            if (!ci.m_inners.isEmpty()) {

-                                for (int k = 0; k < ci.m_inners.size(); k++) {

-                                    JarEntry inner = inputJar.getJarEntry((String) ci.m_inners.get(k) + ".class");

-                                    manipulateInnerClass(inputJar, inner, (String) ci.m_inners.get(k), ci);

-                                }

-                            }

-                        }

-                    }

-                } catch (IOException e) {

-                    error("Cannot read the class : " + curEntry.getName());

-                    return;

-                }

-            }

-        }

-    }

-    

-    /**

-     * Manipulates an inner class.

-     * @param inputJar input jar

-     * @param je inner class jar entry

-     * @param innerClassName inner class name

-     * @param ci component info of the component owning the inner class

-     * @throws IOException the inner class cannot be read

-     */

-    private void manipulateInnerClass(JarFile inputJar, JarEntry je, String innerClassName, ComponentInfo ci) throws IOException {

-        InputStream currIn = inputJar.getInputStream(je);

-        byte[] in = new byte[0];

-        int c;

-        while ((c = currIn.read()) >= 0) {

-            byte[] in2 = new byte[in.length + 1];

-            System.arraycopy(in, 0, in2, 0, in.length);

-            in2[in.length] = (byte) c;

-            in = in2;

-        }

-        

-        InnerClassManipulator man = new InnerClassManipulator(ci.m_classname.substring(0, ci.m_classname.length() - 6), ci.m_fields);

-        byte[] out = man.manipulate(in);

-        

-        m_classes.put(je.getName(), out);

-        

-    }

-

-    /**

-     * Create the manifest.

-     * Set the bundle activator, imports, iPOJO-components clauses

-     * @param initial : initial Jar file.

-     * @return the generated manifest.

-     */

-    private Manifest doManifest(JarFile initial) {

-        Manifest mf = null;

-        try {

-            mf = initial.getManifest(); // Get the initial manifest

-        } catch (IOException e) {

-            e.printStackTrace();

-        }

-        Attributes att = mf.getMainAttributes();

-        setImports(att); // Set the imports (add ipojo and handler namespaces

-        setPOJOMetadata(att); // Add iPOJO-Component

-        setCreatedBy(att); // Add iPOJO to the creators

-        return mf;

-    }

-

-    /**

-     * Manipulate a component class.

-     * @param in : the byte array of the class to manipulate

-     * @param je : Jar entry of the classes

-     * @param ci : attached component info (containing metadata and manipulation metadata)

-     * @return the generated class (byte array)

-     */

-    private byte[] manipulateComponent(byte[] in, JarEntry je, ComponentInfo ci) {

-        Manipulator man = new Manipulator();

-        try {

-            byte[] out = man.manipulate(in); // iPOJO manipulation

-            ci.detectMissingFields(man.getFields()); // Detect missing field

-            // Insert information to metadata

-            ci.m_componentMetadata.addElement(man.getManipulationMetadata());

-            ci.m_isManipulated = true;

-            ci.m_inners = man.getInnerClasses();

-            ci.m_fields = man.getFields().keySet();

-            return out;

-        } catch (IOException e) {

-            error("Cannot manipulate the class " + je.getName() + " : " + e.getMessage());

-            return null;

-        }

-    }

-

-    /**

-     * Return the list of "concrete" component.

-     * @param meta : metadata.

-     * @return the list of component info requiring a manipulation.

-     */

-    private List getDeclaredComponents(Element[] meta) {

-        List componentClazzes = new ArrayList();

-        for (int i = 0; i < meta.length; i++) {

-            String name = meta[i].getAttribute("classname");

-            if (name != null) { // Only handler and component have a classname attribute 

-                name = name.replace('.', '/');

-                name += ".class";

-                componentClazzes.add(new ComponentInfo(name, meta[i]));

-            }

-        }

-        return componentClazzes;

-    }

-

-    /**

-     * Component Info.

-     * Represent a component type to be manipulated or already manipulated.

-     * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>

-     */

-    private class ComponentInfo {

-        /**

-         * Component Type metadata.

-         */

-        Element m_componentMetadata;

-

-        /**

-         * Component Type implementation class.

-         */

-        String m_classname;

-

-        /**

-         * Is the class already manipulated. 

-         */

-        boolean m_isManipulated;

-        

-        /**

-         * List of inner classes of the implementation class.

-         */

-        List m_inners;

-        

-        /**

-         * Set of fields of the implementation class.

-         */

-        Set m_fields;

-

-        /**

-         * Constructor.

-         * @param cn : class name

-         * @param met : component type metadata

-         */

-        ComponentInfo(String cn, Element met) {

-            this.m_classname = cn;

-            this.m_componentMetadata = met;

-            m_isManipulated = false;

-        }

-        

-        /**

-         * Detects missing fields.

-         * If a referenced field does not exist in the class

-         * the method throws an error breaking the build process.

-         * @param fields : field found in the manipulated class

-         */

-        void detectMissingFields(Map fields) {

-            // First, compute the list of referred fields

-            List list = new ArrayList();

-            computeReferredFields(list, m_componentMetadata);

-            // Then, try to find each referred field in the given field map

-            for (int i = 0; i < list.size(); i++) {

-                if (!fields.containsKey(list.get(i))) {

-                    error("The field " + list.get(i) + " is referenced in the "

-                            + "metadata but does not exist in the " + m_classname + " class");

-                }

-            }

-        }

-        

-        /**

-         * Looks for 'field' attribute in the given metadata.

-         * @param list : discovered field (accumulator)

-         * @param metadata : metadata to inspect

-         */

-        private void computeReferredFields(List list, Element metadata) {

-            String field = metadata.getAttribute("field");

-            if (field != null && ! list.contains(field)) {

-                list.add(field);

-            }

-            for (int i = 0; i < metadata.getElements().length; i++) {

-                computeReferredFields(list, metadata.getElements()[i]);

-            }

-        }

-        

-    }

-

-    /**

-     * Set the create-by in the manifest.

-     * @param att : manifest attribute.

-     */

-    private void setCreatedBy(Attributes att) {

-        String prev = att.getValue("Created-By");

-        att.putValue("Created-By", prev + " & iPOJO");

-    }

-

-    /**

-     * Add imports to the given manifest attribute list. This method add ipojo imports and handler imports (if needed).

-     * @param att : the manifest attribute list to modify.

-     */

-    private void setImports(Attributes att) {

-        Map imports = parseHeader(att.getValue("Import-Package"));

-        Map ver = new TreeMap();

-        ver.put("version", "0.9.0");

-        if (!imports.containsKey("org.apache.felix.ipojo")) {

-            imports.put("org.apache.felix.ipojo", ver);

-        }

-        if (!imports.containsKey("org.apache.felix.ipojo.architecture")) {

-            imports.put("org.apache.felix.ipojo.architecture", ver);

-        }

-        if (!imports.containsKey("org.osgi.service.cm")) {

-            Map verCM = new TreeMap();

-            verCM.put("version", "1.2");

-            imports.put("org.osgi.service.cm", verCM);

-        }

-        if (!imports.containsKey("org.osgi.service.log")) {

-            Map verCM = new TreeMap();

-            verCM.put("version", "1.3");

-            imports.put("org.osgi.service.log", verCM);

-        }

-

-        // Add referred imports from the metadata

-        for (int i = 0; i < m_referredPackages.size(); i++) {

-            String pack = (String) m_referredPackages.get(i);

-            imports.put(pack, new TreeMap());

-        }

-

-        // Write imports

-        att.putValue("Import-Package", printClauses(imports, "resolution:"));

-    }

-

-    /**

-     * Add iPOJO-Components to the given manifest attribute list. This method add the iPOJO-Components header and its value (according to the metadata) to the manifest.

-     * @param att : the manifest attribute list to modify.

-     */

-    private void setPOJOMetadata(Attributes att) {

-        String meta = "";

-        for (int i = 0; i < m_metadata.length; i++) {

-            meta += buildManifestMetadata(m_metadata[i], "");

-        }

-        if (!meta.equals("")) { 

-            att.putValue("iPOJO-Components", meta);

-        }

-    }

-

-    /**

-     * Standard OSGi header parser. This parser can handle the format clauses ::= clause ( ',' clause ) + clause ::= name ( ';' name ) (';' key '=' value )

-     * This is mapped to a Map { name => Map { attr|directive => value } }

-     * 

-     * @param value : String to parse.

-     * @return parsed map.

-     */

-    public Map parseHeader(String value) {

-        if (value == null || value.trim().length() == 0) {

-            return new HashMap();

-        }

-

-        Map result = new HashMap();

-        QuotedTokenizer qt = new QuotedTokenizer(value, ";=,");

-        char del;

-        do {

-            boolean hadAttribute = false;

-            Map clause = new HashMap();

-            List aliases = new ArrayList();

-            aliases.add(qt.nextToken());

-            del = qt.getSeparator();

-            while (del == ';') {

-                String adname = qt.nextToken();

-                if ((del = qt.getSeparator()) != '=') {

-                    if (hadAttribute) {

-                        throw new IllegalArgumentException("Header contains name field after attribute or directive: " + adname + " from " + value);

-                    }

-                    aliases.add(adname);

-                } else {

-                    String advalue = qt.nextToken();

-                    clause.put(adname, advalue);

-                    del = qt.getSeparator();

-                    hadAttribute = true;

-                }

-            }

-            for (Iterator i = aliases.iterator(); i.hasNext();) {

-                result.put(i.next(), clause);

-            }

-        } while (del == ',');

-        return result;

-    }

-

-    /**

-     * Print a standard Map based OSGi header.

-     * 

-     * @param exports : map { name => Map { attribute|directive => value } }

-     * @param allowedDirectives : list of allowed directives.

-     * @return the clauses

-     */

-    public String printClauses(Map exports, String allowedDirectives) {

-        StringBuffer sb = new StringBuffer();

-        String del = "";

-        for (Iterator i = exports.keySet().iterator(); i.hasNext();) {

-            String name = (String) i.next();

-            Map map = (Map) exports.get(name);

-            sb.append(del);

-            sb.append(name);

-

-            for (Iterator j = map.keySet().iterator(); j.hasNext();) {

-                String key = (String) j.next();

-

-                // Skip directives we do not recognize

-                if (key.endsWith(":") && allowedDirectives.indexOf(key) < 0) {

-                    continue;

-                }

-

-                String value = (String) map.get(key);

-                sb.append(";");

-                sb.append(key);

-                sb.append("=");

-                boolean dirty = value.indexOf(',') >= 0 || value.indexOf(';') >= 0;

-                if (dirty) {

-                    sb.append("\"");

-                }

-                sb.append(value);

-                if (dirty) {

-                    sb.append("\"");

-                }

-            }

-            del = ", ";

-        }

-        return sb.toString();

-    }

-

-    /**

-     * Parse XML Metadata.

-     * @param path : path of the file to parse.

-     * @return the parsed element array.

-     */

-    private Element[] parseXMLMetadata(String path) {

-        File metadata = new File(path);

-        URL url;

-        Element[] meta = null;

-        try {

-            url = metadata.toURL();

-            if (url == null) {

-                warn("Cannot find the metadata file : " + path);

-                return new Element[0];

-            }

-

-            InputStream stream = url.openStream();            

-            XMLReader parser = (XMLReader) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();

-            XMLMetadataParser handler = new XMLMetadataParser();

-            parser.setContentHandler(handler);

-            parser.setFeature("http://xml.org/sax/features/validation",

-                    true); 

-            parser.setFeature("http://apache.org/xml/features/validation/schema", 

-                    true);

-           

-            parser.setErrorHandler(handler);

-            

-            InputSource is = new InputSource(stream);

-            parser.parse(is);

-            meta = handler.getMetadata();

-            stream.close();

-

-        } catch (MalformedURLException e) {

-            error("Malformed Metadata URL for " + path);

-            return null;

-        } catch (IOException e) {

-            error("Cannot open the file : " + path);

-            return null;

-        } catch (ParseException e) {

-            error("Parsing Error when parsing the XML file " + path + " : " + e.getMessage());

-            return null;

-        } catch (SAXParseException e) {

-            error("Error during metadata parsing at line " + e.getLineNumber() + " : " + e.getMessage());

-            return null;

-        } catch (SAXException e) {

-            error("Parsing Error when parsing (Sax Error) the XML file " + path + " : " + e.getMessage());

-            return null;

-        } catch (InstantiationException e) {

-            error("Cannot instantiate the SAX parser for the XML file " + path + " : " + e.getMessage());

-            return null;

-        } catch (IllegalAccessException e) {

-            error("Cannot instantiate  the SAX parser (IllegalAccess) for the XML file " + path + " : " + e.getMessage());

-            return null;

-        } catch (ClassNotFoundException e) {

-            error("Cannot load the Sax Parser : " + e.getMessage());

-            return null;

-        }

-

-        if (meta == null || meta.length == 0) {

-            warn("Neither component types, nor instances in " + path);

-        }

-

-        return meta;

-    }

-    

-    /**

-     * Get packages referenced by composite.

-     * @return the list of referenced packages.

-     */

-    private List getReferredPackages() {

-        List referred = new ArrayList();

-        for (int i = 0; i < m_metadata.length; i++) {

-            if (m_metadata[i].getName().equalsIgnoreCase("composite")) {

-                Element[] elems = m_metadata[i].getElements();

-                for (int j = 0; j < elems.length; j++) {

-                    String att = elems[j].getAttribute("specification");

-                    if (att != null) {

-                        int last = att.lastIndexOf('.');

-                        if (last != -1) {

-                            referred.add(att.substring(0, last));

-                        }

-                    }

-                }

-            }

-        }

-        return referred;

-    }

-

-    /**

-     * Generate manipulation metadata.

-     * @param element : actual element. 

-     * @param actual : actual manipulation metadata.

-     * @return : given manipulation metadata + manipulation metadata of the given element.

-     */

-    private String buildManifestMetadata(Element element, String actual) {

-        String result = "";

-        if (element.getNameSpace() == null) {

-            result = actual + element.getName() + " { ";

-        } else {

-            result = actual + element.getNameSpace() + ":" + element.getName() + " { ";

-        }

-

-        Attribute[] atts = element.getAttributes();

-        for (int i = 0; i < atts.length; i++) {

-            Attribute current = (Attribute) atts[i];

-            if (current.getNameSpace() == null) {

-                result = result + "$" + current.getName() + "=\"" + current.getValue() + "\" ";

-            } else {

-                result = result + "$" + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\" ";

-            }

-        }

-

-        Element[] elems = element.getElements();

-        for (int i = 0; i < elems.length; i++) {

-            result = buildManifestMetadata(elems[i], result);

-        }

-

-        return result + "}";

-    }

-

-    public List getWarnings() {

-        return m_warnings;

-    }

-

-}

-

+/* 
+ * 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.ipojo.manipulator;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.felix.ipojo.manipulation.InnerClassManipulator;
+import org.apache.felix.ipojo.manipulation.Manipulator;
+import org.apache.felix.ipojo.manipulation.annotations.MetadataCollector;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.xml.parser.ParseException;
+import org.apache.felix.ipojo.xml.parser.XMLMetadataParser;
+import org.objectweb.asm.ClassReader;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Pojoization allows creating an iPOJO bundle from a "normal" bundle.  
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Pojoization {
+
+    /**
+     * List of component types.
+     */
+    private List m_components;
+
+    /**
+     * Metadata (in internal format).
+     */
+    private Element[] m_metadata = new Element[0];
+
+    /**
+     * Errors which occur during the manipulation.
+     */
+    private List m_errors = new ArrayList();
+
+    /**
+     * Warnings which occur during the manipulation.
+     */
+    private List m_warnings = new ArrayList();
+
+    /**
+     * Class map (jar entry, byte[]).
+     */
+    private Map m_classes = new HashMap();
+
+    /**
+     * Referenced packages by the composite.
+     */
+    private List m_referredPackages;
+
+    /**
+     * Flag describing if we need of not compute annotations.
+     */
+    private boolean m_ignoreAnnotations;
+
+    /**
+     * Add an error in the error list.
+     * @param mes : error message.
+     */
+    private void error(String mes) {
+        m_errors.add(mes);
+    }
+
+    /**
+     * Add a warning in the warning list.
+     * @param mes : warning message
+     */
+    public void warn(String mes) {
+        m_warnings.add(mes);
+    }
+
+    public List getErrors() {
+        return m_errors;
+    }
+    
+    /**
+     * Activate annotation processing.
+     */
+    public void setAnnotationProcessing() {
+        m_ignoreAnnotations = false;
+    }
+
+    /**
+     * Manipulate a normal bundle.
+     * It will create an iPOJO bundle based on the given metadata file.
+     * The original and final bundle must be different.
+     * @param in : original bundle.
+     * @param out : final bundle.
+     * @param metadataFile : iPOJO metadata file (XML). 
+     */
+    public void pojoization(File in, File out, File metadataFile) {
+        // Get the metadata.xml location if not null
+        if (metadataFile != null) {
+            String path = metadataFile.getAbsolutePath();
+            if (!path.startsWith("/")) {
+                path = "/" + path;
+            }
+            m_metadata = parseXMLMetadata(path);
+            if (m_metadata == null) {
+                return;
+            }
+        }
+        
+        JarFile inputJar;
+        try {
+            inputJar = new JarFile(in);
+        } catch (IOException e) {
+            error("The input file " + in.getAbsolutePath() + " is not a Jar file");
+            return;
+        }
+
+        // Get the list of declared component
+        m_components = getDeclaredComponents(m_metadata);
+
+        // Start the manipulation
+        manipulation(inputJar, out);
+
+        // Check that all declared components are manipulated
+        for (int i = 0; i < m_components.size(); i++) {
+            ComponentInfo ci = (ComponentInfo) m_components.get(i);
+            if (!ci.m_isManipulated) {
+                error("The component " + ci.m_classname + " is declared but not in the bundle");
+            }
+        }
+    }
+
+    /**
+     * Parse the content of the input Jar file to detect annotated classes.
+     * @param inC : the class to inspect.
+     */
+    private void computeAnnotations(byte[] inC) {
+        ClassReader cr = new ClassReader(inC);
+        MetadataCollector xml = new MetadataCollector();
+        cr.accept(xml, 0);
+        if (xml.isAnnotated()) {
+            boolean toskip = false;
+            for (int i = 0; !toskip && i < m_metadata.length; i++) {
+                if (m_metadata[i].containsAttribute("name")
+                        && m_metadata[i].getAttribute("name").equalsIgnoreCase(xml.getElem().getAttribute("name"))) {
+                    toskip = true;
+                    warn("The component " + xml.getElem().getAttribute("name") + " is overriden by the metadata file");
+                }
+            }
+            if (!toskip) {
+                if (m_metadata != null || m_metadata.length != 0) {
+                    Element[] newElementsList = new Element[m_metadata.length + 1];
+                    System.arraycopy(m_metadata, 0, newElementsList, 0, m_metadata.length);
+                    newElementsList[m_metadata.length] = xml.getElem();
+                    m_metadata = newElementsList;
+                } else {
+                    m_metadata = new Element[] { xml.getElem() };
+                }
+                String name = m_metadata[m_metadata.length - 1].getAttribute("classname");
+                name = name.replace('.', '/');
+                name += ".class";
+                m_components.add(new ComponentInfo(name, m_metadata[m_metadata.length - 1]));
+            }
+        }
+    }
+
+    /**
+     * Manipulate the Bundle.
+     * @param inputJar : original bundle (JarFile)
+     * @param out : final bundle
+     */
+    private void manipulation(JarFile inputJar, File out) {
+        manipulateComponents(inputJar); // Manipulate classes
+        m_referredPackages = getReferredPackages();
+        Manifest mf = doManifest(inputJar); // Compute the manifest
+
+        // Create a new Jar file
+        FileOutputStream fos = null;
+        JarOutputStream jos = null;
+        try {
+            fos = new FileOutputStream(out);
+            jos = new JarOutputStream(fos, mf);
+        } catch (FileNotFoundException e1) {
+            error("Cannot manipulate the Jar file : the output file " + out.getAbsolutePath() + " is not found");
+            return;
+        } catch (IOException e) {
+            error("Cannot manipulate the Jar file : cannot access to " + out.getAbsolutePath());
+            return;
+        }
+
+        try {
+            // Copy classes and resources
+            Enumeration entries = inputJar.entries();
+            while (entries.hasMoreElements()) {
+                JarEntry curEntry = (JarEntry) entries.nextElement();
+                // Check if we need to manipulate the class
+                if (m_classes.containsKey(curEntry.getName())) {
+                    JarEntry je = new JarEntry(curEntry.getName());
+                    byte[] outClazz = (byte[]) m_classes.get(curEntry.getName());
+                    if (outClazz.length != 0) {
+                        jos.putNextEntry(je); // copy the entry header to jos
+                        jos.write(outClazz);
+                        jos.closeEntry();
+                    } else { // The class is already manipulated
+                        jos.putNextEntry(curEntry);
+                        InputStream currIn = inputJar.getInputStream(curEntry);
+                        int c;
+                        int i = 0;
+                        while ((c = currIn.read()) >= 0) {
+                            jos.write(c);
+                            i++;
+                        }
+                        currIn.close();
+                        jos.closeEntry();
+                    }
+                } else {
+                    // Do not copy the manifest
+                    if (!curEntry.getName().equals("META-INF/MANIFEST.MF")) {
+                        // copy the entry header to jos
+                        jos.putNextEntry(curEntry);
+                        InputStream currIn = inputJar.getInputStream(curEntry);
+                        int c;
+                        int i = 0;
+                        while ((c = currIn.read()) >= 0) {
+                            jos.write(c);
+                            i++;
+                        }
+                        currIn.close();
+                        jos.closeEntry();
+                    }
+                }
+            }
+        } catch (IOException e) {
+            error("Cannot manipulate the Jar file : " + e.getMessage());
+            return;
+        }
+
+        try {
+            inputJar.close();
+            jos.close();
+            fos.close();
+            jos = null;
+            fos = null;
+        } catch (IOException e) {
+            error("Cannot close the new Jar file : " + e.getMessage());
+            return;
+        }
+    }
+
+    /**
+     * Manipulate classes of the input Jar.
+     * @param inputJar : input bundle.
+     */
+    private void manipulateComponents(JarFile inputJar) {
+        Enumeration entries = inputJar.entries();
+        while (entries.hasMoreElements()) {
+            JarEntry curEntry = (JarEntry) entries.nextElement();
+            if (curEntry.getName().endsWith(".class")) {
+                try {
+                    InputStream currIn = inputJar.getInputStream(curEntry);
+                    byte[] in = new byte[0];
+                    int c;
+                    while ((c = currIn.read()) >= 0) {
+                        byte[] in2 = new byte[in.length + 1];
+                        System.arraycopy(in, 0, in2, 0, in.length);
+                        in2[in.length] = (byte) c;
+                        in = in2;
+                    }
+                    currIn.close();
+                    if (! m_ignoreAnnotations) {
+                        computeAnnotations(in);
+                    }
+                    // Check if we need to manipulate the class
+                    for (int i = 0; i < m_components.size(); i++) {
+                        ComponentInfo ci = (ComponentInfo) m_components.get(i);
+                        if (ci.m_classname.equals(curEntry.getName())) {
+                            byte[] outClazz = manipulateComponent(in, curEntry, ci);
+                            m_classes.put(curEntry.getName(), outClazz);
+                            
+                            // Manipulate inner classes ?
+                            if (!ci.m_inners.isEmpty()) {
+                                for (int k = 0; k < ci.m_inners.size(); k++) {
+                                    JarEntry inner = inputJar.getJarEntry((String) ci.m_inners.get(k) + ".class");
+                                    manipulateInnerClass(inputJar, inner, (String) ci.m_inners.get(k), ci);
+                                }
+                            }
+                        }
+                    }
+                } catch (IOException e) {
+                    error("Cannot read the class : " + curEntry.getName());
+                    return;
+                }
+            }
+        }
+    }
+    
+    /**
+     * Manipulates an inner class.
+     * @param inputJar input jar
+     * @param je inner class jar entry
+     * @param innerClassName inner class name
+     * @param ci component info of the component owning the inner class
+     * @throws IOException the inner class cannot be read
+     */
+    private void manipulateInnerClass(JarFile inputJar, JarEntry je, String innerClassName, ComponentInfo ci) throws IOException {
+        InputStream currIn = inputJar.getInputStream(je);
+        byte[] in = new byte[0];
+        int c;
+        while ((c = currIn.read()) >= 0) {
+            byte[] in2 = new byte[in.length + 1];
+            System.arraycopy(in, 0, in2, 0, in.length);
+            in2[in.length] = (byte) c;
+            in = in2;
+        }
+        
+        InnerClassManipulator man = new InnerClassManipulator(ci.m_classname.substring(0, ci.m_classname.length() - 6), ci.m_fields);
+        byte[] out = man.manipulate(in);
+        
+        m_classes.put(je.getName(), out);
+        
+    }
+
+    /**
+     * Create the manifest.
+     * Set the bundle activator, imports, iPOJO-components clauses
+     * @param initial : initial Jar file.
+     * @return the generated manifest.
+     */
+    private Manifest doManifest(JarFile initial) {
+        Manifest mf = null;
+        try {
+            mf = initial.getManifest(); // Get the initial manifest
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        Attributes att = mf.getMainAttributes();
+        setImports(att); // Set the imports (add ipojo and handler namespaces
+        setPOJOMetadata(att); // Add iPOJO-Component
+        setCreatedBy(att); // Add iPOJO to the creators
+        return mf;
+    }
+
+    /**
+     * Manipulate a component class.
+     * @param in : the byte array of the class to manipulate
+     * @param je : Jar entry of the classes
+     * @param ci : attached component info (containing metadata and manipulation metadata)
+     * @return the generated class (byte array)
+     */
+    private byte[] manipulateComponent(byte[] in, JarEntry je, ComponentInfo ci) {
+        Manipulator man = new Manipulator();
+        try {
+            byte[] out = man.manipulate(in); // iPOJO manipulation
+            ci.detectMissingFields(man.getFields()); // Detect missing field
+            // Insert information to metadata
+            ci.m_componentMetadata.addElement(man.getManipulationMetadata());
+            ci.m_isManipulated = true;
+            ci.m_inners = man.getInnerClasses();
+            ci.m_fields = man.getFields().keySet();
+            return out;
+        } catch (IOException e) {
+            error("Cannot manipulate the class " + je.getName() + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    /**
+     * Return the list of "concrete" component.
+     * @param meta : metadata.
+     * @return the list of component info requiring a manipulation.
+     */
+    private List getDeclaredComponents(Element[] meta) {
+        List componentClazzes = new ArrayList();
+        for (int i = 0; i < meta.length; i++) {
+            String name = meta[i].getAttribute("classname");
+            if (name != null) { // Only handler and component have a classname attribute 
+                name = name.replace('.', '/');
+                name += ".class";
+                componentClazzes.add(new ComponentInfo(name, meta[i]));
+            }
+        }
+        return componentClazzes;
+    }
+
+    /**
+     * Component Info.
+     * Represent a component type to be manipulated or already manipulated.
+     * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+     */
+    private class ComponentInfo {
+        /**
+         * Component Type metadata.
+         */
+        Element m_componentMetadata;
+
+        /**
+         * Component Type implementation class.
+         */
+        String m_classname;
+
+        /**
+         * Is the class already manipulated. 
+         */
+        boolean m_isManipulated;
+        
+        /**
+         * List of inner classes of the implementation class.
+         */
+        List m_inners;
+        
+        /**
+         * Set of fields of the implementation class.
+         */
+        Set m_fields;
+
+        /**
+         * Constructor.
+         * @param cn : class name
+         * @param met : component type metadata
+         */
+        ComponentInfo(String cn, Element met) {
+            this.m_classname = cn;
+            this.m_componentMetadata = met;
+            m_isManipulated = false;
+        }
+        
+        /**
+         * Detects missing fields.
+         * If a referenced field does not exist in the class
+         * the method throws an error breaking the build process.
+         * @param fields : field found in the manipulated class
+         */
+        void detectMissingFields(Map fields) {
+            // First, compute the list of referred fields
+            List list = new ArrayList();
+            computeReferredFields(list, m_componentMetadata);
+            // Then, try to find each referred field in the given field map
+            for (int i = 0; i < list.size(); i++) {
+                if (!fields.containsKey(list.get(i))) {
+                    error("The field " + list.get(i) + " is referenced in the "
+                            + "metadata but does not exist in the " + m_classname + " class");
+                }
+            }
+        }
+        
+        /**
+         * Looks for 'field' attribute in the given metadata.
+         * @param list : discovered field (accumulator)
+         * @param metadata : metadata to inspect
+         */
+        private void computeReferredFields(List list, Element metadata) {
+            String field = metadata.getAttribute("field");
+            if (field != null && ! list.contains(field)) {
+                list.add(field);
+            }
+            for (int i = 0; i < metadata.getElements().length; i++) {
+                computeReferredFields(list, metadata.getElements()[i]);
+            }
+        }
+        
+    }
+
+    /**
+     * Set the create-by in the manifest.
+     * @param att : manifest attribute.
+     */
+    private void setCreatedBy(Attributes att) {
+        String prev = att.getValue("Created-By");
+        att.putValue("Created-By", prev + " & iPOJO");
+    }
+
+    /**
+     * Add imports to the given manifest attribute list. This method add ipojo imports and handler imports (if needed).
+     * @param att : the manifest attribute list to modify.
+     */
+    private void setImports(Attributes att) {
+        Map imports = parseHeader(att.getValue("Import-Package"));
+        Map ver = new TreeMap();
+        ver.put("version", "0.9.0");
+        if (!imports.containsKey("org.apache.felix.ipojo")) {
+            imports.put("org.apache.felix.ipojo", ver);
+        }
+        if (!imports.containsKey("org.apache.felix.ipojo.architecture")) {
+            imports.put("org.apache.felix.ipojo.architecture", ver);
+        }
+        if (!imports.containsKey("org.osgi.service.cm")) {
+            Map verCM = new TreeMap();
+            verCM.put("version", "1.2");
+            imports.put("org.osgi.service.cm", verCM);
+        }
+        if (!imports.containsKey("org.osgi.service.log")) {
+            Map verCM = new TreeMap();
+            verCM.put("version", "1.3");
+            imports.put("org.osgi.service.log", verCM);
+        }
+
+        // Add referred imports from the metadata
+        for (int i = 0; i < m_referredPackages.size(); i++) {
+            String pack = (String) m_referredPackages.get(i);
+            imports.put(pack, new TreeMap());
+        }
+
+        // Write imports
+        att.putValue("Import-Package", printClauses(imports, "resolution:"));
+    }
+
+    /**
+     * Add iPOJO-Components to the given manifest attribute list. This method add the iPOJO-Components header and its value (according to the metadata) to the manifest.
+     * @param att : the manifest attribute list to modify.
+     */
+    private void setPOJOMetadata(Attributes att) {
+        String meta = "";
+        for (int i = 0; i < m_metadata.length; i++) {
+            meta += buildManifestMetadata(m_metadata[i], "");
+        }
+        if (!meta.equals("")) { 
+            att.putValue("iPOJO-Components", meta);
+        }
+    }
+
+    /**
+     * Standard OSGi header parser. This parser can handle the format clauses ::= clause ( ',' clause ) + clause ::= name ( ';' name ) (';' key '=' value )
+     * This is mapped to a Map { name => Map { attr|directive => value } }
+     * 
+     * @param value : String to parse.
+     * @return parsed map.
+     */
+    public Map parseHeader(String value) {
+        if (value == null || value.trim().length() == 0) {
+            return new HashMap();
+        }
+
+        Map result = new HashMap();
+        QuotedTokenizer qt = new QuotedTokenizer(value, ";=,");
+        char del;
+        do {
+            boolean hadAttribute = false;
+            Map clause = new HashMap();
+            List aliases = new ArrayList();
+            aliases.add(qt.nextToken());
+            del = qt.getSeparator();
+            while (del == ';') {
+                String adname = qt.nextToken();
+                if ((del = qt.getSeparator()) != '=') {
+                    if (hadAttribute) {
+                        throw new IllegalArgumentException("Header contains name field after attribute or directive: " + adname + " from " + value);
+                    }
+                    aliases.add(adname);
+                } else {
+                    String advalue = qt.nextToken();
+                    clause.put(adname, advalue);
+                    del = qt.getSeparator();
+                    hadAttribute = true;
+                }
+            }
+            for (Iterator i = aliases.iterator(); i.hasNext();) {
+                result.put(i.next(), clause);
+            }
+        } while (del == ',');
+        return result;
+    }
+
+    /**
+     * Print a standard Map based OSGi header.
+     * 
+     * @param exports : map { name => Map { attribute|directive => value } }
+     * @param allowedDirectives : list of allowed directives.
+     * @return the clauses
+     */
+    public String printClauses(Map exports, String allowedDirectives) {
+        StringBuffer sb = new StringBuffer();
+        String del = "";
+        for (Iterator i = exports.keySet().iterator(); i.hasNext();) {
+            String name = (String) i.next();
+            Map map = (Map) exports.get(name);
+            sb.append(del);
+            sb.append(name);
+
+            for (Iterator j = map.keySet().iterator(); j.hasNext();) {
+                String key = (String) j.next();
+
+                // Skip directives we do not recognize
+                if (key.endsWith(":") && allowedDirectives.indexOf(key) < 0) {
+                    continue;
+                }
+
+                String value = (String) map.get(key);
+                sb.append(";");
+                sb.append(key);
+                sb.append("=");
+                boolean dirty = value.indexOf(',') >= 0 || value.indexOf(';') >= 0;
+                if (dirty) {
+                    sb.append("\"");
+                }
+                sb.append(value);
+                if (dirty) {
+                    sb.append("\"");
+                }
+            }
+            del = ", ";
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Parse XML Metadata.
+     * @param path : path of the file to parse.
+     * @return the parsed element array.
+     */
+    private Element[] parseXMLMetadata(String path) {
+        File metadata = new File(path);
+        URL url;
+        Element[] meta = null;
+        try {
+            url = metadata.toURL();
+            if (url == null) {
+                warn("Cannot find the metadata file : " + path);
+                return new Element[0];
+            }
+
+            InputStream stream = url.openStream();            
+            XMLReader parser = (XMLReader) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();
+            XMLMetadataParser handler = new XMLMetadataParser();
+            parser.setContentHandler(handler);
+            parser.setFeature("http://xml.org/sax/features/validation",
+                    true); 
+            parser.setFeature("http://apache.org/xml/features/validation/schema", 
+                    true);
+           
+            parser.setErrorHandler(handler);
+            
+            InputSource is = new InputSource(stream);
+            parser.parse(is);
+            meta = handler.getMetadata();
+            stream.close();
+
+        } catch (MalformedURLException e) {
+            error("Malformed metadata URL for " + path);
+            return null;
+        } catch (IOException e) {
+            error("Cannot open the file : " + path);
+            return null;
+        } catch (ParseException e) {
+            error("Parsing error when parsing the XML file " + path + " : " + e.getMessage());
+            return null;
+        } catch (SAXParseException e) {
+            error("Error during metadata parsing at line " + e.getLineNumber() + " : " + e.getMessage());
+            return null;
+        } catch (SAXException e) {
+            error("Parsing error when parsing (Sax Error) the XML file " + path + " : " + e.getMessage());
+            return null;
+        } catch (InstantiationException e) {
+            error("Cannot instantiate the SAX parser for the XML file " + path + " : " + e.getMessage());
+            return null;
+        } catch (IllegalAccessException e) {
+            error("Cannot instantiate  the SAX parser (IllegalAccess) for the XML file " + path + " : " + e.getMessage());
+            return null;
+        } catch (ClassNotFoundException e) {
+            error("Cannot load the SAX Parser : " + e.getMessage());
+            return null;
+        }
+
+        if (meta == null || meta.length == 0) {
+            warn("Neither component types, nor instances in " + path);
+        }
+
+        return meta;
+    }
+    
+    /**
+     * Get packages referenced by composite.
+     * @return the list of referenced packages.
+     */
+    private List getReferredPackages() {
+        List referred = new ArrayList();
+        for (int i = 0; i < m_metadata.length; i++) {
+            if (m_metadata[i].getName().equalsIgnoreCase("composite")) {
+                Element[] elems = m_metadata[i].getElements();
+                for (int j = 0; j < elems.length; j++) {
+                    String att = elems[j].getAttribute("specification");
+                    if (att != null) {
+                        int last = att.lastIndexOf('.');
+                        if (last != -1) {
+                            referred.add(att.substring(0, last));
+                        }
+                    }
+                }
+            }
+        }
+        return referred;
+    }
+
+    /**
+     * Generate manipulation metadata.
+     * @param element : actual element. 
+     * @param actual : actual manipulation metadata.
+     * @return : given manipulation metadata + manipulation metadata of the given element.
+     */
+    private String buildManifestMetadata(Element element, String actual) {
+        String result = "";
+        if (element.getNameSpace() == null) {
+            result = actual + element.getName() + " { ";
+        } else {
+            result = actual + element.getNameSpace() + ":" + element.getName() + " { ";
+        }
+
+        Attribute[] atts = element.getAttributes();
+        for (int i = 0; i < atts.length; i++) {
+            Attribute current = (Attribute) atts[i];
+            if (current.getNameSpace() == null) {
+                result = result + "$" + current.getName() + "=\"" + current.getValue() + "\" ";
+            } else {
+                result = result + "$" + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\" ";
+            }
+        }
+
+        Element[] elems = element.getElements();
+        for (int i = 0; i < elems.length; i++) {
+            result = buildManifestMetadata(elems[i], result);
+        }
+
+        return result + "}";
+    }
+
+    public List getWarnings() {
+        return m_warnings;
+    }
+
+}
+
diff --git a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
index a09e942..ccb2998 100644
--- a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
+++ b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
@@ -1,177 +1,177 @@
-/* 

- * 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.ipojo.plugin;

-

-import java.io.File;

-import java.util.Arrays;

-import java.util.List;

-

-import org.apache.felix.ipojo.manipulator.Pojoization;

-import org.apache.maven.plugin.AbstractMojo;

-import org.apache.maven.plugin.MojoExecutionException;

-import org.apache.maven.project.MavenProject;

-import org.apache.maven.project.MavenProjectHelper;

-

-/**

- * Packages an OSGi jar "bundle" as an "iPOJO bundle".

- *

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- * @version $Rev$, $Date$

- * @goal ipojo-bundle

- * @phase package

- * @requiresDependencyResolution runtime

- * @description manipulate an OSGi bundle jar to build an iPOJO bundle

- */

-public class ManipulatorMojo extends AbstractMojo {

-

-    /**

-     * The directory for the generated JAR.

-     *

-     * @parameter expression="${project.build.directory}"

-     * @required

-     */

-    private String m_buildDirectory;

-

-    /**

-     * The directory containing generated classes.

-     *

-     * @parameter expression="${project.build.outputDirectory}"

-     * @required

-     * @readonly

-     */

-    private File m_outputDirectory;

-

-    /**

-     * The name of the generated JAR file.

-     *

-     * @parameter alias="jarName" expression="${project.build.finalName}"

-     * @required

-     */

-    private String m_jarName;

-

-    /**

-     * Location of the metadata file.

-     * @parameter alias="metadata" default-value="metadata.xml"

-     */

-    private String m_metadata;

-

-    /**

-     * If set, the manipulated jar will be attached to the project as a separate artifact.

-     *

-     * @parameter alias="classifier" expression="${ipojo.classifier}"

-     */

-    private String m_classifier;

-

-    /**

-     * The Maven project.

-     *

-     * @parameter expression="${project}"

-     * @required

-     * @readonly

-     */

-    private MavenProject m_project;

-

-    /**

-     * Used for attaching new artifacts.

-     * @component

-     * @required

-     */

-    private MavenProjectHelper m_helper;

-

-    /**

-     * Project types which this plugin supports.

-     * @parameter

-     */

-    private List m_supportedProjectTypes = Arrays.asList(new String[]{"bundle"});

-

-    /**

-     * Ignore annotations parameter.

-     * @parameter alias="ignoreAnnotations" default-value="false"

-     */

-    private boolean m_ignoreAnnotations;

-

-    protected MavenProject getProject() {

-        return this.m_project;

-    }

-

-    /**

-     * Execute method : this method launches the pojoization.

-     * @throws MojoExecutionException : an exception occurs during the manipulation.

-     * @see org.apache.maven.plugin.AbstractMojo#execute()

-     */

-    public void execute() throws MojoExecutionException {

-        // ignore project types not supported, useful when the plugin is configured in the parent pom

-        if (!this.m_supportedProjectTypes.contains(this.getProject().getArtifact().getType())) {

-            this.getLog().debug("Ignoring project " + this.getProject().getArtifact() + " : type " + this.getProject().getArtifact().getType() + " is not supported by ipojo plugin, supported types are " + this.m_supportedProjectTypes);

-            return;

-        }

-

-        getLog().info("Start bundle manipulation");

-        // Get metadata file

-        

-        // Look for the metadata file in the output directory

-        File meta = new File(m_outputDirectory + File.separator + m_metadata);

-        

-        // If not found look inside the pom directory

-        if (! meta.exists()) {

-            meta = new File(m_project.getBasedir() + File.separator + m_metadata);

-        }

-        

-        getLog().info("Metadata File : " + meta.getAbsolutePath());

-        if (!meta.exists()) {

-            // Verify if annotations are ignored

-            if (m_ignoreAnnotations) {

-                getLog().info("No metadata file found - ignore annotations");

-                return;

-            } else {

-                getLog().info("No metadata file found - try to use only annotations");

-                meta = null;

-            }

-        }

-

-        // Get input bundle

-        File in = new File(m_buildDirectory + File.separator + m_jarName + ".jar");

-        getLog().info("Input Bundle File : " + in.getAbsolutePath());

-        if (!in.exists()) {

-            throw new MojoExecutionException("the specified bundle file does not exists");

-        }

-

-        File out = new File(m_buildDirectory + File.separator + "_out.jar");

-

-        Pojoization pojo = new Pojoization();

-        if (!m_ignoreAnnotations) { pojo.setAnnotationProcessing(); }

-        pojo.pojoization(in, out, meta);

-        for (int i = 0; i < pojo.getWarnings().size(); i++) {

-            getLog().warn((String) pojo.getWarnings().get(i));

-        }

-        if (pojo.getErrors().size() > 0) { throw new MojoExecutionException((String) pojo.getErrors().get(0)); }

-

-        if (m_classifier != null) {

-            // The user want to attach the resulting jar

-            // Do not delete in File

-            m_helper.attachArtifact(m_project, "jar", m_classifier, out);

-        } else {

-            // Usual behavior

-            in.delete();

-            out.renameTo(in);

-        }

-        getLog().info("Bundle manipulation - SUCCESS");

-    }

-

-}

+/* 
+ * 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.ipojo.plugin;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.felix.ipojo.manipulator.Pojoization;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+/**
+ * Packages an OSGi jar "bundle" as an "iPOJO bundle".
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @version $Rev$, $Date$
+ * @goal ipojo-bundle
+ * @phase package
+ * @requiresDependencyResolution runtime
+ * @description manipulate an OSGi bundle jar to build an iPOJO bundle
+ */
+public class ManipulatorMojo extends AbstractMojo {
+
+    /**
+     * The directory for the generated JAR.
+     *
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private String m_buildDirectory;
+
+    /**
+     * The directory containing generated classes.
+     *
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File m_outputDirectory;
+
+    /**
+     * The name of the generated JAR file.
+     *
+     * @parameter alias="jarName" expression="${project.build.finalName}"
+     * @required
+     */
+    private String m_jarName;
+
+    /**
+     * Location of the metadata file.
+     * @parameter alias="metadata" default-value="metadata.xml"
+     */
+    private String m_metadata;
+
+    /**
+     * If set, the manipulated jar will be attached to the project as a separate artifact.
+     *
+     * @parameter alias="classifier" expression="${ipojo.classifier}"
+     */
+    private String m_classifier;
+
+    /**
+     * The Maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject m_project;
+
+    /**
+     * Used for attaching new artifacts.
+     * @component
+     * @required
+     */
+    private MavenProjectHelper m_helper;
+
+    /**
+     * Project types which this plugin supports.
+     * @parameter
+     */
+    private List m_supportedProjectTypes = Arrays.asList(new String[]{"bundle"});
+
+    /**
+     * Ignore annotations parameter.
+     * @parameter alias="ignoreAnnotations" default-value="false"
+     */
+    private boolean m_ignoreAnnotations;
+
+    protected MavenProject getProject() {
+        return this.m_project;
+    }
+
+    /**
+     * Execute method : this method launches the pojoization.
+     * @throws MojoExecutionException : an exception occurs during the manipulation.
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
+    public void execute() throws MojoExecutionException {
+        // ignore project types not supported, useful when the plugin is configured in the parent pom
+        if (!this.m_supportedProjectTypes.contains(this.getProject().getArtifact().getType())) {
+            this.getLog().debug("Ignoring project " + this.getProject().getArtifact() + " : type " + this.getProject().getArtifact().getType() + " is not supported by iPOJO plugin, supported types are " + this.m_supportedProjectTypes);
+            return;
+        }
+
+        getLog().info("Start bundle manipulation");
+        // Get metadata file
+        
+        // Look for the metadata file in the output directory
+        File meta = new File(m_outputDirectory + File.separator + m_metadata);
+        
+        // If not found look inside the pom directory
+        if (! meta.exists()) {
+            meta = new File(m_project.getBasedir() + File.separator + m_metadata);
+        }
+        
+        getLog().info("Metadata file : " + meta.getAbsolutePath());
+        if (!meta.exists()) {
+            // Verify if annotations are ignored
+            if (m_ignoreAnnotations) {
+                getLog().info("No metadata file found - ignoring annotations");
+                return;
+            } else {
+                getLog().info("No metadata file found - trying to use only annotations");
+                meta = null;
+            }
+        }
+
+        // Get input bundle
+        File in = new File(m_buildDirectory + File.separator + m_jarName + ".jar");
+        getLog().info("Input Bundle File : " + in.getAbsolutePath());
+        if (!in.exists()) {
+            throw new MojoExecutionException("the specified bundle file does not exist");
+        }
+
+        File out = new File(m_buildDirectory + File.separator + "_out.jar");
+
+        Pojoization pojo = new Pojoization();
+        if (!m_ignoreAnnotations) { pojo.setAnnotationProcessing(); }
+        pojo.pojoization(in, out, meta);
+        for (int i = 0; i < pojo.getWarnings().size(); i++) {
+            getLog().warn((String) pojo.getWarnings().get(i));
+        }
+        if (pojo.getErrors().size() > 0) { throw new MojoExecutionException((String) pojo.getErrors().get(0)); }
+
+        if (m_classifier != null) {
+            // The user want to attach the resulting jar
+            // Do not delete in File
+            m_helper.attachArtifact(m_project, "jar", m_classifier, out);
+        } else {
+            // Usual behavior
+            in.delete();
+            out.renameTo(in);
+        }
+        getLog().info("Bundle manipulation - SUCCESS");
+    }
+
+}