felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1051085 - in /felix/sandbox/clement/ipojo-constructor-injection: core/src/main/java/org/apache/felix/ipojo/ core/src/main/java/org/apache/felix/ipojo/parser/ core/src/test/java/org/apache/felix/ipojo/parser/ core/src/test/resources/ core/s...
Date Mon, 20 Dec 2010 12:39:31 GMT
Author: clement
Date: Mon Dec 20 12:39:30 2010
New Revision: 1051085

URL: http://svn.apache.org/viewvc?rev=1051085&view=rev
Log:
Add PojoMetadata test
Add contructor support in PojoMetadata

Modify temporary the manipulator pom file to support java 5 (annotation tests)

Add the constructor injection support in the InstanceManager. This is still in progress (no handler are supporting this injection yet, and a lot of test must be done).

Added:
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/ConstructorMetadata.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/
    felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/MANIFEST.MF
    felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Child.java
    felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Multiconstructor.java
    felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Parent.java
Modified:
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java
    felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
    felix/sandbox/clement/ipojo-constructor-injection/manipulator/pom.xml
    felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
    felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/test/java/test/Constructor.java
    felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/resources/metadata.xml

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java Mon Dec 20 12:39:30 2010
@@ -30,6 +30,7 @@ import java.util.Map;
 import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ConstructorMetadata;
 import org.apache.felix.ipojo.parser.ParseUtils;
 import org.apache.felix.ipojo.parser.PojoMetadata;
 import org.apache.felix.ipojo.util.Logger;
@@ -91,6 +92,9 @@ public class ComponentFactory extends IP
      */
     private PojoMetadata m_manipulation;
 
