Add some javadoc comments,
Normalize the code format.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@766355 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java
index 6e0958c..84f52b7 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java
@@ -31,6 +31,6 @@
* @return the Element-Attribute structure containing the handler
* configuration.
*/
- public Element getElement();
+ Element getElement();
}
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
index 93bdb54..e93c222 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
@@ -126,7 +126,7 @@
/**
* List of Handler representing external
- * handler configuration
+ * handler configuration.
*/
private List m_handlers = new ArrayList();
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java
index 8db255e..39f510d 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java
@@ -33,6 +33,10 @@
*/
public class SingletonComponentType extends PrimitiveComponentType {
+ /**
+ * The POJO object to inject through the
+ * instance configuration.
+ */
private Object m_pojo;
/**
@@ -44,10 +48,11 @@
}
/**
- * Set the pojo object used by the instance.
+ * Sets the pojo object used by the instance.
* The object must be compatible with the
* implementation class.
* @param obj the object.
+ * @return the current singleton component type.
*/
public SingletonComponentType setObject(Object obj) {
m_pojo = obj;
@@ -59,6 +64,7 @@
* instance. This method has to be called in place of the
* {@link PrimitiveComponentType#start()} and the
* {@link PrimitiveComponentType#createInstance()} methods.
+ * @return the created component instance.
* @throws ConfigurationException occurs if the type description is
* incorrect
* @throws MissingHandlerException occurs if a handler is not available
@@ -84,6 +90,7 @@
* {@link PrimitiveComponentType#start()} and the
* {@link PrimitiveComponentType#createInstance()} methods.
* @param conf the instance configuration
+ * @return the created component instance
* @throws ConfigurationException occurs if the type description is
* incorrect
* @throws MissingHandlerException occurs if a handler is not available
@@ -105,6 +112,9 @@
* instance. This method has to be called in place of the
* {@link PrimitiveComponentType#start()} and the
* {@link PrimitiveComponentType#createInstance()} methods.
+ * @param name the name of the instance to create. This parameter will
+ * be used as the <code>instance.name</code> property.
+ * @return the created component instance.
* @throws ConfigurationException occurs if the type description is
* incorrect
* @throws MissingHandlerException occurs if a handler is not available
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java
index 3da590e..9d33c28 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java
@@ -74,7 +74,7 @@
private List m_instantiated = new ArrayList();
/**
- * List of contained instance:
+ * List of contained instance.
*/
private List m_contained = new ArrayList();
@@ -89,7 +89,7 @@
private String m_name;
/**
- * List of Handler representing external
+ * List of Handler representing external.
* handler configuration
*/
private List m_handlers = new ArrayList();
@@ -183,26 +183,51 @@
return this;
}
+ /**
+ * Adds a contained instance.
+ * @param inst the instance to add
+ * @return the current composite component type
+ */
public CompositeComponentType addInstance(Instance inst) {
m_contained.add(inst);
return this;
}
+ /**
+ * Adds an imported (sub-)service.
+ * @param is the imported service to add
+ * @return the current composite component type
+ */
public CompositeComponentType addSubService(ImportedService is) {
m_imported.add(is);
return this;
}
+ /**
+ * Adds an instantiated sub-service.
+ * @param is the instantiated service to add
+ * @return the current composite component type
+ */
public CompositeComponentType addSubService(InstantiatedService is) {
m_instantiated.add(is);
return this;
}
+ /**
+ * Adds an exported service.
+ * @param es the exported service to add
+ * @return the current composite component type
+ */
public CompositeComponentType addService(ExportedService es) {
m_exported.add(es);
return this;
}
+ /**
+ * Adds a provided service.
+ * @param es the provided service to add
+ * @return the current composite component type
+ */
public CompositeComponentType addService(ProvidedService es) {
m_provided.add(es);
return this;
@@ -215,8 +240,9 @@
* @param handler the handler configuration to add
* @return the current component type.
*/
- public void CompositeComponentType(HandlerConfiguration handler) {
+ public CompositeComponentType addHandler(HandlerConfiguration handler) {
m_handlers.add(handler);
+ return this;
}
/**
@@ -269,7 +295,7 @@
ensureValidity();
m_metadata = generateComponentMetadata();
try {
- m_factory = new CompositeFactory(m_context, m_metadata);
+ m_factory = new CompositeFactory(m_context, m_metadata);
m_factory.start();
} catch (ConfigurationException e) {
throw new IllegalStateException("An exception occurs during factory initialization : " + e.getMessage());
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java
index c7cb423..86fd25c 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java
@@ -23,15 +23,24 @@
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.util.DependencyModel;
+/**
+ * Allows defining an exported service. A service export is the
+ * publication of service from the composite to the parent composite
+ * or global registry. The service export relies on a service dependency
+ * inside the composite. Matching services will be exported.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class ExportedService implements HandlerConfiguration {
/**
- * The required specification.
+ * The exported specification.
*/
private String m_specification;
/**
- * The LDAP filter of the dependency.
+ * The LDAP filter of the service dependency
+ * used to select the adequate service provider from
+ * the composite.
*/
private String m_filter;
@@ -56,12 +65,10 @@
* (used to compare service providers)
*/
private String m_comparator;
-
-
/**
- * Gets the dependency metadata.
- * @return the 'requires' element describing
+ * Gets the exported service metadata.
+ * @return the 'provides' element describing
* the current dependency.
*/
public Element getElement() {
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java
index d7aff45..fbb994f 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java
@@ -23,12 +23,27 @@
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.util.DependencyModel;
+/**
+ * Allows defining an imported service. A service import is the
+ * publication of service from the parent composite
+ * or global registry inside the composite.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class ImportedService implements HandlerConfiguration {
+ /**
+ * Scoping policy: composite.
+ */
public static final String COMPOSITE_SCOPE = "composite";
+ /**
+ * Scoping policy: global.
+ */
public static final String GLOBAL_SCOPE = "global";
+ /**
+ * Scoping policy: composite+global.
+ */
public static final String COMPOSITE_AND_GLOBAL_SCOPE = "composite+global";
@@ -70,7 +85,7 @@
private String m_id;
/**
- * Dependency scope
+ * Dependency scope.
*/
private String m_scope = COMPOSITE_SCOPE;
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java
index ae66997..0d652b4 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java
@@ -24,22 +24,45 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.Vector;
-import java.util.Map.Entry;
import org.apache.felix.ipojo.api.HandlerConfiguration;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Allows defining a contained instance. A contained instance is like
+ * an instance declaration but the instance is created in the composite.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class Instance implements HandlerConfiguration {
- private String m_type;
- private List m_conf = new ArrayList();
+ /**
+ * Targeted component type.
+ */
+ private String m_type;
+
+ /**
+ * Configuration.
+ */
+ private List m_conf = new ArrayList();
+
+ /**
+ * Creates a Instance.
+ * @param type the targeted type.
+ */
public Instance(String type) {
m_type = type;
}
-
+
+ /**
+ * Adds the string property.
+ * @param name property name
+ * @param value property value
+ * @return the current instance
+ */
public Instance addProperty(String name, String value) {
Element elem = new Element("property", "");
m_conf.add(elem);
@@ -47,14 +70,20 @@
elem.addAttribute(new Attribute("value", value));
return this;
}
-
+
+ /**
+ * Adds a list property.
+ * @param name property name
+ * @param values the list
+ * @return the current instance
+ */
public Instance addProperty(String name, List values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
elem.addAttribute(new Attribute("type", "list"));
m_conf.add(elem);
-
+
for (int i = 0; i < values.size(); i++) {
Object obj = values.get(i);
Element e = new Element("property", "");
@@ -62,31 +91,44 @@
if (obj instanceof String) {
e.addAttribute(new Attribute("value", obj.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds an array property.
+ * @param name the property name
+ * @param values the array
+ * @return the current instance
+ */
public Instance addProperty(String name, String[] values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
elem.addAttribute(new Attribute("type", "array"));
m_conf.add(elem);
-
+
for (int i = 0; i < values.length; i++) {
Object obj = values[i];
Element e = new Element("property", "");
elem.addElement(e);
e.addAttribute(new Attribute("value", obj.toString()));
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a vector property.
+ * @param name the property name
+ * @param values the vector
+ * @return the current instance
+ */
public Instance addProperty(String name, Vector values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -101,14 +143,21 @@
if (obj instanceof String) {
e.addAttribute(new Attribute("value", obj.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a map property.
+ * @param name the property name
+ * @param values the map
+ * @return the current instance
+ */
public Instance addProperty(String name, Map values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -117,7 +166,7 @@
m_conf.add(elem);
Set entries = values.entrySet();
Iterator it = entries.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Map.Entry entry = (Entry) it.next();
Element e = new Element("property", "");
elem.addElement(e);
@@ -128,14 +177,21 @@
e.addAttribute(new Attribute("name", n));
e.addAttribute(new Attribute("value", v.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a dictionary property.
+ * @param name the property name
+ * @param values the dictionary
+ * @return the current instance
+ */
public Instance addProperty(String name, Dictionary values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -143,7 +199,7 @@
m_conf.add(elem);
Enumeration e = values.keys();
- while(e.hasMoreElements()) {
+ while (e.hasMoreElements()) {
Element el = new Element("property", "");
elem.addElement(el);
@@ -153,20 +209,30 @@
el.addAttribute(new Attribute("name", n));
el.addAttribute(new Attribute("value", v.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
- return this;
- }
+ return this;
+ }
+
+ /**
+ * Ensures the validity of the instance description.
+ */
private void ensureValidity() {
- if(m_type == null) {
- throw new IllegalStateException("Invalid containted instance configuration : the component type is not set");
+ if (m_type == null) {
+ throw new IllegalStateException(
+ "Invalid containted instance configuration : the component type is not set");
}
}
-
+
+ /**
+ * Gets the instance description in the Element-Attribute form.
+ * @return the root Element of the instance description
+ * @see org.apache.felix.ipojo.api.HandlerConfiguration#getElement()
+ */
public Element getElement() {
ensureValidity();
Element instance = new Element("instance", "");
@@ -177,4 +243,4 @@
}
return instance;
}
-}
\ No newline at end of file
+}
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java
index b53c636..fa67c02 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java
@@ -24,76 +24,79 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.Vector;
-import java.util.Map.Entry;
import org.apache.felix.ipojo.api.HandlerConfiguration;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.util.DependencyModel;
+/**
+ * Allows defining an instantiated sub-service. An instantiated sub-
+ * service will be reified by instances publishing the required service.
+ * Those instances are created from public factories
+ * inside the composite.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class InstantiatedService implements HandlerConfiguration {
-
+
/**
* The required specification.
*/
private String m_specification;
-
+
/**
- * The LDAP filter of the dependency.
+ * The LDAP filter of the dependency.
*/
private String m_filter;
-
+
/**
- * Is the dependency optional?
+ * Is the dependency optional?
*/
private boolean m_optional;
-
+
/**
- * Is the dependency aggregate?
+ * Is the dependency aggregate?
*/
private boolean m_aggregate;
-
+
/**
- * The dependency binding policy.
- * Default: Dynamic policy.
+ * The dependency binding policy. Default: Dynamic policy.
*/
private int m_policy = DependencyModel.DYNAMIC_BINDING_POLICY;
-
+
/**
- * The dependency comparator.
- * (used to compare service providers)
+ * The dependency comparator. (used to compare service providers)
*/
private String m_comparator;
-
+
/**
- * Instance configuration
- * List of Element (Property)
+ * Instance configuration List of Element (Property).
*/
private List m_conf = new ArrayList();
-
+
/**
* Gets the dependency metadata.
- * @return the 'requires' element describing
- * the current dependency.
+ * @return the 'subservice' element describing the current
+ * instantiated service.
*/
public Element getElement() {
ensureValidity();
-
+
Element dep = new Element("subservice", "");
dep.addAttribute(new Attribute("action", "instantiate"));
-
+
dep.addAttribute(new Attribute("specification", m_specification));
-
if (m_filter != null) {
dep.addAttribute(new Attribute("filter", m_filter));
}
if (m_comparator != null) {
dep.addAttribute(new Attribute("comparator", m_comparator));
}
-
+
if (m_optional) {
dep.addAttribute(new Attribute("optional", "true"));
}
@@ -108,15 +111,21 @@
} else if (m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY) {
dep.addAttribute(new Attribute("policy", "dynamic-priority"));
}
-
+
for (int i = 0; i < m_conf.size(); i++) {
Element elem = (Element) m_conf.get(i);
dep.addElement(elem);
}
-
+
return dep;
}
-
+
+ /**
+ * Adds a string property.
+ * @param name the property name
+ * @param value the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, String value) {
Element elem = new Element("property", "");
m_conf.add(elem);
@@ -124,14 +133,20 @@
elem.addAttribute(new Attribute("value", value));
return this;
}
-
+
+ /**
+ * Adds a list property.
+ * @param name the property name
+ * @param values the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, List values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
elem.addAttribute(new Attribute("type", "list"));
m_conf.add(elem);
-
+
for (int i = 0; i < values.size(); i++) {
Object obj = values.get(i);
Element e = new Element("property", "");
@@ -139,31 +154,44 @@
if (obj instanceof String) {
e.addAttribute(new Attribute("value", obj.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds an array property.
+ * @param name the property name
+ * @param values the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, String[] values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
elem.addAttribute(new Attribute("type", "array"));
m_conf.add(elem);
-
+
for (int i = 0; i < values.length; i++) {
Object obj = values[i];
Element e = new Element("property", "");
elem.addElement(e);
e.addAttribute(new Attribute("value", obj.toString()));
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a vector property.
+ * @param name the property name
+ * @param values the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, Vector values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -178,14 +206,21 @@
if (obj instanceof String) {
e.addAttribute(new Attribute("value", obj.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a map property.
+ * @param name the property name
+ * @param values the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, Map values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -194,7 +229,7 @@
m_conf.add(elem);
Set entries = values.entrySet();
Iterator it = entries.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Map.Entry entry = (Entry) it.next();
Element e = new Element("property", "");
elem.addElement(e);
@@ -205,14 +240,21 @@
e.addAttribute(new Attribute("name", n));
e.addAttribute(new Attribute("value", v.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
+ /**
+ * Adds a dictionary property.
+ * @param name the property name
+ * @param values the property value
+ * @return the current instantiated sub-service
+ */
public InstantiatedService addProperty(String name, Dictionary values) {
Element elem = new Element("property", "");
elem.addAttribute(new Attribute("name", name));
@@ -220,7 +262,7 @@
m_conf.add(elem);
Enumeration e = values.keys();
- while(e.hasMoreElements()) {
+ while (e.hasMoreElements()) {
Element el = new Element("property", "");
elem.addElement(el);
@@ -230,90 +272,90 @@
el.addAttribute(new Attribute("name", n));
el.addAttribute(new Attribute("value", v.toString()));
} else {
- // TODO
- throw new UnsupportedOperationException("Complex properties are not supported yet");
+ // TODO
+ throw new UnsupportedOperationException(
+ "Complex properties are not supported yet");
}
}
-
+
return this;
- }
-
+ }
+
/**
* Sets the required service specification.
* @param spec the specification
- * @return the current imported sub-service.
+ * @return the current instantiated sub-service
*/
public InstantiatedService setSpecification(String spec) {
m_specification = spec;
return this;
}
-
+
/**
* Sets the dependency filter.
* @param filter the LDAP filter
- * @return the current imported sub-service
+ * @return the current instantiated sub-service
*/
public InstantiatedService setFilter(String filter) {
m_filter = filter;
return this;
}
-
-
+
/**
* Sets the dependency optionality.
- * @param opt <code>true</code> to set the
- * dependency to optional.
- * @return the current imported sub-service.
+ * @param opt <code>true</code> to set the dependency to optional.
+ * @return the current instantiated sub-service
*/
public InstantiatedService setOptional(boolean opt) {
m_optional = opt;
return this;
}
-
+
/**
* Sets the dependency cardinality.
- * @param agg <code>true</code> to set the
- * dependency to aggregate.
- * @return the current imported sub-service.
+ * @param agg <code>true</code> to set the dependency to aggregate.
+ * @return the current instantiated sub-service
*/
public InstantiatedService setAggregate(boolean agg) {
m_aggregate = agg;
return this;
}
-
-
+
/**
* Sets the dependency binding policy.
* @param policy the binding policy
- * @return the current imported sub-service
+ * @return the current instantiated sub-service
*/
public InstantiatedService setBindingPolicy(int policy) {
m_policy = policy;
return this;
}
-
+
/**
* Sets the dependency comparator.
* @param cmp the comparator class name
- * @return the current imported sub-service
+ * @return the current instantiated sub-service
*/
public InstantiatedService setComparator(String cmp) {
m_comparator = cmp;
return this;
}
-
+
/**
* Checks dependency configuration validity.
*/
private void ensureValidity() {
// Check specification
if (m_specification == null) {
- throw new IllegalStateException("The specification of the instantiated service must be set");
+ throw new IllegalStateException(
+ "The specification of the instantiated service must be set");
}
// Check binding policy.
- if (!(m_policy == DependencyModel.DYNAMIC_BINDING_POLICY || m_policy == DependencyModel.STATIC_BINDING_POLICY || m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY)) {
- throw new IllegalStateException("Unknown binding policy : " + m_policy);
+ if (!(m_policy == DependencyModel.DYNAMIC_BINDING_POLICY
+ || m_policy == DependencyModel.STATIC_BINDING_POLICY || m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY)) {
+ throw new IllegalStateException("Unknown binding policy : "
+ + m_policy);
}
}
diff --git a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java
index 136419e..922c992 100644
--- a/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java
+++ b/ipojo/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java
@@ -25,13 +25,25 @@
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Allows defining a provided service. A provided service is a service
+ * 'implemented' by the composite. This implementations relies (by
+ * delegation) on contained instances and services.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class ProvidedService implements HandlerConfiguration {
+ /**
+ * Delegation policy: all.
+ */
public static final String ALL_POLICY = "all";
- public static final String ONE_POLICY = "one";
-
/**
- * The required specification.
+ * Delegation policy: one.
+ */
+ public static final String ONE_POLICY = "one";
+
+ /**
+ * The provided specification.
*/
private String m_specification;
@@ -41,12 +53,11 @@
*/
private List m_delegation = new ArrayList();
-
-
+
/**
- * Gets the dependency metadata.
- * @return the 'requires' element describing
- * the current dependency.
+ * Gets the provided element.
+ * @return the 'provides' element describing
+ * the current provided service.
*/
public Element getElement() {
ensureValidity();
@@ -64,9 +75,9 @@
}
/**
- * Sets the required service specification.
+ * Sets the provided service specification.
* @param spec the specification
- * @return the current exported service.
+ * @return the current provided service.
*/
public ProvidedService setSpecification(String spec) {
m_specification = spec;
@@ -74,7 +85,7 @@
}
/**
- * Sets the delegation policy of the given method
+ * Sets the delegation policy of the given method.
* @param method the method name
* @param policy the delegation policy
* @return the current exported service.
@@ -89,7 +100,7 @@
/**
- * Checks dependency configuration validity.
+ * Checks provided service configuration validity.
*/
private void ensureValidity() {
// Check specification
diff --git a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java
index ef665ed..3a7dd37 100644
--- a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java
+++ b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java
@@ -1,42 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.felix.ipojo.api.composite;
-
import junit.framework.TestCase;
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Test about {@link ExportedService}.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class ExportedServiceTest extends TestCase {
-
+ //
+ // <comp:composite name="composite.export.5" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // aggregate="true" optional="true" filter="(!(instance.name=export))"
+ // scope="composite" />
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // filter="(instance.name=foo1)" />
+ // </comp:composite>
-//
-//<comp:composite name="composite.export.5" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// aggregate="true" optional="true" filter="(!(instance.name=export))"
-// scope="composite" />
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// filter="(instance.name=foo1)" />
-//</comp:composite>
-
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService" />
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // />
+ /**
+ * Tests simple export.
+ */
public void testSimple() {
ExportedService svc = new ExportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.BazService");
-
+ .setSpecification("org.apache.felix.ipojo.test.composite.service.BazService");
+
Element elem = svc.getElement();
- String name = elem.getName();
- String action = elem.getAttribute("action");
String spec = elem.getAttribute("specification");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.BazService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.BazService",
+ spec);
}
-
+
+ /**
+ * Tests a malformed export.
+ */
public void testBad() {
ExportedService svc = new ExportedService()
- //.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") NO SPEC
- ;
+ // .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService")
+ // NO SPEC
+ ;
try {
svc.getElement();
fail("Invalid element accepted");
@@ -44,75 +71,90 @@
// OK
}
}
-
-
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// aggregate="true" />
+
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // aggregate="true" />
+ /**
+ * Tests aggregate export.
+ */
public void testAggregate() {
- ExportedService svc = new ExportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.BazService")
- .setAggregate(true);
-
-
+ ExportedService svc = new ExportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.BazService")
+ .setAggregate(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String agg = elem.getAttribute("aggregate");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.BazService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.BazService",
+ spec);
assertEquals("aggregate", "true", agg);
}
-
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// optional="true" />
+
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // optional="true" />
+ /**
+ * Tests optional export.
+ */
public void testOptional() {
- ExportedService svc = new ExportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.BazService")
- .setOptional(true);
-
-
+ ExportedService svc = new ExportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.BazService")
+ .setOptional(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String opt = elem.getAttribute("optional");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.BazService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.BazService",
+ spec);
assertEquals("optional", "true", opt);
}
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// aggregate="true" optional="true" />
+
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // aggregate="true" optional="true" />
+ /**
+ * Tests optional and aggregate export.
+ */
public void testOptionalAndAggregate() {
- ExportedService svc = new ExportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setOptional(true)
- .setAggregate(true);
-
-
+ ExportedService svc = new ExportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setOptional(true).setAggregate(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String opt = elem.getAttribute("optional");
String agg = elem.getAttribute("aggregate");
-
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("optional", "true", opt);
assertEquals("aggregate", "true", agg);
}
-// <comp:provides action="export"
-// specification="org.apache.felix.ipojo.test.composite.service.BazService"
-// filter="(instance.name=foo1)" />
+ // <comp:provides action="export"
+ // specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ // filter="(instance.name=foo1)" />
+ /**
+ * Tests filtered export.
+ */
public void testFilter() {
- ExportedService svc = new ExportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setFilter("(&(int=2)(long=40))");
-
+ ExportedService svc = new ExportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setFilter("(&(int=2)(long=40))");
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String filter = elem.getAttribute("filter");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("filter", "(&(int=2)(long=40))", filter);
}
diff --git a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java
index 5cf580c..3c889bf 100644
--- a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java
+++ b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java
@@ -1,30 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.felix.ipojo.api.composite;
-
import junit.framework.TestCase;
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Tests about {@link ImportedService}.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class ImportedServiceTest extends TestCase {
-
-// <comp:composite name="composite.requires.1" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.FooService"
-// scope="composite" />
-//</comp:composite>
+
+ // <comp:composite name="composite.requires.1" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ // scope="composite" />
+ // </comp:composite>
+ /**
+ * Simple test.
+ */
public void testSimple() {
ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService");
-
+ .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService");
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
}
-
+
+ /**
+ * Malformed import.
+ */
public void testBad() {
ImportedService svc = new ImportedService()
- //.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") NO SPEC
- ;
+ // .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService")
+ // NO SPEC
+ ;
try {
svc.getElement();
fail("Invalid element accepted");
@@ -32,110 +62,129 @@
// OK
}
}
-
+
+ /**
+ * Tests scopes.
+ */
public void testScope() {
- ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setScope(ImportedService.COMPOSITE_SCOPE);
-
-
+ ImportedService svc = new ImportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setScope(ImportedService.COMPOSITE_SCOPE);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String scope = elem.getAttribute("scope");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("scope", "composite", scope);
}
-
-//
-//<comp:composite name="composite.requires.2" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.FooService"
-// aggregate="true" scope="composite" />
-//</comp:composite>
+
+ //
+ // <comp:composite name="composite.requires.2" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ // aggregate="true" scope="composite" />
+ // </comp:composite>
+ /**
+ * Tests aggregate.
+ */
public void testAggregate() {
- ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setScope(ImportedService.COMPOSITE_SCOPE)
- .setAggregate(true);
-
-
+ ImportedService svc = new ImportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setScope(ImportedService.COMPOSITE_SCOPE).setAggregate(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String scope = elem.getAttribute("scope");
String agg = elem.getAttribute("aggregate");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("scope", "composite", scope);
assertEquals("aggregate", "true", agg);
}
-
-//
-//<comp:composite name="composite.requires.3" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.FooService"
-// optional="true" scope="composite" />
-//</comp:composite>
+
+ //
+ // <comp:composite name="composite.requires.3" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ // optional="true" scope="composite" />
+ // </comp:composite>
+ /**
+ * Tests optional.
+ */
public void testOptional() {
- ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setScope(ImportedService.COMPOSITE_SCOPE)
- .setOptional(true);
-
-
+ ImportedService svc = new ImportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setScope(ImportedService.COMPOSITE_SCOPE).setOptional(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String scope = elem.getAttribute("scope");
String opt = elem.getAttribute("optional");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("scope", "composite", scope);
assertEquals("optional", "true", opt);
}
-//
-//<comp:composite name="composite.requires.4" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.FooService"
-// optional="true" aggregate="true" scope="comp:composite" />
-//</comp:composite>
+
+ //
+ // <comp:composite name="composite.requires.4" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ // optional="true" aggregate="true" scope="comp:composite" />
+ // </comp:composite>
+ /**
+ * Tests optional and aggregate.
+ */
public void testOptionalAndAggregate() {
- ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setScope(ImportedService.COMPOSITE_SCOPE)
- .setOptional(true)
- .setAggregate(true);
-
-
+ ImportedService svc = new ImportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setScope(ImportedService.COMPOSITE_SCOPE).setOptional(true)
+ .setAggregate(true);
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String scope = elem.getAttribute("scope");
String opt = elem.getAttribute("optional");
String agg = elem.getAttribute("aggregate");
-
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("scope", "composite", scope);
assertEquals("optional", "true", opt);
assertEquals("aggregate", "true", agg);
}
-//
-//<comp:composite name="composite.requires.5" architecture="true">
-// <subservice action="import"
-// specification="org.apache.felix.ipojo.test.composite.service.FooService"
-// filter="(&(int=2)(long=40))" scope="composite" />
-//</comp:composite>
+
+ //
+ // <comp:composite name="composite.requires.5" architecture="true">
+ // <subservice action="import"
+ // specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ // filter="(&(int=2)(long=40))" scope="composite" />
+ // </comp:composite>
+ /**
+ * Tests filter.
+ */
public void testFilter() {
- ImportedService svc = new ImportedService()
- .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
- .setScope(ImportedService.COMPOSITE_SCOPE)
- .setFilter("(&(int=2)(long=40))");
-
+ ImportedService svc = new ImportedService().setSpecification(
+ "org.apache.felix.ipojo.test.composite.service.FooService")
+ .setScope(ImportedService.COMPOSITE_SCOPE).setFilter(
+ "(&(int=2)(long=40))");
+
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String scope = elem.getAttribute("scope");
String filter = elem.getAttribute("filter");
- assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
+ assertEquals("spec",
+ "org.apache.felix.ipojo.test.composite.service.FooService",
+ spec);
assertEquals("scope", "composite", scope);
assertEquals("filter", "(&(int=2)(long=40))", filter);
}
diff --git a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java
index 9d96ae3..02ab484 100644
--- a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java
+++ b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java
@@ -30,8 +30,15 @@
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Tests about {@link Instance}.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class InstanceTest extends TestCase {
+ /**
+ * One simple instance.
+ */
public void testJustComponent() {
Instance inst = new Instance("mycmp");
Element elem = inst.getElement();
@@ -39,6 +46,9 @@
assertEquals("Check component attribute", "mycmp", cmp);
}
+ /**
+ * Sting property.
+ */
public void testStringProp() {
Instance inst = new Instance("mycmp");
inst.addProperty("p1", "v1");
@@ -59,6 +69,9 @@
}
+ /**
+ * Several properties.
+ */
public void testStringProps() {
Instance inst = new Instance("mycmp");
inst.addProperty("p1", "v1");
@@ -79,6 +92,9 @@
assertEquals("Check property 1 - value", "v2", v);
}
+ /**
+ * List property.
+ */
public void testListProp() {
Instance inst = new Instance("mycmp");
List list = new ArrayList();
@@ -112,6 +128,9 @@
}
}
+ /**
+ * Array property.
+ */
public void testArrayProp() {
Instance inst = new Instance("mycmp");
String[] list = new String[] {"a", "a", "a"};
@@ -142,6 +161,9 @@
}
}
+ /**
+ * Vector property.
+ */
public void testVectorProp() {
Instance inst = new Instance("mycmp");
Vector list = new Vector();
@@ -176,6 +198,9 @@
}
}
+ /**
+ * Map property.
+ */
public void testMapProp() {
Instance inst = new Instance("mycmp");
Map map = new HashMap();
@@ -209,6 +234,9 @@
}
}
+ /**
+ * Dictionary property.
+ */
public void testDictProp() {
Instance inst = new Instance("mycmp");
Dictionary map = new Properties();
diff --git a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java
index 7aed767..ec878bf 100644
--- a/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java
+++ b/ipojo/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.felix.ipojo.api.composite;
@@ -5,12 +23,19 @@
import org.apache.felix.ipojo.metadata.Element;
+/**
+ * Tests about {@link InstantiatedService}.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
public class InstantiatedServiceTest extends TestCase {
// <comp:composite name="composite.bar.1" architecture="true">
// <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService"/>
//</comp:composite>
+ /**
+ * Simple test.
+ */
public void testSimple() {
InstantiatedService svc = new InstantiatedService()
.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService");
@@ -22,6 +47,9 @@
assertEquals("action" , "instantiate", action);
}
+ /**
+ * Malformed instantiated service.
+ */
public void testBad() {
InstantiatedService svc = new InstantiatedService()
//.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") NO SPEC
@@ -42,6 +70,9 @@
// <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" aggregate="true"/>
//</comp:composite>
+ /**
+ * Aggregate.
+ */
public void testAggregate() {
InstantiatedService svc = new InstantiatedService()
.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService")
@@ -62,6 +93,9 @@
//<comp:composite name="composite.bar.3" architecture="true">
// <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" optional="true"/>
//</comp:composite>
+ /**
+ * Optional.
+ */
public void testOptional() {
InstantiatedService svc = new InstantiatedService()
.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService")
@@ -82,6 +116,9 @@
//<comp:composite name="composite.bar.4" architecture="true">
// <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService" aggregate="true" optional="true"/>
//</comp:composite>
+ /**
+ * Aggregate and optional.
+ */
public void testOptionalAndAggregate() {
InstantiatedService svc = new InstantiatedService()
.setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")
@@ -108,6 +145,9 @@
// <property name="int" value="5"/>
// </subservice>
//</comp:composite>
+ /**
+ * Instance configuration.
+ */
public void testWithConfiguration() {
InstantiatedService svc = new InstantiatedService()
.setSpecification("org.apache.felix.ipojo.test.composite.service.FooService")