Improve LDAP filter in InstanceCreator.java
Some cosmetic fixes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@555662 13f79535-47bb-0310-9956-ffa450edef68
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 1f42b9a..ea39c20 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
@@ -18,16 +18,15 @@
*/
package org.apache.felix.ipojo;
-import java.io.IOException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import org.apache.felix.ipojo.architecture.ComponentDescription;
@@ -50,18 +49,19 @@
public class ComponentFactory implements Factory, ManagedServiceFactory {
/**
- * List of the managed instance managers. The key of this hashmap is the
- * name (i.e. pid) of the created instance
- */
- private HashMap m_componentInstances = new HashMap();
-
- /**
* List of the managed instance name. This list is shared by all factories.
*/
private static List m_instancesName = new ArrayList();
+
+ /**
+ * List of the managed instance managers. The key of this map is the
+ * name (i.e. PID) of the created instance
+ */
+ private Map m_componentInstances = new HashMap();
+
/**
- * Ture if the component is a composition.
+ * True if the component is a composition.
*/
private boolean m_isComposite = false;
@@ -86,7 +86,7 @@
private String m_typeName = null;
/**
- * Classloader to delegate loading.
+ * Class loader to delegate loading.
*/
private FactoryClassloader m_classLoader = null;
@@ -130,7 +130,7 @@
/**
* Map of defined classes [Name, Class Object].
*/
- private HashMap m_definedClasses = new HashMap();
+ private Map m_definedClasses = new HashMap();
/**
* load the class.
@@ -146,7 +146,7 @@
}
/**
- * Return the URL of the asked ressource.
+ * Return the URL of the asked resource.
*
* @param arg : the name of the resource to find.
* @return the URL of the resource.
@@ -157,18 +157,6 @@
}
/**
- * .
- *
- * @param arg : resource to find
- * @return : the enumeration found
- * @throws IOException : if the lookup failed.
- * @see java.lang.ClassLoader#getResources(java.lang.String)
- */
- public Enumeration getRessources(String arg) throws IOException {
- return m_context.getBundle().getResources(arg);
- }
-
- /**
* The defineClass method.
*
* @param name : name of the class
@@ -181,44 +169,13 @@
if (m_definedClasses.containsKey(name)) {
return (Class) m_definedClasses.get(name);
}
- Class c = super.defineClass(name, b, 0, b.length, domain);
+ final Class c = super.defineClass(name, b, 0, b.length, domain);
m_definedClasses.put(name, c);
return c;
}
}
/**
- * Return the bundle context.
- *
- * @return the Bundle Context.
- */
- protected BundleContext getBundleContext() {
- return m_context;
- }
-
- protected String getComponentTypeName() {
- return m_typeName;
- }
-
- /**
- * Get the implementation class of the component type.
- *
- * @return the name of the component-type implementation class.
- */
- protected String getComponentClassName() {
- return m_componentClassName;
- }
-
- /**
- * Get the logger used by instances of he current factory.
- *
- * @return the factory logger.
- */
- public Logger getLogger() {
- return m_logger;
- }
-
- /**
* Create a instance manager factory.
*
* @param bc : bundle context
@@ -261,6 +218,62 @@
}
/**
+ * Create a instance manager factory. The class is given in parameter. The
+ * component type is not a composite.
+ *
+ * @param bc : bundle context
+ * @param clazz : the component class
+ * @param cm : metadata of the component
+ */
+ public ComponentFactory(BundleContext bc, byte[] clazz, Element cm) {
+ m_context = bc;
+ m_clazz = clazz;
+ m_componentClassName = cm.getAttribute("className");
+ m_componentMetadata = cm;
+
+ // Get the name
+ if (cm.containsAttribute("name")) {
+ m_typeName = cm.getAttribute("name");
+ m_logger = new Logger(m_context, m_typeName, Logger.WARNING);
+ } else {
+ m_logger = new Logger(m_context, m_componentClassName, Logger.WARNING);
+ }
+
+ computeFactoryName();
+ }
+
+ /**
+ * Return the bundle context.
+ *
+ * @return the Bundle Context.
+ */
+ protected BundleContext getBundleContext() {
+ return m_context;
+ }
+
+ protected String getComponentTypeName() {
+ return m_typeName;
+ }
+
+ /**
+ * Get the implementation class of the component type.
+ *
+ * @return the name of the component-type implementation class.
+ */
+ protected String getComponentClassName() {
+ return m_componentClassName;
+ }
+
+ /**
+ * Get the logger used by instances of he current factory.
+ *
+ * @return the factory logger.
+ */
+ public Logger getLogger() {
+ return m_logger;
+ }
+
+ /**
* Compute the factory name.
*/
private void computeFactoryName() {
@@ -298,38 +311,13 @@
}
/**
- * Create a instance manager factory. The class is given in parameter. The
- * component type is not a composite.
- *
- * @param bc : bundle context
- * @param clazz : the component class
- * @param cm : metadata of the component
- */
- public ComponentFactory(BundleContext bc, byte[] clazz, Element cm) {
- m_context = bc;
- m_clazz = clazz;
- m_componentClassName = cm.getAttribute("className");
- m_componentMetadata = cm;
-
- // Get the name
- if (cm.containsAttribute("name")) {
- m_typeName = cm.getAttribute("name");
- m_logger = new Logger(m_context, m_typeName, Logger.WARNING);
- } else {
- m_logger = new Logger(m_context, m_componentClassName, Logger.WARNING);
- }
-
- computeFactoryName();
- }
-
- /**
* Stop all the instance managers.
*/
public synchronized void stop() {
- Collection col = m_componentInstances.values();
- Iterator it = col.iterator();
+ final Collection col = m_componentInstances.values();
+ final Iterator it = col.iterator();
while (it.hasNext()) {
- ComponentInstance ci = (ComponentInstance) it.next();
+ final ComponentInstance ci = (ComponentInstance) it.next();
if (ci.isStarted()) {
if (ci instanceof CompositeManager) {
((CompositeManager) ci).kill();
@@ -355,18 +343,18 @@
if (m_componentDesc != null) { // Already started.
return;
}
- Properties props = new Properties();
+ final Properties props = new Properties();
// create a ghost component
if (!m_isComposite) {
- InstanceManager ghost = new InstanceManager(this, m_context);
- Properties p = new Properties();
+ final InstanceManager ghost = new InstanceManager(this, m_context);
+ final Properties p = new Properties();
p.put("name", "ghost");
ghost.configure(m_componentMetadata, p);
m_componentDesc = ghost.getComponentDescription();
} else {
- CompositeManager ghost = new CompositeManager(this, m_context);
- Properties p = new Properties();
+ final CompositeManager ghost = new CompositeManager(this, m_context);
+ final Properties p = new Properties();
p.put("name", "ghost");
ghost.configure(m_componentMetadata, p);
m_componentDesc = ghost.getComponentDescription();
@@ -503,14 +491,14 @@
m_instancesName.add(pid);
}
- IPojoContext context = new IPojoContext(m_context);
+ final IPojoContext context = new IPojoContext(m_context);
ComponentInstance instance = null;
if (!m_isComposite) {
- InstanceManager inst = new InstanceManager(this, context);
+ final InstanceManager inst = new InstanceManager(this, context);
inst.configure(m_componentMetadata, configuration);
instance = inst;
} else {
- CompositeManager inst = new CompositeManager(this, context);
+ final CompositeManager inst = new CompositeManager(this, context);
inst.configure(m_componentMetadata, configuration);
instance = inst;
}
@@ -558,14 +546,14 @@
m_instancesName.add(pid);
}
- IPojoContext context = new IPojoContext(m_context, serviceContext);
+ final IPojoContext context = new IPojoContext(m_context, serviceContext);
ComponentInstance instance = null;
if (!m_isComposite) {
- InstanceManager inst = new InstanceManager(this, context);
+ final InstanceManager inst = new InstanceManager(this, context);
inst.configure(m_componentMetadata, configuration);
instance = inst;
} else {
- CompositeManager inst = new CompositeManager(this, context);
+ final CompositeManager inst = new CompositeManager(this, context);
inst.configure(m_componentMetadata, configuration);
instance = inst;
}
@@ -583,7 +571,7 @@
*/
public synchronized void deleted(String pid) {
m_instancesName.remove(pid);
- InstanceManager cm = (InstanceManager) m_componentInstances.remove(pid);
+ final InstanceManager cm = (InstanceManager) m_componentInstances.remove(pid);
if (cm == null) {
return; // do nothing, the component does not exist !
} else {
@@ -618,7 +606,7 @@
* java.util.Dictionary)
*/
public synchronized void updated(String pid, Dictionary properties) throws ConfigurationException {
- InstanceManager cm = (InstanceManager) m_componentInstances.get(pid);
+ final InstanceManager cm = (InstanceManager) m_componentInstances.get(pid);
if (cm == null) {
try {
properties.put("name", pid); // Add the name in the configuration
@@ -648,9 +636,9 @@
* @return true when the configuration seems to be acceptable
*/
public boolean isAcceptable(Dictionary conf) {
- PropertyDescription[] props = m_componentDesc.getProperties();
+ final PropertyDescription[] props = m_componentDesc.getProperties();
for (int i = 0; i < props.length; i++) {
- PropertyDescription pd = props[i];
+ final PropertyDescription pd = props[i];
// Failed if the props has no default value and the configuration
// does not push a value
if (pd.getValue() == null && conf.get(pd.getName()) == null) {
@@ -667,9 +655,9 @@
* @throws UnacceptableConfiguration : the configuration is not acceptable.
*/
private void checkAcceptability(Dictionary conf) throws UnacceptableConfiguration {
- PropertyDescription[] props = m_componentDesc.getProperties();
+ final PropertyDescription[] props = m_componentDesc.getProperties();
for (int i = 0; i < props.length; i++) {
- PropertyDescription pd = props[i];
+ final PropertyDescription pd = props[i];
// Failed if the props has no default value and the configuration
// does not push a value
if (pd.getValue() == null && conf.get(pd.getName()) == null) {
@@ -690,7 +678,7 @@
if (properties == null || properties.get("name") == null) {
throw new UnacceptableConfiguration("The configuration does not contains the \"name\" property");
}
- String name = (String) properties.get("name");
+ final String name = (String) properties.get("name");
ComponentInstance cm = null;
if (m_isComposite) {
cm = (CompositeManager) m_componentInstances.get(name);
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentInstance.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentInstance.java
index 2e4d0f4..31cc863 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentInstance.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/ComponentInstance.java
@@ -44,7 +44,7 @@
/**
* Component Instance State : INVALID. The component is invalid when it
- * start or when a component dependency is unvalid.
+ * start or when a component dependency is invalid.
*/
int INVALID = 1;
@@ -115,7 +115,7 @@
boolean isStarted();
/**
- * Re-configurare an instance. Do nothing if the instance does not support
+ * Re-configure an instance. Do nothing if the instance does not support
* dynamic reconfiguration. The reconfiguration does not stop the instance.
*
* @param configuration : the new configuration.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeHandler.java
index a3f4c3e..5307d9f 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeHandler.java
@@ -25,7 +25,7 @@
/**
* Composite Handler Abstract Class. An composite handler need implements these
- * method to be notifed of lifecycle change...
+ * method to be notified of lifecycle change...
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeManager.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeManager.java
index ea053ca..6672f6a 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeManager.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/CompositeManager.java
@@ -96,14 +96,14 @@
}
/**
- * Configure the instance manager. Stop the existings handler, clear the
+ * Configure the instance manager. Stop the existing handler, clear the
* handler list, change the metadata, recreate the handler
*
* @param cm : the component type metadata
* @param configuration : the configuration of the instance
*/
public void configure(Element cm, Dictionary configuration) {
- // Stop all previous registred handler
+ // Stop all previous registered handler
if (m_handlers.length != 0) {
stop();
}
@@ -194,8 +194,8 @@
}
/**
- * REturn the list of handlers plugged on this instace.
- * @return the list of the registred handlers.
+ * REturn the list of handlers plugged on this instance.
+ * @return the list of the registered handlers.
*/
public CompositeHandler[] getRegistredCompositeHandlers() {
return m_handlers;
@@ -438,7 +438,7 @@
/**
* Unregister the given handler.
*
- * @param h : the handler to unregiter
+ * @param h : the handler to unregister
*/
public void unregister(CompositeHandler h) {
int idx = -1;
@@ -505,7 +505,7 @@
/**
* Reconfigure the current instance.
- * @param configuration : the new instance ocnfiguration.
+ * @param configuration : the new instance configuration.
* @see org.apache.felix.ipojo.ComponentInstance#reconfigure(java.util.Dictionary)
*/
public void reconfigure(Dictionary configuration) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/DefaultServiceContext.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/DefaultServiceContext.java
index 694283c..6c8fa72 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/DefaultServiceContext.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/DefaultServiceContext.java
@@ -50,7 +50,7 @@
/**
* Add a service listener.
- * @param listener : the service lsitener to add.
+ * @param listener : the service listener to add.
* @param filter : the LDAP filter
* @throws InvalidSyntaxException : occurs when the LDAP filter is malformed
* @see org.apache.felix.ipojo.ServiceContext#addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)
@@ -102,10 +102,10 @@
/**
* Get service reference list for the given query.
- * @param clazz : the name of the requried service interface
+ * @param clazz : the name of the required service interface
* @param filter : LDAP filter to apply on service provider
* @return : the array of consistent service reference or null if no available provider
- * @throws InvalidSyntaxException : occrus if the LDAP filter is malformed
+ * @throws InvalidSyntaxException : occurs if the LDAP filter is malformed
* @see org.apache.felix.ipojo.ServiceContext#getServiceReferences(java.lang.String, java.lang.String)
*/
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
@@ -139,7 +139,7 @@
/**
* Remove a service listener.
- * @param listener : the service listner to remove
+ * @param listener : the service listener to remove
* @see org.apache.felix.ipojo.ServiceContext#removeServiceListener(org.osgi.framework.ServiceListener)
*/
public void removeServiceListener(ServiceListener listener) {
@@ -149,7 +149,7 @@
/**
* Unget the service reference.
- * @param reference : the reference to unget
+ * @param reference : the service reference to unget
* @return true if you are the last user of the reference
* @see org.apache.felix.ipojo.ServiceContext#ungetService(org.osgi.framework.ServiceReference)
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
index 84895c9..0b80e0e 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
@@ -84,6 +84,8 @@
case BundleEvent.STOPPING:
closeManagementFor(event.getBundle());
break;
+ default:
+ break;
}
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
index 3df44b4..7342e4c 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
@@ -46,7 +46,7 @@
* @param configuration : the configuration properties for this component.
* @param serviceContext : the service context of the component.
* @return the created instance manager.
- * @throws UnacceptableConfiguration : when the given configuration isnot valid.
+ * @throws UnacceptableConfiguration : when the given configuration is not valid.
*/
ComponentInstance createComponentInstance(Dictionary configuration, ServiceContext serviceContext) throws UnacceptableConfiguration;
@@ -79,7 +79,7 @@
*
* @param conf : the configuration to reconfigure the instance.
* @throws UnacceptableConfiguration : if the given configuration is not
- * consistent for the tragetted instance.
+ * consistent for the targeted instance.
*/
void reconfigure(Dictionary conf) throws UnacceptableConfiguration;
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Handler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Handler.java
index 89f196e..b9618e4 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Handler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Handler.java
@@ -24,8 +24,8 @@
import org.apache.felix.ipojo.metadata.Element;
/**
- * Handler Abstract Class. An handler need implements tese method to be notifed
- * of lifecycle change, getfield operation and putfield operation
+ * Handler Abstract Class. An handler need implements these method to be notified
+ * of lifecycle change, GETFIELD & PUTFIELD instruction as well as method entry and exit.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -117,7 +117,7 @@
/**
* Return the current handler description.
- * Thesimplest description contains only the name and the validity of the handler.
+ * The simplest description contains only the name and the validity of the handler.
* @return the description of the handler..
*/
public HandlerDescription getDescription() {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoContext.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoContext.java
index e789f14..1431eca 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoContext.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoContext.java
@@ -94,7 +94,7 @@
/**
* Add a service listener.
- * @param listener : the service lsitener to add.
+ * @param listener : the service listener to add.
* @param filter : the LDAP filter
* @throws InvalidSyntaxException : occurs when the LDAP filter is malformed
* @see org.osgi.framework.BundleContext#addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)
@@ -207,10 +207,10 @@
/**
* Get service reference list for the given query.
- * @param clazz : the name of the requried service interface
+ * @param clazz : the name of the required service interface
* @param filter : LDAP filter to apply on service provider
* @return : the array of consistent service reference or null if no available provider
- * @throws InvalidSyntaxException : occrus if the LDAP filter is malformed
+ * @throws InvalidSyntaxException : occurs if the LDAP filter is malformed
* @see org.osgi.framework.BundleContext#getServiceReferences(java.lang.String, java.lang.String)
*/
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
@@ -284,7 +284,7 @@
/**
* Remove a service listener.
- * @param listener : the service listner to remove
+ * @param listener : the service listener to remove
* @see org.apache.felix.ipojo.ServiceContext#removeServiceListener(org.osgi.framework.ServiceListener)
* @see org.osgi.framework.BundleContext#removeServiceListener(org.osgi.framework.ServiceListener)
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceCreator.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceCreator.java
index e7fd8a9..b502477 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceCreator.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceCreator.java
@@ -140,7 +140,8 @@
Factory fact = null;
try {
- String fil = "(|(" + org.osgi.framework.Constants.SERVICE_PID + "=" + componentType + ")(component.class=" + componentType + ")(component.type=" + componentType + ")";
+ String fil = "(|(" + org.osgi.framework.Constants.SERVICE_PID + "=" + componentType + ")"
+ + "(component.class=" + componentType + ")(component.type=" + componentType + "))";
ServiceReference[] refs = context.getServiceReferences(org.apache.felix.ipojo.Factory.class.getName(), fil);
if (refs != null) {
fact = (Factory) m_context.getService(refs[0]);
@@ -153,7 +154,7 @@
}
}
- // Register a service listenner on Factory Service
+ // Register a service listener on Factory Service
try {
m_context.addServiceListener(this, "(objectClass=" + Factory.class.getName() + ")");
} catch (InvalidSyntaxException e) {
@@ -164,7 +165,7 @@
/**
* Create an instance using the given factory and the given configuration.
*
- * @param fact : the facotry name to used.
+ * @param fact : the factory name to used.
* @param config : the configuration.
*/
private void createInstance(Factory fact, ManagedConfiguration config) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
index e3e46b5..16f3600 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
@@ -22,6 +22,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Dictionary;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import org.apache.felix.ipojo.architecture.ComponentDescription;
@@ -68,12 +69,12 @@
/**
* Map [field, handler list] storing handlers interested by the field.
*/
- private HashMap m_fieldRegistration = new HashMap();
+ private Map m_fieldRegistration = new HashMap();
/**
* Map [method identifier, handler list] storing handlers interested by the method.
*/
- private HashMap m_methodRegistration = new HashMap();
+ private Map m_methodRegistration = new HashMap();
/**
* Component state (STOPPED at the beginning).
@@ -81,7 +82,7 @@
private int m_state = STOPPED;
/**
- * Manipulated clazz.
+ * Manipulated class.
*/
private Class m_clazz;
@@ -115,14 +116,14 @@
}
/**
- * Configure the instance manager. Stop the existings handler, clear the
+ * Configure the instance manager. Stop the existing handler, clear the
* handler list, change the metadata, recreate the handlers
*
* @param cm : the component type metadata
* @param configuration : the configuration of the instance
*/
public void configure(Element cm, Dictionary configuration) {
- // Stop all previous registred handler
+ // Stop all previous registered handler
if (m_handlers.length != 0) {
stop();
}
@@ -133,7 +134,7 @@
// Set the component-type metadata
m_className = cm.getAttribute("className");
if (m_className == null) {
- m_factory.getLogger().log(Logger.ERROR, "The class name of the component cannot be setted, it does not exist in the metadata");
+ m_factory.getLogger().log(Logger.ERROR, "The class name of the component cannot be set, it does not exist in the metadata");
}
// ComponentInfo initialization
@@ -180,7 +181,7 @@
}
/**
- * Get the compoenent-type description of the current instance.
+ * Get the component type description of the current instance.
* @return the component type information.
* @see org.apache.felix.ipojo.ComponentInstance#getComponentDescription()
*/
@@ -476,7 +477,7 @@
/**
* Remove an instance from the created instance list.
- * The instance will be eated by the garbage collector.
+ * The instance will be destroyed by the garbage collector.
*
* @param o : the instance to remove
*/
@@ -738,7 +739,7 @@
/**
* Unregister the given handler.
*
- * @param h : the handler to unregiter
+ * @param h : the handler to unregister
*/
public void unregister(Handler h) {
int idx = -1;
@@ -801,7 +802,7 @@
}
/**
- * Dispatch entry method event on registred handler.
+ * Dispatch entry method event on registered handler.
* @param methodId : method id
*/
public void entryCallback(String methodId) {
@@ -812,8 +813,8 @@
}
/**
- * Dispatch exit method event on registred handler.
- * The given returned object is an instance of Exception if the method has throwed an exception.
+ * Dispatch exit method event on registered handler.
+ * The given returned object is an instance of Exception if the method has launched an exception.
* If the given object is null, either the method returns void, either the method has returned null.
* @param methodId : method id
* @param e : returned object.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Nullable.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Nullable.java
index ae1531f..22ce37c 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Nullable.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Nullable.java
@@ -19,7 +19,7 @@
package org.apache.felix.ipojo;
/**
- * A nullable object must implement this interface.
+ * A Nullable object must implement this interface.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/ServiceContext.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/ServiceContext.java
index 1c145f3..110cd8f 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/ServiceContext.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/ServiceContext.java
@@ -26,7 +26,7 @@
import org.osgi.framework.ServiceRegistration;
/**
- * A service context give the access the a service registry. All service
+ * A service context give the access the a service broker. All service
* interaction should use this service context.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
@@ -35,7 +35,7 @@
/**
* Add a service listener.
- * @param listener : the service lsitener to add.
+ * @param listener : the service listener to add.
* @param filter : the LDAP filter
* @throws InvalidSyntaxException : occurs when the LDAP filter is malformed
* @see org.osgi.framework.BundleContext#addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)
@@ -77,10 +77,10 @@
/**
* Get service reference list for the given query.
- * @param clazz : the name of the requried service interface
+ * @param clazz : the name of the required service interface
* @param filter : LDAP filter to apply on service provider
* @return : the array of consistent service reference or null if no available provider
- * @throws InvalidSyntaxException : occrus if the LDAP filter is malformed
+ * @throws InvalidSyntaxException : occurs if the LDAP filter is malformed
* @see org.osgi.framework.BundleContext#getServiceReferences(java.lang.String, java.lang.String)
*/
ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/UnacceptableConfiguration.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/UnacceptableConfiguration.java
index d72fe84..b6aff61 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/UnacceptableConfiguration.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/UnacceptableConfiguration.java
@@ -19,7 +19,7 @@
package org.apache.felix.ipojo;
/**
- * UnacceptableConfiguration is throwed when a factory refuses to create an
+ * UnacceptableConfiguration occurs when a factory refuses to create an
* instance.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentDescription.java
index a519d0b..12234a9 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentDescription.java
@@ -69,8 +69,8 @@
}
/**
- * Get a displayable form of the current component type description.
- * @return displayable form of the component type description
+ * Get a printable form of the current component type description.
+ * @return printable form of the component type description
* @see java.lang.Object#toString()
*/
public String toString() {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java
index 3ea9a4c..17ae520 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java
@@ -44,11 +44,11 @@
public class CompositeServiceContext implements ServiceContext, ServiceListener {
/**
- * Structure stoing the referense, the factory and the registration.
+ * Structure storing the reference, the factory and the registration.
*/
private class Record {
/**
- * Reference of the proxed factory from the external context.
+ * Reference of the represented factory from the external context.
*/
private ServiceReference m_ref;
/**
@@ -56,7 +56,7 @@
*/
private ServiceRegistration m_reg;
/**
- * Proxed Factory.
+ * Represented Factory.
*/
private FactoryProxy m_fact;
}
@@ -124,9 +124,9 @@
/**
* Add a filtered service listener.
- * @param arg0 : the service listner object to add
+ * @param arg0 : the service listener object to add
* @param arg1 : the LDAP filter for this listener
- * @throws InvalidSyntaxException : throwed if the LDAP filter is malformed
+ * @throws InvalidSyntaxException : occurs if the LDAP filter is malformed
* @see org.apache.felix.ipojo.ServiceContext#addServiceListener(org.osgi.framework.ServiceListener,
* java.lang.String)
*/
@@ -136,7 +136,7 @@
/**
* Get all service references.
- * @param arg0 : The requried service interface.
+ * @param arg0 : The required service interface.
* @param arg1 : LDAP filter
* @return the list of all service reference matching with the query
* @throws InvalidSyntaxException : occurs when the given filter is malformed
@@ -160,7 +160,7 @@
/**
* Get a service reference for the required interface.
- * @param arg0 : the requried interface name
+ * @param arg0 : the required interface name
* @return the service reference or null if no available provider
* @see org.apache.felix.ipojo.ServiceContext#getServiceReference(java.lang.String)
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java
index 6919306..40d8e03 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java
@@ -46,7 +46,7 @@
/**
* Constructor.
*
- * @param fact : the targetted factory.
+ * @param fact : the targeted factory.
* @param s : the service context to target.
*/
public FactoryProxy(Factory fact, ServiceContext s) {
@@ -119,7 +119,7 @@
*
* @param conf : the configuration to reconfigure the instance.
* @throws UnacceptableConfiguration : if the given configuration is not
- * consistent for the tragetted instance.
+ * consistent for the targeted instance.
* @see org.apache.felix.ipojo.Factory#reconfigure(java.util.Dictionary)
*/
public void reconfigure(Dictionary conf) throws UnacceptableConfiguration {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceReferenceImpl.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceReferenceImpl.java
index 4682d75..b7670e2 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceReferenceImpl.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceReferenceImpl.java
@@ -23,7 +23,7 @@
import org.osgi.framework.ServiceReference;
/**
- * Internal service reference implemenation. This class is used for in the
+ * Internal service reference implementation. This class is used for in the
* composition.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistrationImpl.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistrationImpl.java
index a8546c5..bbaddc5 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistrationImpl.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistrationImpl.java
@@ -22,6 +22,7 @@
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.apache.felix.ipojo.ComponentInstance;
@@ -32,7 +33,7 @@
import org.osgi.framework.ServiceRegistration;
/**
- * Internal service registration implemenation. This class is used for in the
+ * Internal service registration implementation. This class is used for in the
* composition.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
@@ -75,6 +76,11 @@
private ServiceReferenceImpl m_ref = null;
/**
+ * Property Keys List.
+ */
+ private transient List m_list = new ArrayList();
+
+ /**
* Constructor.
*
* @param registry : the service registry
@@ -95,7 +101,7 @@
// This reference is the "standard" reference for this service and will
// always be returned by getReference().
// Since all reference to this service are supposed to be equal, we use
- // the hashcode of this reference for
+ // the hash code of this reference for
// a references to this service in ServiceReference.
m_ref = new ServiceReferenceImpl(cm, this);
}
@@ -159,11 +165,6 @@
}
/**
- * Property Keys List.
- */
- private transient ArrayList m_list = new ArrayList();
-
- /**
* Get the property keys.
* @return the property keys list.
*/
@@ -196,7 +197,7 @@
/**
* Initialize properties.
*
- * @param dict : serivce properties to publish.
+ * @param dict : service properties to publish.
*/
private void initializeProperties(Dictionary dict) {
// Create a case insensitive map.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistry.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistry.java
index dfe8662..6b94ddc 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistry.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/ServiceRegistry.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Dictionary;
+import java.util.List;
import org.apache.felix.ipojo.ComponentInstance;
import org.osgi.framework.BundleContext;
@@ -46,12 +47,12 @@
/**
* List of service listeners.
*/
- private ArrayList m_listeners = new ArrayList(); // ListenerInfo List
+ private List m_listeners = new ArrayList(); // ListenerInfo List
/**
* List of service registration.
*/
- private ArrayList m_regs = new ArrayList();
+ private List m_regs = new ArrayList();
/**
* A "real" bundle context to create LDAP filter.
@@ -114,7 +115,7 @@
/**
* Unregister a service listener.
*
- * @param arg0 : the service listenenr to remove
+ * @param arg0 : the service listener to remove
*/
public void removeServiceListener(ServiceListener arg0) {
m_listeners.remove(arg0);
@@ -163,7 +164,7 @@
*/
private void fireServiceChanged(ServiceEvent event) {
synchronized (this) {
- // Iterate on the service listenner list to notify service listener
+ // Iterate on the service listener list to notify service listener
for (int i = 0; i < m_listeners.size(); i++) {
ListenerInfo li = (ListenerInfo) m_listeners.get(i);
ServiceReference sr = event.getServiceReference();
@@ -193,7 +194,7 @@
filter = m_bc.createFilter(expr);
}
- ArrayList refs = new ArrayList();
+ List refs = new ArrayList();
for (int i = 0; i < m_regs.size(); i++) {
ServiceRegistrationImpl reg = (ServiceRegistrationImpl) m_regs.get(i);
@@ -300,7 +301,7 @@
try {
li.m_filter = m_bc.createFilter(filter);
} catch (InvalidSyntaxException ex) {
- System.err.println("Scope Service Registry : Problem when creatin a service listener " + ex.getMessage());
+ System.err.println("Scope Service Registry : Problem when creating a service listener " + ex.getMessage());
}
m_listeners.add(li);
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java
index d52bfdc..abc1053 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java
@@ -93,7 +93,7 @@
* @see org.apache.felix.ipojo.Handler#start()
*/
public void start() {
- // Unregister the service if already registred
+ // Unregister the service if already registered
if (m_sr != null) {
m_sr.unregister();
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java
index d0aef96..cd71882 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java
@@ -18,7 +18,9 @@
*/
package org.apache.felix.ipojo.composite.instance;
+import java.util.ArrayList;
import java.util.Dictionary;
+import java.util.List;
import java.util.Properties;
import org.apache.felix.ipojo.ComponentInstance;
@@ -41,7 +43,7 @@
/**
* Composite Instance Handler.
- * This handler allo to create an instance inside a composite.
+ * This handler allows creating an instance inside a composite.
* This instance is determine by its type and a configuration.
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -152,7 +154,7 @@
/**
* Create an instance using the given factory and the given configuration.
*
- * @param fact : the facotry name to used.
+ * @param fact : the factory name to used.
* @param config : the configuration.
*/
private void createInstance(Factory fact, ManagedConfiguration config) {
@@ -226,7 +228,7 @@
/**
- * Configrue method.
+ * Configure method.
* @param im : instance manager.
* @param metadata : component type metadata.
* @param configuration : instance configuration.
@@ -284,7 +286,7 @@
* Parse a property.
* @param prop : the current element to parse
* @param dict : the dictionary to populate
- * @throws ParseException : occurs if the proeprty cannot be parsed correctly
+ * @throws ParseException : occurs if the property cannot be parsed correctly
*/
private void parseProperty(Element prop, Dictionary dict) throws ParseException {
// Check that the property has a name
@@ -332,7 +334,7 @@
}
}
- // Register a service listenner on Factory Service
+ // Register a service listener on Factory Service
try {
m_context.addServiceListener(this, "(objectClass=" + Factory.class.getName() + ")");
} catch (InvalidSyntaxException e) {
@@ -388,12 +390,16 @@
if (m_validity && ! checkValidity()) {
m_manager.checkInstanceState();
}
+ break;
+ default :
+ break;
+
}
}
/**
- * Method returning an instance object of the given componenet type.
- * This method must be coalled only on 'primitive' type.
+ * Method returning an instance object of the given component type.
+ * This method must be called only on 'primitive' type.
* @param type : type.
* @return an instance object or null if not found.
*/
@@ -406,9 +412,19 @@
return null;
}
+ /**
+ * Return the handler description, i.e. the state of created instances.
+ * @return the handler description.
+ * @see org.apache.felix.ipojo.CompositeHandler#getDescription()
+ */
public HandlerDescription getDescription() {
- //TODO
- return null;
+ List l = new ArrayList();
+ for (int i = 0; i < m_configurations.length; i++) {
+ if (m_configurations[i].getInstance() != null) {
+ l.add(m_configurations[i]);
+ }
+ }
+ return new InstanceHandlerDescription(InstanceHandler.class.getName(), m_validity, l);
}
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java
index 72ec63e..707ed4c 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java
@@ -50,7 +50,7 @@
}
/**
- * Build service instantiator handler description.
+ * Build handler description.
* @return the handler description
* @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
*/
@@ -70,6 +70,8 @@
state = "valid"; break;
case ComponentInstance.INVALID :
state = "invalid"; break;
+ default :
+ break;
}
instance.addAttribute(new Attribute("State", state));
instance.addElement(inst.getInstanceDescription().getDescription());
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ImportExportHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ImportExportHandler.java
index d356f4f..2c837a3 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ImportExportHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ImportExportHandler.java
@@ -31,7 +31,7 @@
import org.osgi.framework.BundleContext;
/**
- * This handler manages the importation and the exportation of services from /
+ * This handler manages the import and the export of services from /
* to the parent context.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
@@ -126,8 +126,7 @@
boolean aggregate = false;
String specification = null;
- if (!exp[i].containsAttribute("specification")) { // Malformed
- // exports
+ if (!exp[i].containsAttribute("specification")) { // Malformed exports
im.getFactory().getLogger().log(Logger.ERROR, "Malformed exports : the specification attribute is mandatory");
} else {
specification = exp[i].getAttribute("specification");
@@ -148,8 +147,7 @@
}
}
ServiceExporter si = new ServiceExporter(specification, filter, aggregate, optional, m_scope, m_context, this);
- // Update the componenet type description
-
+ // Update the component type description
m_manager.getComponentDescription().addProvidedServiceSpecification(specification);
m_exporters.add(si);
}
@@ -250,7 +248,7 @@
/**
* Notify the handler that an exporter becomes invalid.
*
- * @param exporter : the impcated exporter.
+ * @param exporter : the implicated exporter.
*/
protected void invalidating(ServiceExporter exporter) {
// An import is no more valid
@@ -263,7 +261,7 @@
/**
* Notify the handler that an exporter becomes valid.
*
- * @param exporter : the impcated exporter.
+ * @param exporter : the implicated exporter.
*/
protected void validating(ServiceExporter exporter) {
// An import becomes valid
@@ -274,7 +272,7 @@
}
/**
- * Get the composite maanger.
+ * Get the composite manager.
* @return the attached composite manager.
*/
protected CompositeManager getManager() {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceExporter.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceExporter.java
index 6b785b4..e2dbc93 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceExporter.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceExporter.java
@@ -137,7 +137,7 @@
/**
* Start method.
- * Start the provider traking and the publication.
+ * Start the provider tracking and the publication.
*/
public void start() {
try {
@@ -260,24 +260,21 @@
if (ev.getType() == ServiceEvent.MODIFIED) {
if (m_filter.match(ev.getServiceReference())) {
- // Test if the ref is always matching with the filter
+ // Test if the reference is always matching with the filter
List l = getRecordsByRef(ev.getServiceReference());
- if (l.size() > 0) { // The ref is already contained => update
- // the properties
- for (int i = 0; i < l.size(); i++) { // Stop the implied
- // record
+ if (l.size() > 0) { // The reference is already contained => update the properties
+ for (int i = 0; i < l.size(); i++) { // Stop the implied record
Record rec = (Record) l.get(i);
if (rec.m_reg != null) {
rec.m_reg.setProperties(getProps(rec.m_ref));
}
}
- } else { // it is a new mathcing service => add it
+ } else { // it is a new matching service => add it
arrivalManagement(ev.getServiceReference());
}
} else {
List l = getRecordsByRef(ev.getServiceReference());
- if (l.size() > 0) { // The ref is already contained => the
- // service does no more match
+ if (l.size() > 0) { // The reference is already contained => the service does no more match
departureManagement(ev.getServiceReference());
}
}
@@ -327,14 +324,12 @@
}
m_records.removeAll(l);
- // Check the validity & if we need to reimport the service
+ // Check the validity & if we need to re-import the service
if (m_records.size() > 0) {
// There is other available services
if (!m_aggregate) { // Import the next one
Record rec = (Record) m_records.get(0);
- if (rec.m_svcObject == null) { // It is the first service who
- // disappears - create the next
- // one
+ if (rec.m_svcObject == null) { // It is the first service which disappears - create the next one
rec.m_svcObject = m_origin.getService(rec.m_ref);
rec.m_reg = m_destination.registerService(m_specification, rec.m_svcObject, getProps(rec.m_ref));
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceImporter.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceImporter.java
index d92e198..c50a394 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceImporter.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/importer/ServiceImporter.java
@@ -46,7 +46,7 @@
private ServiceContext m_destination;
/**
- * Origine Context.
+ * Origin Context.
*/
private BundleContext m_origine;
@@ -108,7 +108,7 @@
/**
* Constructor.
*
- * @param specification : targetted specification
+ * @param specification : targeted specification
* @param filter : LDAP filter
* @param multiple : should the importer imports several services ?
* @param optional : is the import optional ?
@@ -213,7 +213,7 @@
}
/**
- * Check if the import is statisfied.
+ * Check if the import is satisfied.
* @return true if the import is optional or at least one provider is imported
*/
public boolean isSatisfied() {
@@ -252,24 +252,21 @@
if (ev.getType() == ServiceEvent.MODIFIED) {
if (m_filter.match(ev.getServiceReference())) {
- // Test if the ref is always matching with the filter
+ // Test if the reference is always matching with the filter
List l = getRecordsByRef(ev.getServiceReference());
- if (l.size() > 0) { // The ref is already contained => update
- // the properties
- for (int i = 0; i < l.size(); i++) { // Stop the implied
- // record
+ if (l.size() > 0) { // The reference is already contained => update the properties
+ for (int i = 0; i < l.size(); i++) { // Stop the implied record
Record rec = (Record) l.get(i);
if (rec.m_reg != null) {
rec.m_reg.setProperties(getProps(rec.m_ref));
}
}
- } else { // it is a new mathcing service => add it
+ } else { // it is a new matching service => add it
arrivalManagement(ev.getServiceReference());
}
} else {
List l = getRecordsByRef(ev.getServiceReference());
- if (l.size() > 0) { // The ref is already contained => the
- // service does no more match
+ if (l.size() > 0) { // The reference is already contained => the service does no more match
departureManagement(ev.getServiceReference());
}
}
@@ -277,8 +274,7 @@
}
/**
- * Manage the arrival of a consitent service.
- *
+ * Manage the arrival of a consistent service.
* @param ref : the arrival service reference
*/
private void arrivalManagement(ServiceReference ref) {
@@ -289,9 +285,7 @@
rec.m_ref = ref;
m_records.add(rec);
// Publishing ?
- if (m_records.size() == 1 || m_aggregate) { // If the service is the
- // first one, or if it
- // is a multiple imports
+ if (m_records.size() == 1 || m_aggregate) { // If the service is the first one, or if it is a multiple imports
rec.m_svcObject = m_origine.getService(rec.m_ref);
rec.m_reg = m_destination.registerService(m_specification, rec.m_svcObject, getProps(rec.m_ref));
}
@@ -321,14 +315,12 @@
}
m_records.removeAll(l);
- // Check the validity & if we need to reimport the service
+ // Check the validity & if we need to re-import the service
if (m_records.size() > 0) {
// There is other available services
if (!m_aggregate) { // Import the next one
Record rec = (Record) m_records.get(0);
- if (rec.m_svcObject == null) { // It is the first service who
- // disappears - create the next
- // one
+ if (rec.m_svcObject == null) { // It is the first service which disappears - create the next one
rec.m_svcObject = m_origine.getService(rec.m_ref);
rec.m_reg = m_destination.registerService(m_specification, rec.m_svcObject, getProps(rec.m_ref));
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java
index b8d967b..c1a4094 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java
@@ -18,9 +18,9 @@
*/
package org.apache.felix.ipojo.composite.service.instantiator;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.felix.ipojo.ComponentInstance;
@@ -30,7 +30,7 @@
import org.osgi.framework.ServiceReference;
/**
- * Description of the Service Instantiator Handler.
+ * Description of the Service Creator Handler.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -69,7 +69,7 @@
state = "resolved";
}
service.addAttribute(new Attribute("State", state));
- HashMap map = inst.getUsedReferences();
+ Map map = inst.getUsedReferences();
Set keys = map.keySet();
Iterator it = keys.iterator();
while (it.hasNext()) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorHandler.java
index 7c987bf..babcf56 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorHandler.java
@@ -115,7 +115,7 @@
/**
* Check the handler validity.
- * @return true if oall created service isntance are valid
+ * @return true if all created service instances are valid
* @see org.apache.felix.ipojo.CompositeHandler#isValid()
*/
public boolean isValid() {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
index a69dab6..6570fa9 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
@@ -22,6 +22,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -37,7 +38,7 @@
import org.osgi.framework.ServiceReference;
/**
- * Manage a service instantiation. This service create componenet instance
+ * Manage a service instantiation. This service create component instance
* providing the required service specification.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
@@ -57,7 +58,7 @@
/**
* Map of factory references => instance or NO_INSTANCE.
*/
- private HashMap /* ServiceReference */m_usedRef = new HashMap();
+ private Map /* ServiceReference */m_usedRef = new HashMap();
/**
* Does we instantiate several provider ?
@@ -95,8 +96,8 @@
* @param h : the handler.
* @param spec : required specification.
* @param conf : instance configuration.
- * @param isAgg : is the svc instance an aggregate service ?
- * @param isOpt : is the svc instance optional ?
+ * @param isAgg : is the service instance an aggregate service ?
+ * @param isOpt : is the service instance optional ?
* @param filt : LDAP filter
*/
public SvcInstance(ServiceInstantiatorHandler h, String spec, Dictionary conf, boolean isAgg, boolean isOpt, String filt) {
@@ -123,7 +124,7 @@
e.printStackTrace(); // Should not happens
}
- // Init the instances
+ // Initialize the instances
if (m_usedRef.size() > 0) {
Set keys = m_usedRef.keySet();
Iterator it = keys.iterator();
@@ -234,10 +235,10 @@
}
/**
- * Init the list of available factory.
+ * Initialize the list of available factory.
*/
public void initFactoryList() {
- // Init factory list
+ // Initialize factory list
try {
ServiceReference[] refs = m_context.getServiceReferences(Factory.class.getName(), m_filterStr);
if (refs == null) {
@@ -246,7 +247,7 @@
for (int i = 0; i < refs.length; i++) {
ServiceReference ref = refs[i];
Factory fact = (Factory) m_context.getService(ref);
- // Check provided spec & conf
+ // Check provided specification & configuration
if (match(fact)) {
m_usedRef.put(ref, null);
}
@@ -259,7 +260,7 @@
}
/**
- * Check if the service isntance is statisfed.
+ * Check if the service instance is satisfed.
* @return true if the service instance if satisfied.
*/
public boolean isSatisfied() {
@@ -273,7 +274,7 @@
* @return true if the factory match, false otherwise.
*/
private boolean match(Factory fact) {
- // Check if the factory can provide the spec
+ // Check if the factory can provide the specification
Element[] provides = fact.getDescription().getElements("provides");
for (int i = 0; i < provides.length; i++) {
if (provides[i].getAttribute("specification").equals(m_specification)) {
@@ -356,7 +357,7 @@
return;
}
if (ev.getType() == ServiceEvent.UNREGISTERING) {
- // Remove the ref is contained
+ // Remove the reference is contained
Object o = m_usedRef.remove(ev.getServiceReference());
if (o != null) {
stopInstance(ev.getServiceReference());
@@ -384,10 +385,10 @@
}
/**
- * Get the map of used references [ref, component instance].
+ * Get the map of used references [reference, component instance].
* @return the map of used references.
*/
- protected HashMap getUsedReferences() {
+ protected Map getUsedReferences() {
return m_usedRef;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java
index c30dd5e..4202643 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java
@@ -19,7 +19,7 @@
package org.apache.felix.ipojo.composite.service.provides;
/**
- * Exception throwed when a composition error occurs.
+ * Exception occurs when a composition error occurs.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -44,7 +44,7 @@
}
/**
- * Get the excepttion message.
+ * Get the exception message.
* @return the message.
* @see java.lang.Throwable#getMessage()
*/
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
index 4b8b2e1..25e6875 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java
@@ -38,7 +38,7 @@
import org.osgi.framework.ServiceReference;
/**
- * Check and build a compostion, i.e. a pojo containing the composition.
+ * Check and build a composition, i.e. a POJO containing the composition.
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class CompositionMetadata {
@@ -214,7 +214,7 @@
FieldMetadata field = ((Mapping) availableSvcMethods.get(met)).getField();
field.setUseful(true);
method.setDelegation(field);
- // Test optionality
+ // Test optional
if (field.isOptional() && !method.getExceptions().contains("java/lang/UnsupportedOperationException")) {
m_handler.getManager().getFactory().getLogger().log(Logger.WARNING, "The method " + method.getMethodName() + " could not be provided correctly : the specification " + field.getSpecification().getName() + " is optional");
}
@@ -222,7 +222,7 @@
}
}
if (!found) {
- throw new CompositionException("Unconsistent composition - the method " + method.getMethodName() + " could not be delegated");
+ throw new CompositionException("Inconsistent composition - the method " + method.getMethodName() + " could not be delegated");
}
}
}
@@ -311,7 +311,7 @@
}
/**
- * Get the method lsit contained in the implemented specification.
+ * Get the method list contained in the implemented specification.
* @return the List of implemented method.
*/
private List getMethodList() {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java
index a5491d3..97fddd9 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java
@@ -19,6 +19,7 @@
package org.apache.felix.ipojo.composite.service.provides;
import java.util.ArrayList;
+import java.util.List;
import org.apache.felix.ipojo.handlers.dependency.nullable.MethodSignature;
@@ -51,15 +52,15 @@
/**
* List of arguments.
*/
- private ArrayList/* <String> */m_arguments = new ArrayList/* <String> */();
+ private List/* <String> */m_arguments = new ArrayList/* <String> */();
/**
* List of exceptions.
*/
- private ArrayList/* <String> */m_exceptions = new ArrayList/* <String> */();
+ private List/* <String> */m_exceptions = new ArrayList/* <String> */();
/**
- * Delegator field.
+ * Delegation field.
*/
private FieldMetadata m_delegation;
@@ -94,11 +95,11 @@
m_exceptions.add(exception);
}
- public ArrayList/* <String> */getArguments() {
+ public List/* <String> */getArguments() {
return m_arguments;
}
- public ArrayList/* <String> */getExceptions() {
+ public List/* <String> */getExceptions() {
return m_exceptions;
}
@@ -106,8 +107,6 @@
return m_methodName;
}
-
-
public void setDelegation(FieldMetadata dm) {
m_delegation = dm;
}
@@ -133,16 +132,12 @@
}
}
-// for (int i = 0; i < m_exceptions.size(); i++) {
-// if (! mm.getExceptions().contains(m_exceptions.get(i))) { return false; }
-// }
-
return true;
}
/**
* Equals method for Method Signature.
- * @param ms : the method signatur to compare.
+ * @param ms : the method signature to compare.
* @return true if the given method signature is equals to the current method metadata.
*/
public boolean equals(MethodSignature ms) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
index d960bca..1e529dd 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java
@@ -33,7 +33,7 @@
import org.objectweb.asm.Type;
/**
- * Create the proxy class.
+ * Create the Proxy class.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -75,7 +75,7 @@
}
/**
- * Return the proxy classname for the contract contractname by delegating on available service.
+ * Return the proxy 'classname' for the contract 'contractname' by delegating on available service.
* @param url URL of the needed contract
* @param contractName : The interface to implement
* @param className : The class name to create
@@ -141,19 +141,6 @@
e.printStackTrace();
}
- // Write the class :
-// try {
-// FileOutputStream fos = new FileOutputStream(
-// "F:\\dev\\workspaces\\iPOJO_dev\\Test_Manipulator\\manipulated\\org\\apache\\felix\\ipojo\\test\\scenarios\\component\\"
-// + className.replace('/', '.') + ".class");
-//
-// fos.write(b);
-//
-// fos.close();
-// } catch (Exception e) {
-// System.err.println("Exception : " + e.getMessage());
-// }
-
return b;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
index 164c5bc..3b24bd2 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
@@ -54,7 +54,7 @@
/**
* List of managed services.
*/
- private ArrayList m_managedServices = new ArrayList();
+ private List m_managedServices = new ArrayList();
/**
* Handler validity. False if
@@ -64,7 +64,7 @@
/**
* List of component type.
*/
- private ArrayList m_types;
+ private List m_types;
/**
* Configure the handler.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
index 4e5952c..bc101fc 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
@@ -23,6 +23,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
+import java.util.List;
import org.apache.felix.ipojo.handlers.dependency.nullable.MethodSignature;
import org.apache.felix.ipojo.handlers.dependency.nullable.MethodSignatureVisitor;
@@ -45,10 +46,10 @@
/**
* List of the method contained in the specification.
*/
- private ArrayList/* <MethodMetadata> */m_methods = new ArrayList/* <MethodMetadata> */();
+ private List/* <MethodMetadata> */m_methods = new ArrayList/* <MethodMetadata> */();
/**
- * Is the specificatino an aggregate?
+ * Is the specification an aggregate?
*/
private boolean m_isAggregate;
@@ -72,37 +73,6 @@
*/
private ProvidedServiceHandler m_handler;
- public String getName() {
- return m_name;
- }
-
- public ArrayList/* <MethodMetadata> */getMethods() {
- return m_methods;
- }
-
- /**
- * Add a method metadata to the current specification.
- * @param mm : the method metadata to add.
- */
- public void addMethod(MethodMetadata mm) {
- m_methods.add(mm);
- }
-
- /**
- * Get a method by its name.
- * @param name : method name
- * @return the method metadata contained in the current specification with the given name. Null if the method is not found.
- */
- public MethodMetadata getMethodByName(String name) {
- for (int i = 0; i < m_methods.size(); i++) {
- MethodMetadata met = (MethodMetadata) m_methods.get(i);
- if (met.getMethodName().equals(name)) {
- return met;
- }
- }
- return null;
- }
-
/**
* Constructor.
* @param name : specification name.
@@ -114,7 +84,7 @@
public SpecificationMetadata(String name, BundleContext bc, boolean isAggregate, boolean isOptional, ProvidedServiceHandler psd) {
m_name = name;
m_handler = psd;
-
+
// Populate methods :
URL url = bc.getBundle().getResource(name.replace('.', '/') + ".class");
InputStream is = null;
@@ -130,13 +100,13 @@
m_handler.getManager().getFactory().getLogger().log(Logger.ERROR, "Cannot open " + name + " : " + e.getMessage());
return;
}
-
+
MethodSignature[] containsMethods = msv.getMethods();
for (int i = 0; i < containsMethods.length; i++) {
MethodSignature met = containsMethods[i];
String desc = met.getDesc();
MethodMetadata method = new MethodMetadata(met.getName(), desc);
-
+
Type[] args = Type.getArgumentTypes(desc);
String[] exceptionClasses = met.getException();
for (int j = 0; j < args.length; j++) {
@@ -145,14 +115,14 @@
for (int j = 0; j < exceptionClasses.length; j++) {
method.addException(exceptionClasses[j]);
}
-
+
addMethod(method);
}
-
+
m_isAggregate = isAggregate;
m_isOptional = isOptional;
}
-
+
/**
* Constructor.
* @param c : class
@@ -177,12 +147,43 @@
for (int j = 0; j < exceptionClasses.length; j++) {
method.addException(exceptionClasses[j].getName());
}
-
+
addMethod(method);
}
m_isInterface = false;
}
+ public String getName() {
+ return m_name;
+ }
+
+ public List/* <MethodMetadata> */getMethods() {
+ return m_methods;
+ }
+
+ /**
+ * Add a method metadata to the current specification.
+ * @param mm : the method metadata to add.
+ */
+ public void addMethod(MethodMetadata mm) {
+ m_methods.add(mm);
+ }
+
+ /**
+ * Get a method by its name.
+ * @param name : method name
+ * @return the method metadata contained in the current specification with the given name. Null if the method is not found.
+ */
+ public MethodMetadata getMethodByName(String name) {
+ for (int i = 0; i < m_methods.size(); i++) {
+ MethodMetadata met = (MethodMetadata) m_methods.get(i);
+ if (met.getMethodName().equals(name)) {
+ return met;
+ }
+ }
+ return null;
+ }
+
public boolean isAggregate() {
return m_isAggregate;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
index a16ee6a..0dc93df 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Enumeration;
+import java.util.List;
import java.util.Properties;
import org.apache.felix.ipojo.Handler;
@@ -123,7 +124,7 @@
Element[] configurables = confs[0].getElements("Property");
- ArrayList ff = new ArrayList();
+ List ff = new ArrayList();
for (int i = 0; i < configurables.length; i++) {
String fieldName = null;
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 e34a917..0f2882b 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
@@ -21,6 +21,7 @@
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
+import java.util.Map;
import org.apache.felix.ipojo.InstanceManager;
import org.apache.felix.ipojo.util.Logger;
@@ -201,8 +202,8 @@
* Build the map [service object, service reference] of used services.
* @return the used service.
*/
- public HashMap getUsedServices() {
- HashMap hm = new HashMap();
+ public Map getUsedServices() {
+ Map hm = new HashMap();
if (m_isAggregate) {
for (int i = 0; i < m_ref.length; i++) {
if (i < m_services.length) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
index 98b126b..eb31f9a 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
@@ -19,6 +19,7 @@
package org.apache.felix.ipojo.handlers.dependency;
import java.util.HashMap;
+import java.util.Map;
import org.osgi.framework.ServiceReference;
@@ -54,25 +55,15 @@
private String m_filter;
/**
- * Hashmap [Instance reference, service reference] of the used service.
+ * Map [Instance reference, service reference] of the used service.
*/
- private HashMap m_usedServices = new HashMap();
+ private Map m_usedServices = new HashMap();
/**
* The list of service reference.
*/
private ServiceReference[] m_serviceReferences;
- public boolean isMultiple() { return m_multiple; }
-
- public boolean isOptional() { return m_optional; }
-
- public String getFilter() { return m_filter; }
-
- public String getInterface() { return m_interface; }
-
- public int getState() { return m_state; }
-
/**
* Constructor.
* @param itf : the needed itf
@@ -91,6 +82,16 @@
m_serviceReferences = new ServiceReference[0];
}
+ public boolean isMultiple() { return m_multiple; }
+
+ public boolean isOptional() { return m_optional; }
+
+ public String getFilter() { return m_filter; }
+
+ public String getInterface() { return m_interface; }
+
+ public int getState() { return m_state; }
+
/**
* Get the service refrence array.
* @return the array of service reference (only if the cardinality could be n).
@@ -111,15 +112,15 @@
/**
* Get the used service map.
- * @return the hashmap [object reference, service reference] containing the used services
+ * @return the map [object reference, service reference] containing the used services
*/
- public HashMap getUsedServices() { return m_usedServices; }
+ public Map getUsedServices() { return m_usedServices; }
/**
* Set the usedServices.
* @param hm : the new usedService
*/
- public void setUsedServices(HashMap hm) {
+ public void setUsedServices(Map hm) {
m_usedServices = hm;
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
index 2a64910..b468b13 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
@@ -48,9 +49,9 @@
private String[] m_itfs = new String[0];
/**
- * Field hashmap [field name, type] discovered in the component class.
+ * Field map [field name, type] discovered in the component class.
*/
- private HashMap m_fields = new HashMap();
+ private Map m_fields = new HashMap();
/**
* Method List of method descriptor discovered in the component class.
@@ -206,9 +207,9 @@
/**
* Get collected fields.
- * @return the field hashmap [field_name, type].
+ * @return the field map [field_name, type].
*/
- public HashMap getFields() {
+ public Map getFields() {
return m_fields;
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
index c0af374..419e324 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
@@ -42,6 +42,36 @@
public static final int SEVERE = 2;
/**
+ * Activator internal package name.
+ */
+ protected static final String IPOJO_INTERNAL_PACKAGE_NAME = "org/apache/felix/ipojo/";
+
+ /**
+ * Ipojo internal package name for internal descriptor.
+ */
+ protected static final String IPOJO_INTERNAL_DESCRIPTOR = "L" + IPOJO_INTERNAL_PACKAGE_NAME;
+
+ /**
+ * iPOJO Package name.
+ */
+ protected static final String IPOJO_PACKAGE_NAME = "org.apache.felix.ipojo";
+
+ /**
+ * Helper array for bytecode manipulation of primitive type.
+ */
+ protected static final String[][] PRIMITIVE_BOXING_INFORMATION = new String[][] {
+ { "V", "ILLEGAL", "ILLEGAL" },
+ { "Z", "java/lang/Boolean", "booleanValue" },
+ { "C", "java/lang/Character", "charValue" },
+ { "B", "java/lang/Byte", "byteValue" },
+ { "S", "java/lang/Short", "shortValue" },
+ { "I", "java/lang/Integer", "intValue" },
+ { "F", "java/lang/Float", "floatValue" },
+ { "J", "java/lang/Long", "longValue" },
+ { "D", "java/lang/Double", "doubleValue" }
+ };
+
+ /**
* Internal logger implementation.
*/
protected static class Logger {
@@ -62,6 +92,9 @@
case SEVERE:
System.err.println("[SEVERE] " + message);
break;
+ default:
+ System.err.println("[SEVERE] " + message);
+ break;
}
}
}
@@ -76,6 +109,7 @@
* Default logger level.
*/
private static int m_logLevel = WARNING;
+
/**
* Get the manipulator logger.
@@ -87,34 +121,4 @@
}
return m_logger;
}
-
- /**
- * iPOJO Package name.
- */
- protected static final String IPOJO_PACKAGE_NAME = "org.apache.felix.ipojo";
-
- /**
- * Activator internal package name.
- */
- protected static final String IPOJO_INTERNAL_PACKAGE_NAME = "org/apache/felix/ipojo/";
-
- /**
- * Ipojo internal package name for internal descriptor.
- */
- protected static final String IPOJO_INTERNAL_DESCRIPTOR = "L" + IPOJO_INTERNAL_PACKAGE_NAME;
-
- /**
- * Helper array for bytecode manipulation of primitive type.
- */
- protected static final String[][] PRIMITIVE_BOXING_INFORMATION = new String[][] { { "V", "ILLEGAL", "ILLEGAL" }, // Void type [0]
- { "Z", "java/lang/Boolean", "booleanValue" }, // boolean [1]
- { "C", "java/lang/Character", "charValue" }, // char [2]
- { "B", "java/lang/Byte", "byteValue" }, // byte [3]
- { "S", "java/lang/Short", "shortValue" }, // short [4]
- { "I", "java/lang/Integer", "intValue" }, // int [5]
- { "F", "java/lang/Float", "floatValue" }, // float [6]
- { "J", "java/lang/Long", "longValue" }, // long [7]
- { "D", "java/lang/Double", "doubleValue" } // double [8]
- };
-
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index ca51a7d..bcd32c1 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -28,6 +28,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
@@ -43,7 +44,7 @@
/**
* Store the visited fields : [name fo the field, type of the field].
*/
- private HashMap m_fields = new HashMap();
+ private Map m_fields = new HashMap();
/**
* Store the interface implemented by the class.
@@ -95,7 +96,7 @@
// Get interface and remove POJO interface is presents
String[] its = ck.getInterfaces();
- ArrayList l = new ArrayList();
+ List l = new ArrayList();
for (int i = 0; i < its.length; i++) {
l.add(its[i]);
}
@@ -168,7 +169,7 @@
// Get interface and remove POJO interface is presents
String[] its = ck.getInterfaces();
- ArrayList l = new ArrayList();
+ List l = new ArrayList();
for (int i = 0; i < its.length; i++) {
l.add(its[i]);
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
index d9c2095..aeb5942 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
@@ -60,7 +60,7 @@
/**
* Getter/Setter methods creator.
*/
- FieldAdapter m_getterSetterCreator = new FieldAdapter(cv);
+ private FieldAdapter m_getterSetterCreator = new FieldAdapter(cv);
/**
* Constructor.
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
index a56f198..fd2e80d 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
@@ -76,10 +76,10 @@
/**
* Class map (jar entry, byte[]).
*/
- private HashMap m_classes = new HashMap();
+ private Map m_classes = new HashMap();
/**
- * Referendec packages by the composite.
+ * Referenced packages by the composite.
*/
private List m_referredPackages;