+
+	private ConstructorMetadata m_constructor;
+
     /**
      * Creates a instance manager factory.
      * The class is given in parameter. The component type is not a composite.
@@ -135,6 +139,7 @@ public class ComponentFactory extends IP
         m_classname = element.getAttribute("classname");
         if (m_classname == null) { throw new ConfigurationException("A component needs a class name : " + element); }
         m_manipulation = new PojoMetadata(m_componentMetadata);
+        m_constructor = new ConstructorMetadata(m_componentMetadata);
     }
 
     /**
@@ -291,7 +296,8 @@ public class ComponentFactory extends IP
         Element[] elems = m_componentMetadata.getElements();
         for (int i = 0; i < elems.length; i++) {
             Element current = elems[i];
-            if (!"manipulation".equals(current.getName())) {
+            if (!"manipulation".equals(current.getName()) // Remove the manipulation element
+            		&& !"constructor".equals(current.getName())) { // Remove the constructor element
                 RequiredHandler req = new RequiredHandler(current.getName(), current.getNameSpace());
                 if (!list.contains(req)) {
                     list.add(req);
@@ -434,6 +440,10 @@ public class ComponentFactory extends IP
         return m_manipulation;
     }
 
+    public ConstructorMetadata getConstructorMetadata() {
+    	return m_constructor;
+    }
+
     /**
      * Gets the version of the component type.
      * @return the version of <code>null</code> if not set.

Added: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo;
+
+public interface ConstructorInjector {
+
+	Object getConstructorParameter(String id, int index);
+
+}

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java Mon Dec 20 12:39:30 2010
@@ -1,4 +1,4 @@
-/* 
+/*
  * 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
@@ -82,7 +82,7 @@ public class HandlerManager extends Inst
         if (m_handler != null) { return; }
         m_handler = (Handler) createPojoObject();
     }
-    
+
     /**
      * Creates an instance of the content.
      * This method needs to be called once only for singleton provided service.
@@ -103,9 +103,9 @@ public class HandlerManager extends Inst
             }
             m_pojoObjects.add(instance);
         }
-        
+
         //Do not call onCreation, this will be done in the start method.
-        
+
         return instance;
     }
 
@@ -114,9 +114,9 @@ public class HandlerManager extends Inst
      */
     public void start() {
         synchronized (this) {
-            if (m_state != STOPPED) { 
+            if (m_state != STOPPED) {
                 return; // Instance already started
-            } else { 
+            } else {
                 m_state = -2; // Temporary starting state, avoiding concurrent starts.
             }
         }
@@ -126,16 +126,16 @@ public class HandlerManager extends Inst
             m_handlers[i].addInstanceStateListener(this);
             m_handlers[i].start();
         }
-        
+
         // Call the onCreation method.
         for (int i = 0; i < m_handlers.length; i++) {
             ((PrimitiveHandler) m_handlers[i].getHandler()).onCreation(m_handler);
         }
 
-        
+
         m_handler.start(); // Call the handler start method, the instance might be invalid.
-        
-        
+
+
         for (int i = 0; i < m_handlers.length; i++) {
             if (!m_handlers[i].getHandler().isValid()) {
                 setState(INVALID);
@@ -147,7 +147,7 @@ public class HandlerManager extends Inst
         } else {
             setState(INVALID);
         }
-        
+
         // Now, the state is necessary different from the temporary state.
     }
 
@@ -156,10 +156,10 @@ public class HandlerManager extends Inst
      */
     public void stop() {
         synchronized (this) {
-            if (m_state == STOPPED) { 
+            if (m_state == STOPPED) {
                 return; // Instance already stopped
             } else {
-                m_state = -2; // Temporary state avoiding concurrent stopping. 
+                m_state = -2; // Temporary state avoiding concurrent stopping.
             }
         }
 
@@ -182,7 +182,7 @@ public class HandlerManager extends Inst
                 listeners = new ArrayList(m_listeners); // Stack confinement.
             }
         }
-        
+
         if (listeners != null) {
             for (int i = 0; i < listeners.size(); i++) {
                 ((InstanceStateListener) listeners.get(i)).stateChanged(this, STOPPED);
@@ -190,7 +190,7 @@ public class HandlerManager extends Inst
         }
     }
 
-    /** 
+    /**
      * Disposes the instance.
      * @see org.apache.felix.ipojo.ComponentInstance#dispose()
      */
@@ -211,14 +211,14 @@ public class HandlerManager extends Inst
     /**
      * State Change listener callback.
      * This method is notified at each time a plugged handler becomes invalid.
-     * @param instance the changing instance 
+     * @param instance the changing instance
      * @param newState the new state
      * @see org.apache.felix.ipojo.InstanceStateListener#stateChanged(org.apache.felix.ipojo.ComponentInstance, int)
      */
     public void stateChanged(ComponentInstance instance, int newState) {
         int state;
         synchronized (this) {
-            if (m_state <= STOPPED) { 
+            if (m_state <= STOPPED) {
                 return;
             } else {
                 state = m_state; // Stack confinement
@@ -241,4 +241,11 @@ public class HandlerManager extends Inst
         }
     }
 
+	public Object getConstructorParameter(String id, int index) {
+		if (m_handler instanceof ConstructorInjector) {
+			return ((ConstructorInjector) m_handler).getConstructorParameter(id, index);
+		}
+		return null;
+	}
+
 }

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java Mon Dec 20 12:39:30 2010
@@ -152,7 +152,8 @@ public class HandlerManagerFactory exten
         Element[] elems = m_componentMetadata.getElements();
         for (int i = 0; i < elems.length; i++) {
             Element current = elems[i];
-            if (!"manipulation".equals(current.getName())) {
+            if (!"manipulation".equals(current.getName()) // Remove the manipulation element
+            		&& !"constructor".equals(current.getName())) { // Remove the constructor element
                 RequiredHandler req = new RequiredHandler(current.getName(),
                         current.getNameSpace());
                 if (!list.contains(req)) {

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java Mon Dec 20 12:39:30 2010
@@ -595,29 +595,60 @@ public class InstanceManager implements 
         if (m_factoryMethod == null) {
             // No factory-method, we use the constructor.
             try {
-                // Try to find if there is a constructor with a bundle context as parameter :
-                try {
-                    Constructor cst = m_clazz.getDeclaredConstructor(new Class[] { InstanceManager.class, BundleContext.class });
-                    if (! cst.isAccessible()) {
+            	// Try to find the correct constructor.
+            	if (getFactory().getConstructorMetadata().hasConstructorMetadata()) {
+            		// Build the map of injected values.
+            		String[] ids = getFactory().getConstructorMetadata().getIds();
+            		// Initialize the injected values and types
+            		// We have the IM first.
+            		Object[] values = new Object[ids.length + 1];
+            		Class[] types = new Class[ids.length + 1];
+            		values[0] = this;
+            		types[0] = InstanceManager.class;
+            		for (int i = 0; i < ids.length; i++) {
+            			for (int j = 0; values[i] == null  && j < m_handlers.length; j++) {
+            				Object v = m_handlers[j].getConstructorParameter(ids[i], i);
+            				if (v != null) {
+            					values[i + 1] = v;
+            					types[i + 1] = v.getClass();
+            				}
+            			}
+            		}
+            		// Find the constructor.
+            		Constructor cst = m_clazz.getDeclaredConstructor(types);
+            		if (! cst.isAccessible()) {
                         cst.setAccessible(true);
                     }
-                    Object[] args = new Object[] { this, m_context };
-                    onEntry(null, MethodMetadata.BC_CONSTRUCTOR_ID,  new Object[] {m_context});
-                    instance = cst.newInstance(args);
-                    onExit(instance, MethodMetadata.BC_CONSTRUCTOR_ID, instance);
-                } catch (NoSuchMethodException e) {
-                    // Create an instance if no instance are already created with <init>()BundleContext
-                    if (instance == null) {
-                        Constructor cst = m_clazz.getDeclaredConstructor(new Class[] { InstanceManager.class });
+                    onEntry(null, null /*TODO Compute id*/,  values);
+            		instance = cst.newInstance(values);
+            		onExit(instance, null /*TODO Compute id*/, instance);
+            	} else {
+            		// Old semantic
+            		// Try to find if there is a constructor with a bundle context as parameter :
+                    try {
+                        Constructor cst = m_clazz.getDeclaredConstructor(new Class[] { InstanceManager.class, BundleContext.class });
                         if (! cst.isAccessible()) {
                             cst.setAccessible(true);
                         }
-                        Object[] args = new Object[] {this};
-                        onEntry(null, MethodMetadata.EMPTY_CONSTRUCTOR_ID, new Object[0]);
+                        Object[] args = new Object[] { this, m_context };
+                        onEntry(null, MethodMetadata.BC_CONSTRUCTOR_ID,  new Object[] {m_context});
                         instance = cst.newInstance(args);
-                        onExit(instance, MethodMetadata.EMPTY_CONSTRUCTOR_ID, instance);
+                        onExit(instance, MethodMetadata.BC_CONSTRUCTOR_ID, instance);
+                    } catch (NoSuchMethodException e) {
+                        // Create an instance if no instance are already created with <init>()BundleContext
+                        if (instance == null) {
+                            Constructor cst = m_clazz.getDeclaredConstructor(new Class[] { InstanceManager.class });
+                            if (! cst.isAccessible()) {
+                                cst.setAccessible(true);
+                            }
+                            Object[] args = new Object[] {this};
+                            onEntry(null, MethodMetadata.EMPTY_CONSTRUCTOR_ID, new Object[0]);
+                            instance = cst.newInstance(args);
+                            onExit(instance, MethodMetadata.EMPTY_CONSTRUCTOR_ID, instance);
+                        }
                     }
-                }
+            	}
+
             } catch (IllegalAccessException e) {
                 m_logger.log(Logger.ERROR,
                                           "[" + m_name + "] createInstance -> The POJO constructor is not accessible : " + e.getMessage(), e);

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java Mon Dec 20 12:39:30 2010
@@ -33,7 +33,8 @@ import org.apache.felix.ipojo.util.Logge
 * Classes overriding this class can change the behavior of those methods.
 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
 */
-public abstract class PrimitiveHandler extends Handler implements FieldInterceptor, MethodInterceptor {
+public abstract class PrimitiveHandler extends Handler implements FieldInterceptor, MethodInterceptor,
+	ConstructorInjector {
 
     /**
      * The "Primitive" Handler type (value).
@@ -159,6 +160,14 @@ public abstract class PrimitiveHandler e
     }
 
     /**
+     * TODO
+     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameter(java.lang.String, int)
+     */
+    public Object getConstructorParameter(String id, int index) {
+    	return null;
+    }
+
+    /**
      * Callback method called when a method will be invoked.
      * This default implementation does nothing.
      * @param pojo the pojo on which the method is called.

Added: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/ConstructorMetadata.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/ConstructorMetadata.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/ConstructorMetadata.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/ConstructorMetadata.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,76 @@
+package org.apache.felix.ipojo.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.metadata.Element;
+
+public class ConstructorMetadata {
+
+	private final boolean m_hasConstructor;
+	private final String m_parameters;
+	private final List/*<String>*/ m_params = new ArrayList();
+
+	public ConstructorMetadata(Element desc) throws ConfigurationException {
+		if (! desc.containsElement("constructor")) {
+			m_hasConstructor = false;
+			m_parameters = null;
+			return;
+		}
+		m_hasConstructor = true;
+		Element cst = desc.getElements("constructor")[0]; // Manage only the first one.
+		m_parameters = cst.getAttribute("parameters");
+
+		Element[] params = cst.getElements("parameter");
+		if (params != null) {
+			for (int i = 0; i < params.length; i++) {
+				addParameter(i, params[i]);
+			}
+			// Check that we have continuous index
+			for (int i = 0; i < params.length; i++) {
+				if (m_params.get(i) == null) {
+					throw new ConfigurationException("Constructor Parameter with index " + i
+							+ " is missing");
+				}
+			}
+		}
+	}
+
+	private void addParameter(int i, Element element) throws ConfigurationException {
+		String refid = element.getAttribute("refid");
+		String idx = element.getAttribute("index");
+		int index = i;
+		if (idx != null) {
+			try {
+				index = Integer.parseInt(idx);
+			} catch (NumberFormatException e) {
+				throw new ConfigurationException("Cannot parse the index of a contructor parameter: "
+						+ e.getMessage());
+			}
+		}
+
+		if (refid == null) {
+			throw new ConfigurationException("Constructor Parameter with index " + i
+					+ " does not have a refid");
+		} else {
+			m_params.add(index, refid);
+		}
+	}
+
+	public boolean hasConstructorMetadata() {
+		return m_hasConstructor;
+	}
+
+	public String getConstructorSignature() {
+		return m_parameters;
+	}
+
+	public String[] getIds() {
+		if (m_params == null) {
+			return new String[0];
+		}
+		return (String[]) m_params.toArray(new String[m_params.size()]);
+	}
+
+}

Modified: felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java Mon Dec 20 12:39:30 2010
@@ -1,4 +1,4 @@
-/* 
+/*
  * 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
@@ -24,25 +24,25 @@ import org.apache.felix.ipojo.metadata.E
 /**
  * Manipulation Metadata allows getting information about the implementation class
  * without using reflection such as implemented interfaces, super class,
- * methods and fields. 
+ * methods and fields.
  * This method allows getting object to register {@link org.apache.felix.ipojo.FieldInterceptor} and
  * {@link org.apache.felix.ipojo.MethodInterceptor}.
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class PojoMetadata {
-    
+
     /**
      * The list of implemented interfaces.
      */
     private String[] m_interfaces = new String[0];
-    
+
     /**
      * The list of fields.
      */
     private FieldMetadata[] m_fields = new FieldMetadata[0];
-    
+
     /**
-     * The list of methods. 
+     * The list of methods.
      */
     private MethodMetadata[] m_methods = new MethodMetadata[0];
 
@@ -50,8 +50,8 @@ public class PojoMetadata {
      * The Super class (if <code>null</code> for {@link Object}).
      */
     private String m_super;
-    
-    
+
+
     /**
      * Creates Pojo metadata.
      * Manipulation Metadata object are created from component type metadata by
@@ -62,7 +62,7 @@ public class PojoMetadata {
     public PojoMetadata(Element metadata) throws ConfigurationException {
         Element[] elems = metadata.getElements("manipulation", "");
         if (elems == null) {
-            throw new ConfigurationException("The component " + metadata.getAttribute("classname") + " has no manipulation metadata"); 
+            throw new ConfigurationException("The component " + metadata.getAttribute("classname") + " has no manipulation metadata");
         }
         Element manip = elems[0];
         m_super = manip.getAttribute("super");
@@ -81,38 +81,38 @@ public class PojoMetadata {
             addInterface(itfs[i].getAttribute("name"));
         }
     }
-    
+
     public MethodMetadata[] getMethods() { return m_methods; }
-    
+
     public FieldMetadata[] getFields() { return m_fields; }
-    
+
     public String[] getInterfaces() { return m_interfaces; }
-    
+
     /**
-     * Gets the field metadata for the given name. 
+     * Gets the field metadata for the given name.
      * @param name : the name of the field
      * @return the corresponding field metadata or <code>null</code> if not found
      */
-    public FieldMetadata getField(String name) { 
+    public FieldMetadata getField(String name) {
         for (int i = 0; i < m_fields.length; i++) {
             if (m_fields[i].getFieldName().equalsIgnoreCase(name)) { return m_fields[i]; }
         }
         return null;
     }
-    
+
     /**
-     * Gets the field metadata for the given name and type. 
+     * Gets the field metadata for the given name and type.
      * @param name : the name of the field
      * @param type : the type of the field
      * @return the corresponding field metadata or <code>null</code> if not found
      */
-    public FieldMetadata getField(String name, String type) { 
+    public FieldMetadata getField(String name, String type) {
         for (int i = 0; i < m_fields.length; i++) {
             if (m_fields[i].getFieldName().equalsIgnoreCase(name) && m_fields[i].getFieldType().equalsIgnoreCase(type)) { return m_fields[i]; }
         }
         return null;
     }
-    
+
     /**
      * Checks if the given interface name is implemented.
      * This methods checks on interface directly implemented
@@ -127,7 +127,7 @@ public class PojoMetadata {
         }
         return false;
     }
-    
+
     /**
      * Gets the MethodMetadata corresponding to the method
      * (contained in the implementation class) with
@@ -142,11 +142,11 @@ public class PojoMetadata {
         }
         return null;
     }
-    
+
     /**
      * Gets the MethodMetadata list corresponding to the method
      * (contained in the implementation class) to given name.
-     * All methods contained in the implementation class matching 
+     * All methods contained in the implementation class matching
      * with the name are in the returned list.
      * @param name the name of the method to look for.
      * @return the Method Metadata array or an empty array if not found
@@ -154,7 +154,7 @@ public class PojoMetadata {
     public MethodMetadata[] getMethods(String name) {
         MethodMetadata[] mms = new MethodMetadata[0];
         for (int i = 0; i < m_methods.length; i++) {
-            if (m_methods[i].getMethodName().equalsIgnoreCase(name)) { 
+            if (m_methods[i].getMethodName().equalsIgnoreCase(name)) {
                 if (mms.length > 0) {
                     MethodMetadata[] newInstances = new MethodMetadata[mms.length + 1];
                     System.arraycopy(mms, 0, newInstances, 0, mms.length);
@@ -167,13 +167,22 @@ public class PojoMetadata {
         }
         return mms;
     }
-    
+
+    /**
+     * Gets the MethodMetadata list corresponding to the constructors
+     * (contained in the implementation class).
+     * @return the Method Metadata array or an empty array if not found
+     */
+    public MethodMetadata[] getConstructors() {
+        return getMethods("$init");
+    }
+
     /**
      * Gets the MethodMetadata corresponding to the method
-     * (contained in the implementation class) to given name 
+     * (contained in the implementation class) to given name
      * and argument types.
      * @param name the name of the method to look for.
-     * @param types the array of the argument types of the method 
+     * @param types the array of the argument types of the method
      * @return the Method Metadata or <code>null</code> if not found
      */
     public MethodMetadata getMethod(String name, String[] types) {
@@ -190,7 +199,16 @@ public class PojoMetadata {
         }
         return null;
     }
-        
+
+    /**
+     * Gets the constructor corresponding to the given argument types.
+     * @param types the argument types
+     * @return the matching constructor or <code>null</code> if not found.
+     */
+    public MethodMetadata getConstructor(String[] types) {
+    	return getMethod("$init", types); // Constructors are named $init in the manipulation metadata
+    }
+
      /**
      * Adds a method to the list.
      * This method is used during the creation of the {@link PojoMetadata}
@@ -207,7 +225,7 @@ public class PojoMetadata {
             m_methods = new MethodMetadata[] { method };
         }
     }
-        
+
      /**
      * Adds a field to the list.
      * This method is used during the creation of the {@link PojoMetadata}
@@ -224,7 +242,7 @@ public class PojoMetadata {
             m_fields = new FieldMetadata[] { field };
         }
     }
-        
+
     /**
      * Adds the interface to the list.
      * This method is used during the creation of the {@link PojoMetadata}

Added: felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,257 @@
+/*
+ * 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.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.jar.Manifest;
+
+import junit.framework.TestCase;
+
+import org.apache.felix.ipojo.metadata.Element;
+
+/**
+ * Check manipulation metadata written in the manifest.
+ */
+public class ManipulationMetadataTest extends TestCase {
+
+	private String header;
+
+	public void setUp() {
+		File manFile = new File("src/test/resources/manipulation/MANIFEST.MF");
+		Manifest manifest;
+		try {
+			manifest = new Manifest(new FileInputStream(manFile));
+			header = manifest.getMainAttributes().getValue("iPOJO-Components");
+		} catch (FileNotFoundException e) {
+			fail(e.getMessage());
+		} catch (IOException e) {
+			fail(e.getMessage());
+		}
+	}
+
+	public void testGetMetadata() {
+		Element elem = null;
+		try {
+			elem = ManifestMetadataParser.parseHeaderMetadata(header);
+		} catch (ParseException e) {
+			fail("Parse Exception when parsing iPOJO-Component");
+		}
+
+		assertNotNull("Check elem not null", elem);
+
+		Element manip = getManipulationForComponent(elem, "ManipulationMetadata-FooProviderType-1");
+		assertNotNull("Check manipulation metadata not null for " + "FooProviderType-1", manip);
+	}
+
+	public void testInterface() {
+		String comp_name = "ManipulationMetadata-FooProviderType-1";
+		Element manip = getManipulationForComponent(comp_name);
+		Element[] itf = manip.getElements("Interface");
+		assertEquals("Check interfaces number", itf.length, 1);
+		assertEquals("Check itf name", itf[0].getAttribute("name"),
+				"org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService");
+	}
+
+	public void testInterfaces() {
+		String comp_name = "ManipulationMetadata-FooBarProviderType-1";
+		Element manip = getManipulationForComponent(comp_name);
+		Element[] itf = manip.getElements("Interface");
+		assertEquals("Check interfaces number", itf.length, 2);
+		assertEquals("Check itf name", itf[0].getAttribute("name"),
+				"org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService");
+		assertEquals("Check itf name", itf[1].getAttribute("name"),
+				"org.apache.felix.ipojo.test.scenarios.manipulation.service.BarService");
+	}
+
+	public void testFields() {
+		String comp_name = "ManipulationMetadata-FooProviderType-Dyn";
+		Element manip = getManipulationForComponent(comp_name);
+		Element[] fields = manip.getElements("field");
+		assertEquals("Check field count " + fields.length, fields.length, 5);
+		/*
+		private int intProp;
+		private String strProp;
+		private String[] strAProp;
+		private int[] intAProp;
+		private boolean boolProp;
+		 */
+
+		Element field;
+
+		field = getFieldFromName(manip, "intProp");
+		assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intProp");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
+
+		field = getFieldFromName(manip, "strProp");
+		assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strProp");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String");
+
+		field = getFieldFromName(manip, "strAProp");
+		assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strAProp");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String[]");
+
+		field = getFieldFromName(manip, "intAProp");
+		assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intAProp");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
+
+		field = getFieldFromName(manip, "boolProp");
+		assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "boolProp");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
+	}
+
+	public void testPrimitivesFields() {
+		String comp_name = "ManipulationMetadata-PrimitiveManipulationTester";
+		Element manip = getManipulationForComponent(comp_name);
+		Element[] fields = manip.getElements("Field");
+		assertEquals("Check field count", fields.length, 16);
+		/*
+		byte b = 1;
+		short s = 1;
+		int i = 1;
+		long l = 1;
+		double d = 1.1;
+		float f = 1.1f;
+		char c = 'a';
+		boolean bool = false;
+		byte[] bs = new byte[] {0,1,2};
+		short[] ss = new short[] {0,1,2};
+		int[] is = new int[] {0,1,2};
+		long[] ls = new long[] {0,1,2};
+		double[] ds = new double[] {0.0, 1.1, 2.2};
+		float[] fs = new float[] {0.0f, 1.1f, 2.2f};
+		char[] cs = new char[] {'a', 'b', 'c'};
+		boolean[] bools = new boolean[] {false, true, false};
+		 */
+		Element field;
+
+		field = getFieldFromName(manip, "b");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte");
+		field = getFieldFromName(manip, "s");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short");
+		field = getFieldFromName(manip, "i");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
+		field = getFieldFromName(manip, "l");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long");
+		field = getFieldFromName(manip, "d");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double");
+		field = getFieldFromName(manip, "f");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float");
+		field = getFieldFromName(manip, "c");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char");
+		field = getFieldFromName(manip, "bool");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
+
+		field = getFieldFromName(manip, "bs");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte[]");
+		field = getFieldFromName(manip, "ss");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short[]");
+		field = getFieldFromName(manip, "is");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
+		field = getFieldFromName(manip, "ls");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long[]");
+		field = getFieldFromName(manip, "ds");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double[]");
+		field = getFieldFromName(manip, "fs");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float[]");
+		field = getFieldFromName(manip, "cs");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char[]");
+		field = getFieldFromName(manip, "bools");
+		assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean[]");
+	}
+
+	public void testNoArgMethod() {
+		String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+		Element manip = getManipulationForComponent(comp_name);
+		Element method = getMethodFromName(manip, "check");
+		assertFalse("Check no args", method.containsAttribute("arguments"));
+		assertEquals("Check return", method.getAttribute("return"), "boolean");
+	}
+
+	public void testOneArgsMethod() {
+		String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+		Element manip = getManipulationForComponent(comp_name);
+		Element method = getMethodFromName(manip, "refBind");
+		assertEquals("Check args", method.getAttribute("arguments"), "{org.osgi.framework.ServiceReference}");
+		assertEquals("Check args count", 1, ParseUtils.parseArrays("{org.osgi.framework.ServiceReference}").length);
+		assertFalse("Check return", method.containsAttribute("return"));
+	}
+
+	public void testTwoArgsMethod() {
+		String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+		Element manip = getManipulationForComponent(comp_name);
+		Element method = getMethodFromName(manip, "doNothing");
+		assertEquals("Check args", method.getAttribute("arguments"), "{java.lang.Object,java.lang.String}");
+		assertEquals("Check args count", 2, ParseUtils.parseArrays("{java.lang.Object,java.lang.String}").length);
+		assertEquals("Check return", method.getAttribute("return"), "java.lang.Object");
+	}
+
+	private Element getManipulationForComponent(Element metadata, String comp_name) {
+		Element[] comps = metadata.getElements("component");
+		for(int i = 0; i < comps.length; i++) {
+			if(comps[i].containsAttribute("factory") && comps[i].getAttribute("factory").equals(comp_name)) {
+				return comps[i].getElements("manipulation")[0];
+			}
+            if(comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) {
+                return comps[i].getElements("manipulation")[0];
+            }
+		}
+		return null;
+	}
+
+	private Element getManipulationForComponent(String comp_name) {
+		Element elem = null;
+		try {
+			elem = ManifestMetadataParser.parseHeaderMetadata(header);
+		} catch (ParseException e) {
+			fail("Parse Exception when parsing iPOJO-Component");
+		}
+
+		assertNotNull("Check elem not null", elem);
+		Element manip = getManipulationForComponent(elem, comp_name);
+		assertNotNull("Check manipulation metadata not null for " + comp_name, manip);
+		return manip;
+	}
+
+	private Element getMethodFromName(Element manip, String name) {
+		Element methods[] = manip.getElements("Method");
+		for(int i = 0; i < methods.length; i++) {
+			if(methods[i].containsAttribute("name") && methods[i].getAttribute("name").equals(name)) {
+				return methods[i];
+			}
+		}
+		fail("Method " + name + " not found");
+		return null;
+	}
+
+	private Element getFieldFromName(Element manip, String name) {
+		Element fields[] = manip.getElements("Field");
+		for(int i = 0; i < fields.length; i++) {
+			if(fields[i].containsAttribute("name") && fields[i].getAttribute("name").equals(name)) {
+				return fields[i];
+			}
+		}
+		fail("Field " + name + " not found");
+		return null;
+	}
+
+
+}

Added: felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,322 @@
+/*
+ * 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.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.jar.Manifest;
+
+import junit.framework.TestCase;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.metadata.Element;
+
+public class PojoMetadataTest extends TestCase {
+
+    PojoMetadata FooProviderType1, FooBarProviderType1, FooProviderTypeDyn, PrimitiveManipulationTester, SimpleMultipleCheckServiceProvider;
+
+    private String header;
+
+	public void setUp() {
+		File manFile = new File("src/test/resources/manipulation/MANIFEST.MF");
+		Manifest manifest;
+		try {
+			manifest = new Manifest(new FileInputStream(manFile));
+			header = manifest.getMainAttributes().getValue("iPOJO-Components");
+		} catch (FileNotFoundException e) {
+			fail(e.getMessage());
+		} catch (IOException e) {
+			fail(e.getMessage());
+		}
+
+        String comp_name = "ManipulationMetadata-FooProviderType-1";
+        FooProviderType1 = getManipulationMetadataForComponent(comp_name);
+
+        comp_name = "ManipulationMetadata-FooBarProviderType-1";
+        FooBarProviderType1 = getManipulationMetadataForComponent(comp_name);
+
+        comp_name = "ManipulationMetadata-FooProviderType-Dyn";
+        FooProviderTypeDyn = getManipulationMetadataForComponent(comp_name);
+
+        comp_name = "ManipulationMetadata-PrimitiveManipulationTester";
+        PrimitiveManipulationTester = getManipulationMetadataForComponent(comp_name);
+
+        comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+        SimpleMultipleCheckServiceProvider = getManipulationMetadataForComponent(comp_name);
+	}
+
+	public void testGetMetadata() {
+		Element elem = null;
+		try {
+			elem = ManifestMetadataParser.parseHeaderMetadata(header);
+		} catch (ParseException e) {
+			fail("Parse Exception when parsing iPOJO-Component");
+		}
+
+		assertNotNull("Check elem not null", elem);
+
+		Element manip = getMetadataForComponent(elem, "ManipulationMetadata-FooProviderType-1");
+        assertNotNull("Check manipulation metadata not null for " + "Manipulation-FooProviderType-1", manip);
+        PojoMetadata mm;
+        try {
+            mm = new PojoMetadata(manip);
+            assertNotNull("Check mm not null", mm);
+        } catch (ConfigurationException e) {
+            fail("The creation of pojo metadata has failed");
+        }
+	}
+
+	public void testInterface() {
+	    PojoMetadata manip = FooProviderType1;
+
+        String[] itf = manip.getInterfaces();
+		assertEquals("Check interfaces number", itf.length, 1);
+		assertEquals("Check itf name", itf[0], "org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService");
+
+        assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented("org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService"));
+        assertFalse("Check Bar Service implementation", manip.isInterfaceImplemented("org.apache.felix.ipojo.test.scenarios.manipulation.service.BarService"));
+	}
+
+	public void testInterfaces() {
+	    PojoMetadata manip = FooBarProviderType1;
+        String[] itf = manip.getInterfaces();
+		assertEquals("Check interfaces number", itf.length, 2);
+		assertEquals("Check itf name", itf[0], "org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService");
+		assertEquals("Check itf name", itf[1], "org.apache.felix.ipojo.test.scenarios.manipulation.service.BarService");
+
+        assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented("org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService"));
+        assertTrue("Check Bar Service implementation", manip.isInterfaceImplemented("org.apache.felix.ipojo.test.scenarios.manipulation.service.BarService"));
+	}
+
+	public void testFields() {
+	    PojoMetadata manip = FooProviderTypeDyn;
+
+		FieldMetadata[] fields = manip.getFields();
+		assertEquals("Check field count + " + fields.length, fields.length, 5);
+		/*
+		private int intProp;
+		private String strProp;
+		private String[] strAProp;
+		private int[] intAProp;
+		private boolean boolProp;
+		 */
+
+		FieldMetadata field;
+
+		field = manip.getField("intProp");
+		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "int");
+
+        field = manip.getField("intProp", "int");
+        assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
+
+        field = manip.getField("intProp", "long");
+        assertNull("Check bad field", field);
+
+		field = manip.getField("strProp");
+		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "java.lang.String");
+
+        field = manip.getField("strProp", "String");
+        assertNull("Check bad field", field);
+
+        field = manip.getField("strProp", "java.lang.String");
+        assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
+
+		field = manip.getField("strAProp");
+		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
+        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[Ljava.lang.String;");
+
+        field = manip.getField("strAProp", "java.lang.String[]");
+        assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
+
+        field = manip.getField("strAProp", "String[]");
+        assertNull("Check bad field", field);
+
+		field = manip.getField("intAProp");
+		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
+        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[I");
+
+        field = manip.getField("intAProp", "int[]");
+        assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
+
+        field = manip.getField("intAProp", "String[]");
+        assertNull("Check bad field", field);
+
+		field = manip.getField("boolProp");
+		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "boolean");
+
+        field = manip.getField("boolProp", "boolean");
+        assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
+
+        field = manip.getField("boolProp", "bool");
+        assertNull("Check bad field", field);
+	}
+
+	public void testPrimitivesFields() {
+	    PojoMetadata manip = PrimitiveManipulationTester;
+		FieldMetadata[] fields = manip.getFields();
+		assertEquals("Check field count", fields.length, 16);
+
+		FieldMetadata field;
+
+		field = manip.getField("b");
+		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte");
+		field = manip.getField("s");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short");
+		field = manip.getField("i");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
+		field = manip.getField("l");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long");
+		field = manip.getField("d");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double");
+		field = manip.getField("f");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float");
+		field = manip.getField("c");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char");
+		field = manip.getField("bool");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
+
+		field = manip.getField("bs");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte[]");
+		field = manip.getField("ss");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short[]");
+		field = manip.getField("is");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
+		field = manip.getField("ls");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long[]");
+		field = manip.getField("ds");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double[]");
+		field = manip.getField("fs");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float[]");
+		field = manip.getField("cs");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char[]");
+		field = manip.getField("bools");
+        assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean[]");
+	}
+
+	public void testNoArgMethod() {
+	    PojoMetadata manip = SimpleMultipleCheckServiceProvider;
+		MethodMetadata method = manip.getMethod("check");
+		assertEquals("Check no args", method.getMethodArguments().length, 0);
+		assertEquals("Check return", method.getMethodReturn(), "boolean");
+
+        method = manip.getMethod("check", new String[0]);
+        assertEquals("Check no args", method.getMethodArguments().length, 0);
+        assertEquals("Check return", method.getMethodReturn(), "boolean");
+	}
+
+	public void testOneArgsMethod() {
+	    PojoMetadata manip = SimpleMultipleCheckServiceProvider;
+        MethodMetadata method = manip.getMethods("refBind")[0];
+		assertEquals("Check args count", method.getMethodArguments().length, 1);
+        assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference");
+		assertEquals("Check return", method.getMethodReturn(), "void");
+
+        method = manip.getMethod("refBind", new String[] {"org.osgi.framework.ServiceReference"});
+        assertEquals("Check args count", method.getMethodArguments().length, 1);
+        assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference");
+        assertEquals("Check return", method.getMethodReturn(), "void");
+	}
+
+	public void testTwoArgsMethod() {
+	    PojoMetadata manip = SimpleMultipleCheckServiceProvider;
+        MethodMetadata method = manip.getMethods("doNothing")[0];
+        assertEquals("Check args count", 2, method.getMethodArguments().length);
+		assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object");
+        assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String");
+		assertEquals("Check return", method.getMethodReturn(), "java.lang.Object");
+
+        method = manip.getMethod("doNothing", new String[] {"java.lang.Object", "java.lang.String"});
+        assertEquals("Check args count", 2, method.getMethodArguments().length);
+        assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object");
+        assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String");
+        assertEquals("Check return", method.getMethodReturn(), "java.lang.Object");
+	}
+
+	public void testSuper() {
+		String comp_name = "org.apache.felix.ipojo.test.scenarios.component.Child";
+		PojoMetadata manip = getManipulationMetadataForComponent(comp_name);
+		assertEquals("org.apache.felix.ipojo.test.scenarios.component.Parent", manip.getSuperClass());
+		assertEquals(1, manip.getConstructors().length);
+	}
+
+	public void testConstructors() {
+		String comp_name = "org.apache.felix.ipojo.test.scenarios.component.Multiconstructor";
+		PojoMetadata manip = getManipulationMetadataForComponent(comp_name);
+		assertEquals(3, manip.getConstructors().length);
+		assertNotNull(manip.getConstructor(new String[] {String.class.getName(), String.class.getName()}));
+		assertNotNull(manip.getConstructor(new String[] {String.class.getName(), String.class.getName(), Integer.TYPE.getName()}));
+		assertNotNull(manip.getConstructor(new String[] {String.class.getName(), Integer.TYPE.getName()}));
+		assertNull(manip.getConstructor(new String[] {String.class.getName()}));
+	}
+
+
+	private Element getMetadataForComponent(Element metadata, String comp_name) {
+		Element[] comps = metadata.getElements("component");
+		for(int i = 0; i < comps.length; i++) {
+			if(comps[i].containsAttribute("factory") && comps[i].getAttribute("factory").equals(comp_name)) {
+				return comps[i];
+			}
+            if(comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) {
+                return comps[i];
+            }
+            if(comps[i].containsAttribute("classname") && comps[i].getAttribute("classname").equals(comp_name)) {
+                return comps[i];
+            }
+		}
+		return null;
+	}
+
+
+    private PojoMetadata getManipulationMetadataForComponent(String comp_name) {
+        Element elem = null;
+        try {
+            elem = ManifestMetadataParser.parseHeaderMetadata(header);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            fail("Parse Exception when parsing iPOJO-Component " + e);
+        }
+
+        assertNotNull("Check elem not null", elem);
+
+        Element manip = getMetadataForComponent(elem, comp_name);
+        assertNotNull("Check manipulation metadata not null for " + comp_name, manip);
+        try {
+            return new PojoMetadata(manip);
+        } catch (ConfigurationException e) {
+            fail("The creation of pojo metadata for " + comp_name + " has failed");
+            return null;
+        }
+    }
+
+}

Added: felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/MANIFEST.MF
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/MANIFEST.MF?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/MANIFEST.MF (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/core/src/test/resources/manipulation/MANIFEST.MF Mon Dec 20 12:39:30 2010
@@ -0,0 +1,142 @@
+Manifest-Version: 1.0
+Export-Package: org.apache.felix.ipojo.test.scenarios.manipulation.ser
+ vice
+iPOJO-Components: component { $name="ManipulationMetadata-FooProviderT
+ ype-1" $classname="org.apache.felix.ipojo.test.scenarios.component.Fo
+ oProviderType1" $architecture="true" provides { }manipulation { field
+  { $name="m_context" $type="org.osgi.framework.BundleContext" }field 
+ { $name="m_foo" $type="java.lang.String" }field { $name="m_bar" $type
+ ="int" }method { $arguments="{org.osgi.framework.BundleContext}" $nam
+ e="singleton" $return="org.apache.felix.ipojo.test.scenarios.componen
+ t.FooProviderType1" }method { $arguments="{org.osgi.framework.BundleC
+ ontext}" $name="several" $return="org.apache.felix.ipojo.test.scenari
+ os.component.FooProviderType1" }method { $arguments="{org.osgi.framew
+ ork.BundleContext}" $name="$init" }method { $name="foo" $return="bool
+ ean" }method { $name="fooProps" $return="java.util.Properties" }metho
+ d { $name="testException" }method { $name="testTry" }method { $argume
+ nts="{java.lang.String}" $name="testTry2" }method { $arguments="{java
+ .lang.String}" $name="nexttry" }method { $name="getBoolean" $return="
+ boolean" }method { $name="getDouble" $return="double" }method { $name
+ ="getInt" $return="int" }method { $name="getLong" $return="long" }met
+ hod { $name="getObject" $return="java.lang.Boolean" }method { $argume
+ nts="{int,java.lang.String,org.osgi.framework.BundleContext}" $name="
+ $init" }interface { $name="org.apache.felix.ipojo.test.scenarios.mani
+ pulation.service.FooService" }}}component { $name="ManipulationMetada
+ ta-FooBarProviderType-1" $classname="org.apache.felix.ipojo.test.scen
+ arios.component.FooBarProviderType1" $architecture="true" provides { 
+ }manipulation { method { $name="$init" }method { $name="foo" $return=
+ "boolean" }method { $name="fooProps" $return="java.util.Properties" }
+ method { $name="bar" $return="boolean" }method { $name="getProps" $re
+ turn="java.util.Properties" }method { $name="getBoolean" $return="boo
+ lean" }method { $name="getDouble" $return="double" }method { $name="g
+ etInt" $return="int" }method { $name="getLong" $return="long" }method
+  { $name="getObject" $return="java.lang.Boolean" }interface { $name="
+ org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService
+ " }interface { $name="org.apache.felix.ipojo.test.scenarios.manipulat
+ ion.service.BarService" }}}component { $name="ManipulationMetadata-Fo
+ oProviderType-Dyn" $classname="org.apache.felix.ipojo.test.scenarios.
+ component.FooProviderTypeDyn" $architecture="true" provides { propert
+ y { $field="intProp" $mandatory="false" $name="int" $value="2" }prope
+ rty { $field="boolProp" $mandatory="false" $name="boolean" $value="fa
+ lse" }property { $field="strProp" $mandatory="false" $name="string" $
+ value="foo" }property { $field="strAProp" $mandatory="false" $name="s
+ trAProp" $value="[foo, bar]" }property { $field="intAProp" $mandatory
+ ="false" $name="intAProp" $value="[ 1,2,3]" }}manipulation { field { 
+ $name="boolProp" $type="boolean" }field { $name="strProp" $type="java
+ .lang.String" }field { $name="strAProp" $type="java.lang.String[]" }f
+ ield { $name="intProp" $type="int" }field { $name="intAProp" $type="i
+ nt[]" }method { $name="$init" }method { $name="foo" $return="boolean"
+  }method { $name="fooProps" $return="java.util.Properties" }method { 
+ $name="getBoolean" $return="boolean" }method { $name="getDouble" $ret
+ urn="double" }method { $name="getInt" $return="int" }method { $name="
+ getLong" $return="long" }method { $name="getObject" $return="java.lan
+ g.Boolean" }interface { $name="org.apache.felix.ipojo.test.scenarios.
+ manipulation.service.FooService" }}}component { $name="ManipulationMe
+ tadata-PrimitiveManipulationTester" $classname="org.apache.felix.ipoj
+ o.test.scenarios.component.Manipulation23Tester" $architecture="true"
+  provides { }manipulation { field { $name="f" $type="float" }field { 
+ $name="d" $type="double" }field { $name="is" $type="int[]" }field { $
+ name="bools" $type="boolean[]" }field { $name="b" $type="byte" }field
+  { $name="ls" $type="long[]" }field { $name="c" $type="char" }field {
+  $name="l" $type="long" }field { $name="bs" $type="byte[]" }field { $
+ name="cs" $type="char[]" }field { $name="i" $type="int" }field { $nam
+ e="s" $type="short" }field { $name="fs" $type="float[]" }field { $nam
+ e="ss" $type="short[]" }field { $name="bool" $type="boolean" }field {
+  $name="ds" $type="double[]" }method { $name="$init" }method { $name=
+ "getBoolean" $return="boolean" }method { $name="getBooleans" $return=
+ "boolean[]" }method { $name="getByte" $return="byte" }method { $name=
+ "getBytes" $return="byte[]" }method { $name="getChar" $return="char" 
+ }method { $name="getChars" $return="char[]" }method { $name="getDoubl
+ e" $return="double" }method { $name="getDoubles" $return="double[]" }
+ method { $name="getFloat" $return="float" }method { $name="getFloats"
+  $return="float[]" }method { $name="getInt" $return="int" }method { $
+ name="getInts" $return="int[]" }method { $name="getLong" $return="lon
+ g" }method { $name="getLongs" $return="long[]" }method { $name="getSh
+ ort" $return="short" }method { $name="getShorts" $return="short[]" }m
+ ethod { $arguments="{boolean}" $name="setBoolean" }method { $argument
+ s="{boolean[]}" $name="setBooleans" }method { $arguments="{byte}" $na
+ me="setByte" }method { $arguments="{byte[]}" $name="setBytes" }method
+  { $arguments="{char}" $name="setChar" }method { $arguments="{char[]}
+ " $name="setChars" }method { $arguments="{double}" $name="setDouble" 
+ }method { $arguments="{double[]}" $name="setDoubles" }method { $argum
+ ents="{float}" $name="setFloat" }method { $arguments="{float[]}" $nam
+ e="setFloats" }method { $arguments="{int}" $name="setInt" }method { $
+ arguments="{int[]}" $name="setInts" }method { $arguments="{long}" $na
+ me="setLong" }method { $arguments="{long[]}" $name="setLongs" }method
+  { $arguments="{short}" $name="setShort" }method { $arguments="{short
+ []}" $name="setShorts" }method { $arguments="{long,java.lang.String}"
+  $name="setLong" }interface { $name="org.apache.felix.ipojo.test.scen
+ arios.manipulation.service.PrimitiveManipulationTestService" }}}compo
+ nent { $name="ManipulationMetadata-SimpleMultipleCheckServiceProvider
+ " $classname="org.apache.felix.ipojo.test.scenarios.component.Multipl
+ eCheckService" $architecture="true" provides { }manipulation { field 
+ { $name="refU" $type="int" }field { $name="objectU" $type="int" }fiel
+ d { $name="bothB" $type="int" }field { $name="objectB" $type="int" }f
+ ield { $name="bothU" $type="int" }field { $name="fs" $type="org.apach
+ e.felix.ipojo.test.scenarios.manipulation.service.FooService[]" }fiel
+ d { $name="simpleU" $type="int" }field { $name="simpleB" $type="int" 
+ }field { $name="refB" $type="int" }method { $name="$init" }method { $
+ name="check" $return="boolean" }method { $name="getBoolean" $return="
+ boolean" }method { $name="getInt" $return="int" }method { $name="getL
+ ong" $return="long" }method { $name="getDouble" $return="double" }met
+ hod { $arguments="{java.lang.Object,java.lang.String}" $name="doNothi
+ ng" $return="java.lang.Object" }method { $name="getProps" $return="ja
+ va.util.Properties" }method { $name="voidBind" }method { $name="voidU
+ nbind" }method { $arguments="{org.apache.felix.ipojo.test.scenarios.m
+ anipulation.service.FooService}" $name="objectBind" }method { $argume
+ nts="{org.apache.felix.ipojo.test.scenarios.manipulation.service.FooS
+ ervice}" $name="objectUnbind" }method { $arguments="{org.osgi.framewo
+ rk.ServiceReference}" $name="refBind" }method { $arguments="{org.osgi
+ .framework.ServiceReference}" $name="refUnbind" }method { $arguments=
+ "{org.apache.felix.ipojo.test.scenarios.manipulation.service.FooServi
+ ce,org.osgi.framework.ServiceReference}" $name="bothBind" }method { $
+ arguments="{org.apache.felix.ipojo.test.scenarios.manipulation.servic
+ e.FooService,org.osgi.framework.ServiceReference}" $name="bothUnbind"
+  }interface { $name="org.apache.felix.ipojo.test.scenarios.manipulati
+ on.service.CheckService" }}requires { $field="fs" }}component { $clas
+ sname="org.apache.felix.ipojo.test.scenarios.component.Child" manipul
+ ation { $super="org.apache.felix.ipojo.test.scenarios.component.Paren
+ t" method { $arguments="{java.lang.String}" $name="$init" }}}componen
+ t { $classname="org.apache.felix.ipojo.test.scenarios.component.Multi
+ constructor" manipulation { method { $arguments="{java.lang.String,ja
+ va.lang.String}" $name="$init" }method { $arguments="{java.lang.Strin
+ g,int}" $name="$init" }method { $arguments="{java.lang.String,java.la
+ ng.String,int}" $name="$init" }}}
+Test-Suite: org.apache.felix.ipojo.test.scenarios.manipulation.Manipul
+ ationTestSuite
+Built-By: clement
+Tool: Bnd-0.0.357
+Bundle-Name: iPOJO Manipulation Metadata Test Suite
+Created-By: Apache Maven Bundle Plugin & iPOJO  1.6.0
+Build-Jdk: 1.6.0_22
+Bundle-Version: 1.5.0.SNAPSHOT
+Bnd-LastModified: 1292762858403
+Bundle-ManifestVersion: 2
+Import-Package: org.osgi.service.log;version=1.3, org.apache.felix.ipo
+ jo.test.scenarios.manipulation.service, org.apache.felix.ipojo.junit4
+ osgi, junit.framework, org.apache.felix.ipojo.architecture;version=1.
+ 6, org.apache.felix.ipojo;version=1.6, org.osgi.framework;version=1.5
+ , org.osgi.service.cm;version=1.2, org.apache.felix.ipojo.metadata, o
+ rg.apache.felix.ipojo.parser;version=1.6
+Bundle-SymbolicName: tests.manipulation.metadata
+

Modified: felix/sandbox/clement/ipojo-constructor-injection/manipulator/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/manipulator/pom.xml?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/manipulator/pom.xml (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/manipulator/pom.xml Mon Dec 20 12:39:30 2010
@@ -51,6 +51,11 @@
       <artifactId>org.apache.felix.ipojo.metadata</artifactId>
       <version>1.4.0</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+      <version>1.7.0-SNAPSHOT</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -109,6 +114,16 @@
           <configLocation>http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml</configLocation>
         </configuration>
       </plugin>
+
+	<plugin>
+		<groupId>org.apache.maven.plugins</groupId>
+		<artifactId>maven-compiler-plugin</artifactId>
+		<configuration>
+			<source>1.5</source>
+			<target>1.5</target>
+		</configuration>
+	</plugin>
+
     </plugins>
 
     <resources>

Modified: felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java Mon Dec 20 12:39:30 2010
@@ -71,7 +71,7 @@ public class MethodCollector extends Emp
                 visitor = new BindAnnotationParser(index);
             }
 
-            if (CustomAnnotationVisitor.isCustomAnnotation(annotation)) {
+            if (visitor == null  && CustomAnnotationVisitor.isCustomAnnotation(annotation)) {
                 Element elem = CustomAnnotationVisitor.buildElement(annotation);
                 elem.addAttribute(new Attribute("index", "" + index));
                 visitor = new CustomAnnotationVisitor(elem, m_collector, true, false, index, m_descriptor);
@@ -608,7 +608,6 @@ public class MethodCollector extends Emp
                 }
             }
 
-            prop.addAttribute(new Attribute("method", m_method));
             if (m_value != null) {
                 prop.addAttribute(new Attribute("value", m_value));
             }
@@ -618,6 +617,8 @@ public class MethodCollector extends Emp
 
             if (m_isParameterAnnotation) {
             	m_collector.addConstructorParameter(m_index, m_id);
+            } else {
+                prop.addAttribute(new Attribute("method", m_method));
             }
 
         }

Modified: felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/test/java/test/Constructor.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/test/java/test/Constructor.java?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/test/java/test/Constructor.java (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/manipulator/src/test/java/test/Constructor.java Mon Dec 20 12:39:30 2010
@@ -8,6 +8,7 @@ import org.apache.felix.ipojo.annotation
 public class Constructor {
 
 	public Constructor(@Property(name="foo") String s, @Requires(id="t") Thread t) {
+		// plop
 
 	}
 

Added: felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Child.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Child.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Child.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Child.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,9 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class Child extends Parent {
+
+	public Child(String s) {
+		super(s);
+	}
+
+}

Added: felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Multiconstructor.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Multiconstructor.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Multiconstructor.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Multiconstructor.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class Multiconstructor {
+
+	public Multiconstructor(String s1, String s2) {
+		this(s1, s2, -1);
+	}
+
+	public Multiconstructor(String s1, int s2) {
+		this(s1, "" + s2, s2);
+	}
+
+	public Multiconstructor(String s1, String s2, int i) {
+		//...
+	}
+
+}

Added: felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Parent.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Parent.java?rev=1051085&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Parent.java (added)
+++ felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Parent.java Mon Dec 20 12:39:30 2010
@@ -0,0 +1,15 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class Parent {
+
+	private String s;
+
+	public Parent(String s) {
+		this.s = s;
+	}
+
+	public String getS() {
+		return s;
+	}
+
+}

Modified: felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/resources/metadata.xml?rev=1051085&r1=1051084&r2=1051085&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/resources/metadata.xml (original)
+++ felix/sandbox/clement/ipojo-constructor-injection/tests/manipulator/metadata/src/main/resources/metadata.xml Mon Dec 20 12:39:30 2010
@@ -9,14 +9,14 @@
 		name="ManipulationMetadata-FooProviderType-1" architecture="true">
 		<provides />
 	</component>
-	
+
 	<!-- Provider providing 2 services -->
 	<component
 		classname="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
 		name="ManipulationMetadata-FooBarProviderType-1" architecture="true">
 		<provides />
 	</component>
-	
+
 	<!-- Provider with dynamic property -->
 	<component
 		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn"
@@ -30,7 +30,7 @@
 			<property name="intAProp" field="intAProp" value="[ 1,2,3]" />
 		</provides>
 	</component>
-	
+
 	<!-- Manipulation -->
 	<component
 		classname="org.apache.felix.ipojo.test.scenarios.component.Manipulation23Tester"
@@ -38,11 +38,20 @@
 		<provides />
 	</component>
 
-	
+
 	<component
 		classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
 		name="ManipulationMetadata-SimpleMultipleCheckServiceProvider" architecture="true">
 		<requires field="fs" />
 		<provides />
 	</component>
+
+
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.Child">
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.Multiconstructor">
+    </component>
 </ipojo>



Mime
View raw message