Decreases the log level of some messages (WARNING => INFO, INFO => DEBUG) reducing the number of useless traces.
Adds the dependency id to the instance description.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@710023 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 aa29369..4030075 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
@@ -301,8 +301,8 @@
String imm = m_componentMetadata.getAttribute("immediate");
if (imm == null) { // immediate not specified, set the immediate attribute to true
getLogger().log(
- Logger.WARNING,
- "The component " + getFactoryName()
+ Logger.INFO,
+ "The component type " + getFactoryName()
+ " becomes immediate");
m_componentMetadata.addAttribute(new Attribute("immediate",
"true"));
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 abe9db5..cf47054 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
@@ -234,7 +234,7 @@
}
ManagedAbstractFactoryType mft = new ManagedAbstractFactoryType(clazz, type, bundle);
m_factoryTypes.add(mft);
- m_logger.log(Logger.INFO, "New factory type available: " + type);
+ m_logger.log(Logger.DEBUG, "New factory type available: " + type);
for (int j = m_unboundTypes.size() - 1; j >= 0; j--) {
UnboundComponentType unbound = (UnboundComponentType) m_unboundTypes.get(j);
@@ -393,7 +393,7 @@
// If not found, return. It will wait for a new component type factory.
if (factoryType == null) {
- m_logger.log(Logger.WARNING, "Type of component not yet recognized : " + metadata.getName());
+ m_logger.log(Logger.WARNING, "Type of component not available: " + metadata.getName());
m_unboundTypes.add(new UnboundComponentType(metadata.getName(), metadata, bundle));
return;
}
@@ -606,7 +606,7 @@
public synchronized void addBundle(Bundle bundle) {
m_bundles.add(bundle);
notifyAll(); // Notify the thread to force the process.
- m_logger.log(Logger.INFO, "Creator thread is going to analyze the bundle " + bundle.getBundleId() + " List : " + m_bundles);
+ m_logger.log(Logger.DEBUG, "Creator thread is going to analyze the bundle " + bundle.getBundleId() + " List : " + m_bundles);
}
/**
@@ -636,7 +636,7 @@
* @see java.lang.Runnable#run()
*/
public void run() {
- m_logger.log(Logger.INFO, "Creator thread is starting");
+ m_logger.log(Logger.DEBUG, "Creator thread is starting");
boolean started;
synchronized (this) {
started = m_started;
@@ -646,14 +646,14 @@
synchronized (this) {
while (m_started && m_bundles.isEmpty()) {
try {
- m_logger.log(Logger.INFO, "Creator thread is waiting - Nothing to do");
+ m_logger.log(Logger.DEBUG, "Creator thread is waiting - Nothing to do");
wait();
} catch (InterruptedException e) {
// Interruption, re-check the condition
}
}
if (!m_started) {
- m_logger.log(Logger.INFO, "Creator thread is stopping");
+ m_logger.log(Logger.DEBUG, "Creator thread is stopping");
return; // The thread must be stopped immediately.
} else {
// The bundle list is not empty, get the bundle.
@@ -664,7 +664,7 @@
}
}
// Process ...
- m_logger.log(Logger.INFO, "Creator thread is processing " + bundle.getBundleId());
+ m_logger.log(Logger.DEBUG, "Creator thread is processing " + bundle.getBundleId());
try {
startManagementFor(bundle);
} catch (Throwable e) {
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 5d96c33..9e14cd5 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
@@ -103,6 +103,15 @@
public final void info(String message) {
getLogger().log(Logger.INFO, message);
}
+
+ /**
+ * Log method (debug).
+ * Log a debug message to the handler logger.
+ * @param message the message to log
+ */
+ public final void debug(String message) {
+ getLogger().log(Logger.DEBUG, message);
+ }
/**
* Log method (warning).
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java
index 5578170..a5f6c7e 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java
@@ -59,7 +59,7 @@
* @see org.apache.felix.ipojo.Handler#start()
*/
public void start() {
- info("Start architecture handler with " + m_name + " name");
+ debug("Start architecture handler with " + m_name + " name");
}
/**
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 4b1177c..f229a44 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
@@ -309,7 +309,7 @@
* @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary)
*/
public synchronized void reconfigure(Dictionary configuration) {
- warn(getInstanceManager().getInstanceName() + " is reconfiguring the properties : " + configuration);
+ info(getInstanceManager().getInstanceName() + " is reconfiguring the properties : " + configuration);
Properties props = reconfigureProperties(configuration);
propagate(props, m_propagatedFromInstance);
m_propagatedFromInstance = props;
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 c8f5bfd..997b3b8 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
@@ -40,6 +40,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.SynchronousBundleListener;
/**
* Represent a service dependency of the component instance.
@@ -336,12 +337,16 @@
}
super.start();
+ // Once the dependency is started, access to fields must be synchronized.
+ synchronized (this) {
+ if (getBindingPolicy() == STATIC_BINDING_POLICY && m_handler.getInstanceManager().getPojoObjects() != null) {
+ m_isFrozen = true;
+ }
- if (getBindingPolicy() == STATIC_BINDING_POLICY && m_handler.getInstanceManager().getPojoObjects() != null) {
- m_isFrozen = true;
+ m_isStarted = true;
}
-
- m_isStarted = true;
+
+
}
protected DependencyCallback[] getCallbacks() {
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 1297b57..b79f41f 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
@@ -32,6 +32,11 @@
* Required Service Interface.
*/
private String m_interface;
+
+ /**
+ * Dependency Id.
+ */
+ private String m_id;
/**
* Is the dependency aggregate?
@@ -90,21 +95,23 @@
private List m_serviceReferences;
/**
- * Constructor.
- * @param itf : the needed interface
- * @param multiple : is the dependency a multiple dependency ?
- * @param optional : is the dependency optional ?
- * @param filter : the filter
- * @param policy : binding policy
- * @param nullable : does the dependency support nullable object
- * @param defaultImpl : does the dependency use a default implementation
- * @param comparator : does the dependency use a special comparator
- * @param frozen : is the provider set frozen
- * @param state : the state
+ * Creates a dependency description.
+ * @param itf the needed interface
+ * @param id the dependency id.
+ * @param multiple is the dependency a multiple dependency ?
+ * @param optional is the dependency optional ?
+ * @param filter the filter
+ * @param policy binding policy
+ * @param nullable does the dependency support nullable object
+ * @param defaultImpl does the dependency use a default implementation
+ * @param comparator does the dependency use a special comparator
+ * @param frozen is the provider set frozen
+ * @param state the state
*/
- public DependencyDescription(String itf, boolean multiple, boolean optional, String filter, int policy, boolean nullable, String defaultImpl, String comparator, boolean frozen, int state) {
+ public DependencyDescription(String itf, String id, boolean multiple, boolean optional, String filter, int policy, boolean nullable, String defaultImpl, String comparator, boolean frozen, int state) {
super();
m_interface = itf;
+ m_id = id;
m_aggregate = multiple;
m_optional = optional;
m_filter = filter;
@@ -126,6 +133,8 @@
public int getState() { return m_state; }
+ public String getId() { return m_id; }
+
/**
* Gets true if the dependency uses Nullable objects.
* @return true if the dependency is optional and supports nullable object.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
index b65e455..56237a3 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
@@ -180,7 +180,7 @@
for (int i = 0; callbacks != null && i < callbacks.length; i++) {
MethodMetadata[] mets = manipulation.getMethods(callbacks[i].getMethodName());
if (mets.length == 0) {
- info("A requirement callback " + callbacks[i].getMethodName() + " does not exist in the implementation class, will try the super classes");
+ debug("A requirement callback " + callbacks[i].getMethodName() + " does not exist in the implementation class, will try the super classes");
} else {
if (mets[0].getMethodArguments().length > 2) {
throw new ConfigurationException("Requirement Callback : A requirement callback "
@@ -258,7 +258,7 @@
throw new ConfigurationException("Cannot discover the required specification for " + dep.getField());
} else {
// If the specification is different, warn that we will override it.
- warn("Cannot discover the required specification for " + dep.getField());
+ info("Cannot discover the required specification for " + dep.getField());
}
}
} else { // In all other case, className is not null.
@@ -483,7 +483,7 @@
Dependency dep = getDependencies()[j];
// Create & add the dependency description
DependencyDescription desc =
- new DependencyDescription(dep.getSpecification().getName(), dep.isAggregate(), dep.isOptional(), dep.getFilter(), dep.getBindingPolicy(), dep.supportsNullable(), dep.getDefaultImplementation(), dep.getComparator(), dep.isFrozen(), dep.getState());
+ new DependencyDescription(dep.getSpecification().getName(), dep.getId(), dep.isAggregate(), dep.isOptional(), dep.getFilter(), dep.getBindingPolicy(), dep.supportsNullable(), dep.getDefaultImplementation(), dep.getComparator(), dep.isFrozen(), dep.getState());
desc.setServiceReferences(dep.getServiceReferencesAsList());
desc.setUsedServices(dep.getUsedServiceReferences());
dhd.addDependency(desc);
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java
index 79e8f70..4da77ad 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java
@@ -94,6 +94,7 @@
}
Element dep = new Element("Requires", "");
dep.addAttribute(new Attribute("Specification", m_dependencies[i].getInterface()));
+ dep.addAttribute(new Attribute("Id", m_dependencies[i].getId()));
if (m_dependencies[i].getFilter() != null) {
dep.addAttribute(new Attribute("Filter", m_dependencies[i].getFilter()));