package org.apache.felix.dm.impl.dependencies;

import org.apache.felix.dm.dependencies.Dependency;
import org.apache.felix.dm.impl.InvocationUtil;
import org.apache.felix.dm.impl.Logger;

public abstract class DependencyBase implements Dependency, DependencyActivation {
    private boolean m_isRequired;
    private boolean m_isInstanceBound;
    protected final Logger m_logger;

    public DependencyBase(Logger logger) {
        m_logger = logger;
    }

    public synchronized boolean isRequired() {
        return m_isRequired;
    }
    
    protected synchronized void setIsRequired(boolean isRequired) {
        m_isRequired = isRequired;
    }
    
    public final boolean isInstanceBound() {
        return m_isInstanceBound;
    }

    public final void setIsInstanceBound(boolean isInstanceBound) {
        m_isInstanceBound = isInstanceBound;
    }
    
    protected void invokeCallbackMethod(Object[] instances, String methodName, Class[][] signatures, Object[][] parameters) {
        for (int i = 0; i < instances.length; i++) {
        	try {
                InvocationUtil.invokeCallbackMethod(instances[i], methodName, signatures, parameters);
            }
            catch (NoSuchMethodException e) {
                // if the method does not exist, ignore it
            }
            catch (Exception e) {
                m_logger.log(Logger.LOG_WARNING, "Invocation of '" + methodName + "' failed.", e);
            }
        }
    }
}

@@ -41,16 +41,69 @@
 ncies;%0A%0A
+import java.lang.reflect.InvocationTargetException;%0A%0A
 import o
@@ -1366,16 +1366,32 @@
  catch (
+InvocationTarget
 Exceptio
@@ -1389,32 +1389,98 @@
 tException e) %7B%0A
+                // the method itself threw an exception, log that%0A
                 
@@ -1557,16 +1557,170 @@
 ailed.%22,
+ e.getCause());%0A            %7D%0A            catch (Exception e) %7B%0A                m_logger.log(Logger.LOG_WARNING, %22Could not invoke '%22 + methodName + %22'.%22,
  e);%0A   

Made the logging of invocation target exceptions more explicit.