You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/03/28 16:35:29 UTC

svn commit: r642265 [7/11] - in /felix/trunk/ipojo: ./ annotations/ ant/ ant/src/main/java/org/apache/felix/ipojo/task/ arch/ arch/src/main/java/org/apache/felix/ipojo/arch/ arch/src/main/resources/ composite/ composite/src/ composite/src/main/ composi...

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java Fri Mar 28 08:33:36 2008
@@ -40,10 +40,10 @@
 
     /**
      * Constructor.
-     * @param h : handler.
+     * @param handler : handler.
      */
-    public ProvidedServiceHandlerDescription(Handler h) {
-        super(h);
+    public ProvidedServiceHandlerDescription(Handler handler) {
+        super(handler);
     }
 
     /**
@@ -83,17 +83,18 @@
     public Element getHandlerInfo() {
         Element services = super.getHandlerInfo();
         for (int i = 0; i < m_providedServices.length; i++) {
-            Element service = new Element("provides", "");
-            String spec = "[";
+            Element service = new Element("provides", null);
+            StringBuffer spec = new StringBuffer("[");
             for (int j = 0; j < m_providedServices[i].getServiceSpecification().length; j++) {
                 if (j == 0) {
-                    spec += m_providedServices[i].getServiceSpecification()[j];
+                    spec.append(m_providedServices[i].getServiceSpecification()[j]);
                 } else {
-                    spec += ", " + m_providedServices[i].getServiceSpecification()[j];
+                    spec.append(',');
+                    spec.append(m_providedServices[i].getServiceSpecification()[j]);
                 }
             }
-            spec += "]";
-            service.addAttribute(new Attribute("specifications", spec));
+            spec.append(']');
+            service.addAttribute(new Attribute("specifications", spec.toString()));
 
             if (m_providedServices[i].getState() == ProvidedService.REGISTERED) {
                 service.addAttribute(new Attribute("state", "registered"));
@@ -102,12 +103,12 @@
                 service.addAttribute(new Attribute("state", "unregistered"));
             }
             
-            Iterator it = m_providedServices[i].getProperties().keySet().iterator();
-            while (it.hasNext()) {
-                Element prop = new Element("property", "");
-                String k = (String) it.next();
-                prop.addAttribute(new Attribute("name", k));
-                prop.addAttribute(new Attribute("value", m_providedServices[i].getProperties().getProperty(k).toString()));
+            Iterator iterator = m_providedServices[i].getProperties().keySet().iterator();
+            while (iterator.hasNext()) {
+                Element prop = new Element("property", null);
+                String name = (String) iterator.next();
+                prop.addAttribute(new Attribute("name", name));
+                prop.addAttribute(new Attribute("value", m_providedServices[i].getProperties().getProperty(name).toString()));
                 service.addElement(prop);
             }
             services.addElement(service);

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java Fri Mar 28 08:33:36 2008
@@ -62,45 +62,32 @@
     public String getFieldType() { return m_type; }
     
     /**
-     * Get the 'reflective' type of the field.
+     * Get the 'reflective' type of the given type.
      * The reflective type is the type used by the Java Reflection API.
+     * @param type : the type to analyze to find the Java reflective type.
      * @return : the reflective type corresponding to this field.
      */
-    public String getReflectionType() {
+    public static String getReflectionType(String type) {
         // Primitive Array 
-        if (m_type.endsWith("[]") && m_type.indexOf(".") == -1) {
-            String arr = "";
-            for (int i = 0; i < m_type.length(); i++) {
-                if (m_type.charAt(i) == '[') { arr += '['; }
-            }
-            int index = m_type.indexOf('[');
-            String t = m_type.substring(0, index);
-            return arr + getInternalPrimitiveType(t);
+        if (type.endsWith("[]") && type.indexOf('.') == -1) {
+            int index = type.indexOf('[');
+            return '[' + getInternalPrimitiveType(type.substring(0, index));
         }
         // Non-Primitive Array 
-        if (m_type.endsWith("[]") && m_type.indexOf(".") != -1) {
-            String arr = "";
-            for (int i = 0; i < m_type.length(); i++) {
-                if (m_type.charAt(i) == '[') { arr += '['; }
-            }
-            int index = m_type.indexOf('[');
-            String t = m_type.substring(0, index);
-            return arr + "L" + t + ";";
-        }
-        // Simple type 
-        if (!m_type.endsWith("[]")) {
-            return m_type;
+        if (type.endsWith("[]") && type.indexOf('.') != -1) {
+            int index = type.indexOf('[');
+            return "[L" + type.substring(0, index) + ";";
         }
-        
-        return null;
+        // The type is not an array.
+        return type;
     }
     
     /**
      * Get the internal notation for primitive type.
-     * @param string : Stringform of the type
+     * @param string : String form of the type
      * @return the internal notation or null if not found
      */
-    private String getInternalPrimitiveType(String string) {
+    public static String getInternalPrimitiveType(String string) {
         if (string.equalsIgnoreCase("boolean")) {
             return "Z";
         }
@@ -125,7 +112,39 @@
         if (string.equalsIgnoreCase("double")) {
             return "D";
         }
-        System.err.println("No primitive type found for " + m_type);
+        return null;
+    }
+    
+    /**
+     * Get the iPOJO primitive type from the given primitive class.
+     * @param clazz : a primitive class
+     * @return the primitive type.
+     */
+    public static String getPrimitiveTypeByClass(Class clazz) {
+        if (clazz.equals(Boolean.TYPE)) {
+            return "boolean";
+        }
+        if (clazz.equals(Character.TYPE)) {
+            return "char";
+        }
+        if (clazz.equals(Byte.TYPE)) {
+            return "byte";
+        }
+        if (clazz.equals(Short.TYPE)) {
+            return "short";
+        }
+        if (clazz.equals(Integer.TYPE)) {
+            return "int";
+        }
+        if (clazz.equals(Float.TYPE)) {
+            return "float";
+        }
+        if (clazz.equals(Long.TYPE)) {
+            return "long";
+        }
+        if (clazz.equals(Double.TYPE)) {
+            return "double";
+        }
         return null;
     }
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java Fri Mar 28 08:33:36 2008
@@ -18,7 +18,9 @@
  */
 package org.apache.felix.ipojo.parser;
 
+import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.felix.ipojo.metadata.Attribute;
@@ -32,11 +34,6 @@
 public class ManifestMetadataParser {
 
     /**
-     * Manifest Headers.
-     */
-    private Dictionary m_headers;
-
-    /**
      * Element list.
      */
     private Element[] m_elements = new Element[0];
@@ -47,24 +44,14 @@
      * @throws ParseException when a parsing error occurs
      */
     public Element[] getComponentsMetadata() throws ParseException {
-        Element[] components = m_elements[0].getElements("Component");
-        Element[] composites = m_elements[0].getElements("Composite");
-        Element[] handlers = m_elements[0].getElements("Handler");
-        Element[] all = new Element[components.length + composites.length + handlers.length];
-        int l = 0;
-        for (int i = 0; i < components.length; i++) {
-            all[l] = components[i];
-            l++;
-        }
-        for (int i = 0; i < composites.length; i++) {
-            all[l] = composites[i];
-            l++;
-        }
-        for (int i = 0; i < handlers.length; i++) {
-            all[l] = handlers[i];
-            l++;
+        Element[] elems = m_elements[0].getElements();
+        List list = new ArrayList();
+        for (int i = 0; i < elems.length; i++) {
+            if (!"instance".equals(elems[i].getName())) {
+                list.add(elems[i]);
+            }
         }
-        return all;
+        return (Element[]) list.toArray(new Element[list.size()]);
     }
 
     /**
@@ -73,7 +60,10 @@
      * @throws ParseException : if the metadata cannot be parsed successfully
      */
     public Dictionary[] getInstances() throws ParseException {
-        Element[] configs = m_elements[0].getElements("Instance");
+        Element[] configs = m_elements[0].getElements("instance");
+        if (configs == null) {
+            return null;
+        }
         Dictionary[] dicts = new Dictionary[configs.length];
         for (int i = 0; i < configs.length; i++) {
             dicts[i] = parseInstance(configs[i]);
@@ -95,17 +85,18 @@
         if (name != null) {
             dict.put("name", instance.getAttribute("name"));
         }
-        
+
         if (comp == null) {
             throw new ParseException("An instance does not have the 'component' attribute");
         }
-        
+
         dict.put("component", comp);
+        Element[] props = instance.getElements("property");
 
-        for (int i = 0; i < instance.getElements("property").length; i++) {
-            parseProperty(instance.getElements("property")[i], dict);
+        for (int i = 0; props != null && i < props.length; i++) {
+            parseProperty(props[i], dict);
         }
-        
+
         return dict;
     }
 
@@ -122,10 +113,8 @@
         if (name == null) {
             throw new ParseException("A property does not have the 'name' attribute");
         }
-        // Final case : the property element has a 'value' attribute
-        if (value != null) {
-            dict.put(prop.getAttribute("name"), prop.getAttribute("value"));
-        } else {
+        //case : the property element has a 'value' attribute
+        if (value == null) {
             // Recursive case
             // Check if there is 'property' element
             Element[] subProps = prop.getElements("property");
@@ -137,6 +126,8 @@
                 parseProperty(subProps[i], dict2);
                 dict.put(name, dict2);
             }
+        } else {
+            dict.put(prop.getAttribute("name"), prop.getAttribute("value"));
         }
     }
 
@@ -146,13 +137,13 @@
      * @param elem : the element to add
      */
     private void addElement(Element elem) {
-        if (m_elements != null) {
+        if (m_elements == null) {
+            m_elements = new Element[] { elem };
+        } else {
             Element[] newElementsList = new Element[m_elements.length + 1];
             System.arraycopy(m_elements, 0, newElementsList, 0, m_elements.length);
             newElementsList[m_elements.length] = elem;
             m_elements = newElementsList;
-        } else {
-            m_elements = new Element[] { elem };
         }
     }
 
@@ -180,19 +171,18 @@
     }
 
     /**
-     * Parse the given dictionnary and create the instance managers.
+     * Parse the given dictionary and create the instance managers.
      * 
      * @param dict : the given headers of the manifest file
      * @throws ParseException : if any error occurs
      */
     public void parse(Dictionary dict) throws ParseException {
-        m_headers = dict;
-        String componentClassesStr = (String) m_headers.get("iPOJO-Components");
+        String componentClassesStr = (String) dict.get("iPOJO-Components");
         // Add the ipojo element inside the element list
         addElement(new Element("iPOJO", ""));
         parseElements(componentClassesStr.trim());
     }
-    
+
     /**
      * Parse the given header and create the instance managers.
      * 
@@ -222,57 +212,61 @@
     }
 
     /**
-     * Paser the given string.
+     * Parse the given string.
      * 
-     * @param s : the string to parse
+     * @param elems : the string to parse
      */
-    private void parseElements(String s) {
-        char[] string = s.toCharArray();
+    private void parseElements(String elems) {
+        char[] string = elems.toCharArray();
 
         for (int i = 0; i < string.length; i++) {
-            char c = string[i];
+            char current = string[i];
 
-            switch (c) {
+            switch (current) { //NOPMD
                 // Beginning of an attribute.
                 case '$':
-                    String attName = "";
-                    String attValue = "";
-                    String attNs = "";
+                    StringBuffer attName = new StringBuffer();
+                    StringBuffer attValue = new StringBuffer();
+                    StringBuffer attNs = null;
                     i++;
-                    c = string[i];
-                    while (c != '=') {
-                        if (c == ':') {
+                    current = string[i]; // Increment and get the new current char.
+                    while (current != '=') {
+                        if (current == ':') {
                             attNs = attName;
-                            attName = "";
+                            attName = new StringBuffer();
                         } else {
-                            attName = attName + c;
+                            attName.append(current);
                         }
-                        i = i + 1;
-                        c = string[i];
+                        i++;
+                        current = string[i];
                     }
-                    i++; // skip =
-                    i++; // skip "
-                    c = string[i];
-                    while (c != '"') {
-                        attValue = attValue + c;
+                    i = i + 2; // skip ="
+                    current = string[i];
+                    while (current != '"') {
+                        attValue.append(current);
                         i++;
-                        c = string[i];
+                        current = string[i]; // Increment and get the new current char.
                     }
                     i++; // skip "
-                    c = string[i];
+                    current = string[i];
 
-                    Attribute att = new Attribute(attName, attNs, attValue);
+                    Attribute att = null;
+                    if (attNs == null) {
+                        att = new Attribute(attName.toString(), attValue.toString());
+                    } else {
+                        att = new Attribute(attName.toString(), attNs.toString(), attValue.toString());
+                    }
                     m_elements[m_elements.length - 1].addAttribute(att);
                     break;
 
                 // End of an element
                 case '}':
                     Element lastElement = removeLastElement();
-                    if (m_elements.length != 0) {
+                    if (m_elements.length == 0) {
+                        addElement(lastElement);
+                    } else {
                         Element newQueue = m_elements[m_elements.length - 1];
                         newQueue.addElement(lastElement);
-                    } else {
-                        addElement(lastElement);
                     }
                     break;
 
@@ -282,19 +276,19 @@
 
                 // Default case
                 default:
-                    String name = "";
-                    String ns = "";
-                    c = string[i];
-                    while (c != ' ') {
-                        if (c == ':') {
-                            ns = name;
-                            name = "";
+                    StringBuffer name = new StringBuffer();
+                    StringBuffer namespace = null;
+                    current = string[i];
+                    while (current != ' ') {
+                        if (current == ':') {
+                            namespace = name;
+                            name = new StringBuffer();
                             i++;
-                            c = string[i];
+                            current = string[i];
                         } else {
-                            name = name + c;
+                            name.append(current);
                             i++;
-                            c = string[i];
+                            current = string[i]; // Increment and get the new current char.
                         }
                     }
                     // Skip spaces
@@ -302,8 +296,15 @@
                         i = i + 1;
                     }
                     i = i + 1; // skip {
-                    Element elem = new Element(name, ns);
+                    
+                    Element elem = null;
+                    if (namespace == null) {
+                        elem = new Element(name.toString(), null);
+                    } else {
+                        elem = new Element(name.toString(), namespace.toString());
+                    }
                     addElement(elem);
+                    
                     break;
             }
         }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java Fri Mar 28 08:33:36 2008
@@ -18,6 +18,8 @@
  */
 package org.apache.felix.ipojo.parser;
 
+import java.lang.reflect.Method;
+
 import org.apache.felix.ipojo.metadata.Element;
 
 /**
@@ -27,22 +29,22 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class MethodMetadata {
-    
+
     /**
      * Name of the method.
      */
     private String m_name;
-    
+
     /**
      * Argument type array. 
      */
     private String[] m_arguments = new String[0];
-    
+
     /**
      * Returned type. 
      */
     private String m_return = "void";
-    
+
     /**
      * Constructor.
      * @param metadata : method manipulation element.
@@ -50,37 +52,77 @@
     MethodMetadata(Element metadata) {
         m_name = metadata.getAttribute("name");
         String arg = metadata.getAttribute("arguments");
-        String rt = metadata.getAttribute("return");
+        String result = metadata.getAttribute("return");
         if (arg != null) {
             m_arguments = ParseUtils.parseArrays(arg);
         }
-        if (rt != null) {
-            m_return = rt;
+        if (result != null) {
+            m_return = result;
         }
     }
-    
-    public String getMethodName() { return m_name; }
-    
-    public String[] getMethodArguments() { return m_arguments; }
-    
-    public String getMethodReturn() { return m_return; }
-    
+
+    public String getMethodName() {
+        return m_name;
+    }
+
+    public String[] getMethodArguments() {
+        return m_arguments;
+    }
+
+    public String getMethodReturn() {
+        return m_return;
+    }
+
     /**
      * Get the method unique identifier. For internal usage only.
      * @return the method identifier.
      */
     public String getMethodIdentifier() {
-        String id = m_name;
+        StringBuffer identifier = new StringBuffer(m_name);
         for (int i = 0; i < m_arguments.length; i++) {
-            String cn = m_arguments[i];
-            if (cn.endsWith("[]")) {
-                cn = cn.replace('[', '$');
-                cn = cn.substring(0, cn.length() - 1);
+            String arg = m_arguments[i];
+            identifier.append('$');
+            if (arg.endsWith("[]")) {
+                arg = arg.substring(0, arg.length() - 2);
+                identifier.append(arg.replace('.', '_'));
+                identifier.append("__"); // Replace [] by __
+            } else {
+                identifier.append(arg.replace('.', '_'));
+            }
+        }
+        return identifier.toString();
+    }
+
+    /**
+     * Compute the method id for the given method. 
+     * @param method : Method object.
+     * @return the method id.
+     */
+    public static String computeMethodId(Method method) {
+        StringBuffer identifier = new StringBuffer(method.getName());
+        Class[] args = method.getParameterTypes();
+        for (int i = 0; i < args.length; i++) {
+            identifier.append('$'); // Argument separator.
+            if (args[i].isArray()) {
+                if (args[i].getComponentType().isPrimitive()) {
+                    // Primitive array
+                    identifier.append(FieldMetadata.getPrimitiveTypeByClass(args[i].getComponentType()));
+                } else {
+                    // Object array
+                    identifier.append(args[i].getComponentType().getName().replace('.', '_')); // Replace '.' by '_'
+                }
+                identifier.append("__"); // Add __ (array)
+            } else {
+                if (args[i].isPrimitive()) {
+                    // Primitive type
+                    identifier.append(FieldMetadata.getPrimitiveTypeByClass(args[i]));
+                } else {
+                    // Object type
+                    identifier.append(args[i].getName().replace('.', '_')); // Replace '.' by '_'
+                }
             }
-            cn = cn.replace('.', '_');
-            id += cn;
         }
-        return id;
+        return identifier.toString();
     }
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java Fri Mar 28 08:33:36 2008
@@ -18,7 +18,7 @@
  */
 package org.apache.felix.ipojo.parser;
 
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.StringTokenizer;
 
@@ -27,7 +27,7 @@
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class ParseUtils {
+public final class ParseUtils {
 
     /**
      * Parse the string form of an array as {a, b, c}.
@@ -37,18 +37,13 @@
      */
     public static String[] parseArrays(String str) {
         // Remove { and }
-        if (str.startsWith("{") && str.endsWith("}")) {
-            String m = str.substring(1, str.length() - 1);
+        if (str.charAt(0) == '{' && str.charAt(str.length() - 1) == '}') {
+            String internal = (str.substring(1, str.length() - 1)).trim();
             // Check empty array
-            m = m.trim();
-            if (m.length() == 0) {
+            if (internal.length() == 0) {
                 return new String[0];
             }
-            String[] values = split(m, ",");
-            for (int i = 0; i < values.length; i++) {
-                values[i] = values[i].trim();
-            }
-            return values;
+            return split(internal, ",");
         } else {
             return new String[] { str };
         }
@@ -61,40 +56,24 @@
      * @return the resulting string array
      */
     public static List parseArraysAsList(String str) {
-        List result = new ArrayList();
-        // Remove { and }
-        if (str.startsWith("{") && str.endsWith("}")) {
-            String m = str.substring(1, str.length() - 1);
-            // Check empty array
-            m = m.trim();
-            if (m.length() == 0) {
-                return result;
-            }
-            String[] values = split(m, ",");
-            for (int i = 0; i < values.length; i++) {
-                result.add(values[i].trim());
-            }
-            return result;
-        } else {
-            result.add(str);
-            return result;
-        }
+        return Arrays.asList(parseArrays(str));
     }
     
     /**
      * Split method. 
      * This method is equivalent of the String.split in java 1.4
+     * The result array contains 'trimmed' String
      * @param toSplit : String to split
      * @param separator : separator
      * @return the token array 
      */
     public static String[] split(String toSplit, String separator) {
-        StringTokenizer st = new StringTokenizer(toSplit, separator);
-        String[] result = new String[st.countTokens()];
-        int i = 0;
-        while (st.hasMoreElements()) {
-            result[i] = st.nextToken();
-            i++;
+        StringTokenizer tokenizer = new StringTokenizer(toSplit, separator);
+        String[] result = new String[tokenizer.countTokens()];
+        int index = 0;
+        while (tokenizer.hasMoreElements()) {
+            result[index] = tokenizer.nextToken().trim();
+            index++;
         }
         return result;
     }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java Fri Mar 28 08:33:36 2008
@@ -22,15 +22,15 @@
 import java.lang.reflect.Method;
 
 import org.apache.felix.ipojo.InstanceManager;
+import org.apache.felix.ipojo.parser.FieldMetadata;
 import org.apache.felix.ipojo.parser.MethodMetadata;
 
 /**
  * A callback allows calling a method on the component instances.
- * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class Callback {
-    
+
     /**
      * Method object.
      */
@@ -50,7 +50,7 @@
      * Reference on the instance manager.
      */
     private InstanceManager m_manager;
-    
+
     /**
      * Argument classes.
      */
@@ -58,193 +58,112 @@
 
     /**
      * Callback constructor.
-     * 
      * @param method : the name of the method to call
      * @param args : argument type name
      * @param isStatic : is the method a static method
-     * @param im : the instance manager of the component containing the method
+     * @param manager : the instance manager of the component containing the method
      */
-    public Callback(String method, String[] args, boolean isStatic, InstanceManager im) {
+    public Callback(String method, String[] args, boolean isStatic, InstanceManager manager) {
         m_method = method;
         m_isStatic = isStatic;
-        m_manager = im;
+        m_manager = manager;
         if (args != null) {
-            m_args = new String[args.length];
-            for (int i = 0; i < args.length; i++) {
-                // Primitive Array 
-                if (args[i].endsWith("[]") && args[i].indexOf(".") == -1) {
-                    String arr = "";
-                    for (int j = 0; j < args[i].length(); j++) {
-                        if (args[i].charAt(j) == '[') { arr += '['; }
-                    }
-                    int index = args[i].indexOf('[');
-                    m_args[i] = arr + getInternalPrimitiveType(args[i].substring(0, index));
-                }
-                // Non-Primitive Array 
-                if (args[i].endsWith("[]") && args[i].indexOf(".") != -1) {
-                    String arr = "";
-                    for (int j = 0; j < args[i].length(); j++) {
-                        if (args[i].charAt(j) == '[') { arr += '['; }
-                    }
-                    int index = args[i].indexOf('[');
-                    m_args[i] = arr + "L" + args[i].substring(0, index) + ";";
-                }
-                // Simple type 
-                if (!args[i].endsWith("[]")) {
-                    m_args[i] = args[i];
-                }
-            }
+            computeArguments(args);
         }
-        
     }
-    
+
     /**
      * Callback constructor.
-     * 
      * @param method : the name of the method to call
      * @param args : argument classes
      * @param isStatic : is the method a static method
-     * @param im : the instance manager of the component containing the method
+     * @param manager : the instance manager of the component containing the method
      */
-    public Callback(String method, Class[] args, boolean isStatic, InstanceManager im) {
+    public Callback(String method, Class[] args, boolean isStatic, InstanceManager manager) {
         m_method = method;
         m_isStatic = isStatic;
-        m_manager = im;
+        m_manager = manager;
         m_args = new String[args.length];
         for (int i = 0; i < args.length; i++) {
             m_args[i] = args[i].getName();
         }
     }
-    
+
     /**
      * Constructor.
-     * @param mm : Method Metadata obtain form manipulation metadata.
-     * @param im : instance manager.
+     * @param method : Method Metadata obtain form manipulation metadata.
+     * @param manager : instance manager.
      */
-    public Callback(MethodMetadata mm, InstanceManager im) {
+    public Callback(MethodMetadata method, InstanceManager manager) {
         m_isStatic = false;
-        m_method = mm.getMethodName();
-        m_manager = im;
-        String[] args = mm.getMethodArguments();
-        m_args = new String[args.length];
-        for (int i = 0; i < args.length; i++) {
-            // Primitive Array 
-            if (args[i].endsWith("[]") && args[i].indexOf(".") == -1) {
-                String arr = "";
-                for (int j = 0; j < args[i].length(); j++) {
-                    if (args[i].charAt(j) == '[') { arr += '['; }
-                }
-                int index = args[i].indexOf('[');
-                m_args[i] = arr + getInternalPrimitiveType(args[i].substring(0, index));
-            }
-            // Non-Primitive Array 
-            if (args[i].endsWith("[]") && args[i].indexOf(".") != -1) {
-                String arr = "";
-                for (int j = 0; j < args[i].length(); j++) {
-                    if (args[i].charAt(j) == '[') { arr += '['; }
-                }
-                int index = args[i].indexOf('[');
-                m_args[i] = arr + "L" + args[i].substring(0, index) + ";";
-            }
-            // Simple type 
-            if (!args[i].endsWith("[]")) {
-                m_args[i] = args[i];
-            }
-        }
+        m_method = method.getMethodName();
+        m_manager = manager;
+        computeArguments(method.getMethodArguments());
     }
 
     /**
-     * Get the internal notation for primitive type.
-     * @param string : Stringform of the type
-     * @return the internal notation or null if not found
-     */
-    private String getInternalPrimitiveType(String string) {
-        if (string.equalsIgnoreCase("boolean")) {
-            return "Z";
-        }
-        if (string.equalsIgnoreCase("char")) {
-            return "C";
-        }
-        if (string.equalsIgnoreCase("byte")) {
-            return "B";
-        }
-        if (string.equalsIgnoreCase("short")) {
-            return "S";
-        }
-        if (string.equalsIgnoreCase("int")) {
-            return "I";
-        }
-        if (string.equalsIgnoreCase("float")) {
-            return "F";
-        }
-        if (string.equalsIgnoreCase("long")) {
-            return "J";
-        }
-        if (string.equalsIgnoreCase("double")) {
-            return "D";
+     * Compute arguments of the method.
+     * @param args : arguments of the method.
+     */
+    private void computeArguments(String[] args) {
+        m_args = new String[args.length];
+        for (int i = 0; i < args.length; i++) {
+            m_args[i] = FieldMetadata.getReflectionType(args[i]);
         }
-        return null;
     }
-    
+
     /**
-     * Search the method object in the POJO by analyzing present method.
-     * The name of the method and the argument type are checked.
+     * Search the looked method in the given method arrays.
+     * @param methods : method array in which we need to look
+     * @return the method object or null if not found
      */
-    protected void searchMethod() {
-        Method[] methods = m_manager.getClazz().getDeclaredMethods();
-        for (int i = 0; m_methodObj == null && i < methods.length; i++) {
+    private Method searchMethodInMethodArray(Method[] methods) {
+        for (int i = 0; i < methods.length; i++) {
             // First check the method name
             if (methods[i].getName().equals(m_method)) {
                 // Check arguments
                 Class[] clazzes = methods[i].getParameterTypes();
                 if (clazzes.length == m_args.length) { // Test size to avoid useless loop
-                    boolean ok = true;
-                    for (int j = 0; ok && j < m_args.length; j++) {
-                        if (!m_args[j].equals(clazzes[j].getName())) {
-                            ok = false;
+                    int argIndex = 0;
+                    for (; argIndex < m_args.length; argIndex++) {
+                        if (!m_args[argIndex].equals(clazzes[argIndex].getName())) {
+                            break;
                         }
                     }
-                    if (ok) {
-                        m_methodObj = methods[i]; // It is the looked method.
-                    } 
+                    if (argIndex == m_args.length) { // No mismatch detected. 
+                        return methods[i]; // It is the looked method.
+                    }
                 }
-
             }
         }
-        
-        if (m_methodObj == null) { //look at parent classes
+        return null;
+    }
+
+    /**
+     * Search the method object in the POJO by analyzing present method. The name of the method and the argument type are checked.
+     * @throws NoSuchMethodException : occurs when the method cannot be found either in the pojo class either in parent classes.
+     */
+    protected void searchMethod() throws NoSuchMethodException {
+        Method[] methods = m_manager.getClazz().getDeclaredMethods();
+        m_methodObj = searchMethodInMethodArray(methods);
+
+        if (m_methodObj == null) { // look at parent classes
             methods = m_manager.getClazz().getMethods();
-            for (int i = 0; m_methodObj == null && i < methods.length; i++) {
-                // First check the method name
-                if (methods[i].getName().equals(m_method)) {
-                    // Check arguments
-                    Class[] clazzes = methods[i].getParameterTypes();
-                    if (clazzes.length == m_args.length) { // Test size to avoid useless loop
-                        boolean ok = true;
-                        for (int j = 0; ok && j < m_args.length; j++) {
-                            if (!m_args[j].equals(clazzes[j].getName())) {
-                                ok = false;
-                            }
-                        }
-                        if (ok) {
-                            m_methodObj = methods[i]; // It is the looked method.
-                        } 
-                    }
-                }
-            }
+            m_methodObj = searchMethodInMethodArray(methods);
         }
-        
+
         if (m_methodObj == null) {
-            m_manager.getFactory().getLogger().log(Logger.ERROR, "The method " + m_method + " cannot be called : method not found");
-            m_manager.stop();
+            throw new NoSuchMethodException(m_method);
         } else {
-            m_methodObj.setAccessible(true);
+            if (! m_methodObj.isAccessible()) { 
+                // If not accessible, try to set the accessibility.
+                m_methodObj.setAccessible(true);
+            }
         }
     }
 
     /**
      * Call the method.
-     * 
      * @return the result of the invocation, null for void method, the last result for multi-object instance
      * @throws NoSuchMethodException : Method is not found in the class
      * @throws InvocationTargetException : The method is not static
@@ -256,7 +175,6 @@
 
     /**
      * Call the current callback method on the instance given in parameter.
-     * 
      * @param instance : instance on which call the callback
      * @return the result of the invocation, null for void method
      * @throws NoSuchMethodException : the method was not found
@@ -269,19 +187,17 @@
 
     /**
      * Call the callback on the method with the argument given in parameter.
-     * 
      * @param arg : the parameters
      * @return the result of the invocation, null for void method, the last result for multi-object instance
      * @throws NoSuchMethodException : the callback method is not found
      * @throws IllegalAccessException : the callback method cannot be called
-     * @throws InvocationTargetException : an error occurs inside the called
-     * method
+     * @throws InvocationTargetException : an error occurs inside the called method
      */
     public Object call(Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         if (m_methodObj == null) {
             searchMethod();
         }
-        
+
         if (m_isStatic) {
             return m_methodObj.invoke(null, arg);
         } else {
@@ -291,35 +207,32 @@
             if (m_manager.getPojoObjects() == null) {
                 return m_methodObj.invoke(m_manager.getPojoObject(), arg);
             } else {
-                Object r = null;
+                Object newObject = null;
                 for (int i = 0; i < m_manager.getPojoObjects().length; i++) {
-                    r = m_methodObj.invoke(m_manager.getPojoObjects()[i], arg);
+                    newObject = m_methodObj.invoke(m_manager.getPojoObjects()[i], arg);
                 }
-                return r;
+                return newObject;
             }
         }
     }
 
     /**
-     * Call the callback on the method with the argument given in parameter and
-     * with the arguments given in parameter too.
-     * 
+     * Call the callback on the method with the argument given in parameter and with the arguments given in parameter too.
      * @param instance : instance on which call the callback
      * @param arg : the argument array
      * @return the result of the invocation, null for void method
      * @throws NoSuchMethodException : the callback method is not found
      * @throws IllegalAccessException : the callback method cannot be called
-     * @throws InvocationTargetException : an error occurs inside the called
-     * method
+     * @throws InvocationTargetException : an error occurs inside the called method
      */
     public Object call(Object instance, Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         if (m_methodObj == null) {
             searchMethod();
         }
-        
+
         return m_methodObj.invoke(instance, arg);
     }
-    
+
     public String getMethod() {
         return m_method;
     }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java Fri Mar 28 08:33:36 2008
@@ -28,6 +28,11 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class Logger {
+    
+    /**
+     * Ipojo default log level property.
+     */
+    public static final String IPOJO_LOG_LEVEL = "ipojo.log.level";
 
     /**
      * Log Level ERROR.
@@ -67,14 +72,24 @@
     /**
      * Constructor.
      * 
-     * @param bc : bundle context
+     * @param context : bundle context
      * @param name : name of the logger
      * @param level : trace level
      */
-    public Logger(BundleContext bc, String name, int level) {
+    public Logger(BundleContext context, String name, int level) {
         m_name = name;
         m_level = level;
-        m_context = bc;
+        m_context = context;
+    }
+    
+    /**
+     * Constructor.
+     * 
+     * @param context : bundle context
+     * @param name : name of the logger
+     */
+    public Logger(BundleContext context, String name) {
+        this(context, name, getDefaultLevel(context));
     }
 
     /**
@@ -85,7 +100,7 @@
      */
     public void log(int level, String msg) {
         if (m_level >= level) {
-            dispatch(level, msg, null);
+            dispatch(level, msg);
         }
     }
 
@@ -94,26 +109,21 @@
      * 
      * @param level : level of the message
      * @param msg : message to log
-     * @param ex : exception attached to the message
+     * @param exception : exception attached to the message
      */
-    public void log(int level, String msg, Throwable ex) {
+    public void log(int level, String msg, Throwable exception) {
         if (m_level >= level) {
-            dispatch(level, msg, ex);
+            dispatch(level, msg, exception);
         }
     }
-
+    
     /**
      * Internal log method.
      * 
      * @param level : level of the message.
      * @param msg : message to log
-     * @param ex : exception attached to the message
      */
-    private void dispatch(int level, String msg, Throwable ex) {
-        String s = msg;
-        if (ex != null) {
-            s += " (" + ex.getMessage() + ")";
-        }
+    private void dispatch(int level, String msg) {
         
         ServiceReference ref = m_context.getServiceReference(LogService.class.getName());
         LogService log = null;
@@ -124,40 +134,134 @@
         String message = null;
         switch (level) {
             case DEBUG:
-                message = "[" + m_name + "] DEBUG: " + s;
+                message = "[" + m_name + "] DEBUG: " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_DEBUG, message);
                 }
-                System.err.println(message);
+                System.err.println(message); // NOPMD
                 break;
             case ERROR:
-                message = "[" + m_name + "] ERROR: " + s;
+                message = "[" + m_name + "] ERROR: " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_ERROR, message);
                 }
-                System.err.println(message);
+                System.err.println(message); //NOPMD
                 break;
             case INFO:
-                message = "[" + m_name + "] INFO: " + s;
+                message = "[" + m_name + "] INFO: " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_INFO, message);
                 }
-                System.err.println(message);
+                System.err.println(message); // NOPMD
                 break;
             case WARNING:
-                message = "[" + m_name + "] WARNING: " + s;
+                message = "[" + m_name + "] WARNING: " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_WARNING, message);
                 }
-                System.err.println(message);
+                System.err.println(message); // NOPMD
+                break;
+            default:
+                System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + msg); // NOPMD
+                break;
+        }
+        
+        if (log != null) {
+            m_context.ungetService(ref);
+        }
+    }
+
+    /**
+     * Internal log method.
+     * 
+     * @param level : level of the message.
+     * @param msg : message to log
+     * @param exception : exception attached to the message
+     */
+    private void dispatch(int level, String msg, Throwable exception) {
+        
+        ServiceReference ref = m_context.getServiceReference(LogService.class.getName());
+        LogService log = null;
+        if (ref != null) {
+            log = (LogService) m_context.getService(ref);
+        }
+        
+        String message = null;
+        switch (level) {
+            case DEBUG:
+                message = "[" + m_name + "] DEBUG: " + msg;
+                if (log != null) {
+                    log.log(LogService.LOG_DEBUG, message, exception);
+                }
+                System.err.println(message); // NOPMD
+                exception.printStackTrace(); // NOPMD
+                break;
+            case ERROR:
+                message = "[" + m_name + "] ERROR: " + msg;
+                if (log != null) {
+                    log.log(LogService.LOG_ERROR, message, exception);
+                }
+                System.err.println(message); // NOPMD
+                exception.printStackTrace(System.err); // NOPMD
+                break;
+            case INFO:
+                message = "[" + m_name + "] INFO: " + msg;
+                if (log != null) {
+                    log.log(LogService.LOG_INFO, message, exception);
+                }
+                System.err.println(message); // NOPMD
+                exception.printStackTrace(System.err); // NOPMD
+                break;
+            case WARNING:
+                message = "[" + m_name + "] WARNING: " + msg;
+                if (log != null) {
+                    log.log(LogService.LOG_WARNING, message, exception);
+                }
+                System.err.println(message); // NOPMD
+                exception.printStackTrace(System.err); // NOPMD
                 break;
             default:
-                System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + s);
+                System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + msg); // NOPMD
+                exception.printStackTrace(); // NOPMD
                 break;
         }
         
         if (log != null) {
             m_context.ungetService(ref);
         }
+    }
+    
+    /**
+     * Get the default logger level.
+     * The property is searched inside the framework properties, the system properties,
+     * and in the manifest from the given bundle context. By default, set the level to WARNING. 
+     * @param context : bundle context.
+     * @return the default log level.
+     */
+    private static int getDefaultLevel(BundleContext context) {
+        // First check in the framework and in the system properties
+        String level = context.getProperty(IPOJO_LOG_LEVEL);
+        
+        // If null, look in bundle manifest
+        if (level == null) {
+            level = (String) context.getBundle().getHeaders().get(IPOJO_LOG_LEVEL);
+        }
+        
+        if (level != null) {
+            if (level.equalsIgnoreCase("info")) {
+                return INFO;
+            } else if (level.equalsIgnoreCase("debug")) {
+                return DEBUG;
+            } else if (level.equalsIgnoreCase("warning")) {
+                return WARNING;
+            } else if (level.equalsIgnoreCase("error")) {
+                return ERROR;
+            }
+        }
+        
+        // Either l is null, either the specified log level was unknown
+        // Set the default to WARNING
+        return WARNING;
+        
     }
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Tracker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Tracker.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Tracker.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Tracker.java Fri Mar 28 08:33:36 2008
@@ -42,7 +42,7 @@
     /**
      * Bundle context against which this Tracker object is tracking.
      */
-    protected final BundleContext m_context;
+    protected BundleContext m_context;
 
     /**
      * Filter specifying search criteria for the services to track.
@@ -52,22 +52,22 @@
     /**
      * TrackerCustomizer object for this tracker.
      */
-    final TrackerCustomizer m_customizer;
+    protected TrackerCustomizer m_customizer;
 
     /**
      * Filter string for use when adding the ServiceListener. If this field is set, then certain optimizations can be taken since we don't have a user supplied filter.
      */
-    final String m_listenerFilter;
+    protected String m_listenerFilter;
 
     /**
      * Class name to be tracked. If this field is set, then we are tracking by class name.
      */
-    private final String m_trackClass;
+    private String m_trackClass;
 
     /**
      * Reference to be tracked. If this field is set, then we are tracking a single ServiceReference.
      */
-    private final ServiceReference m_trackReference;
+    private ServiceReference m_trackReference;
 
     /**
      * Tracked services: ServiceReference object -> customized. Object and ServiceListener object
@@ -126,13 +126,13 @@
         } else {
             m_customizer = customizer;
         }
-        this.m_listenerFilter = "(" + Constants.OBJECTCLASS + "=" + clazz.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        this.m_listenerFilter = "(" + Constants.OBJECTCLASS + "=" + clazz + ")";
         try {
             this.m_filter = context.createFilter(m_listenerFilter);
         } catch (InvalidSyntaxException e) { // we could only get this exception
             // if the clazz argument was
             // malformed
-            throw new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage()); //$NON-NLS-1$
+            throw new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage());
         }
     }
 
@@ -157,7 +157,7 @@
             m_customizer = customizer;
         }
         if ((context == null) || (filter == null)) { // we throw a NPE here to be consistent with the other constructors
-            throw new NullPointerException();
+            throw new NullPointerException(); // NOPMD by clement on 29/02/08 14:12
         }
     }
 
@@ -188,7 +188,7 @@
                 // the initial
                 // references
             } catch (InvalidSyntaxException e) {
-                throw new RuntimeException("unexpected InvalidSyntaxException: " + e.getMessage()); //$NON-NLS-1$
+                throw new IllegalStateException("unexpected InvalidSyntaxException: " + e.getMessage()); //$NON-NLS-1$
             }
         }
         /* Call tracked outside of synchronized region */
@@ -220,8 +220,8 @@
 
         try {
             m_context.removeServiceListener(outgoing);
-        } catch (IllegalStateException e) {
-            System.err.println("Context stopped");
+        } catch (IllegalStateException e) { //NOPMD
+            //System.err.println("Context stopped");
             /* In case the context was stopped. */
         }
         if (references != null) {
@@ -254,7 +254,7 @@
      * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference)
      */
     public void addedService(ServiceReference reference) {
-
+        // Nothing to do.
     }
 
     /**
@@ -266,6 +266,7 @@
      * @see TrackerCustomizer
      */
     public void modifiedService(ServiceReference reference, Object service) {
+        // Nothing to do.
     }
 
     /**
@@ -326,8 +327,7 @@
             Iterator keys = tracked.keySet().iterator();
             for (int i = 0; i < length; i++) {
                 references[i] = (ServiceReference) keys.next();
-            }
-            // The resulting array is sorted by ranking.
+            }            
             return references;
         }
     }
@@ -353,6 +353,31 @@
             return references;
         }
     }
+    
+    /**
+     * Return the list of references used by the tracker.
+     * A reference becomes used when the dependency has already
+     * call getService on this reference.
+     * @return : the list of used references.
+     */
+    public List/*<ServiceReference>*/getUsedServiceReferences() {
+        Tracked tracked = this.m_tracked; // use local var since we are not synchronized
+        if (tracked == null || tracked.size() == 0) { // if Tracker is not open or empty
+            return null;
+        }
+        synchronized (tracked) {
+            int length = tracked.size();
+            List references = new ArrayList();
+            Iterator keys = tracked.keySet().iterator();
+            for (int i = 0; i < length; i++) {
+                Object key = keys.next(); 
+                if (tracked.get(key) != null) {
+                    references.add(key);
+                }
+            }
+            return references;
+        }
+    }
 
     /**
      * Returns a ServiceReference object for one of the services being tracked by this Tracker object.
@@ -388,11 +413,13 @@
         Object object = null;
         synchronized (tracked) {
             object = tracked.get(reference);
-            if (object != null) { // The object was already get.
-                return object;
-            } else if (tracked.containsKey(reference)) { // Not already get
-                object = m_context.getService(reference);
-                tracked.put(reference, object);
+            if (object == null) {
+                if (tracked.containsKey(reference)) { // Not already get but already tracked.
+                    object = m_context.getService(reference);
+                    tracked.put(reference, object);
+                    return object;
+                }
+            } else { // The object was already get.
                 return object;
             }
             // Not already tracked.
@@ -430,10 +457,10 @@
         synchronized (tracked) {
             ServiceReference[] references = getServiceReferences();
             int length = 0;
-            if (references != null) {
-                length = references.length;
-            } else {
+            if (references == null) {
                 return null;
+            } else {
+                length = references.length;
             }
             Object[] objects = new Object[length];
             for (int i = 0; i < length; i++) {
@@ -541,7 +568,7 @@
             while (true) {
                 ServiceReference reference;
                 synchronized (this) {
-                    if (m_initial.size() == 0) { //  if there are no more inital services
+                    if (m_initial.isEmpty()) { //  if there are no more inital services
                         return; // we are done
                     }
 
@@ -580,14 +607,14 @@
             switch (event.getType()) {
                 case ServiceEvent.REGISTERED:
                 case ServiceEvent.MODIFIED:
-                    if (m_listenerFilter != null) { // constructor supplied filter
-                        track(reference);
-                    } else { // user supplied filter
+                    if (m_listenerFilter == null) { // user supplied filter 
                         if (m_filter.match(reference)) {
                             track(reference); // Arrival
                         } else {
                             untrack(reference); // Departure
                         }
+                    } else { // constructor supplied filter
+                        track(reference);
                     }
                     break;
                 case ServiceEvent.UNREGISTERING:

Modified: felix/trunk/ipojo/core/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/resources/metadata.xml?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/core/src/main/resources/metadata.xml Fri Mar 28 08:33:36 2008
@@ -1,41 +1,27 @@
 <ipojo>
-<!-- Primitives handler -->
-<handler classname="org.apache.felix.ipojo.handlers.lifecycle.controller.ControllerHandler" name="controller" architecture="false"/>
-<handler classname="org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler" name="callback" level="1" architecture="false"/>
-<handler classname="org.apache.felix.ipojo.handlers.dependency.DependencyHandler" name="requires" level="0" architecture="false">
-	<controller field="m_state"/>
-</handler>
-<handler classname="org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler" name="provides" level="3" architecture="false"/>
-<handler classname="org.apache.felix.ipojo.handlers.configuration.ConfigurationHandler" name="properties" level="1" architecture="false"/>
-<handler classname="org.apache.felix.ipojo.handlers.architecture.ArchitectureHandler" name="architecture" architecture="false">
-	<provides>
-		<property field="m_name" name="instance.name" value=""/>
-	</provides>
-</handler>
-
-<!-- Composite Handler -->
-<handler classname="org.apache.felix.ipojo.composite.instance.InstanceHandler" name="instance" type="composite" architecture="false">
-	<controller field="m_isValid"/>
-	<requires filter="(&amp;(factory.state=1)(factory.name=*))" field="m_factories" optional="true" architecture="false">
-		<callback type="bind" method="bindFactory"/>
-		<callback type="unbind" method="unbindFactory"/>
-	</requires>
-</handler>
-<handler classname="org.apache.felix.ipojo.composite.service.importer.ImportHandler" name="requires" type="composite" architecture="false">
-	<controller field="m_valid"/>
-</handler>
-<handler classname="org.apache.felix.ipojo.composite.service.importer.ExportHandler" name="exports" type="composite" architecture="false">
-	<controller field="m_valid"/>
-</handler>
-<handler classname="org.apache.felix.ipojo.composite.service.instantiator.ServiceInstantiatorHandler" name="service" type="composite" architecture="false">
-	<controller field="m_isValid"/>
-</handler>
-<handler classname="org.apache.felix.ipojo.composite.service.provides.ProvidedServiceHandler" name="provides" type="composite" architecture="false">
-	<controller field="m_valid"/>
-</handler>
-<handler classname="org.apache.felix.ipojo.composite.architecture.ArchitectureHandler" name="architecture" type="composite" architecture="false">
-	<provides>
-		<property field="m_name" name="instance.name" value=""/>
-	</provides>
-</handler>
+	<!-- Primitives handler -->
+	<handler
+		classname="org.apache.felix.ipojo.handlers.lifecycle.controller.ControllerHandler"
+		name="controller" architecture="false" />
+	<handler
+		classname="org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler"
+		name="callback" level="1" architecture="false" />
+	<handler
+		classname="org.apache.felix.ipojo.handlers.dependency.DependencyHandler"
+		name="requires" level="0" architecture="false">
+		<!-- <controller field="m_state"/>  -->
+	</handler>
+	<handler
+		classname="org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler"
+		name="provides" level="3" architecture="false" />
+	<handler
+		classname="org.apache.felix.ipojo.handlers.configuration.ConfigurationHandler"
+		name="properties" level="1" architecture="false" />
+	<handler
+		classname="org.apache.felix.ipojo.handlers.architecture.ArchitectureHandler"
+		name="architecture" architecture="false">
+		<provides>
+			<property field="m_name" name="instance.name" value="" />
+		</provides>
+	</handler>
 </ipojo>

Propchange: felix/trunk/ipojo/event.admin.handler/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -1,3 +1,9 @@
 *.patch
 .externalToolBuilders
 maven-eclipse.xml
+target
+bin
+.settings
+.checkstyle
+.classpath
+.project

Modified: felix/trunk/ipojo/event.admin.handler/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/event.admin.handler/pom.xml?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/event.admin.handler/pom.xml (original)
+++ felix/trunk/ipojo/event.admin.handler/pom.xml Fri Mar 28 08:33:36 2008
@@ -1,84 +1,90 @@
-<!--
- 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.
--->
+<!--
+	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.
+-->
 <project>
-  <modelVersion>4.0.0</modelVersion>
-  <packaging>bundle</packaging>
-  <name>iPOJO Event Admin Handler</name>
-  <groupId>org.apache.felix</groupId>
-  <version>0.7.5-SNAPSHOT</version>
-  <artifactId>org.apache.felix.ipojo.handler.event</artifactId>
-	  
-  <dependencies>
-	  <dependency>
-  			<groupId>org.apache.felix</groupId>
-      		<artifactId>org.apache.felix.ipojo</artifactId>
-	        <version>0.7.5-SNAPSHOT</version>
-	  </dependency>
-	  <dependency>
-  			<groupId>org.apache.felix</groupId>
-      		<artifactId>org.apache.felix.ipojo.metadata</artifactId>
-	      	<version>0.7.5-SNAPSHOT</version>
-	  </dependency>
-	  <dependency>
-  			<groupId>org.apache.felix</groupId>
-      		<artifactId>org.osgi.core</artifactId>
-      		<version>1.1.0-SNAPSHOT</version>
-	  </dependency>
-	  <dependency>
-	     <groupId>org.apache.felix</groupId>
-  		 <artifactId>org.osgi.compendium</artifactId>
-         <version>1.0.0</version>
-	</dependency>
-  </dependencies>
-  
+	<parent>
+		<artifactId>iPOJO</artifactId>
+		<groupId>org.apache.felix</groupId>
+		<version>0.7.6-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>Apache Felix iPOJO Event Admin Handler</name>
+	<artifactId>org.apache.felix.ipojo.handler.event</artifactId>
 
-  
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Private-Package>org.apache.felix.ipojo.handler.event</Private-Package>
-            <Bundle-Name>${pom.name}</Bundle-Name>
-            <Bundle-SymbolicName>ipojo.event.admin.handler</Bundle-SymbolicName>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-	      <groupId>org.apache.felix</groupId>
-	      <artifactId>maven-ipojo-plugin</artifactId>
-          <version>${pom.version}</version>
-		  <executions>
-          	<execution>
-            	<goals>
-	              <goal>ipojo-bundle</goal>
-               </goals>
-            <configuration>
-   				<metadata>metadata.xml</metadata>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo</artifactId>
+			<version>${pom.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
+			<version>${pom.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.4.0</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Private-Package>
+							org.apache.felix.ipojo.handler.event
+						</Private-Package>
+						<Bundle-Name>${pom.name}</Bundle-Name>
+						<Bundle-SymbolicName>
+							ipojo.event.admin.handler
+						</Bundle-SymbolicName>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>${pom.version}</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<metadata>metadata.xml</metadata>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>

Modified: felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java (original)
+++ felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java Fri Mar 28 08:33:36 2008
@@ -27,13 +27,13 @@
 import org.apache.felix.ipojo.ConfigurationException;
 import org.apache.felix.ipojo.InstanceManager;
 import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.architecture.ComponentDescription;
+import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
 import org.apache.felix.ipojo.architecture.PropertyDescription;
 import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManipulationMetadata;
 import org.apache.felix.ipojo.parser.MethodMetadata;
+import org.apache.felix.ipojo.parser.ParseUtils;
+import org.apache.felix.ipojo.parser.PojoMetadata;
 import org.apache.felix.ipojo.util.Callback;
-import org.apache.felix.ipojo.util.Logger;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventHandler;
@@ -71,7 +71,7 @@
      * @throws ConfigurationException : metadata are incorrect.
      * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription, org.apache.felix.ipojo.metadata.Element)
      */
-    public void initializeComponentFactory(ComponentDescription cd, Element metadata) throws ConfigurationException {
+    public void initializeComponentFactory(ComponentTypeDescription cd, Element metadata) throws ConfigurationException {
         // Update the current component description
         Dictionary dict = new Properties();
         cd.addProperty(new PropertyDescription("event.topics", Dictionary.class.getName(), dict.toString()));
@@ -93,11 +93,11 @@
 
         // Store the component manager
         m_manager = getInstanceManager();
-        ManipulationMetadata mm = new ManipulationMetadata(metadata);
+        PojoMetadata mm = getFactory().getPojoMetadata();
 
         // Get Metadata subscribers
         Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);
-        if (subscribers.length > 0) {
+        if (subscribers != null) {
             // then check publishers are well formed and fill the publishers'
             // map
             for (int i = 0; i < subscribers.length; i++) {
@@ -109,25 +109,24 @@
                         Callback cb = new Callback(methodMetadata, m_manager);
                         eventAdminSubscriberMetadata.setCallback(cb);
                     } else {
-                        log(Logger.WARNING, " EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");
+                        warn(" EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");
                         throw new ConfigurationException("EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");
                     }
                     m_subEvent.add(eventAdminSubscriberMetadata);
                 } else {
-                    log(Logger.WARNING, " EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
+                    warn(" EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
                     throw new ConfigurationException("EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
                 }
             }
-            log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS : Suscribers detected !");
         } else {
-            log(Logger.ERROR, " EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");
+            error(" EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");
             throw new ConfigurationException(" EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");
         }
 
         // if well formed publishers or subscribers found
         if (!m_subEvent.isEmpty()) {
             // register the handler
-            log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS has been configured !");
+            info(" EVENT HANDLER SUBSCRIBERS has been configured !");
         } else {
             return;
         }
@@ -178,8 +177,6 @@
      * @see org.apache.felix.ipojo.Handler#start()
      */
     public void start() {
-        log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS STARTING!!!");
-
         if (!m_subEvent.isEmpty()) {
             // build the topic to listen
             // Topics is a merge of all required topics by subscribers
@@ -198,9 +195,7 @@
             }
 
             // Put the m_topics properties to the good value
-            m_topics = topics.split(",");
-
-            log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS : EventHandler registered object: " + this);
+            m_topics = ParseUtils.split(topics, ",");
         }
     }
 
@@ -249,7 +244,7 @@
                             c.call(new Object[] { event });
                         }
                     } catch (Exception e) {
-                        log(Logger.ERROR, "EVENT HANDLER SUBSCRIBERS CALLBACK error : " + eventSubscriberData.getCallbackStr() + " exception :" + e + " Cause : " + e.getCause());
+                        error("EVENT HANDLER SUBSCRIBERS CALLBACK error : " + eventSubscriberData.getCallbackStr() + " exception :" + e.getMessage());
                         // stop the component :
                         m_manager.setState(InstanceManager.INVALID);
                     }

Modified: felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java?rev=642265&r1=642264&r2=642265&view=diff
==============================================================================
--- felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java (original)
+++ felix/trunk/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java Fri Mar 28 08:33:36 2008
@@ -20,6 +20,7 @@
 
 import org.apache.felix.ipojo.InstanceManager;
 import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ParseUtils;
 import org.apache.felix.ipojo.util.Callback;
 import org.apache.felix.ipojo.util.Logger;
 import org.osgi.framework.Filter;
@@ -43,7 +44,7 @@
     private Callback m_callback;
 
     /**
-     * Listenned topics.
+     * Listened topics.
      */
     private String m_topics;
 
@@ -112,12 +113,11 @@
      * @return true if the given topic is a listenned topic.
      */
     public boolean matchingTopic(String topic) {
-        return EventUtil.matches(topic, m_topics.split(","));
+        return EventUtil.matches(topic, ParseUtils.split(m_topics, ","));
     }
 
     /**
-     * Is the subscriber metadata valid ?
-     * This method check only the existence of a callback and a name attribute.
+     * Is the subscriber metadata valid ? This method check only the existence of a callback and a name attribute.
      * @param subscriber : metadata.
      * @return true if the metadata is valid.
      */
@@ -174,8 +174,7 @@
     }
 
     /**
-     * Create and set the filter.
-     * The filter is create from the given argument.
+     * Create and set the filter. The filter is create from the given argument.
      * @param filter : the String form of the LDAP filter.
      * @throws InvalidSyntaxException : occurs when the given filter is invalid.
      */

Propchange: felix/trunk/ipojo/examples/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -0,0 +1,6 @@
+target*
+.classpath*
+.setting*
+.project*
+bin*
+maven-eclipse.xml

Propchange: felix/trunk/ipojo/examples/junit4osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -0,0 +1,7 @@
+target*
+bin*
+.settings
+.project
+.classpath
+.externalToolBuilders
+.checkstyle

Propchange: felix/trunk/ipojo/examples/junit4osgi/felix-command/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -0,0 +1,8 @@
+.checkstyle
+.classpath
+.project
+bin
+target
+maven-eclipse.xml
+.externalToolBuilders
+.settings

Copied: felix/trunk/ipojo/examples/junit4osgi/felix-command/metadata.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/metadata.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/felix-command/metadata.xml?p2=felix/trunk/ipojo/examples/junit4osgi/felix-command/metadata.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/metadata.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/metadata.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/felix-command/metadata.xml Fri Mar 28 08:33:36 2008
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<iPOJO>	
-	<component className="org.apache.felix.ipojo.junit4osgi.command.JunitCommand" factory="false">
-		<requires field="runner"/>
-		<provides/>
+<iPOJO>
+	<component
+		className="org.apache.felix.ipojo.junit4osgi.command.JunitCommand"
+		factory="false">
+		<requires field="runner" />
+		<provides />
 	</component>
-	<instance component="org.apache.felix.ipojo.junit4osgi.command.JunitCommand"/>
+	<instance
+		component="org.apache.felix.ipojo.junit4osgi.command.JunitCommand" />
 </iPOJO>

Copied: felix/trunk/ipojo/examples/junit4osgi/felix-command/pom.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/pom.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/felix-command/pom.xml?p2=felix/trunk/ipojo/examples/junit4osgi/felix-command/pom.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/pom.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/pom.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/felix-command/pom.xml Fri Mar 28 08:33:36 2008
@@ -1,3 +1,21 @@
+<!--
+	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.
+-->
 <project>
 	<parent>
 		<groupId>ipojo.examples</groupId>

Copied: felix/trunk/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java?p2=felix/trunk/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java (original)
+++ felix/trunk/ipojo/examples/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java Fri Mar 28 08:33:36 2008
@@ -79,7 +79,7 @@
                     tr = runner.run(bundleId);
                 }
             } catch (NumberFormatException e) {
-                System.err.println("Unable to parse id " + line);
+                err.println("Unable to parse id " + line);
                 return;
             }
         }
@@ -89,7 +89,7 @@
             TestResult result = it.next();
             if (result.failureCount() != 0) {
                 TestFailure fail = (TestFailure) result.failures().nextElement();
-                System.out.println(fail.trace());
+                out.println(fail.trace());
                 return;
             }
         }

Propchange: felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -0,0 +1,8 @@
+.checkstyle
+.classpath
+.project
+bin
+target
+maven-eclipse.xml
+.externalToolBuilders
+.settings

Copied: felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml?p2=felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml Fri Mar 28 08:33:36 2008
@@ -1,8 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<iPOJO>	
-	<component className="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner" factory="false" >
-		<requires field="runner"/>
-		<callback method="start" transition="validate"/>
+<iPOJO>
+	<component
+		className="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner"
+		factory="false">
+		<requires field="runner" />
+		<callback method="start" transition="validate" />
 	</component>
-	<instance component="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner" name="immediate-runner"/>
+	<instance
+		component="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner"
+		name="immediate-runner" />
 </iPOJO>

Copied: felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/pom.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/pom.xml?p2=felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/pom.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/immediate-launcher/pom.xml Fri Mar 28 08:33:36 2008
@@ -1,3 +1,21 @@
+<!--
+	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.
+-->
 <project>
 	<parent>
 		<groupId>ipojo.examples</groupId>

Propchange: felix/trunk/ipojo/examples/junit4osgi/junit4osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 28 08:33:36 2008
@@ -0,0 +1,7 @@
+.checkstyle
+.classpath
+.externalToolBuilders
+.project
+.settings
+maven-eclipse.xml
+target

Copied: felix/trunk/ipojo/examples/junit4osgi/junit4osgi/metadata.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/metadata.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/junit4osgi/metadata.xml?p2=felix/trunk/ipojo/examples/junit4osgi/junit4osgi/metadata.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/metadata.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/metadata.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/junit4osgi/metadata.xml Fri Mar 28 08:33:36 2008
@@ -1,10 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <iPOJO xmlns:extender="org.apache.felix.ipojo.extender">
-	<Component className="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender">
-		<extender:extender extension="Test-Suite" onArrival="onBundleArrival" onDeparture="onBundleDeparture"/>
-		<callback transition="invalidate" method="stopping"/>
-		<callback transition="validate" method="starting"/>
-		<provides/>
+	<Component
+		className="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender">
+		<extender:extender extension="Test-Suite"
+			onArrival="onBundleArrival" onDeparture="onBundleDeparture" />
+		<callback transition="invalidate" method="stopping" />
+		<callback transition="validate" method="starting" />
+		<provides />
 	</Component>
-	<instance component="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender"/>
+	<instance
+		component="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender" />
 </iPOJO>

Copied: felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml (from r640936, felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/pom.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml?p2=felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml&p1=felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/pom.xml&r1=640936&r2=642265&rev=642265&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/pom.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml Fri Mar 28 08:33:36 2008
@@ -1,3 +1,21 @@
+<!--
+	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.
+-->
 <project>
 	<parent>
 		<groupId>ipojo.examples</groupId>