Author: fmeschbe
Date: Sun Jan 29 13:59:32 2012
New Revision: 1237292
URL: http://svn.apache.org/viewvc?rev=1237292&view=rev
Log:
Add some more logging
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java?rev=1237292&r1=1237291&r2=1237292&view=diff
==============================================================================
---
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
(original)
+++
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
Sun Jan 29 13:59:32 2012
@@ -71,10 +71,10 @@ public class ConfigurationAdapter implem
*/
public String getBundleLocation()
{
- delegatee.getConfigurationManager().log( LogService.LOG_DEBUG,
"getBundleLocation()", ( Throwable ) null );
-
// CM 1.4 / 104.13.2.4
final String bundleLocation = delegatee.getBundleLocation();
+ delegatee.getConfigurationManager().log( LogService.LOG_DEBUG,
"getBundleLocation() ==> {0}", new Object[]
+ { bundleLocation } );
configurationAdmin.checkPermission( ( bundleLocation == null ) ? "*" :
bundleLocation );
checkDeleted();
return bundleLocation;
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java?rev=1237292&r1=1237291&r2=1237292&view=diff
==============================================================================
---
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
(original)
+++
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
Sun Jan 29 13:59:32 2012
@@ -290,6 +290,8 @@ class ConfigurationImpl extends Configur
{
if ( this.getBundleLocation() == null )
{
+ getConfigurationManager().log( LogService.LOG_DEBUG, "Dynamically
binding config {0} to {1}", new Object[]
+ { getPid(), bundleLocation } );
setDynamicBundleLocation( bundleLocation, true );
}
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java?rev=1237292&r1=1237291&r2=1237292&view=diff
==============================================================================
---
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
(original)
+++
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Sun Jan 29 13:59:32 2012
@@ -708,6 +708,12 @@ public class ConfigurationManager implem
{
if ( pids != null )
{
+ if ( isLogEnabled( LogService.LOG_DEBUG ) )
+ {
+ log( LogService.LOG_DEBUG, "configure(ManagedService {0})",
new Object[]
+ { toString( sr ) } );
+ }
+
for ( int i = 0; i < pids.length; i++ )
{
ManagedServiceUpdate update = new ManagedServiceUpdate(
pids[i], sr, service );
@@ -728,6 +734,12 @@ public class ConfigurationManager implem
{
if ( pids != null )
{
+ if ( isLogEnabled( LogService.LOG_DEBUG ) )
+ {
+ log( LogService.LOG_DEBUG, "configure(ManagedServiceFactory
{0})", new Object[]
+ { toString( sr ) } );
+ }
+
for ( int i = 0; i < pids.length; i++ )
{
ManagedServiceFactoryUpdate update = new
ManagedServiceFactoryUpdate( pids[i], sr, service );
@@ -1558,47 +1570,56 @@ public class ConfigurationManager implem
return;
}
- for ( Iterator ci=configs.entrySet().iterator(); ci.hasNext(); )
+ if ( configs == null || configs.isEmpty() )
{
- final Map.Entry entry = (Map.Entry) ci.next();
- final ConfigurationImpl cfg = (ConfigurationImpl)
entry.getKey();
- final Dictionary properties = (Dictionary) entry.getValue();
- final long revision = ( ( Long ) revisions.get( cfg )
).longValue();
-
- log( LogService.LOG_DEBUG, "Updating configuration {0} to
revision #{1}", new Object[]
- { cfg.getPid(), new Long( revision ) } );
-
- // CM 1.4 / 104.13.2.1
- if ( !canReceive( serviceBundle, cfg.getBundleLocation() ) )
+ log( LogService.LOG_DEBUG, "No configuration with factory PID
{0}; not updating ManagedServiceFactory",
+ new Object[]
+ { factoryPid } );
+ }
+ else
+ {
+ for ( Iterator ci = configs.entrySet().iterator();
ci.hasNext(); )
{
- log( LogService.LOG_ERROR,
- "Cannot use configuration {0} for {1}: No visibility
to configuration bound to {2}",
- new Object[]
- { cfg.getPid(), ConfigurationManager.toString( sr
), cfg.getBundleLocation() } );
- continue;
- }
-
- // 104.4.2 Dynamic Binding
- cfg.tryBindLocation( serviceBundle.getLocation() );
-
- // prepare the configuration for the service (call plugins)
- // call the plugins with cm.target set to the service's
factory PID
- // (clarification in Section 104.9.1 of Compendium 4.2)
- callPlugins( properties, factoryPid, sr, cfg );
+ final Map.Entry entry = ( Map.Entry ) ci.next();
+ final ConfigurationImpl cfg = ( ConfigurationImpl )
entry.getKey();
+ final Dictionary properties = ( Dictionary )
entry.getValue();
+ final long revision = ( ( Long ) revisions.get( cfg )
).longValue();
- // update the service with the configuration (if non-null)
- if ( properties != null )
- {
- log( LogService.LOG_DEBUG, "{0}: Updating configuration
pid={1}", new Object[]
- { ConfigurationManager.toString( sr ), cfg.getPid() }
);
+ log( LogService.LOG_DEBUG, "Updating configuration {0} to
revision #{1}", new Object[]
+ { cfg.getPid(), new Long( revision ) } );
- try
+ // CM 1.4 / 104.13.2.1
+ if ( !canReceive( serviceBundle, cfg.getBundleLocation() )
)
{
- service.updated( cfg.getPid(), properties );
+ log( LogService.LOG_ERROR,
+ "Cannot use configuration {0} for {1}: No
visibility to configuration bound to {2}",
+ new Object[]
+ { cfg.getPid(), ConfigurationManager.toString(
sr ), cfg.getBundleLocation() } );
+ continue;
}
- catch ( Throwable t )
+
+ // 104.4.2 Dynamic Binding
+ cfg.tryBindLocation( serviceBundle.getLocation() );
+
+ // prepare the configuration for the service (call plugins)
+ // call the plugins with cm.target set to the service's
factory PID
+ // (clarification in Section 104.9.1 of Compendium 4.2)
+ callPlugins( properties, factoryPid, sr, cfg );
+
+ // update the service with the configuration (if non-null)
+ if ( properties != null )
{
- handleCallBackError( t, sr, cfg );
+ log( LogService.LOG_DEBUG, "{0}: Updating
configuration pid={1}", new Object[]
+ { ConfigurationManager.toString( sr ),
cfg.getPid() } );
+
+ try
+ {
+ service.updated( cfg.getPid(), properties );
+ }
+ catch ( Throwable t )
+ {
+ handleCallBackError( t, sr, cfg );
+ }
}
}
}