felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r661839 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/
Date Fri, 30 May 2008 19:56:02 GMT
Author: fmeschbe
Date: Fri May 30 12:56:02 2008
New Revision: 661839

URL: http://svn.apache.org/viewvc?rev=661839&view=rev
Log:
FELIX-579 Modified logging calls by adding an AbstractComponentManager.log method, which
checks whether the BundleComponentActivator is not null before calling the log method

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
Fri May 30 12:56:02 2008
@@ -69,7 +69,7 @@
         m_state = STATE_DISABLED;
         m_dependencyManagers = new ArrayList();
 
-        getActivator().log( LogService.LOG_DEBUG, "Component created", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Component created", m_componentMetadata, null );
     }
 
 
@@ -147,8 +147,7 @@
      */
     public final void reconfigure()
     {
-        getActivator().log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure",
m_componentMetadata,
-            null );
+        log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure", m_componentMetadata,
null );
         reactivate();
     }
 
@@ -259,7 +258,8 @@
     {
         if ( m_dependencyManagers != null && m_dependencyManagers.size() > 0 )
         {
-            return (org.apache.felix.scr.Reference[] ) m_dependencyManagers.toArray( new
Reference[m_dependencyManagers.size()] );
+            return ( org.apache.felix.scr.Reference[] ) m_dependencyManagers
+                .toArray( new Reference[m_dependencyManagers.size()] );
         }
 
         return null;
@@ -310,17 +310,16 @@
 
         if ( getState() == STATE_DESTROYED )
         {
-            getActivator().log( LogService.LOG_ERROR, "Destroyed Component cannot be enabled",
m_componentMetadata,
-                null );
+            log( LogService.LOG_ERROR, "Destroyed Component cannot be enabled", m_componentMetadata,
null );
             return;
         }
         else if ( getState() != STATE_DISABLED )
         {
-            getActivator().log( LogService.LOG_DEBUG, "Component is already enabled", m_componentMetadata,
null );
+            log( LogService.LOG_DEBUG, "Component is already enabled", m_componentMetadata,
null );
             return;
         }
 
-        getActivator().log( LogService.LOG_DEBUG, "Enabling component", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Enabling component", m_componentMetadata, null );
 
         try
         {
@@ -342,14 +341,14 @@
             // enter enabled state before trying to activate
             setState( STATE_ENABLED );
 
-            getActivator().log( LogService.LOG_DEBUG, "Component enabled", m_componentMetadata,
null );
+            log( LogService.LOG_DEBUG, "Component enabled", m_componentMetadata, null );
 
             // immediately activate the compopnent, no need to schedule again
             activateInternal();
         }
         catch ( Exception ex )
         {
-            getActivator().log( LogService.LOG_ERROR, "Failed enabling Component", m_componentMetadata,
ex );
+            log( LogService.LOG_ERROR, "Failed enabling Component", m_componentMetadata,
ex );
 
             // ensure we get back to DISABLED state
             // immediately disable, no need to schedule again
@@ -384,13 +383,13 @@
             // we cannot activate if the component activator is shutting down
             if ( !isActive() )
             {
-                getActivator().log( LogService.LOG_DEBUG,
-                    "Component cannot be activated because the Activator is being disposed",
m_componentMetadata, null );
+                log( LogService.LOG_DEBUG, "Component cannot be activated because the Activator
is being disposed",
+                    m_componentMetadata, null );
                 setState( STATE_UNSATISFIED );
                 return;
             }
 
-            getActivator().log( LogService.LOG_DEBUG, "Activating component", m_componentMetadata,
null );
+            log( LogService.LOG_DEBUG, "Activating component", m_componentMetadata, null
);
 
             // Before creating the implementation object, we are going to
             // test if all the mandatory dependencies are satisfied
@@ -407,8 +406,7 @@
                 if ( !dm.isSatisfied() )
                 {
                     // at least one dependency is not satisfied
-                    getActivator().log( LogService.LOG_INFO, "Dependency not satisfied: "
+ dm.getName(),
-                        m_componentMetadata, null );
+                    log( LogService.LOG_INFO, "Dependency not satisfied: " + dm.getName(),
m_componentMetadata, null );
                     setState( STATE_UNSATISFIED );
                 }
 
@@ -427,7 +425,7 @@
             if ( !createComponent() )
             {
                 // component creation failed, not active now
-                getActivator().log( LogService.LOG_ERROR, "Component instance could not be
created, activation failed",
+                log( LogService.LOG_ERROR, "Component instance could not be created, activation
failed",
                     m_componentMetadata, null );
 
                 // set state to unsatisfied
@@ -449,13 +447,13 @@
         try
         {
             m_serviceRegistration = registerComponentService();
-            getActivator().log( LogService.LOG_DEBUG, "Component activated", m_componentMetadata,
null );
+            log( LogService.LOG_DEBUG, "Component activated", m_componentMetadata, null );
         }
         catch ( IllegalStateException ise )
         {
             // thrown by service registration if the bundle is stopping
             // we just log this at debug level but ignore it
-            getActivator().log( LogService.LOG_DEBUG, "Component activation failed while
registering the service",
+            log( LogService.LOG_DEBUG, "Component activation failed while registering the
service",
                 m_componentMetadata, ise );
         }
 
@@ -483,7 +481,7 @@
             return;
         }
 
-        getActivator().log( LogService.LOG_DEBUG, "Deactivating component", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Deactivating component", m_componentMetadata, null );
 
         // 0.- Remove published services from the registry
         unregisterComponentService();
@@ -498,7 +496,7 @@
         // reset to state UNSATISFIED
         setState( STATE_UNSATISFIED );
 
-        getActivator().log( LogService.LOG_DEBUG, "Component deactivated", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Component deactivated", m_componentMetadata, null );
     }
 
 
@@ -510,7 +508,7 @@
         // deactivate first, this does nothing if not active/registered/factory
         deactivateInternal();
 
-        getActivator().log( LogService.LOG_DEBUG, "Disabling component", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Disabling component", m_componentMetadata, null );
 
         // close all service listeners now, they are recreated on enable
         // Stop the dependency managers to listen to events...
@@ -525,7 +523,7 @@
         // we are now disabled, ready for re-enablement or complete destroyal
         setState( STATE_DISABLED );
 
-        getActivator().log( LogService.LOG_DEBUG, "Component disabled", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Component disabled", m_componentMetadata, null );
     }
 
 
@@ -543,7 +541,7 @@
         // this component must not be used any more
         setState( STATE_DESTROYED );
 
-        getActivator().log( LogService.LOG_DEBUG, "Component disposed", m_componentMetadata,
null );
+        log( LogService.LOG_DEBUG, "Component disposed", m_componentMetadata, null );
 
         // release references (except component metadata for logging purposes)
         m_activator = null;
@@ -615,7 +613,7 @@
     {
         if ( getComponentMetadata().getServiceMetadata() != null )
         {
-            getActivator().log( LogService.LOG_DEBUG, "registering services", getComponentMetadata(),
null );
+            log( LogService.LOG_DEBUG, "registering services", getComponentMetadata(), null
);
 
             // get a copy of the component properties as service properties
             Dictionary serviceProperties = copyTo( null, getProperties() );
@@ -635,7 +633,7 @@
             m_serviceRegistration.unregister();
             m_serviceRegistration = null;
 
-            getActivator().log( LogService.LOG_DEBUG, "unregistering the services", getComponentMetadata(),
null );
+            log( LogService.LOG_DEBUG, "unregistering the services", getComponentMetadata(),
null );
         }
     }
 
@@ -648,6 +646,16 @@
     }
 
 
+    void log( int level, String message, ComponentMetadata metadata, Throwable ex )
+    {
+        BundleComponentActivator activator = getActivator();
+        if ( activator != null )
+        {
+            activator.log( level, message, metadata, ex );
+        }
+    }
+
+
     /**
      * Returns <code>true</code> if this instance has not been disposed off
      * yet and the BundleComponentActivator is still active. If the Bundle
@@ -755,7 +763,7 @@
     **/
     protected synchronized void setState( int newState )
     {
-        getActivator().log( LogService.LOG_DEBUG,
+        log( LogService.LOG_DEBUG,
             "State transition : " + stateToString( m_state ) + " -> " + stateToString(
newState ), m_componentMetadata,
             null );
 

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java Fri
May 30 12:56:02 2008
@@ -82,7 +82,7 @@
 
     protected ServiceRegistration registerComponentService()
     {
-        getActivator().log( LogService.LOG_DEBUG, "registering component factory", getComponentMetadata(),
null );
+        log( LogService.LOG_DEBUG, "registering component factory", getComponentMetadata(),
null );
 
         Dictionary serviceProperties = getProperties();
         return getActivator().getBundleContext().registerService( new String[]
@@ -162,8 +162,8 @@
             ComponentManager cm = ( ComponentManager ) m_configuredServices.remove( pid );
             if ( cm != null )
             {
-                getActivator().log( LogService.LOG_DEBUG, "Disposing component after configuration
deletion",
-                    getComponentMetadata(), null );
+                log( LogService.LOG_DEBUG, "Disposing component after configuration deletion",
getComponentMetadata(),
+                    null );
 
                 disposeComponentManager( cm );
             }
@@ -201,7 +201,7 @@
         {
             ( ( ImmediateComponentManager ) cm ).setFactoryProperties( configuration );
         }
-        
+
         // enable synchronously or asynchronously depending on the flag
         if ( cm instanceof AbstractComponentManager )
         {

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java Fri
May 30 12:56:02 2008
@@ -73,9 +73,8 @@
 
     public Object getService( Bundle arg0, ServiceRegistration arg1 )
     {
-        getActivator().log( LogService.LOG_DEBUG, "DelayedComponentServiceFactory.getService()",
-            getComponentMetadata(), null );
-        
+        log( LogService.LOG_DEBUG, "DelayedComponentServiceFactory.getService()", getComponentMetadata(),
null );
+
         // When the getServiceMethod is called, the implementation object must be created
         // unless another bundle has already retrievd it
 

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java Fri May
30 12:56:02 2008
@@ -143,10 +143,9 @@
         // ignore the service, if it does not match the target filter
         if ( !targetFilterMatch( reference ) )
         {
-            m_componentManager.getActivator().log( LogService.LOG_DEBUG,
-                    "Dependency Manager: Ignoring added Service for " + m_dependencyMetadata.getName()
-                        + " : does not match target filter " + getTarget(), m_componentManager.getComponentMetadata(),
-                    null );
+            m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Ignoring added
Service for "
+                + m_dependencyMetadata.getName() + " : does not match target filter " + getTarget(),
m_componentManager
+                .getComponentMetadata(), null );
             return;
         }
 
@@ -157,9 +156,9 @@
         // by adding this service, try to activate
         if ( m_componentManager.getState() == AbstractComponentManager.STATE_UNSATISFIED
)
         {
-            m_componentManager.getActivator().log( LogService.LOG_INFO,
-                "Dependency Manager: Service " + m_dependencyMetadata.getName() + " registered,
trying to activate",
-                m_componentManager.getComponentMetadata(), null );
+            m_componentManager.log( LogService.LOG_INFO, "Dependency Manager: Service "
+                + m_dependencyMetadata.getName() + " registered, trying to activate", m_componentManager
+                .getComponentMetadata(), null );
 
             m_componentManager.activate();
         }
@@ -175,10 +174,9 @@
                 // only reactivate if the service has an influence on binding
                 if ( m_dependencyMetadata.isMultiple() || !isBound() )
                 {
-                    m_componentManager.getActivator().log(
-                        LogService.LOG_DEBUG,
-                        "Dependency Manager: Service " + m_dependencyMetadata.getName()
-                            + " registered, reactivate component", m_componentManager.getComponentMetadata(),
null );
+                    m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Service
"
+                        + m_dependencyMetadata.getName() + " registered, reactivate component",
m_componentManager
+                        .getComponentMetadata(), null );
 
                     m_componentManager.reactivate();
                 }
@@ -212,10 +210,9 @@
         // ignore the service, if it does not match the target filter
         if ( !targetFilterMatch( reference ) )
         {
-            m_componentManager.getActivator().log( LogService.LOG_DEBUG,
-                    "Dependency Manager: Ignoring removed Service for " + m_dependencyMetadata.getName()
-                        + " : does not match target filter " + getTarget(), m_componentManager.getComponentMetadata(),
-                    null );
+            m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Ignoring removed
Service for "
+                + m_dependencyMetadata.getName() + " : does not match target filter " + getTarget(),
m_componentManager
+                .getComponentMetadata(), null );
             return;
         }
 
@@ -251,17 +248,15 @@
             {
                 try
                 {
-                    m_componentManager.getActivator().log(
-                        LogService.LOG_DEBUG,
-                        "Dependency Manager: Static dependency on " + m_dependencyMetadata.getName()
+ "/"
-                            + m_dependencyMetadata.getInterface() + " is broken",
+                    m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Static
dependency on "
+                        + m_dependencyMetadata.getName() + "/" + m_dependencyMetadata.getInterface()
+ " is broken",
                         m_componentManager.getComponentMetadata(), null );
                     m_componentManager.reactivate();
                 }
                 catch ( Exception ex )
                 {
-                    m_componentManager.getActivator().log( LogService.LOG_ERROR,
-                        "Exception while recreating dependency ", m_componentManager.getComponentMetadata(),
ex );
+                    m_componentManager.log( LogService.LOG_ERROR, "Exception while recreating
dependency ",
+                        m_componentManager.getComponentMetadata(), ex );
                 }
             }
 
@@ -280,8 +275,7 @@
                     // available, bind returns false and we deactivate
                     if ( !bind( instance ) )
                     {
-                        m_componentManager.getActivator().log(
-                            LogService.LOG_DEBUG,
+                        m_componentManager.log( LogService.LOG_DEBUG,
                             "Dependency Manager: Deactivating component due to mandatory
dependency on "
                                 + m_dependencyMetadata.getName() + "/" + m_dependencyMetadata.getInterface()
                                 + " not satisfied", m_componentManager.getComponentMetadata(),
null );
@@ -314,7 +308,6 @@
 
     //---------- Reference interface ------------------------------------------
 
-
     public String getServiceName()
     {
         return m_dependencyMetadata.getInterface();
@@ -357,7 +350,6 @@
     }
 
 
-
     //---------- Service tracking support -------------------------------------
 
     /**
@@ -437,8 +429,7 @@
         }
         catch ( InvalidSyntaxException ise )
         {
-            m_componentManager.getActivator().log( LogService.LOG_ERROR,
-                "Unexpected problem with filter '" + getTarget() + "'",
+            m_componentManager.log( LogService.LOG_ERROR, "Unexpected problem with filter
'" + getTarget() + "'",
                 m_componentManager.getComponentMetadata(), ise );
             return null;
         }
@@ -792,9 +783,8 @@
             }
             catch ( ClassNotFoundException ex2 )
             {
-                m_componentManager.getActivator().log( LogService.LOG_ERROR,
-                    "Cannot load class used as parameter " + parameterClassName,
-                    m_componentManager.getComponentMetadata(), ex2 );
+                m_componentManager.log( LogService.LOG_ERROR, "Cannot load class used as
parameter "
+                    + parameterClassName, m_componentManager.getComponentMetadata(), ex2
);
             }
         }
 
@@ -830,8 +820,8 @@
             try
             {
                 // Get the bind method
-                m_componentManager.getActivator().log( LogService.LOG_DEBUG,
-                    "getting bind: " + m_dependencyMetadata.getBind(), m_componentManager.getComponentMetadata(),
null );
+                m_componentManager.log( LogService.LOG_DEBUG, "getting bind: " + m_dependencyMetadata.getBind(),
+                    m_componentManager.getComponentMetadata(), null );
                 if ( m_bind == null )
                 {
                     m_bind = getBindingMethod( m_dependencyMetadata.getBind(), implementationObject.getClass(),
@@ -842,8 +832,8 @@
                     // method
                     if ( m_bind == null )
                     {
-                        m_componentManager.getActivator().log( LogService.LOG_ERROR, "bind()
method not found",
-                            m_componentManager.getComponentMetadata(), null );
+                        m_componentManager.log( LogService.LOG_ERROR, "bind() method not
found", m_componentManager
+                            .getComponentMetadata(), null );
                         return true;
                     }
 
@@ -867,9 +857,8 @@
                     parameter = getService( ref );
                     if ( parameter == null )
                     {
-                        m_componentManager.getActivator().log( LogService.LOG_INFO,
-                            "Dependency Manager: Service " + ref + " has already gone, not
binding",
-                            m_componentManager.getComponentMetadata(), null );
+                        m_componentManager.log( LogService.LOG_INFO, "Dependency Manager:
Service " + ref
+                            + " has already gone, not binding", m_componentManager.getComponentMetadata(),
null );
                         return false;
                     }
                 }
@@ -878,8 +867,8 @@
                 m_bind.invoke( implementationObject, new Object[]
                     { parameter } );
 
-                m_componentManager.getActivator().log( LogService.LOG_DEBUG, "bound: " +
getName(),
-                    m_componentManager.getComponentMetadata(), null );
+                m_componentManager.log( LogService.LOG_DEBUG, "bound: " + getName(), m_componentManager
+                    .getComponentMetadata(), null );
 
                 return true;
             }
@@ -888,17 +877,16 @@
                 // 112.3.1 If the method is not is not declared protected or
                 // public, SCR must log an error message with the log service,
                 // if present, and ignore the method
-                m_componentManager.getActivator().log( LogService.LOG_ERROR, "bind() method
cannot be called",
-                    m_componentManager.getComponentMetadata(), ex );
+                m_componentManager.log( LogService.LOG_ERROR, "bind() method cannot be called",
m_componentManager
+                    .getComponentMetadata(), ex );
                 return true;
             }
             catch ( InvocationTargetException ex )
             {
                 // 112.5.7 If a bind method throws an exception, SCR must log an
                 // error message containing the exception [...]
-                m_componentManager.getActivator().log( LogService.LOG_ERROR,
-                    "DependencyManager : exception while invoking " + m_dependencyMetadata.getBind()
+ "()",
-                    m_componentManager.getComponentMetadata(), ex );
+                m_componentManager.log( LogService.LOG_ERROR, "DependencyManager : exception
while invoking "
+                    + m_dependencyMetadata.getBind() + "()", m_componentManager.getComponentMetadata(),
ex );
                 return true;
             }
         }
@@ -936,9 +924,8 @@
             try
             {
                 // Get the bind method
-                m_componentManager.getActivator().log( LogService.LOG_DEBUG,
-                    "getting unbind: " + m_dependencyMetadata.getUnbind(), m_componentManager.getComponentMetadata(),
-                    null );
+                m_componentManager.log( LogService.LOG_DEBUG, "getting unbind: " + m_dependencyMetadata.getUnbind(),
+                    m_componentManager.getComponentMetadata(), null );
                 if ( m_unbind == null )
                 {
                     m_unbind = getBindingMethod( m_dependencyMetadata.getUnbind(), implementationObject.getClass(),
@@ -949,8 +936,8 @@
                         // 112.3.1 If the method is not found, SCR must log an error
                         // message with the log service, if present, and ignore the
                         // method
-                        m_componentManager.getActivator().log( LogService.LOG_ERROR, "unbind()
method not found",
-                            m_componentManager.getComponentMetadata(), null );
+                        m_componentManager.log( LogService.LOG_ERROR, "unbind() method not
found", m_componentManager
+                            .getComponentMetadata(), null );
                         return true;
                     }
                     // cache whether the unbind method takes a reference
@@ -968,9 +955,8 @@
                     parameter = getService( ref );
                     if ( parameter == null )
                     {
-                        m_componentManager.getActivator().log( LogService.LOG_INFO,
-                            "Dependency Manager: Service " + ref + " has already gone, not
unbinding",
-                            m_componentManager.getComponentMetadata(), null );
+                        m_componentManager.log( LogService.LOG_INFO, "Dependency Manager:
Service " + ref
+                            + " has already gone, not unbinding", m_componentManager.getComponentMetadata(),
null );
                         return false;
                     }
                 }
@@ -978,8 +964,8 @@
                 m_unbind.invoke( implementationObject, new Object[]
                     { parameter } );
 
-                m_componentManager.getActivator().log( LogService.LOG_DEBUG, "unbound: "
+ getName(),
-                    m_componentManager.getComponentMetadata(), null );
+                m_componentManager.log( LogService.LOG_DEBUG, "unbound: " + getName(), m_componentManager
+                    .getComponentMetadata(), null );
 
                 return true;
             }
@@ -988,17 +974,18 @@
                 // 112.3.1 If the method is not is not declared protected or
                 // public, SCR must log an error message with the log service,
                 // if present, and ignore the method
-                m_componentManager.getActivator().log( LogService.LOG_ERROR, "unbind() method
cannot be called",
-                    m_componentManager.getComponentMetadata(), ex );
+                m_componentManager.log( LogService.LOG_ERROR, "unbind() method cannot be
called", m_componentManager
+                    .getComponentMetadata(), ex );
                 return false;
             }
             catch ( InvocationTargetException ex )
             {
                 // 112.5.13 If an unbind method throws an exception, SCR must
                 // log an error message containing the exception [...]
-                m_componentManager.getActivator().log( LogService.LOG_ERROR,
-                    "DependencyManager : exception while invoking " + m_dependencyMetadata.getUnbind()
+ "()",
-                    m_componentManager.getComponentMetadata(), ex.getCause() );
+                m_componentManager
+                    .log( LogService.LOG_ERROR, "DependencyManager : exception while invoking
"
+                        + m_dependencyMetadata.getUnbind() + "()", m_componentManager.getComponentMetadata(),
ex
+                        .getCause() );
                 return true;
             }
             finally

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
Fri May 30 12:56:02 2008
@@ -112,8 +112,7 @@
             }
             catch ( Throwable t )
             {
-                getActivator().log( LogService.LOG_INFO, "Unexpected problem unregistering
ManagedService",
-                    getComponentMetadata(), t );
+                log( LogService.LOG_INFO, "Unexpected problem unregistering ManagedService",
getComponentMetadata(), t );
             }
         }
 
@@ -188,7 +187,7 @@
         catch ( Exception ex )
         {
             // failed to instantiate, return null
-            getActivator().log( LogService.LOG_ERROR, "Error during instantiation of the
implementation object",
+            log( LogService.LOG_ERROR, "Error during instantiation of the implementation
object",
                 getComponentMetadata(), ex );
             return null;
         }
@@ -203,9 +202,8 @@
             DependencyManager dm = ( DependencyManager ) it.next();
             if ( !dm.bind( implementationObject ) )
             {
-                getActivator().log( LogService.LOG_ERROR,
-                    "Cannot create component instance due to failure to bind reference "
+ dm.getName(),
-                    getComponentMetadata(), null );
+                log( LogService.LOG_ERROR, "Cannot create component instance due to failure
to bind reference "
+                    + dm.getName(), getComponentMetadata(), null );
 
                 // make sure, we keep no bindings
                 it = getDependencyManagers();
@@ -231,21 +229,19 @@
         catch ( NoSuchMethodException ex )
         {
             // We can safely ignore this one
-            getActivator().log( LogService.LOG_DEBUG, "activate() method is not implemented",
getComponentMetadata(),
-                null );
+            log( LogService.LOG_DEBUG, "activate() method is not implemented", getComponentMetadata(),
null );
         }
         catch ( IllegalAccessException ex )
         {
             // Ignored, but should it be logged?
-            getActivator().log( LogService.LOG_DEBUG, "activate() method cannot be called",
getComponentMetadata(),
-                null );
+            log( LogService.LOG_DEBUG, "activate() method cannot be called", getComponentMetadata(),
null );
         }
         catch ( InvocationTargetException ex )
         {
             // 112.5.8 If the activate method throws an exception, SCR must log an error
message
             // containing the exception with the Log Service and activation fails
-            getActivator().log( LogService.LOG_ERROR, "The activate method has thrown an
exception",
-                getComponentMetadata(), ex.getCause() );
+            log( LogService.LOG_ERROR, "The activate method has thrown an exception", getComponentMetadata(),
ex
+                .getCause() );
 
             // make sure, we keep no bindings
             it = getDependencyManagers();
@@ -276,21 +272,19 @@
         catch ( NoSuchMethodException ex )
         {
             // We can safely ignore this one
-            getActivator().log( LogService.LOG_DEBUG, "deactivate() method is not implemented",
getComponentMetadata(),
-                null );
+            log( LogService.LOG_DEBUG, "deactivate() method is not implemented", getComponentMetadata(),
null );
         }
         catch ( IllegalAccessException ex )
         {
             // Ignored, but should it be logged?
-            getActivator().log( LogService.LOG_DEBUG, "deactivate() method cannot be called",
getComponentMetadata(),
-                null );
+            log( LogService.LOG_DEBUG, "deactivate() method cannot be called", getComponentMetadata(),
null );
         }
         catch ( InvocationTargetException ex )
         {
             // 112.5.12 If the deactivate method throws an exception, SCR must log an error
message
             // containing the exception with the Log Service and continue
-            getActivator().log( LogService.LOG_ERROR, "The deactivate method has thrown an
exception",
-                getComponentMetadata(), ex.getCause() );
+            log( LogService.LOG_ERROR, "The deactivate method has thrown an exception", getComponentMetadata(),
ex
+                .getCause() );
         }
 
         // 2. Unbind any bound services
@@ -396,7 +390,7 @@
         // configuration data
         if ( ( getState() & ( STATE_ACTIVE | STATE_FACTORY | STATE_REGISTERED ) ) !=
0 )
         {
-            getActivator().log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure
from configuration",
+            log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure from configuration",
                 getComponentMetadata(), null );
             reactivate();
         }

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java?rev=661839&r1=661838&r2=661839&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
Fri May 30 12:56:02 2008
@@ -92,8 +92,7 @@
      */
     public Object getService( Bundle bundle, ServiceRegistration registration )
     {
-        getActivator().log( LogService.LOG_DEBUG, "DelayedServiceFactoryServiceFactory.getService()",
-            getComponentMetadata(), null );
+        log( LogService.LOG_DEBUG, "DelayedServiceFactoryServiceFactory.getService()", getComponentMetadata(),
null );
 
         // When the getServiceMethod is called, the implementation object must be created
 
@@ -120,8 +119,7 @@
      */
     public void ungetService( Bundle bundle, ServiceRegistration registration, Object service
)
     {
-        getActivator().log( LogService.LOG_DEBUG, "DelayedServiceFactoryServiceFactory.ungetService()",
-            getComponentMetadata(), null );
+        log( LogService.LOG_DEBUG, "DelayedServiceFactoryServiceFactory.ungetService()",
getComponentMetadata(), null );
 
         // When the ungetServiceMethod is called, the implementation object must be deactivated
 



Mime
View raw message