Fix the issue Felix-637 about stack size error when a composite uses a long.
Update annotations to reflect changes about factory name computation (add the public_factory attribute).
Some cosmetic fixes too as well as tests on recent features.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@677545 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
index 96984d9..d6bc8ee 100644
--- a/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
+++ b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
@@ -31,9 +31,9 @@
/**
* Set if the component type is public.
- * Default: false
+ * Default: true
*/
- boolean factory() default false;
+ boolean public_factory() default true;
/**
* Set the component type name.
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
index 60432a8..9a03a5e 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
@@ -172,7 +172,7 @@
}
public String getFactoryName() {
- return m_componentMetadata.getAttribute("name");
+ return m_componentMetadata.getAttribute("name"); // Mandatory attribute.
}
}
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
index c099297..93de3d0 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
@@ -237,10 +237,12 @@
try {
Factory fact = (Factory) getService(ref);
if (m_factories.get(ref) == null) {
- ComponentInstance instance = createInstance(fact);
- m_factories.put(ref, instance);
+ ComponentInstance instance = createInstance(fact);
+ m_factories.put(ref, instance);
} else {
- m_handler.info("An arriving factory is already used, ignore the creation : " + fact.getName());
+ m_handler
+ .info("An arriving factory is already used, ignore the creation : "
+ + fact.getName());
}
} catch (UnacceptableConfiguration e) {
@@ -267,7 +269,8 @@
// Remove the reference is contained
Object instance = m_factories.remove(ref);
if (instance != null) {
- m_handler.info("Dispose the instance (departure of the factory) " + ((ComponentInstance) instance).getInstanceName());
+ m_handler.info("Dispose the instance (departure of the factory) "
+ + ((ComponentInstance) instance).getInstanceName());
((ComponentInstance) instance).dispose();
}
}
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
index f4cd823..dc1419f 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
@@ -233,7 +233,7 @@
// The class has already be loaded.
return null;
}
- byte[] pojo = POJOWriter.dump(clazz, m_name, getFieldList(), getMethodList());
+ byte[] pojo = POJOWriter.dump(clazz, m_name, getFieldList(), getMethodList(), m_handler);
Manipulator manipulator = new Manipulator();
try {
byte[] newclazz = manipulator.manipulate(pojo);
@@ -253,7 +253,7 @@
protected Element buildMetadata(String name) {
Element elem = new Element("component", "");
Attribute className = new Attribute("classname", m_name);
- Attribute factory = new Attribute("factory", "false");
+ Attribute factory = new Attribute("public", "false");
elem.addAttribute(className);
elem.addAttribute(factory);
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
index 91ed8cc..ffca9c8 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
@@ -21,6 +21,7 @@
import java.lang.reflect.Method;
import java.util.List;
+import org.apache.felix.ipojo.Handler;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
@@ -34,10 +35,7 @@
*/
public class POJOWriter implements Opcodes {
- //TODO : consider using getOpCode
- //TODO : fix bug on double-space
- //TODO : use a logger
- //TODO : merge this class with another class only static method.
+ //TODO : merge this class with another class only static methods.
/**
* Create a class.
@@ -73,6 +71,21 @@
}
}
}
+
+ /**
+ * Generates an empty constructor.
+ * this constructor just call the java.lang.Object constructor.
+ * @param cw class writer
+ */
+ private static void generateConstructor(ClassWriter cw) {
+ // Inject a constructor <INIT>()V
+ MethodVisitor cst = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+ cst.visitVarInsn(ALOAD, 0);
+ cst.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+ cst.visitInsn(RETURN);
+ cst.visitMaxs(0, 0);
+ cst.visitEnd();
+ }
/**
* Return the proxy 'classname' for the contract 'contractname' by delegating on available service.
@@ -80,9 +93,10 @@
* @param className : The class name to create
* @param fields : the list of fields on which delegate
* @param methods : the list of method on which delegate
+ * @param handler : handler object used to access the logger
* @return byte[] : the build class
*/
- public static byte[] dump(Class clazz, String className, List fields, List methods) {
+ public static byte[] dump(Class clazz, String className, List fields, List methods, Handler handler) {
Method[] itfmethods = clazz.getMethods();
// Create the class
@@ -93,14 +107,8 @@
// Inject fields inside the POJO
injectFields(cw, fields);
- // Inject a constructor <INIT>()V
- MethodVisitor cst = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
- cst.visitVarInsn(ALOAD, 0);
- cst.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
- cst.visitInsn(RETURN);
- cst.visitMaxs(0, 0);
- cst.visitEnd();
-
+ generateConstructor(cw);
+
for (int i = 0; i < itfmethods.length; ++i) {
Method method = itfmethods[i];
@@ -116,7 +124,7 @@
}
}
- generateOneMethod(cw, className, methodDelegator, method, delegator);
+ generateMethod(cw, className, methodDelegator, method, delegator, handler);
}
@@ -132,8 +140,9 @@
* @param method : the method to generate
* @param sign : method signature to generate
* @param delegator : the field on which delegate
+ * @param handler : the handler (used to acess the logger)
*/
- private static void generateOneMethod(ClassWriter cw, String className, MethodMetadata method, Method sign, FieldMetadata delegator) {
+ private static void generateMethod(ClassWriter cw, String className, MethodMetadata method, Method sign, FieldMetadata delegator, Handler handler) {
String desc = Type.getMethodDescriptor(sign);
String name = sign.getName();
String[] exc = new String[sign.getExceptionTypes().length];
@@ -157,24 +166,20 @@
// Aggregate and One Policy
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "[L" + delegator.getSpecification().getName().replace('.', '/') + ";");
- mv.visitInsn(ICONST_0); // Take the first one
+ mv.visitInsn(ICONST_0); // Use the first one
mv.visitInsn(AALOAD);
- // Loads args
- Type[] args = Type.getArgumentTypes(desc);
- for (int i = 0; i < args.length; i++) {
- writeLoad(args[i], i + 1, mv);
- }
+ loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc));
// Invoke
mv.visitMethodInsn(INVOKEINTERFACE, delegator.getSpecification().getName().replace('.', '/'), name, desc);
// Return
- writeReturn(Type.getReturnType(desc), mv);
+ mv.visitInsn(Type.getReturnType(desc).getOpcode(Opcodes.IRETURN));
+
} else { // All policy
if (Type.getReturnType(desc).getSort() != Type.VOID) {
- //TODO use logger.
- System.err.println("All policy cannot be used on method which does not return void");
+ handler.error("All policy cannot be used on method which does not return void");
}
Type[] args = Type.getArgumentTypes(desc);
@@ -196,10 +201,7 @@
mv.visitVarInsn(ILOAD, index);
mv.visitInsn(AALOAD);
- // Loads args
- for (int i = 0; i < args.length; i++) {
- writeLoad(args[i], i + 1, mv);
- }
+ loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc));
mv.visitMethodInsn(INVOKEINTERFACE, delegator.getSpecification().getName().replace('.', '/'), name, desc);
@@ -223,11 +225,7 @@
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "L" + delegator.getSpecification().getName().replace('.', '/') + ";");
- // Loads args
- Type[] args = Type.getArgumentTypes(desc);
- for (int i = 0; i < args.length; i++) {
- writeLoad(args[i], i + 1, mv);
- }
+ loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc));
// Invoke
if (delegator.getSpecification().isInterface()) {
@@ -237,7 +235,7 @@
}
// Return
- writeReturn(Type.getReturnType(desc), mv);
+ mv.visitInsn(Type.getReturnType(desc).getOpcode(IRETURN));
}
mv.visitMaxs(0, 0);
@@ -288,90 +286,38 @@
mv.visitInsn(ATHROW);
mv.visitLabel(end);
}
-
+
/**
- * Write a return instruction according to the given type.
- * @param t : the type
- * @param mv : the method visitor
+ * Load on stack the method arguments.
+ * @param mv method visitor
+ * @param access access level of the method
+ * @param args argument types array
*/
- private static void writeReturn(Type t, MethodVisitor mv) {
- switch (t.getSort()) {
- case Type.BOOLEAN:
- case Type.INT:
- case Type.BYTE:
- case Type.CHAR:
- case Type.SHORT:
- // Integer or Boolean : return 0 ( false)
- mv.visitInsn(IRETURN);
- break;
- case Type.LONG:
- // mv.visitInsn(LCONST_0);
- mv.visitInsn(LRETURN);
- break;
- case Type.DOUBLE:
- // Double : return 0.0
- // mv.visitInsn(DCONST_0);
- mv.visitInsn(DRETURN);
- break;
- case Type.FLOAT:
- // Double : return 0.0
- // mv.visitInsn(DCONST_0);
- mv.visitInsn(FRETURN);
- break;
- case Type.ARRAY:
- case Type.OBJECT:
- // Return always null for array and object
- // mv.visitInsn(ACONST_NULL);
- mv.visitInsn(ARETURN);
- break;
- case Type.VOID:
- mv.visitInsn(RETURN);
- break;
- default:
- System.err.println("Type not yet managed : " + t);
- break;
+ private static void loadArgs(MethodVisitor mv, int access, Type[] args) {
+ int i = 0;
+ int j = args.length;
+ int k = getArgIndex(access, args, i);
+ for (int l = 0; l < j; l++) {
+ Type type = args[i + l];
+ mv.visitVarInsn(type.getOpcode(ILOAD), k);
+ k += type.getSize();
}
}
-
+
/**
- * Write a load instruction according to the given type.
- * @param t : the type
- * @param mv : the method visitor
- * @param index : variable name (index)
+ * Gets the index of the argument 'i'.
+ * This method manages double-spaces.
+ * @param access method access (mostly public)
+ * @param args argument type array
+ * @param i wanted index
+ * @return the real index
*/
- private static void writeLoad(Type t, int index, MethodVisitor mv) {
- switch (t.getSort()) {
- case Type.BOOLEAN:
- case Type.INT:
- case Type.BYTE:
- case Type.CHAR:
- case Type.SHORT:
- // Integer or Boolean : return 0 ( false)
- mv.visitVarInsn(ILOAD, index);
- break;
- case Type.LONG:
- // mv.visitInsn(LCONST_0);
- mv.visitVarInsn(LLOAD, index);
- break;
- case Type.FLOAT:
- // mv.visitInsn(LCONST_0);
- mv.visitVarInsn(FLOAD, index);
- break;
- case Type.DOUBLE:
- // Double : return 0.0
- // mv.visitInsn(DCONST_0);
- mv.visitVarInsn(DLOAD, index);
- break;
- case Type.ARRAY:
- case Type.OBJECT:
- // Return always null for array and object
- // mv.visitInsn(ACONST_NULL);
- mv.visitVarInsn(ALOAD, index);
- break;
- default:
- System.err.println("Type not yet managed : " + t);
- break;
+ private static int getArgIndex(int access, Type[] args, int i) {
+ int j = (access & 8) != 0 ? 0 : 1;
+ for (int k = 0; k < i; k++) {
+ j += args[k].getSize();
}
+ return j;
}
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
index 5cb5500..a353bc3 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
@@ -143,21 +143,22 @@
InstanceManager instance = new InstanceManager(this, context, handlers);
try {
- instance.configure(m_componentMetadata, config);
+ instance.configure(m_componentMetadata, config);
instance.start();
return instance;
} catch (ConfigurationException e) {
- // An exception occurs while executing the configure or start methods.
- if (instance != null) {
- instance.dispose();
- instance = null;
- }
- throw e;
+ // An exception occurs while executing the configure or start
+ // methods.
+ if (instance != null) {
+ instance.dispose();
+ instance = null;
+ }
+ throw e;
} catch (Throwable e) { // All others exception are handled here.
- if (instance != null) {
- instance.dispose();
- instance = null;
- }
+ if (instance != null) {
+ instance.dispose();
+ instance = null;
+ }
m_logger.log(Logger.ERROR, e.getMessage(), e);
throw new ConfigurationException(e.getMessage());
}
@@ -242,8 +243,9 @@
*/
public String getFactoryName() {
String name = m_componentMetadata.getAttribute("name");
- if (name == null) { // No factory name, use the classname (mandatory attribute)
- name = m_componentMetadata.getAttribute("classname");
+ if (name == null) {
+ // No factory name, use the classname (mandatory attribute)
+ name = m_componentMetadata.getAttribute("classname");
}
return name;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
index 8d0f2ba..41baeb3 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
@@ -311,9 +311,11 @@
// It generally comes from a missing import.
throw new IllegalStateException("Cannot create the Nullable object, a referenced class cannot be loaded: " + e.getMessage());
} catch (Throwable e) { // Catch any other exception that can occurs
- throw new IllegalStateException("Cannot create the Nullable object, an unexpected error occurs: " + e.getMessage());
+ throw new IllegalStateException(
+ "Cannot create the Nullable object, an unexpected error occurs: "
+ + e.getMessage());
}
- }
+ }
} else {
// Create the default-implementation object.
try {
@@ -325,7 +327,7 @@
throw new IllegalStateException("Cannot load the default-implementation " + m_di + " : " + e.getMessage());
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Cannot load the default-implementation " + m_di + " : " + e.getMessage());
- } catch(Throwable e) { // Catch any other exception
+ } catch (Throwable e) { // Catch any other exception
throw new IllegalStateException("Cannot load the default-implementation (unexpected exception) " + m_di + " : " + e.getMessage());
}
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
index 81633de..fe033ac 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
@@ -121,30 +121,37 @@
// Get the type of the structure to create
String type = prop.getAttribute("type");
if (type == null || type.equalsIgnoreCase("dictionary")) {
- dict.put(name, parseDictionary(prop));
+ dict.put(name, parseDictionary(prop));
} else if (type.equalsIgnoreCase("map")) {
- dict.put(name, parseMap(prop));
- } else if (type.equalsIgnoreCase("list")) {
- dict.put(name, parseList(prop));
+ dict.put(name, parseMap(prop));
+ } else if (type.equalsIgnoreCase("list")) {
+ dict.put(name, parseList(prop));
} else if (type.equalsIgnoreCase("array")) {
List list = parseList(prop);
boolean isString = true;
for (int i = 0; isString && i < list.size(); i++) {
- isString = list.get(i) instanceof String;
+ isString = list.get(i) instanceof String;
}
- Object[] obj = null;
+ Object[] obj = null;
if (isString) {
- obj = new String[list.size()];
+ obj = new String[list.size()];
} else {
obj = new Object[list.size()];
}
- dict.put(name, list.toArray(obj)); // Transform the list to array
+ // Transform the list to array
+ dict.put(name, list.toArray(obj));
}
} else {
dict.put(prop.getAttribute("name"), prop.getAttribute("value"));
}
}
+ /**
+ * Parses a complex property. This property will be build as a Dictionary.
+ * @param prop Element to parse.
+ * @return the resulting dictionary
+ * @throws ParseException occurs when an internal property is incorrect.
+ */
private Dictionary parseDictionary(Element prop) throws ParseException {
// Check if there is 'property' elements
Element[] subProps = prop.getElements("property");
@@ -160,6 +167,13 @@
}
}
+ /**
+ * Parses a complex property. This property will be built as a Map.
+ * The used Map implementation is HashMap.
+ * @param prop the property to parse
+ * @return the resulting Map
+ * @throws ParseException occurs when an internal property is incorrect.
+ */
private Map parseMap(Element prop) throws ParseException {
// Check if there is 'property' elements
Element[] subProps = prop.getElements("property");
@@ -174,6 +188,13 @@
}
}
+ /**
+ * Parses a complex property. This property will be built as a List.
+ * The used Map implementation is ArrayList. The order or element is kept.
+ * @param prop the property to parse
+ * @return the resulting List
+ * @throws ParseException occurs when an internal property is incorrect.
+ */
private List parseList(Element prop) throws ParseException {
Element[] subProps = prop.getElements("property");
if (subProps != null) {
@@ -199,38 +220,47 @@
String name = prop.getAttribute("name");
String value = prop.getAttribute("value");
if (name == null) {
- throw new ParseException("A property does not have the 'name' attribute");
+ throw new ParseException(
+ "A property does not have the 'name' attribute");
}
- //case : the property element has no 'value' attribute
+ // case : the property element has no 'value' attribute
if (value == null) {
// Recursive case
// Get the type of the structure to create
String type = prop.getAttribute("type");
if (type == null || type.equalsIgnoreCase("dictionary")) {
- map.put(name, parseDictionary(prop));
+ map.put(name, parseDictionary(prop));
} else if (type.equalsIgnoreCase("map")) {
- map.put(name, parseMap(prop));
- } else if (type.equalsIgnoreCase("list")) {
- map.put(name, parseList(prop));
+ map.put(name, parseMap(prop));
+ } else if (type.equalsIgnoreCase("list")) {
+ map.put(name, parseList(prop));
} else if (type.equalsIgnoreCase("array")) {
- List list = parseList(prop);
- boolean isString = true;
- for (int i = 0; isString && i < list.size(); i++) {
- isString = list.get(i) instanceof String;
- }
- Object[] obj = null;
- if (isString) {
- obj = new String[list.size()];
- } else {
- obj = new Object[list.size()];
- }
- map.put(name, list.toArray(obj)); // Transform the list to array
+ List list = parseList(prop);
+ boolean isString = true;
+ for (int i = 0; isString && i < list.size(); i++) {
+ isString = list.get(i) instanceof String;
+ }
+ Object[] obj = null;
+ if (isString) {
+ obj = new String[list.size()];
+ } else {
+ obj = new Object[list.size()];
+ }
+ map.put(name, list.toArray(obj)); // Transform the list to array
}
} else {
map.put(prop.getAttribute("name"), prop.getAttribute("value"));
}
}
+ /**
+ * Parse an anonymous property. An anonymous property is a property with no name.
+ * An anonymous property can be simple (just a value) or complex (i.e. a map, a dictionary
+ * a list or an array).
+ * @param prop the property to parse
+ * @param list the list to populate with the resulting property
+ * @throws ParseException occurs when an internal property cannot be parse correctly
+ */
private void parseAnonymousProperty(Element prop, List list) throws ParseException {
// Check that the property has a name
String name = prop.getAttribute("name");
@@ -270,30 +300,34 @@
list.add(new HashMap(0));
}
} else if (type.equalsIgnoreCase("list")) {
- Element[] subProps = prop.getElements("property");
- if (subProps != null) {
- List list2 = new ArrayList(subProps.length); // Create a list to store elements.
- for (int i = 0; i < subProps.length; i++) {
- parseAnonymousProperty(subProps[i], list2); // Anonymous properties.
- }
- list.add(list2);
- } else {
- // If no sub-properties, inject an empty list.
- list.add(new ArrayList(0));
+ Element[] subProps = prop.getElements("property");
+ if (subProps != null) {
+ // Create a list to store elements.
+ List list2 = new ArrayList(subProps.length);
+ for (int i = 0; i < subProps.length; i++) {
+ parseAnonymousProperty(subProps[i], list2); // Anonymous properties
}
- } else if (type.equalsIgnoreCase("array")) {
- // Check sub-props.
- Element[] subProps = prop.getElements("property");
- if (subProps != null) {
- List list2 = new ArrayList(subProps.length); // Use list as pivot type
- for (int i = 0; i < subProps.length; i++) {
- parseAnonymousProperty(subProps[i], list2);
- }
- list.add(list.toArray(new Object[list.size()])); // Transform the list to array
- } else {
- list.add(new Element[0]); // Insert an empty Element array.
- }
+ list.add(list2);
+ } else {
+ // If no sub-properties, inject an empty list.
+ list.add(new ArrayList(0));
}
+ } else if (type.equalsIgnoreCase("array")) {
+ // Check sub-props.
+ Element[] subProps = prop.getElements("property");
+ if (subProps != null) {
+ List list2 = new ArrayList(subProps.length); // Use list as
+ // pivot type
+ for (int i = 0; i < subProps.length; i++) {
+ parseAnonymousProperty(subProps[i], list2);
+ }
+ list.add(list.toArray(new Object[list.size()])); // Transform
+ // the list
+ // to array
+ } else {
+ list.add(new Element[0]); // Insert an empty Element array.
+ }
+ }
} else {
list.add(prop.getAttribute("value"));
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java
index 2405edc..4cba781 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java
@@ -41,8 +41,8 @@
}
// Remove { and } or [ and ]
- if ((str.charAt(0) == '{' && str.charAt(str.length() - 1) == '}') ||
- (str.charAt(0) == '[' && str.charAt(str.length() - 1) == ']') ) {
+ if ((str.charAt(0) == '{' && str.charAt(str.length() - 1) == '}')
+ || (str.charAt(0) == '[' && str.charAt(str.length() - 1) == ']')) {
String internal = (str.substring(1, str.length() - 1)).trim();
// Check empty array
if (internal.length() == 0) {
diff --git a/ipojo/event.admin.handler/pom.xml b/ipojo/event.admin.handler/pom.xml
deleted file mode 100644
index a17eb5e..0000000
--- a/ipojo/event.admin.handler/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <packaging>bundle</packaging>
- <name>Apache Felix iPOJO Event Admin Handler</name>
- <artifactId>org.apache.felix.ipojo.handler.event</artifactId>
- <groupId>org.apache.felix</groupId>
- <version>0.9.0-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>0.9.0-SNAPSHOT</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>
- <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-ipojo-plugin</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>ipojo-bundle</goal>
- </goals>
- <configuration>
- <metadata>metadata.xml</metadata>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
index e38ed2c..175a286 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
@@ -313,7 +313,7 @@
* @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String arg0, Object arg1) {
- if (arg0.equals("factory")) {
+ if (arg0.equals("public_factory")) {
m_factory = arg1.toString();
return;
}
@@ -349,10 +349,10 @@
m_name = m_className.replace('/', '.');
}
m_elem.addAttribute(new Attribute("name", m_name));
- if (m_factory == null) {
- m_elem.addAttribute(new Attribute("factory", "false"));
+ if (m_factory != null && m_factory.equalsIgnoreCase("false")) {
+ m_elem.addAttribute(new Attribute("public", "false"));
} else {
- m_elem.addAttribute(new Attribute("factory", m_factory));
+ m_elem.addAttribute(new Attribute("public", "true"));
}
if (m_architecture != null) {
m_elem.addAttribute(new Attribute("architecture", m_architecture));
diff --git a/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java b/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
index 6df96d1..328e093 100644
--- a/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
+++ b/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
@@ -31,41 +31,40 @@
import org.osgi.framework.ServiceReference;
/**
-* Temporal dependency.
-* A temporal dependency waits (block) for the availability of the service.
-* If no provider arrives in the specified among of time, a runtime exception is thrown.
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class TemporalDependency extends DependencyModel implements FieldInterceptor {
-
+ * Temporal dependency. A temporal dependency waits (block) for the availability
+ * of the service. If no provider arrives in the specified among of time, a
+ * runtime exception is thrown.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TemporalDependency extends DependencyModel implements
+ FieldInterceptor {
+
/**
* Timeout.
*/
private long m_timeout;
-
+
/**
- * Default-Implementation
+ * Default-Implementation.
*/
private String m_di;
-
+
/**
- * Nullable object / Default-Implementation instance if used
+ * Nullable object / Default-Implementation instance if used.
*/
private Object m_nullableObject;
-
+
/**
* Handler managing this dependency.
*/
private PrimitiveHandler m_handler;
-
+
/**
- * Timetout policy.
- * Null inject null
- * Nullable injects a nullable object or an array with a nullable object
- * Default-Implementation inject an object created from the specified injected
- * implementation or an array with it
- * Empty array inject an empty array (must be an aggregate dependency)
- * No policy (0) throw a runtime exception when the timeout occurs *
+ * Timetout policy. Null inject null Nullable injects a nullable object or
+ * an array with a nullable object Default-Implementation inject an object
+ * created from the specified injected implementation or an array with it
+ * Empty array inject an empty array (must be an aggregate dependency) No
+ * policy (0) throw a runtime exception when the timeout occurs *
*/
private int m_policy;
@@ -77,9 +76,14 @@
* @param context : service context
* @param timeout : timeout
* @param handler : Handler managing this dependency
+ * @param defaultImpl : class used as default-implementation
+ * @param policy : onTimeout policy
*/
- public TemporalDependency(Class spec, boolean agg, Filter filter, BundleContext context, long timeout, int policy, String defaultImpl, TemporalHandler handler) {
- super(spec, agg, true, filter, null, DependencyModel.DYNAMIC_BINDING_POLICY, context, handler);
+ public TemporalDependency(Class spec, boolean agg, Filter filter,
+ BundleContext context, long timeout, int policy,
+ String defaultImpl, TemporalHandler handler) {
+ super(spec, agg, true, filter, null,
+ DependencyModel.DYNAMIC_BINDING_POLICY, context, handler);
m_di = defaultImpl;
m_policy = policy;
m_timeout = timeout;
@@ -90,10 +94,13 @@
* The dependency has been reconfigured.
* @param arg0 : new service references
* @param arg1 : old service references
- * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[])
+ * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[],
+ * org.osgi.framework.ServiceReference[])
*/
- public void onDependencyReconfiguration(ServiceReference[] arg0, ServiceReference[] arg1) {
- throw new UnsupportedOperationException("Reconfiguration not yet supported");
+ public void onDependencyReconfiguration(ServiceReference[] arg0,
+ ServiceReference[] arg1) {
+ throw new UnsupportedOperationException(
+ "Reconfiguration not yet supported");
}
/**
@@ -109,30 +116,32 @@
}
/**
- * A provider leaves.
- * Nothing to do.
+ * A provider leaves. Nothing to do.
* @param arg0 : leaving service references.
* @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)
*/
- public synchronized void onServiceDeparture(ServiceReference arg0) { }
-
+ public synchronized void onServiceDeparture(ServiceReference arg0) {
+ }
+
/**
- * The code require a value of the monitored field.
- * If providers are available, the method return service object(s) immediately.
- * Else, the thread is blocked until an arrival. If no provider arrives during
- * the among of time specified, the method throws a Runtime Exception.
- * @param arg0 : POJO instance asking for the service
+ * The code require a value of the monitored field. If providers are
+ * available, the method return service object(s) immediately. Else, the
+ * thread is blocked until an arrival. If no provider arrives during the
+ * among of time specified, the method throws a Runtime Exception.
+ * @param arg0 : POJO instance asking for the service
* @param arg1 : field name
* @param arg2 : previous value
* @return the object to inject.
- * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
+ * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object,
+ * java.lang.String, java.lang.Object)
*/
public synchronized Object onGet(Object arg0, String arg1, Object arg2) {
ServiceReference[] refs = getServiceReferences();
if (refs != null) {
// Immediate return.
if (isAggregate()) {
- Object[] svc = (Object[]) Array.newInstance(getSpecification(), refs.length);
+ Object[] svc = (Object[]) Array.newInstance(getSpecification(),
+ refs.length);
for (int i = 0; i < svc.length; i++) {
svc[i] = getService(refs[i]);
}
@@ -146,24 +155,25 @@
boolean exhausted = false;
ServiceReference ref = null;
synchronized (this) {
- while (getServiceReference() == null && ! exhausted) {
+ while (getServiceReference() == null && !exhausted) {
try {
wait(1);
} catch (InterruptedException e) {
// We was interrupted ....
} finally {
- long end = System.currentTimeMillis();
+ long end = System.currentTimeMillis();
exhausted = (end - enter) > m_timeout;
}
}
}
- // Check
+ // Check
if (exhausted) {
- return onTimeout();
+ return onTimeout();
} else {
ref = getServiceReference();
if (isAggregate()) {
- Object[] svc = (Object[]) Array.newInstance(getSpecification(), 1);
+ Object[] svc = (Object[]) Array.newInstance(
+ getSpecification(), 1);
svc[0] = getService(ref);
return svc;
} else {
@@ -172,10 +182,15 @@
}
}
}
-
+
+ /**
+ * Start method.
+ * Initializes the nullable object.
+ * @see org.apache.felix.ipojo.util.DependencyModel#start()
+ */
public void start() {
- super.start();
- switch(m_policy) {
+ super.start();
+ switch (m_policy) {
case TemporalHandler.NULL:
m_nullableObject = null;
break;
@@ -189,12 +204,14 @@
new Class[] { getSpecification(), Nullable.class },
new NullableObject()); // NOPMD
if (isAggregate()) {
- Object[] array = (Object[]) Array.newInstance(getSpecification(), 1);
+ Object[] array = (Object[]) Array.newInstance(
+ getSpecification(), 1);
array[0] = m_nullableObject;
- m_nullableObject = array;
+ m_nullableObject = array;
}
} catch (NoClassDefFoundError e) {
- // A NoClassDefFoundError is thrown if the specification uses a
+ // A NoClassDefFoundError is thrown if the specification
+ // uses a
// class not accessible by the actual instance.
// It generally comes from a missing import.
throw new IllegalStateException(
@@ -204,7 +221,7 @@
break;
case TemporalHandler.DEFAULT_IMPLEMENTATION:
- // Create the default-implementation object.
+ // Create the default-implementation object.
try {
Class clazz = m_handler.getInstanceManager().getContext()
.getBundle().loadClass(m_di);
@@ -223,7 +240,8 @@
+ " : " + e.getMessage());
}
if (isAggregate()) {
- Object[] array = (Object[]) Array.newInstance(getSpecification(), 1);
+ Object[] array = (Object[]) Array.newInstance(
+ getSpecification(), 1);
array[0] = m_nullableObject;
m_nullableObject = array;
}
@@ -231,37 +249,48 @@
case TemporalHandler.EMPTY_ARRAY:
m_nullableObject = Array.newInstance(getSpecification(), 0);
break;
+ default: // Cannot occurs
+ break;
}
- }
-
- public void stop() {
- super.stop();
- m_nullableObject = null;
}
/**
- * The monitored field receives a value.
- * Nothing to do.
+ * Stop method.
+ * Just release the reference on the nullable object.
+ * @see org.apache.felix.ipojo.util.DependencyModel#stop()
+ */
+ public void stop() {
+ super.stop();
+ m_nullableObject = null;
+ }
+
+ /**
+ * The monitored field receives a value. Nothing to do.
* @param arg0 : POJO setting the value.
* @param arg1 : field name
* @param arg2 : received value
- * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object, java.lang.String, java.lang.Object)
+ * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object,
+ * java.lang.String, java.lang.Object)
*/
- public void onSet(Object arg0, String arg1, Object arg2) { }
-
+ public void onSet(Object arg0, String arg1, Object arg2) {
+ }
+
/**
- * Implements the timeout policy according to the specified configuration
+ * Implements the timeout policy according to the specified configuration.
+ * @return the object to return when the timeout occurs.
*/
private Object onTimeout() {
- switch(m_policy) {
+ switch (m_policy) {
case TemporalHandler.NULL:
case TemporalHandler.NULLABLE:
case TemporalHandler.DEFAULT_IMPLEMENTATION:
case TemporalHandler.EMPTY_ARRAY:
return m_nullableObject;
- default:
+ default:
// Throws a runtime exception
- throw new RuntimeException("Service " + getSpecification().getName() + " unavailable : timeout");
+ throw new RuntimeException("Service "
+ + getSpecification().getName()
+ + " unavailable : timeout");
}
}
diff --git a/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java b/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
index 4783c77..0be2dbb 100644
--- a/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
+++ b/ipojo/temporal.dependency.handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
@@ -45,10 +45,25 @@
*/
public static final int DEFAULT_TIMEOUT = 3000;
+ /**
+ * No policy.
+ */
public static final int NO_POLICY = 0;
+ /**
+ * Use a nullable object.
+ */
public static final int NULLABLE = 1;
+ /**
+ * Use a default-implementation object.
+ */
public static final int DEFAULT_IMPLEMENTATION = 2;
+ /**
+ * Use an empty array.
+ */
public static final int EMPTY_ARRAY = 3;
+ /**
+ * Use null.
+ */
public static final int NULL = 4;
/**
@@ -118,11 +133,6 @@
}
boolean agg = false;
- String aggregate = meta.getAttribute("aggregate");
- if (aggregate != null) {
- agg = aggregate.equalsIgnoreCase("true");
- }
-
String spec = fieldmeta.getFieldType();
if (spec.endsWith("[]")) {
agg = true;
diff --git a/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml b/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml
index dc1c764..4e383dc 100644
--- a/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml
@@ -42,7 +42,7 @@
</composite>
<!-- Instance of a specified component -->
- <composite name="composite.inst.1" factory="true" architecture="true">
+ <composite name="composite.inst.1" architecture="true">
<instance component="COMPO-FooProviderType-1" /> <!-- name="FooProv" -->
<instance component="COMPO-FooProviderType-Dyn2">
<property name="boolean" value="true"/>
diff --git a/ipojo/tests/tests.composite/src/main/resources/metadata.xml b/ipojo/tests/tests.composite/src/main/resources/metadata.xml
index 49b8637..eecf974 100644
--- a/ipojo/tests/tests.composite/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.composite/src/main/resources/metadata.xml
@@ -2,7 +2,7 @@
<!-- Used component type -->
<component
className="org.apache.felix.ipojo.test.composite.component.FooProviderType1"
- factory="COMPO-FooProviderType-1" architecture="true">
+ name="COMPO-FooProviderType-1" architecture="true">
<provides />
</component>
<component
@@ -31,7 +31,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.composite.component.FooProviderTypeDyn2"
- name="COMPO-FooProviderType-Dyn2" factory="true" architecture="true">
+ name="COMPO-FooProviderType-Dyn2" architecture="true">
<provides>
<property name="int" field="intProp" value="4" />
<property name="boolean" field="boolProp" />
@@ -43,24 +43,24 @@
</component>
<component
className="org.apache.felix.ipojo.test.composite.component.CheckServiceProvider"
- factory="COMPO-SimpleCheckServiceProvider" architecture="true">
+ name="COMPO-SimpleCheckServiceProvider" architecture="true">
<requires field="fs" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.composite.component.FooBarProviderType1"
- factory="COMPO-FooBarProviderType-1" architecture="true">
+ name="COMPO-FooBarProviderType-1" architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.composite.component.FooBarProviderType1"
- factory="COMPO-FooBarProviderType-2" architecture="true">
+ name="COMPO-FooBarProviderType-2" architecture="true">
<provides
interface="{org.apache.felix.ipojo.test.composite.service.FooService, org.apache.felix.ipojo.test.composite.service.BarService }" />
</component>
<component
className="org.apache.felix.ipojo.test.composite.component.FooBarProviderType1"
- factory="COMPO-FooBarProviderType-3" architecture="true">
+ name="COMPO-FooBarProviderType-3" architecture="true">
<provides
interface="{org.apache.felix.ipojo.test.composite.service.FooService}">
<property name="baz" type="java.lang.String" value="foo" />
@@ -73,33 +73,33 @@
<component
className="org.apache.felix.ipojo.test.composite.component.BazProviderType1"
- factory="BazProviderType" scope="composite">
+ name="BazProviderType" scope="composite">
<provides />
</component>
<component
classname="org.apache.felix.ipojo.test.composite.component.TataProvider"
- factory="tata">
+ name="tata">
<provides />
</component>
<component
classname="org.apache.felix.ipojo.test.composite.component.TotoProvider"
- factory="toto" architecture="true">
+ name="toto" architecture="true">
<provides />
</component>
<component
classname="org.apache.felix.ipojo.test.composite.component.TotoProviderGlue"
- factory="totoglue">
+ name="totoglue">
<requires field="m_toto" scope="composite" />
</component>
<!-- Composite -->
- <composite name="composite.empty" factory="true" architecture="true">
+ <composite name="composite.empty" architecture="true">
</composite>
- <component className="org.apache.felix.ipojo.test.composite.component.Baz2CheckProvider" factory="Baz2CheckProvider" architecture="true">
+ <component className="org.apache.felix.ipojo.test.composite.component.Baz2CheckProvider" name="Baz2CheckProvider" architecture="true">
<requires field="fs" scope="composite"/>
<provides/>
</component>
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
index a6098ef..0283992 100644
--- a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
@@ -8,7 +8,7 @@
public void testArch() {
Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Factory");
- String fact = meta.getAttribute("factory");
+ String fact = meta.getAttribute("public");
String name = meta.getAttribute("name");
assertNotNull("Factory exists ", fact);
assertEquals("Factory value", "true", fact);
@@ -18,7 +18,7 @@
public void testNoArch() {
Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoFactory");
- String fact = meta.getAttribute("factory");
+ String fact = meta.getAttribute("public");
String name = meta.getAttribute("name");
assertNotNull("Factory exists ", fact);
assertEquals("Factory value", "false", fact);
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
index a0b6cda..bafde54 100644
--- a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
@@ -2,6 +2,6 @@
import org.apache.felix.ipojo.annotations.Component;
-@Component(name="factory", factory=true)
+@Component(name="factory", public_factory=true)
public class Factory {
}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java
index 9226a19..d8e15b2 100644
--- a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java
@@ -2,6 +2,6 @@
import org.apache.felix.ipojo.annotations.Component;
-@Component(name="nofactory", factory=false)
+@Component(name="nofactory", public_factory=false)
public class NoFactory {
}
diff --git a/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java b/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
index 2a3cfa4..3421eee 100644
--- a/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
+++ b/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
@@ -19,11 +19,14 @@
package org.apache.felix.ipojo.test.scenarios.bad;
import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.Factory;
import org.apache.felix.ipojo.HandlerManagerFactory;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class BadFactories extends OSGiTestCase {
@@ -38,7 +41,7 @@
elem.addAttribute(new Attribute("name", "noclassname"));
return elem;
}
-
+
private Element getElementHandlerFactoryWithNoName() {
Element elem = new Element("handler", "");
elem.addAttribute(new Attribute("className", "noclassname"));
@@ -72,6 +75,54 @@
}
}
+ public void testCreationOnBadConstructor() {
+ Factory factory = Utils.getFactoryByName(context, "BAD-BadConstructor");
+ ComponentInstance ci;
+ try {
+ ci = factory.createComponentInstance(null);
+ assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+ ci.dispose();
+ } catch (Throwable e) {
+ fail("Exception unexpected : " + e.getMessage());
+ }
+ }
+
+ public void testCreationOnBadFactory() {
+ Factory factory = Utils.getFactoryByName(context, "BAD-BadFactory");
+ ComponentInstance ci;
+ try {
+ ci = factory.createComponentInstance(null);
+ assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+ ci.dispose();
+ } catch (Throwable e) {
+ fail("Exception unexpected : " + e.getMessage());
+ }
+ }
+
+ public void testCreationOnBadFactory2() {
+ Factory factory = Utils.getFactoryByName(context, "BAD-BadFactory2");
+ ComponentInstance ci;
+ try {
+ ci = factory.createComponentInstance(null);
+ assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+ ci.dispose();
+ } catch (Throwable e) {
+ fail("Exception unexpected : " + e.getMessage());
+ }
+ }
+
+ public void testNoManipulationMetadata() {
+ Element elem = new Element("component", "");
+ elem.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"));
+ try {
+ ComponentFactory fact = new ComponentFactory(context, elem);
+ fact.stop();
+ fail("A factory with no manipulation metadata must be rejected");
+ } catch (ConfigurationException e) {
+ // OK.
+ }
+ }
+
}
diff --git a/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/BadConstructors.java b/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/BadConstructors.java
new file mode 100644
index 0000000..74c6159
--- /dev/null
+++ b/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/BadConstructors.java
@@ -0,0 +1,21 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class BadConstructors {
+
+ public BadConstructors() {
+ throw new Error("BAD");
+ }
+
+ public BadConstructors(int i) {
+ // DO NOTHING
+ }
+
+ public static BadConstructors createBad() {
+ throw new RuntimeException("BAD");
+ }
+
+ public static BadConstructors createBad2(int o) {
+ return new BadConstructors(o);
+ }
+
+}
diff --git a/ipojo/tests/tests.core.bad.configurations/src/main/resources/metadata.xml b/ipojo/tests/tests.core.bad.configurations/src/main/resources/metadata.xml
index 8222765..939215b 100644
--- a/ipojo/tests/tests.core.bad.configurations/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.bad.configurations/src/main/resources/metadata.xml
@@ -1,7 +1,7 @@
<ipojo>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- factory="BAD-CallbackCheckService" architecture="true">
+ name="BAD-CallbackCheckService" architecture="true">
<requires field="fs" />
<provides />
<callback transition="validate" method="start" />
@@ -20,7 +20,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="BAD-BothCheckServiceProvider" architecture="true">
+ name="BAD-BothCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -28,4 +28,24 @@
<provides />
</component>
+ <!-- Bad constructors -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.BadConstructors"
+ name="BAD-BadConstructor"
+ immediate="true"
+ />
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.BadConstructors"
+ factory-method="createBad"
+ name="BAD-BadFactory"
+ immediate="true"
+ />
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.BadConstructors"
+ factory-method="createBad2"
+ name="BAD-BadFactory2"
+ immediate="true"
+ />
</ipojo>
diff --git a/ipojo/tests/tests.core.configuration/src/main/resources/metadata.xml b/ipojo/tests/tests.core.configuration/src/main/resources/metadata.xml
index f7f012c..8447c8c 100644
--- a/ipojo/tests/tests.core.configuration/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.configuration/src/main/resources/metadata.xml
@@ -1,7 +1,7 @@
<ipojo>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn"
- factory="CONFIG-FooProviderType-Conf" architecture="true">
+ name="CONFIG-FooProviderType-Conf" architecture="true">
<provides />
<properties propagation="false">
<property name="int" field="intProp" value="2" />
@@ -14,7 +14,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="CONFIG-FooProviderType-3" architecture="true">
+ name="CONFIG-FooProviderType-3" architecture="true">
<provides>
<property name="foo" field="m_foo" />
<property name="bar" field="m_bar" />
@@ -26,7 +26,7 @@
</properties>
</component>
<!-- Configuration Management Test -->
- <component factory="CONFIG-FieldConfigurableCheckService"
+ <component name="CONFIG-FieldConfigurableCheckService"
className="org.apache.felix.ipojo.test.scenarios.component.ConfigurableCheckServiceProvider"
architecture="true">
<provides />
@@ -52,7 +52,7 @@
</properties>
</component>
- <component factory="CONFIG-BothConfigurableCheckService"
+ <component name="CONFIG-BothConfigurableCheckService"
className="org.apache.felix.ipojo.test.scenarios.component.ConfigurableCheckServiceProvider"
architecture="true">
<provides />
@@ -78,7 +78,7 @@
</properties>
</component>
- <component factory="CONFIG-MethodConfigurableCheckService"
+ <component name="CONFIG-MethodConfigurableCheckService"
className="org.apache.felix.ipojo.test.scenarios.component.ConfigurableCheckServiceProvider"
architecture="true">
<provides />
@@ -104,7 +104,7 @@
</properties>
</component>
- <component factory="CONFIG-ParentMethodConfigurableCheckService"
+ <component name="CONFIG-ParentMethodConfigurableCheckService"
className="org.apache.felix.ipojo.test.scenarios.component.ParentConfigurableCheckServiceProvider"
architecture="true">
<provides />
@@ -133,7 +133,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="CONFIG-FooProviderType-4" architecture="true">
+ name="CONFIG-FooProviderType-4" architecture="true">
<provides>
<property name="foo" field="m_foo" />
<property name="bar" field="m_bar" />
@@ -221,7 +221,5 @@
<property name="empty-list" type="list"/>
<property name="empty-map" type="map"/>
</instance>
-
-
</ipojo>
diff --git a/ipojo/tests/tests.core.external.handlers/src/main/resources/metadata.xml b/ipojo/tests/tests.core.external.handlers/src/main/resources/metadata.xml
index 576125f..9491a34 100644
--- a/ipojo/tests/tests.core.external.handlers/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.external.handlers/src/main/resources/metadata.xml
@@ -9,7 +9,7 @@
</handler>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="HANDLER-HandlerTester" architecture="true">
+ name="HANDLER-HandlerTester" architecture="true">
<cs:check />
</component>
<instance name="HandlerTest-2" component="HANDLER-HandlerTester">
diff --git a/ipojo/tests/tests.core.factories/src/main/resources/metadata.xml b/ipojo/tests/tests.core.factories/src/main/resources/metadata.xml
index 2d10ac8..c6abfe7 100644
--- a/ipojo/tests/tests.core.factories/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.factories/src/main/resources/metadata.xml
@@ -2,14 +2,14 @@
<!-- Simple provider -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Factories-FooProviderType-1" architecture="true">
+ name="Factories-FooProviderType-1" architecture="true">
<provides />
</component>
<!-- Provider providing 2 services -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
- factory="Factories-FooBarProviderType-1" architecture="true">
+ name="Factories-FooBarProviderType-1" architecture="true">
<provides />
</component>
@@ -42,7 +42,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn2"
- name="Factories-FooProviderType-Dyn2" factory="true" architecture="true">
+ name="Factories-FooProviderType-Dyn2" architecture="true">
<provides>
<property name="int" field="intProp" value="4" />
<property name="boolean" field="boolProp" />
@@ -55,7 +55,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Factories-FooProviderType-3" architecture="true">
+ name="Factories-FooProviderType-3" architecture="true">
<provides>
<property name="foo" field="m_foo" />
<property name="bar" field="m_bar" />
diff --git a/ipojo/tests/tests.core.lifecycle.callback/src/main/resources/metadata.xml b/ipojo/tests/tests.core.lifecycle.callback/src/main/resources/metadata.xml
index c60c239..cddab70 100644
--- a/ipojo/tests/tests.core.lifecycle.callback/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.lifecycle.callback/src/main/resources/metadata.xml
@@ -1,14 +1,14 @@
<ipojo>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="LFCB-FooProviderType-1" architecture="true">
+ name="LFCB-FooProviderType-1" architecture="true">
<provides />
</component>
<!-- Lifecycle Callback -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- factory="LFCB-CallbackCheckService" architecture="true">
+ name="LFCB-CallbackCheckService" architecture="true">
<requires field="fs" />
<provides />
<callback transition="validate" method="start" />
@@ -16,7 +16,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- factory="LFCB-ParentCallbackCheckService" architecture="true">
+ name="LFCB-ParentCallbackCheckService" architecture="true">
<requires field="fs" />
<provides />
<callback transition="validate" method="parentStart" />
@@ -24,7 +24,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- immediate="true" factory="LFCB-ImmediateCallbackCheckService"
+ immediate="true" name="LFCB-ImmediateCallbackCheckService"
architecture="true">
<requires field="fs" />
<provides />
@@ -33,7 +33,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- immediate="true" factory="LFCB-ImmediateCallbackCheckServiceSingleton"
+ immediate="true" name="LFCB-ImmediateCallbackCheckServiceSingleton"
factory-method="singleton" architecture="true">
<requires field="fs" />
<provides />
@@ -42,7 +42,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"
- immediate="true" factory="LFCB-ImmediateCallbackCheckServiceSeveral"
+ immediate="true" name="LFCB-ImmediateCallbackCheckServiceSeveral"
factory-method="several" architecture="true">
<requires field="fs" />
<provides />
diff --git a/ipojo/tests/tests.core.manipulation/src/main/resources/metadata.xml b/ipojo/tests/tests.core.manipulation/src/main/resources/metadata.xml
index 6d73ce8..f0a3063 100644
--- a/ipojo/tests/tests.core.manipulation/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.manipulation/src/main/resources/metadata.xml
@@ -2,14 +2,14 @@
<!-- Simple provider used for manipulation analysis -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-FooProviderType-1" architecture="true">
+ name="Manipulation-FooProviderType-1" architecture="true">
<provides />
</component>
<!-- Non lazzy service provider, to check instantiation -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-ImmediateFooProviderType" immediate="true"
+ name="Manipulation-ImmediateFooProviderType" immediate="true"
architecture="true">
<provides />
</component>
@@ -17,7 +17,7 @@
<!-- Provider providing 2 services -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
- factory="Manipulation-FooBarProviderType-1" architecture="true">
+ name="Manipulation-FooBarProviderType-1" architecture="true">
<provides />
</component>
@@ -38,20 +38,20 @@
<!-- Manipulation -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.Manipulation23Tester"
- factory="Manipulation-PrimitiveManipulationTester" architecture="true">
+ name="Manipulation-PrimitiveManipulationTester" architecture="true">
<provides />
</component>
<!-- Manipulation with numbers -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.A123.Manipulation23Tester"
- factory="Manipulation-PrimitiveManipulationTesterA" architecture="true">
+ name="Manipulation-PrimitiveManipulationTesterA" architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="Manipulation-SimpleMultipleCheckServiceProvider" architecture="true">
+ name="Manipulation-SimpleMultipleCheckServiceProvider" architecture="true">
<requires field="fs" />
<provides />
</component>
@@ -59,35 +59,35 @@
<!-- Type checking different creation policy -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-FooProviderType-1-Sing" factory-method="singleton"
+ name="Manipulation-FooProviderType-1-Sing" factory-method="singleton"
architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-FooProviderType-1-Sev" factory-method="several"
+ name="Manipulation-FooProviderType-1-Sev" factory-method="several"
architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-FooProviderType-1-SingM" factory-method="singleton"
+ name="Manipulation-FooProviderType-1-SingM" factory-method="singleton"
architecture="true">
- <provides factory="method" />
+ <provides/>
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-FooProviderType-1-SevM" factory-method="several"
+ name="Manipulation-FooProviderType-1-SevM" factory-method="several"
architecture="true">
- <provides factory="method" />
+ <provides/>
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="Manipulation-ImmediateFooProviderTypeSingleton" immediate="true"
+ name="Manipulation-ImmediateFooProviderTypeSingleton" immediate="true"
factory-method="singleton" architecture="true">
<provides />
</component>
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml
index 5599af5..1a116b1 100644
--- a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml
@@ -3,13 +3,13 @@
<!-- Static Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticSimpleCheckServiceProvider" architecture="true">
+ name="StaticSimpleCheckServiceProvider" architecture="true">
<requires field="fs" policy="static" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticVoidCheckServiceProvider" architecture="true">
+ name="StaticVoidCheckServiceProvider" architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="voidBind" />
<callback type="unbind" method="voidUnbind" />
@@ -18,7 +18,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticObjectCheckServiceProvider" architecture="true">
+ name="StaticObjectCheckServiceProvider" architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -27,7 +27,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticRefCheckServiceProvider" architecture="true">
+ name="StaticRefCheckServiceProvider" architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -36,7 +36,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticBothCheckServiceProvider" architecture="true">
+ name="StaticBothCheckServiceProvider" architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -45,7 +45,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMObjectCheckServiceProvider" architecture="true">
+ name="StaticMObjectCheckServiceProvider" architecture="true">
<requires policy="static">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -54,7 +54,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMRefCheckServiceProvider" architecture="true">
+ name="StaticMRefCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
policy="static">
@@ -65,7 +65,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMBothCheckServiceProvider" architecture="true">
+ name="StaticMBothCheckServiceProvider" architecture="true">
<requires policy="static">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -76,14 +76,14 @@
<!-- Static Simple & Optional Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticSimpleOptionalCheckServiceProvider"
+ name="StaticSimpleOptionalCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true" policy="static" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticVoidOptionalCheckServiceProvider"
+ name="StaticVoidOptionalCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true" policy="static">
<callback type="bind" method="voidBind" />
@@ -93,7 +93,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticObjectOptionalCheckServiceProvider"
+ name="StaticObjectOptionalCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true" policy="static">
<callback type="bind" method="objectBind" />
@@ -103,7 +103,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticRefOptionalCheckServiceProvider" architecture="true">
+ name="StaticRefOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" policy="static">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -112,7 +112,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
- factory="StaticBothOptionalCheckServiceProvider"
+ name="StaticBothOptionalCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true" policy="static">
<callback type="bind" method="bothBind" />
@@ -122,7 +122,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMObjectOptionalCheckServiceProvider"
+ name="StaticMObjectOptionalCheckServiceProvider"
architecture="true">
<requires optional="true" policy="static">
<callback type="bind" method="objectBind" />
@@ -132,7 +132,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMRefOptionalCheckServiceProvider"
+ name="StaticMRefOptionalCheckServiceProvider"
architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
@@ -144,7 +144,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
- factory="StaticMBothOptionalCheckServiceProvider"
+ name="StaticMBothOptionalCheckServiceProvider"
architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
@@ -157,14 +157,14 @@
<!-- Static Multiple Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
- factory="StaticSimpleMultipleCheckServiceProvider"
+ name="StaticSimpleMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" policy="static" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
- factory="StaticVoidMultipleCheckServiceProvider"
+ name="StaticVoidMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="voidBind" />
@@ -174,7 +174,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
- factory="StaticObjectMultipleCheckServiceProvider"
+ name="StaticObjectMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="objectBind" />
@@ -184,7 +184,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
- factory="StaticRefMultipleCheckServiceProvider" architecture="true">
+ name="StaticRefMultipleCheckServiceProvider" architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -193,7 +193,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
- factory="StaticBothMultipleCheckServiceProvider"
+ name="StaticBothMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" policy="static">
<callback type="bind" method="bothBind" />
@@ -203,7 +203,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
- factory="StaticMObjectMultipleCheckServiceProvider"
+ name="StaticMObjectMultipleCheckServiceProvider"
architecture="true">
<requires aggregate="true" policy="static">
<callback type="bind" method="objectBind" />
@@ -213,7 +213,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
- factory="StaticMRefMultipleCheckServiceProvider"
+ name="StaticMRefMultipleCheckServiceProvider"
architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
@@ -225,7 +225,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
- factory="StaticMBothMultipleCheckServiceProvider"
+ name="StaticMBothMultipleCheckServiceProvider"
architecture="true">
<requires aggregate="true" policy="static">
<callback type="bind" method="bothBind" />
@@ -237,20 +237,20 @@
<!-- Dynamic-Priority -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority.RankedFooProviderType1"
- factory="RankedFooProviderType" architecture="true">
+ name="RankedFooProviderType" architecture="true">
<provides>
<property field="m_grade" name="service.ranking"/>
</provides>
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.DynCheckServiceProvider"
- factory="DPSimpleCheckServiceProvider" architecture="true">
+ name="DPSimpleCheckServiceProvider" architecture="true">
<requires field="fs" policy="dynamic-priority" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.DynCheckServiceProvider"
- factory="DPObjectCheckServiceProvider" architecture="true">
+ name="DPObjectCheckServiceProvider" architecture="true">
<requires field="fs" policy="dynamic-priority">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
diff --git a/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml
index f1a8254..5f96bdc 100644
--- a/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml
@@ -2,7 +2,7 @@
<!-- Simple Filter Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckProvider"
- factory="SimpleFilterCheckServiceProvider" architecture="true">
+ name="SimpleFilterCheckServiceProvider" architecture="true">
<provides>
<property field="m_toto" name="toto" value="A" />
</provides>
@@ -10,7 +10,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
- factory="SimpleFilterCheckServiceSubscriber" architecture="true">
+ name="SimpleFilterCheckServiceSubscriber" architecture="true">
<requires field="m_foo" filter="(toto=B)" id="id1">
<callback type="bind" method="Bind" />
<callback type="unbind" method="Unbind" />
@@ -20,7 +20,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
- factory="SimpleFilterCheckServiceSubscriber2" architecture="true">
+ name="SimpleFilterCheckServiceSubscriber2" architecture="true">
<requires field="m_foo" id="id2">
<callback type="bind" method="Bind" />
<callback type="unbind" method="Unbind" />
@@ -31,7 +31,7 @@
<!-- Optional Simple Filter Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
- factory="OptionalSimpleFilterCheckServiceSubscriber"
+ name="OptionalSimpleFilterCheckServiceSubscriber"
architecture="true">
<requires field="m_foo" filter="(toto=B)" id="id1"
optional="true">
@@ -43,7 +43,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
- factory="OptionalSimpleFilterCheckServiceSubscriber2"
+ name="OptionalSimpleFilterCheckServiceSubscriber2"
architecture="true">
<requires field="m_foo" id="id2" optional="true">
<callback type="bind" method="Bind" />
@@ -55,7 +55,7 @@
<!-- Aggregate filter Dependencies-->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
- factory="MultipleFilterCheckServiceSubscriber" architecture="true">
+ name="MultipleFilterCheckServiceSubscriber" architecture="true">
<requires field="m_foo" filter="(toto=B)" id="id1">
<callback type="bind" method="Bind" />
<callback type="unbind" method="Unbind" />
@@ -65,7 +65,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
- factory="MultipleFilterCheckServiceSubscriber2" architecture="true">
+ name="MultipleFilterCheckServiceSubscriber2" architecture="true">
<requires field="m_foo" id="id2">
<callback type="bind" method="Bind" />
<callback type="unbind" method="Unbind" />
@@ -76,7 +76,7 @@
<!-- Optional Aggregate Filter Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
- factory="OptionalMultipleFilterCheckServiceSubscriber"
+ name="OptionalMultipleFilterCheckServiceSubscriber"
architecture="true">
<requires field="m_foo" filter="(toto=B)" id="id1"
optional="true">
@@ -88,7 +88,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
- factory="OptionalMultipleFilterCheckServiceSubscriber2"
+ name="OptionalMultipleFilterCheckServiceSubscriber2"
architecture="true">
<requires field="m_foo" id="id2" optional="true">
<callback type="bind" method="Bind" />
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
index 3660654..994afeb 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
@@ -1,20 +1,20 @@
<ipojo>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="FooProviderType-1" architecture="true">
+ name="FooProviderType-1" architecture="true">
<provides />
</component>
<!-- Simple Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="SimpleCheckServiceProvider" architecture="true">
+ name="SimpleCheckServiceProvider" architecture="true">
<requires field="fs" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="VoidCheckServiceProvider" architecture="true">
+ name="VoidCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="voidBind" />
<callback type="unbind" method="voidUnbind" />
@@ -23,7 +23,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="ObjectCheckServiceProvider" architecture="true">
+ name="ObjectCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -32,7 +32,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="RefCheckServiceProvider" architecture="true">
+ name="RefCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -41,7 +41,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="BothCheckServiceProvider" architecture="true">
+ name="BothCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -50,7 +50,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DoubleCheckServiceProvider" architecture="true">
+ name="DoubleCheckServiceProvider" architecture="true">
<requires>
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -61,7 +61,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MObjectCheckServiceProvider" architecture="true">
+ name="MObjectCheckServiceProvider" architecture="true">
<requires>
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -70,7 +70,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MRefCheckServiceProvider" architecture="true">
+ name="MRefCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService">
<callback type="bind" method="refBind" />
@@ -80,7 +80,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MBothCheckServiceProvider" architecture="true">
+ name="MBothCheckServiceProvider" architecture="true">
<requires>
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -91,19 +91,19 @@
<!-- Simple & Optional Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="SimpleOptionalCheckServiceProvider" architecture="true">
+ name="SimpleOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="SimpleOptionalNoNullableCheckServiceProvider" architecture="true">
+ name="SimpleOptionalNoNullableCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" nullable="false" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="VoidOptionalCheckServiceProvider" architecture="true">
+ name="VoidOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="voidBind" />
<callback type="unbind" method="voidUnbind" />
@@ -112,7 +112,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="VoidOptionalNoNullableCheckServiceProvider" architecture="true">
+ name="VoidOptionalNoNullableCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" nullable="false">
<callback type="bind" method="voidBind" />
<callback type="unbind" method="voidUnbind" />
@@ -121,7 +121,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="ObjectOptionalCheckServiceProvider" architecture="true">
+ name="ObjectOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -130,7 +130,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="ObjectOptionalNoNullableCheckServiceProvider" architecture="true">
+ name="ObjectOptionalNoNullableCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" nullable="false">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -139,7 +139,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="RefOptionalCheckServiceProvider" architecture="true">
+ name="RefOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -148,7 +148,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="RefOptionalNoNullableCheckServiceProvider" architecture="true">
+ name="RefOptionalNoNullableCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" nullable="false">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -157,7 +157,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="BothOptionalCheckServiceProvider" architecture="true">
+ name="BothOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -166,7 +166,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="BothOptionalNoNullableCheckServiceProvider" architecture="true">
+ name="BothOptionalNoNullableCheckServiceProvider" architecture="true">
<requires field="fs" optional="true" nullable="false">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -176,7 +176,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MObjectOptionalCheckServiceProvider" architecture="true">
+ name="MObjectOptionalCheckServiceProvider" architecture="true">
<requires optional="true">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -185,7 +185,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MRefOptionalCheckServiceProvider" architecture="true">
+ name="MRefOptionalCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
optional="true">
@@ -196,7 +196,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="MBothOptionalCheckServiceProvider" architecture="true">
+ name="MBothOptionalCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
optional="true">
@@ -209,14 +209,14 @@
<!-- Simple & Optional Dependencies with default-implementation -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DISimpleOptionalCheckServiceProvider" architecture="true">
+ name="DISimpleOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DIVoidOptionalCheckServiceProvider" architecture="true">
+ name="DIVoidOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
<callback type="bind" method="voidBind" />
@@ -226,7 +226,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DIObjectOptionalCheckServiceProvider" architecture="true">
+ name="DIObjectOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
<callback type="bind" method="objectBind" />
@@ -236,7 +236,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DIRefOptionalCheckServiceProvider" architecture="true">
+ name="DIRefOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
<callback type="bind" method="refBind" />
@@ -246,7 +246,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="DIBothOptionalCheckServiceProvider" architecture="true">
+ name="DIBothOptionalCheckServiceProvider" architecture="true">
<requires field="fs" optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
<callback type="bind" method="bothBind" />
@@ -257,7 +257,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="DIMObjectOptionalCheckServiceProvider" architecture="true">
+ name="DIMObjectOptionalCheckServiceProvider" architecture="true">
<requires optional="true"
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
<callback type="bind" method="objectBind" />
@@ -267,7 +267,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="DIMRefOptionalCheckServiceProvider" architecture="true">
+ name="DIMRefOptionalCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
optional="true"
@@ -279,7 +279,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="DIMBothOptionalCheckServiceProvider" architecture="true">
+ name="DIMBothOptionalCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
optional="true"
@@ -293,13 +293,13 @@
<!-- Multiple Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="SimpleMultipleCheckServiceProvider" architecture="true">
+ name="SimpleMultipleCheckServiceProvider" architecture="true">
<requires field="fs" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="VoidMultipleCheckServiceProvider" architecture="true">
+ name="VoidMultipleCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="voidBind" />
<callback type="unbind" method="voidUnbind" />
@@ -308,7 +308,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="ObjectMultipleCheckServiceProvider" architecture="true">
+ name="ObjectMultipleCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -317,7 +317,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="RefMultipleCheckServiceProvider" architecture="true">
+ name="RefMultipleCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="refBind" />
<callback type="unbind" method="refUnbind" />
@@ -326,7 +326,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="BothMultipleCheckServiceProvider" architecture="true">
+ name="BothMultipleCheckServiceProvider" architecture="true">
<requires field="fs">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -335,7 +335,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="MObjectMultipleCheckServiceProvider" architecture="true">
+ name="MObjectMultipleCheckServiceProvider" architecture="true">
<requires aggregate="true">
<callback type="bind" method="objectBind" />
<callback type="unbind" method="objectUnbind" />
@@ -344,7 +344,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="MRefMultipleCheckServiceProvider" architecture="true">
+ name="MRefMultipleCheckServiceProvider" architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
aggregate="true">
@@ -355,7 +355,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="MBothMultipleCheckServiceProvider" architecture="true">
+ name="MBothMultipleCheckServiceProvider" architecture="true">
<requires aggregate="true">
<callback type="bind" method="bothBind" />
<callback type="unbind" method="bothUnbind" />
@@ -366,14 +366,14 @@
<!-- Multiple & Optional Dependencies -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="SimpleOptionalMultipleCheckServiceProvider"
+ name="SimpleOptionalMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true" />
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="VoidOptionalMultipleCheckServiceProvider"
+ name="VoidOptionalMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="voidBind" />
@@ -383,7 +383,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="ObjectOptionalMultipleCheckServiceProvider"
+ name="ObjectOptionalMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="objectBind" />
@@ -393,7 +393,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="RefOptionalMultipleCheckServiceProvider"
+ name="RefOptionalMultipleCheckServiceProvider"
architecture="true">
<requires field="fs" optional="true">
<callback type="bind" method="refBind" />
@@ -403,7 +403,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="MObjectOptionalMultipleCheckServiceProvider"
+ name="MObjectOptionalMultipleCheckServiceProvider"
architecture="true">
<requires aggregate="true" optional="true">
<callback type="bind" method="objectBind" />
@@ -413,7 +413,7 @@
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="MRefOptionalMultipleCheckServiceProvider"
+ name="MRefOptionalMultipleCheckServiceProvider"
architecture="true">
<requires
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
diff --git a/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml
index 3588872..fc2787f 100644
--- a/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml
@@ -2,20 +2,20 @@
<!-- Simple provider -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="PS-FooProviderType-1" architecture="true">
+ name="PS-FooProviderType-1" architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="PS-FooProviderType-itf" architecture="true">
+ name="PS-FooProviderType-itf" architecture="true">
<provides
interface="org.apache.felix.ipojo.test.scenarios.ps.service.FooService" />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
- factory="PS-FooProviderType-3" architecture="true">
+ name="PS-FooProviderType-3" architecture="true">
<provides>
<property name="foo" field="m_foo" />
<property name="bar" field="m_bar" />
@@ -30,18 +30,18 @@
<!-- Providers providing 2 services -->
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
- factory="PS-FooBarProviderType-1" architecture="true">
+ name="PS-FooBarProviderType-1" architecture="true">
<provides />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
- factory="PS-FooBarProviderType-2" architecture="true">
+ name="PS-FooBarProviderType-2" architecture="true">
<provides
interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService, org.apache.felix.ipojo.test.scenarios.ps.service.BarService }" />
</component>
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
- factory="PS-FooBarProviderType-3" architecture="true">
+ name="PS-FooBarProviderType-3" architecture="true">
<provides
interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService}">
<property name="baz" type="java.lang.String" value="foo" />
@@ -82,7 +82,7 @@
<component
className="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn2"
- name="PS-FooProviderType-Dyn2" factory="true" architecture="true">
+ name="PS-FooProviderType-Dyn2" architecture="true">
<provides>
<property name="int" field="intProp" value="4" />
<property name="boolean" field="boolProp" />
diff --git a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleCheckServiceProvider.java b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleCheckServiceProvider.java
index a5b4540..fb96538 100644
--- a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleCheckServiceProvider.java
+++ b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleCheckServiceProvider.java
@@ -32,9 +32,11 @@
public boolean check() {
boolean result = true;
-
- for (int i = 0; fs != null && i < fs.length; i++) {
- result = result && fs[i].foo();
+ //Use a local variable to avoid to wait at each access.
+ FooService[] array = fs;
+ for (int i = 0; array != null && i < array.length; i++) {
+ result = result && array[i].foo();
+ System.out.println("Result : " + result);
}
return result;
}
diff --git a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
index 1971efb..619becb 100644
--- a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
+++ b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
@@ -168,7 +168,7 @@
} catch(RuntimeException e) {
fail("A nullable was expected ...");
}
- assertTrue("Check nullable", res);
+ assertFalse("Check nullable", res);
dp.stop();
provider.stop();
@@ -184,7 +184,7 @@
String prov2 = "provider2";
ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
String un = "under-1";
- ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProvider", un);
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
assertNotNull("Check foo availability", ref_fs);
diff --git a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
index 84c33ad..25e9635 100644
--- a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
+++ b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
@@ -184,7 +184,7 @@
String prov2 = "provider2";
ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
String un = "under-1";
- ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProvider", un);
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
assertNotNull("Check foo availability", ref_fs);
diff --git a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
index 31a2d56..a0b3eeb 100644
--- a/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
+++ b/ipojo/tests/tests.temporal.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
@@ -168,7 +168,7 @@
} catch(RuntimeException e) {
fail("A nullable was expected ...");
}
- assertTrue("Check nullable", res);
+ assertFalse("Check nullable", res);
dp.stop();
provider.stop();
@@ -184,7 +184,7 @@
String prov2 = "provider2";
ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
String un = "under-1";
- ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProvider", un);
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
assertNotNull("Check foo availability", ref_fs);
@@ -214,7 +214,7 @@
provider1.stop();
provider2.stop();
-
+
ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
assertNotNull("Check cs availability - 3", ref_cs);
cs = (CheckService) context.getService(ref_cs);