You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/09/10 23:05:17 UTC

svn commit: r280040 [1/2] - in /directory/sandbox/trunk/osgi-spec/trunk/configuration: ./ src/main/java/org/apache/configuration/ src/main/java/org/apache/configuration/impl/ src/main/java/org/apache/configuration/store/

Author: erodriguez
Date: Sat Sep 10 14:05:06 2005
New Revision: 280040

URL: http://svn.apache.org/viewcvs?rev=280040&view=rev
Log:
Round of updates related to backing the Config Admin service with the directory:
o  Replaced simple file store with directory backing store.
o  Enabled dynamic reconfiguration based on directory using EventDirContext events via NamespaceChangedListener and ObjectChangedListener.
o  Split interface and bundle infrastructure to separate package from Configuration Admin implementation.
o  Added SLF4J logging.
o  Added Service Binder to handle InitialContextFactory as required service.

Added:
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminFactory.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminFactory.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminImpl.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDictionary.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDispatcher.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDispatcher.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationImpl.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/PluginManager.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/PluginManager.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/Update.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Update.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/UpdateQueue.java
      - copied, changed from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/UpdateQueue.java
Removed:
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminFactory.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminImpl.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDictionary.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDispatcher.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationImpl.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStoreFactory.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Logger.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/PluginManager.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Update.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/UpdateQueue.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/store/SimpleConfigurationStore.java
Modified:
    directory/sandbox/trunk/osgi-spec/trunk/configuration/   (props changed)
    directory/sandbox/trunk/osgi-spec/trunk/configuration/project.xml
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Activator.java
    directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStore.java

Propchange: directory/sandbox/trunk/osgi-spec/trunk/configuration/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Sep 10 14:05:06 2005
@@ -0,0 +1,6 @@
+bin
+build
+target
+classes
+.classpath
+.project

Modified: directory/sandbox/trunk/osgi-spec/trunk/configuration/project.xml
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/project.xml?rev=280040&r1=280039&r2=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/project.xml (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/project.xml Sat Sep 10 14:05:06 2005
@@ -2,12 +2,12 @@
 <project>
   <extend>${basedir}/../project.xml</extend>
   <pomVersion>3</pomVersion>
-  <groupId>apache</groupId>
+  <groupId>directory-standalone</groupId>
   <artifactId>apache-configuration</artifactId>
   <name>Apache Configuration Admin Bundle</name>
   <currentVersion>0.1.1</currentVersion>
   <properties>
-    <osgi.import.package>org.osgi.framework</osgi.import.package>
+    <osgi.import.package>org.ungoverned.gravity.servicebinder,org.apache.ldap.server.configuration,org.osgi.framework,org.osgi.service.cm</osgi.import.package>
   </properties>
   <inceptionYear>2005</inceptionYear>
   <package>org.apache.configuration</package>

Modified: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Activator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Activator.java?rev=280040&r1=280039&r2=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Activator.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Activator.java Sat Sep 10 14:05:06 2005
@@ -17,65 +17,8 @@
 
 package org.apache.configuration;
 
-import java.io.File;
+import org.ungoverned.gravity.servicebinder.GenericActivator;
 
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.apache.configuration.store.SimpleConfigurationStore;
-
-/**
- * Configuration Admin bundle activator.
- */
-public class Activator implements BundleActivator
+public class Activator extends GenericActivator
 {
-    private static final String STORE_DIR_PROP    = "org.apache.configuration.store";
-    private static final String DEFAULT_STORE_DIR = "configuration";
-    public static final Logger LOG = new Logger();
-    
-    private ServiceRegistration serviceRegistration;
-    
-    static BundleContext bc;
-    
-    public void start( BundleContext bc ) throws BundleException
-    {
-        Activator.bc = bc;
-        
-        if ( bc == null )
-        {
-            throw new BundleException( "Null BundleContext in Activator." );
-        }
-        
-        ConfigurationStore store = new SimpleConfigurationStore( getStoreDir() );
-        serviceRegistration = bc.registerService( ConfigurationAdmin.class.getName(), new ConfigurationAdminFactory( store ), null );
-    }
-    
-    public void stop( BundleContext bc ) throws BundleException
-    {
-        if ( serviceRegistration != null )
-        {
-            serviceRegistration.unregister();
-            serviceRegistration = null;
-        }
-    }
-    
-    private File getStoreDir()
-    {
-        String storeDirName = System.getProperty( STORE_DIR_PROP );
-        File storeDir = null;
-        
-        if ( storeDirName == null || "".equals( storeDirName ) )
-        {
-            storeDir = bc.getDataFile( DEFAULT_STORE_DIR );
-        }
-        else
-        {
-            storeDir = new File( storeDirName );
-        }
-        
-        return storeDir;
-    }
 }
-

Modified: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStore.java?rev=280040&r1=280039&r2=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStore.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationStore.java Sat Sep 10 14:05:06 2005
@@ -21,27 +21,24 @@
 import java.util.Dictionary;
 import java.util.Enumeration;
 
+import org.apache.configuration.impl.ConfigurationDictionary;
+
 
 public interface ConfigurationStore
 {
     public abstract Enumeration listPids();
 
-    public abstract ConfigurationDictionary load( String pid )
-    		throws IOException;
+    public abstract ConfigurationDictionary load( String pid ) throws IOException;
 
-    public abstract ConfigurationDictionary[] loadAll( String factoryPid )
-            throws IOException;
+    public abstract ConfigurationDictionary[] loadAll( String factoryPid ) throws IOException;
 
-    public abstract void store( String pid, String factoryPid, Dictionary configuration )
-    		throws IOException;
+    public abstract void store( String pid, String factoryPid, Dictionary configuration ) throws IOException;
 
-    public abstract ConfigurationDictionary delete( String pid )
-            throws IOException;
+    public abstract ConfigurationDictionary delete( String pid ) throws IOException;
 
-    public abstract void deleteAll( String factoryPid )
-    		throws IOException;
+    public abstract void deleteAll( String factoryPid ) throws IOException;
 
-    public abstract String generatePid( String factoryPid )
-    		throws IOException;
+    public abstract String generatePid( String factoryPid ) throws IOException;
+    
+    public abstract void setConfigurationListener( ConfigurationListener configurationListener );
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminFactory.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminFactory.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminFactory.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminFactory.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminFactory.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminFactory.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminFactory.java Sat Sep 10 14:05:06 2005
@@ -15,7 +15,7 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.io.IOException;
 import java.security.AccessController;
@@ -26,7 +26,9 @@
 import java.util.Hashtable;
 import java.util.List;
 
-import org.osgi.framework.AdminPermission;
+import org.apache.configuration.ConfigurationFactory;
+import org.apache.configuration.ConfigurationListener;
+import org.apache.configuration.ConfigurationStore;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleListener;
@@ -43,82 +45,97 @@
 import org.osgi.service.cm.ConfigurationPlugin;
 import org.osgi.service.cm.ManagedService;
 import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * ConfigurationAdmin implementation
  */
-class ConfigurationAdminFactory implements ServiceFactory, ServiceListener, BundleListener
+public class ConfigurationAdminFactory implements ServiceFactory, ServiceListener, BundleListener, ConfigurationListener
 {
-    private Hashtable               locationToPids = new Hashtable();
-    private Hashtable               existingBundleLocations = new Hashtable();
-    private ConfigurationStore      store;
-    private PluginManager           pluginManager;
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( ConfigurationAdminFactory.class );
+
+    private Hashtable locationToPids = new Hashtable();
+    private Hashtable existingBundleLocations = new Hashtable();
+    private ConfigurationStore store;
+    private PluginManager pluginManager;
     private ConfigurationDispatcher configurationDispatcher;
-    
-    // Constants
+
+    private static final String ANY_LOCATION = "*";
     private static final String FILTER = "(|(objectClass=" + ManagedServiceFactory.class.getName() + ")"
-    									 + "(objectClass=" + ManagedService.class.getName() + ")"
-    									 + "(objectClass=" + ConfigurationPlugin.class.getName() + "))";
-    
-    static AdminPermission ADMIN_PERMISSION = new AdminPermission();
-    static String DYNAMIC_BUNDLE_LOCATION   = "dynamic.service.bundleLocation";
-    static String ANY_LOCATION              = "*";
-    
-    
+            + "(objectClass=" + ManagedService.class.getName() + ")" + "(objectClass="
+            + ConfigurationPlugin.class.getName() + "))";
+
+    static String DYNAMIC_BUNDLE_LOCATION = "dynamic.service.bundleLocation";
+
     public ConfigurationAdminFactory( ConfigurationStore store )
     {
         this.store = store;
-        
+
+        store.setConfigurationListener( this );
+
         pluginManager = new PluginManager();
 
         configurationDispatcher = new ConfigurationDispatcher( pluginManager );
 
         lookForExistingBundleLocations();
-        
+
         try
         {
-            Activator.bc.addServiceListener( this, FILTER );
-            Activator.bc.addBundleListener( this );
+            ConfigurationFactory.bc.addServiceListener( this, FILTER );
+            ConfigurationFactory.bc.addBundleListener( this );
         }
-        catch (InvalidSyntaxException ignored)
+        catch ( InvalidSyntaxException ignored )
         {
             ignored.printStackTrace();
         }
 
         lookForAlreadyRegisteredServices();
     }
-    
-    
+
+    public void configurationChanged( Hashtable configuration )
+    {
+        try
+        {
+            updateTargetServicesMatching( new ConfigurationDictionary( configuration ) );
+        }
+        catch ( IOException ioe )
+        {
+            ioe.printStackTrace();
+        }
+    }
+
     private void lookForAlreadyRegisteredServices()
     {
-        notifyRegisteredServices( ConfigurationPlugin.class );
-        notifyRegisteredServices( ManagedServiceFactory.class );
-        notifyRegisteredServices( ManagedService.class );
+        notifyRegisteredServices( ConfigurationPlugin.class.getName() );
+        notifyRegisteredServices( ManagedServiceFactory.class.getName() );
+        notifyRegisteredServices( ManagedService.class.getName() );
     }
 
-    private void notifyRegisteredServices( Class clazz )
+    private void notifyRegisteredServices( String className )
     {
         try
         {
-            ServiceReference[] srs = Activator.bc.getServiceReferences( clazz.getName(), null );
-            
+            ServiceReference[] srs = ConfigurationFactory.bc.getServiceReferences( className, null );
+
             for ( int ii = 0; srs != null && ii < srs.length; ++ii )
             {
-                serviceChanged(srs[ii], ServiceEvent.REGISTERED, clazz.getName());
+                serviceChanged( srs[ ii ], ServiceEvent.REGISTERED, className );
             }
         }
-        catch (InvalidSyntaxException ignored)
+        catch ( InvalidSyntaxException ignored )
         {
         }
     }
 
     private void lookForExistingBundleLocations()
     {
-        Bundle[] bs = Activator.bc.getBundles();
-        
+        Bundle[] bs = ConfigurationFactory.bc.getBundles();
+
         for ( int ii = 0; bs != null && ii < bs.length; ++ii )
         {
-            existingBundleLocations.put( bs[ii].getLocation(), bs[ii].getLocation() );
+            existingBundleLocations.put( bs[ ii ].getLocation(), bs[ ii ].getLocation() );
         }
     }
 
@@ -134,13 +151,13 @@
         {
             return d;
         }
-        
+
         String configLocation = (String) d.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
 
         if ( isNonExistingBundleLocation( configLocation ) )
         {
             Boolean dynamicLocation = (Boolean) d.get( DYNAMIC_BUNDLE_LOCATION );
-            
+
             if ( dynamicLocation != null && dynamicLocation.booleanValue() )
             {
                 configLocation = null;
@@ -151,7 +168,7 @@
         {
             String fpid = (String) d.get( ConfigurationAdmin.SERVICE_FACTORYPID );
             String pid = (String) d.get( Constants.SERVICE_PID );
-            String serviceLocation = srs[0].getBundle().getLocation();
+            String serviceLocation = srs[ 0 ].getBundle().getLocation();
 
             ConfigurationDictionary copy = d.createCopy();
             copy.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, serviceLocation );
@@ -160,48 +177,47 @@
             store.store( pid, fpid, copy );
             return copy;
         }
-        
+
         return d;
     }
 
     private void findAndUnbindConfigurationsDynamicallyBoundTo( String bundleLocation )
     {
-        String filter = "(&(" + ConfigurationAdmin.SERVICE_BUNDLELOCATION + "=" + bundleLocation + ")"
-                + "(" + DYNAMIC_BUNDLE_LOCATION + "=" + Boolean.TRUE + "))";
+        String filter = "(&(" + ConfigurationAdmin.SERVICE_BUNDLELOCATION + "=" + bundleLocation + ")" + "("
+                + DYNAMIC_BUNDLE_LOCATION + "=" + Boolean.TRUE + "))";
         try
         {
             Configuration[] configurations = listConfigurations( filter );
             for ( int ii = 0; configurations != null && ii < configurations.length; ++ii )
             {
-                configurations[ii].setBundleLocation( null );
+                configurations[ ii ].setBundleLocation( null );
             }
         }
-        catch (Exception e)
+        catch ( Exception e )
         {
-            Activator.LOG.error( "Error while unbinding configurations bound to " + bundleLocation, e );
+            log.error( "Error while unbinding configurations bound to " + bundleLocation, e );
         }
     }
 
     private ServiceReference[] filterOnMatchingLocations( ServiceReference[] srs, String configLocation )
     {
         List results = new ArrayList();
-        
+
         for ( int ii = 0; ii < srs.length; ++ii )
         {
-            String serviceLocation = srs[ii].getBundle().getLocation();
+            String serviceLocation = srs[ ii ].getBundle().getLocation();
             if ( locationsMatch( serviceLocation, configLocation ) )
             {
-                results.add( srs[ii] );
+                results.add( srs[ ii ] );
             }
             else
             {
-                Activator.LOG.error( "The bundle " + serviceLocation
-                                + " has registered a ManagedService(Factory) for a pid bound to "
-                                + configLocation );
+                log.error( "The bundle " + serviceLocation
+                        + " has registered a ManagedService(Factory) for a pid bound to " + configLocation );
             }
         }
-        
-        return (ServiceReference[])results.toArray( new ServiceReference[ results.size() ] );
+
+        return (ServiceReference[]) results.toArray( new ServiceReference[ results.size() ] );
     }
 
     private boolean locationsMatch( String serviceLocation, String configLocation )
@@ -210,12 +226,12 @@
         {
             return false;
         }
-        
+
         if ( configLocation.equals( ANY_LOCATION ) || configLocation.equals( serviceLocation ) )
         {
             return true;
         }
-        
+
         return false;
     }
 
@@ -225,30 +241,29 @@
         {
             return;
         }
-        
+
         String bundleLocation = sr.getBundle().getLocation();
-        
+
         String pid = (String) sr.getProperty( Constants.SERVICE_PID );
-        
+
         if ( pid == null )
         {
             return;
         }
-        
+
         Hashtable pidsForLocation = (Hashtable) locationToPids.get( bundleLocation );
-        
+
         if ( pidsForLocation == null )
         {
             pidsForLocation = new Hashtable();
             locationToPids.put( bundleLocation, pidsForLocation );
         }
-        
+
         if ( pidsForLocation.contains( pid ) )
         {
-            Activator.LOG.error( "Multiple ManagedServices registered from bundle "
-                            + bundleLocation + " for " + pid );
+            log.error( "Multiple ManagedServices registered from bundle " + bundleLocation + " for " + pid );
         }
-        
+
         pidsForLocation.put( sr, pid );
     }
 
@@ -258,36 +273,35 @@
         {
             return;
         }
-        
+
         String bundleLocation = sr.getBundle().getLocation();
         Hashtable pidsForLocation = (Hashtable) locationToPids.get( bundleLocation );
-        
+
         if ( pidsForLocation == null )
         {
             return;
         }
-        
+
         pidsForLocation.remove( sr );
-        
+
         if ( pidsForLocation.isEmpty() )
         {
             locationToPids.remove( bundleLocation );
         }
     }
 
-    private void updateTargetServicesMatching( ConfigurationDictionary cd )
-            throws IOException
+    private void updateTargetServicesMatching( ConfigurationDictionary cd ) throws IOException
     {
         String servicePid = (String) cd.get( Constants.SERVICE_PID );
-        
+
         if ( servicePid == null )
         {
             return;
         }
-        
+
         String factoryPid = (String) cd.get( ConfigurationAdmin.SERVICE_FACTORYPID );
         String bundleLocation = (String) cd.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
-        
+
         if ( factoryPid == null )
         {
             updateManagedServicesMatching( servicePid, bundleLocation );
@@ -298,12 +312,12 @@
         }
     }
 
-    private void updateManagedServiceFactoriesMatching( String servicePid,
-            String factoryPid, String bundleLocation ) throws IOException
+    private void updateManagedServiceFactoriesMatching( String servicePid, String factoryPid, String bundleLocation )
+            throws IOException
     {
         ServiceReference[] srs = getTargetServiceReferences( ManagedServiceFactory.class, factoryPid );
         ConfigurationDictionary cd = store.load( servicePid );
-        
+
         if ( cd == null )
         {
             updateManagedServiceFactories( srs, servicePid, factoryPid, bundleLocation );
@@ -314,56 +328,53 @@
         }
     }
 
-    private void updateManagedServiceFactories( ServiceReference[] srs,
-            String servicePid, String factoryPid, ConfigurationDictionary cd )
-            throws IOException
+    private void updateManagedServiceFactories( ServiceReference[] srs, String servicePid, String factoryPid,
+            ConfigurationDictionary cd ) throws IOException
     {
         ConfigurationDictionary bound = bindLocationIfNecessary( srs, cd );
         String boundLocation = (String) bound.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
         ServiceReference[] filtered = filterOnMatchingLocations( srs, boundLocation );
-        
+
         for ( int ii = 0; ii < filtered.length; ++ii )
         {
-            configurationDispatcher.dispatchUpdateFor( filtered[ii], servicePid, factoryPid, bound );
+            configurationDispatcher.dispatchUpdateFor( filtered[ ii ], servicePid, factoryPid, bound );
         }
     }
-    
-    private void updateManagedServiceFactories( ServiceReference[] srs,
-            String servicePid, String factoryPid, String boundLocation )
+
+    private void updateManagedServiceFactories( ServiceReference[] srs, String servicePid, String factoryPid,
+            String boundLocation )
     {
         ServiceReference[] filtered = filterOnMatchingLocations( srs, boundLocation );
-        
+
         for ( int ii = 0; ii < filtered.length; ++ii )
         {
-            configurationDispatcher.dispatchUpdateFor( filtered[ii], servicePid, factoryPid, null );
+            configurationDispatcher.dispatchUpdateFor( filtered[ ii ], servicePid, factoryPid, null );
         }
     }
-    
-    private void updateManagedServiceFactory( ServiceReference reference )
-            throws IOException
+
+    private void updateManagedServiceFactory( ServiceReference reference ) throws IOException
     {
         String factoryPid = (String) reference.getProperty( Constants.SERVICE_PID );
-        
+
         ConfigurationDictionary[] cds = store.loadAll( factoryPid );
-        
+
         if ( cds != null && cds.length > 0 )
         {
             ServiceReference[] srs = new ServiceReference[] { reference };
-            
+
             for ( int ii = 0; ii < cds.length; ++ii )
             {
-                String servicePid = (String) cds[ii].get( Constants.SERVICE_PID );
-                updateManagedServiceFactories( srs, servicePid, factoryPid, cds[ii] );
+                String servicePid = (String) cds[ ii ].get( Constants.SERVICE_PID );
+                updateManagedServiceFactories( srs, servicePid, factoryPid, cds[ ii ] );
             }
         }
     }
-    
-    private void updateManagedServicesMatching( String servicePid, String bundleLocation )
-    		throws IOException
+
+    private void updateManagedServicesMatching( String servicePid, String bundleLocation ) throws IOException
     {
         ServiceReference[] srs = getTargetServiceReferences( ManagedService.class, servicePid );
         ConfigurationDictionary cd = store.load( servicePid );
-        
+
         if ( cd == null )
         {
             updateManagedServices( srs, servicePid, bundleLocation, null );
@@ -372,33 +383,33 @@
         {
             ConfigurationDictionary bound = bindLocationIfNecessary( srs, cd );
             String boundLocation = (String) bound.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
-            
+
             updateManagedServices( srs, servicePid, boundLocation, bound );
         }
     }
-    
-    private void updateManagedServices( ServiceReference[] srs, String servicePid,
-            String boundLocation, ConfigurationDictionary bound )
+
+    private void updateManagedServices( ServiceReference[] srs, String servicePid, String boundLocation,
+            ConfigurationDictionary bound )
     {
         ServiceReference[] filtered = filterOnMatchingLocations( srs, boundLocation );
-        
+
         for ( int ii = 0; ii < filtered.length; ++ii )
         {
-            configurationDispatcher.dispatchUpdateFor( filtered[ii], servicePid, null, bound );
+            configurationDispatcher.dispatchUpdateFor( filtered[ ii ], servicePid, null, bound );
         }
     }
-    
+
     private void updateManagedService( ServiceReference sr ) throws IOException
     {
         final String servicePid = (String) sr.getProperty( Constants.SERVICE_PID );
         ServiceReference[] srs = new ServiceReference[] { sr };
         ConfigurationDictionary cd = store.load( servicePid );
-        
+
         if ( cd == null )
         {
             for ( int ii = 0; ii < srs.length; ++ii )
             {
-                configurationDispatcher.dispatchUpdateFor( srs[ii], servicePid, null, null );
+                configurationDispatcher.dispatchUpdateFor( srs[ ii ], servicePid, null, null );
             }
         }
         else
@@ -406,10 +417,10 @@
             cd = bindLocationIfNecessary( srs, cd );
             String boundLocation = (String) cd.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
             srs = filterOnMatchingLocations( srs, boundLocation );
-            
+
             for ( int ii = 0; ii < srs.length; ++ii )
             {
-                configurationDispatcher.dispatchUpdateFor( srs[ii], servicePid, null, cd );
+                configurationDispatcher.dispatchUpdateFor( srs[ ii ], servicePid, null, cd );
             }
         }
     }
@@ -417,16 +428,16 @@
     private ServiceReference[] getTargetServiceReferences( Class clazz, String pid )
     {
         String filter = "(" + Constants.SERVICE_PID + "=" + pid + ")";
-        
+
         try
         {
-            ServiceReference[] srs = Activator.bc.getServiceReferences( clazz.getName(), filter );
-            return srs == null ? new ServiceReference[0] : srs;
+            ServiceReference[] srs = ConfigurationFactory.bc.getServiceReferences( clazz.getName(), filter );
+            return srs == null ? new ServiceReference[ 0 ] : srs;
         }
-        catch (InvalidSyntaxException e)
+        catch ( InvalidSyntaxException e )
         {
-            Activator.LOG.error( "Invalid syntax in ldap filter " + filter, e );
-            return new ServiceReference[0];
+            log.error( "Invalid syntax in ldap filter " + filter, e );
+            return new ServiceReference[ 0 ];
         }
     }
 
@@ -439,17 +450,17 @@
                 public Object run() throws IOException
                 {
                     ConfigurationDictionary cd = store.delete( config.getPid() );
-                    
+
                     if ( cd != null )
                     {
                         updateTargetServicesMatching( cd );
                     }
-                    
+
                     return null;
                 }
-            });
+            } );
         }
-        catch (PrivilegedActionException e)
+        catch ( PrivilegedActionException e )
         {
             throw (IOException) e.getException();
         }
@@ -467,9 +478,9 @@
                     updateTargetServicesMatching( config.getConfigurationDictionary() );
                     return null;
                 }
-            });
+            } );
         }
-        catch (PrivilegedActionException e)
+        catch ( PrivilegedActionException e )
         {
             throw (IOException) e.getException();
         }
@@ -479,16 +490,15 @@
     {
         try
         {
-            return (String) AccessController.doPrivileged(
-                    new PrivilegedExceptionAction()
-                    {
-                        public Object run() throws IOException
-                        {
-                            return store.generatePid( factoryPid );
-                        }
-                    });
+            return (String) AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+                public Object run() throws IOException
+                {
+                    return store.generatePid( factoryPid );
+                }
+            } );
         }
-        catch (PrivilegedActionException e)
+        catch ( PrivilegedActionException e )
         {
             throw (IOException) e.getException();
         }
@@ -498,66 +508,64 @@
     {
         try
         {
-            return (ConfigurationDictionary) AccessController.doPrivileged(
-                    new PrivilegedExceptionAction()
-                    {
-                        public Object run() throws IOException
-                        {
-                            return store.load( pid );
-                        }
-                    });
+            return (ConfigurationDictionary) AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+                public Object run() throws IOException
+                {
+                    return store.load( pid );
+                }
+            } );
         }
-        catch (PrivilegedActionException e)
+        catch ( PrivilegedActionException e )
         {
             throw (IOException) e.getException();
         }
     }
 
-    Configuration[] listConfigurations( String filterString )
-            throws IOException, InvalidSyntaxException
+    Configuration[] listConfigurations( String filterString ) throws IOException, InvalidSyntaxException
     {
         Enumeration configurationPids = store.listPids();
-        
+
         List results = new ArrayList();
-        
+
         while ( configurationPids.hasMoreElements() )
         {
             String pid = (String) configurationPids.nextElement();
             ConfigurationDictionary config = store.load( pid );
-            
+
             if ( config == null )
             {
                 continue;
             }
-            
+
             if ( filterString == null )
             {
                 results.add( new ConfigurationImpl( this, config ) );
             }
             else
             {
-                Filter filter = Activator.bc.createFilter( filterString );
-                
+                Filter filter = ConfigurationFactory.bc.createFilter( filterString );
+
                 if ( filter.match( config ) )
                 {
-                    results.add( new ConfigurationImpl(this, config) );
+                    results.add( new ConfigurationImpl( this, config ) );
                 }
             }
         }
-        
-        return (Configuration[])results.toArray( new Configuration[ results.size() ] );
+
+        return (Configuration[]) results.toArray( new Configuration[ results.size() ] );
     }
-    
+
     public Object getService( Bundle bundle, ServiceRegistration registration )
     {
         return new ConfigurationAdminImpl( this, bundle );
     }
-    
+
     public void ungetService( Bundle bundle, ServiceRegistration registration, Object service )
     {
         // For now we do nothing here
     }
-    
+
     public void bundleChanged( BundleEvent event )
     {
         if ( event.getType() == BundleEvent.UNINSTALLED )
@@ -566,11 +574,12 @@
             existingBundleLocations.remove( uninstalledBundleLocation );
             findAndUnbindConfigurationsDynamicallyBoundTo( uninstalledBundleLocation );
         }
-        else if ( event.getType() == BundleEvent.INSTALLED )
-        {
-            String installedBundleLocation = event.getBundle().getLocation();
-            existingBundleLocations.put( installedBundleLocation, installedBundleLocation );
-        }
+        else
+            if ( event.getType() == BundleEvent.INSTALLED )
+            {
+                String installedBundleLocation = event.getBundle().getLocation();
+                existingBundleLocations.put( installedBundleLocation, installedBundleLocation );
+            }
     }
 
     public void serviceChanged( ServiceEvent event )
@@ -578,10 +587,10 @@
         ServiceReference sr = event.getServiceReference();
         int eventType = event.getType();
         String[] objectClasses = (String[]) sr.getProperty( "objectClass" );
-        
+
         for ( int ii = 0; ii < objectClasses.length; ++ii )
         {
-            serviceChanged( sr, eventType, objectClasses[ii] );
+            serviceChanged( sr, eventType, objectClasses[ ii ] );
         }
     }
 
@@ -591,44 +600,45 @@
         {
             managedServiceFactoryChanged( sr, eventType );
         }
-        else if ( ManagedService.class.getName().equals( objectClass ) )
-        {
-            managedServiceChanged( sr, eventType );
-        }
-        else if ( ConfigurationPlugin.class.getName().equals( objectClass ) )
-        {
-            pluginManager.configurationPluginChanged( sr, eventType );
-        }
+        else
+            if ( ManagedService.class.getName().equals( objectClass ) )
+            {
+                managedServiceChanged( sr, eventType );
+            }
+            else
+                if ( ConfigurationPlugin.class.getName().equals( objectClass ) )
+                {
+                    pluginManager.configurationPluginChanged( sr, eventType );
+                }
     }
 
     private void managedServiceFactoryChanged( ServiceReference sr, int eventType )
     {
-        String factoryPid = (String) sr.getProperty( Constants.SERVICE_PID );
-        
+        String servicePid = (String) sr.getProperty( Constants.SERVICE_PID );
+
         switch ( eventType )
         {
             case ServiceEvent.REGISTERED:
                 configurationDispatcher.addQueueFor( sr );
-                
-                if ( factoryPid == null )
+
+                if ( servicePid == null )
                 {
                     String bundleLocation = sr.getBundle().getLocation();
-                    Activator.LOG.error( "ManagedServiceFactory without valid service.pid registered by "
-                                    + bundleLocation );
+                    log.error( "ManagedServiceFactory without valid service.pid registered by " + bundleLocation );
                     return;
                 }
-                
+
                 addToLocationToPidsAndCheck( sr );
-                
+
                 try
                 {
                     updateManagedServiceFactory( sr );
                 }
-                catch (IOException e)
+                catch ( IOException e )
                 {
-                    Activator.LOG.error( "Error while notifying services.", e );
+                    log.error( "Error while notifying services.", e );
                 }
-                
+
                 break;
             case ServiceEvent.MODIFIED:
                 break;
@@ -642,31 +652,30 @@
     private void managedServiceChanged( ServiceReference sr, int eventType )
     {
         final String servicePid = (String) sr.getProperty( Constants.SERVICE_PID );
-        
+
         switch ( eventType )
         {
             case ServiceEvent.REGISTERED:
                 configurationDispatcher.addQueueFor( sr );
-            
+
                 if ( servicePid == null )
                 {
                     String bundleLocation = sr.getBundle().getLocation();
-                    Activator.LOG.error( "ManagedService without valid service.pid registered by "
-                                    + bundleLocation );
+                    log.error( "ManagedService without valid service.pid registered by " + bundleLocation );
                     return;
                 }
-                
+
                 addToLocationToPidsAndCheck( sr );
-                
+
                 try
                 {
                     updateManagedService( sr );
                 }
-                catch (IOException e)
+                catch ( IOException e )
                 {
-                    Activator.LOG.error( "Error while notifying services.", e );
+                    log.error( "Error while notifying services.", e );
                 }
-                
+
                 break;
             case ServiceEvent.MODIFIED:
                 break;
@@ -677,4 +686,3 @@
         }
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminImpl.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminImpl.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationAdminImpl.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java Sat Sep 10 14:05:06 2005
@@ -15,13 +15,14 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
+import org.osgi.framework.AdminPermission;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.cm.Configuration;
@@ -35,128 +36,123 @@
  */
 class ConfigurationAdminImpl implements ConfigurationAdmin
 {
+    private static final AdminPermission ADMIN_PERMISSION = new AdminPermission();
+
     private final ConfigurationAdminFactory factory;
     private Bundle callingBundle;
     private String callingBundleLocation;
 
     ConfigurationAdminImpl( ConfigurationAdminFactory factory, Bundle callingBundle )
     {
-        this.callingBundle         = callingBundle;
-        this.factory               = factory;
+        this.callingBundle = callingBundle;
+        this.factory = factory;
         this.callingBundleLocation = callingBundle.getLocation();
     }
 
-    public Configuration createFactoryConfiguration( String factoryPid )
-            throws IOException
+    public Configuration createFactoryConfiguration( String factoryPid ) throws IOException
     {
         return createFactoryConfiguration( factoryPid, callingBundleLocation );
     }
 
-    public Configuration createFactoryConfiguration( String factoryPid, String location )
-            throws IOException
+    public Configuration createFactoryConfiguration( String factoryPid, String location ) throws IOException
     {
-        ConfigurationImpl config = new ConfigurationImpl( factory, location, factoryPid,
-                this.factory.generatePid( factoryPid ) );
-        
+        ConfigurationImpl config = new ConfigurationImpl( factory, location, factoryPid, this.factory
+                .generatePid( factoryPid ) );
+
         config.update();
-        
+
         return config;
     }
 
     public Configuration getConfiguration( String pid ) throws IOException
     {
-        ConfigurationDictionary d;
-        
+        ConfigurationDictionary dictionary;
+
         try
         {
-            d = factory.load( pid );
+            dictionary = factory.load( pid );
         }
-        catch (IOException e)
+        catch ( IOException e )
         {
-            d = null;
+            dictionary = null;
         }
-        
-        if ( d == null )
+
+        if ( dictionary == null )
         {
             return new ConfigurationImpl( factory, callingBundleLocation, null, pid );
         }
-        
-        String bundleLocation = (String) d.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
-        
-        if ( bundleLocation != null
-                && !bundleLocation.equals( callingBundleLocation )
-                && !callingBundle.hasPermission( ConfigurationAdminFactory.ADMIN_PERMISSION ) )
-        {
-            throw new SecurityException( "Not owner of the requested configuration, owned by "
-                                + bundleLocation + " caller is " + callingBundleLocation );
-        }
-        
-        String factoryPid = (String) d.get( ConfigurationAdmin.SERVICE_FACTORYPID );
-        
-        return new ConfigurationImpl( factory, bundleLocation, factoryPid, pid, d );
+
+        String bundleLocation = (String) dictionary.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
+
+        if ( bundleLocation != null && !bundleLocation.equals( callingBundleLocation )
+                && !callingBundle.hasPermission( ADMIN_PERMISSION ) )
+        {
+            throw new SecurityException( "Not owner of the requested configuration, owned by " + bundleLocation
+                    + " caller is " + callingBundleLocation );
+        }
+
+        String factoryPid = (String) dictionary.get( ConfigurationAdmin.SERVICE_FACTORYPID );
+
+        return new ConfigurationImpl( factory, bundleLocation, factoryPid, pid, dictionary );
     }
 
-    public Configuration getConfiguration( String pid, String location )
-            throws IOException
+    public Configuration getConfiguration( String pid, String location ) throws IOException
     {
         ConfigurationDictionary dictionary;
-        
+
         try
         {
             dictionary = this.factory.load( pid );
         }
-        catch (IOException e)
+        catch ( IOException e )
         {
             dictionary = null;
         }
-        
+
         if ( dictionary == null )
         {
             ConfigurationImpl c = new ConfigurationImpl( factory, location, null, pid );
-            
+
             if ( location != null )
             {
                 c.setBundleLocation( location );
             }
-            
+
             return c;
         }
-        
+
         String bundleLocation = (String) dictionary.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
         String factoryPid = (String) dictionary.get( ConfigurationAdmin.SERVICE_FACTORYPID );
-        
+
         return new ConfigurationImpl( factory, bundleLocation, factoryPid, pid, dictionary );
     }
 
-    public Configuration[] listConfigurations( final String filterString )
-            throws IOException, InvalidSyntaxException
+    public Configuration[] listConfigurations( final String filterString ) throws IOException, InvalidSyntaxException
     {
         Configuration[] configurations = null;
-        
+
         try
         {
             configurations = (Configuration[]) AccessController.doPrivileged( new PrivilegedExceptionAction()
-                    {
-                        public Object run() throws IOException,
-                                InvalidSyntaxException
-                        {
-                            return factory.listConfigurations( filterString );
-                        }
-                    } );
+            {
+                public Object run() throws IOException, InvalidSyntaxException
+                {
+                    return factory.listConfigurations( filterString );
+                }
+            } );
         }
-        catch (PrivilegedActionException e)
+        catch ( PrivilegedActionException e )
         {
             configurations = null;
-            
+
             if ( e.getException().getClass() == InvalidSyntaxException.class )
             {
                 throw (InvalidSyntaxException) e.getException();
             }
-            
+
             throw (IOException) e.getException();
         }
-        
+
         return configurations;
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDictionary.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDictionary.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDictionary.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java Sat Sep 10 14:05:06 2005
@@ -15,7 +15,7 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.lang.reflect.Array;
 import java.util.Dictionary;
@@ -37,7 +37,7 @@
      * Allowed object types.
      */
     private final static Map allowedObjectTypes = new HashMap();
-    
+
     static
     {
         allowedObjectTypes.put( Integer.class, Integer.class );
@@ -55,7 +55,7 @@
      * Allowed primitive types in arrays.
      */
     private final static Map allowedPrimitiveTypes = new HashMap();
-    
+
     static
     {
         allowedPrimitiveTypes.put( Integer.TYPE, Integer.TYPE );
@@ -69,7 +69,7 @@
     }
 
     private final static Hashtable classToPrimitiveType = new Hashtable();
-    
+
     static
     {
         classToPrimitiveType.put( Integer.class, Integer.TYPE );
@@ -133,7 +133,7 @@
 
         String lowercaseKey = ( (String) key ).toLowerCase();
         String originalCaseKey = (String) lowercaseToOriginalCase.get( lowercaseKey );
-        
+
         if ( originalCaseKey != null )
         {
             key = originalCaseKey;
@@ -157,7 +157,7 @@
     public String toString()
     {
         StringBuffer sb = new StringBuffer( getClass().getName() + " [ " );
-        
+
         for ( Enumeration e = keys(); e.hasMoreElements(); )
         {
             Object key = e.nextElement();
@@ -169,9 +169,9 @@
                 sb.append( ", " );
             }
         }
-        
+
         sb.append( " ]" );
-        
+
         return sb.toString();
     }
 
@@ -179,33 +179,33 @@
     {
         String lowercaseKey = ( (String) key ).toLowerCase();
         String originalCaseKey = (String) lowercaseToOriginalCase.get( lowercaseKey );
-        
-        if (originalCaseKey != null)
+
+        if ( originalCaseKey != null )
         {
             key = originalCaseKey;
         }
-        
+
         Object o = originalCase.put( key, value );
-        
+
         if ( originalCaseKey == null )
         {
             updateLowercaseToOriginalCase( (String) key );
         }
-        
+
         return o;
     }
 
-    public Object remove(Object key)
+    public Object remove( Object key )
     {
         String lowercaseKey = ( (String) key ).toLowerCase();
-        
+
         if ( !lowercaseToOriginalCase.containsKey( lowercaseKey ) )
         {
             return null;
         }
 
         String originalCaseKey = (String) lowercaseToOriginalCase.remove( lowercaseKey );
-        
+
         return originalCase.remove( originalCaseKey );
     }
 
@@ -229,14 +229,14 @@
         ConfigurationDictionary cd = createCopy();
         cd.remove( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
         cd.remove( ConfigurationAdminFactory.DYNAMIC_BUNDLE_LOCATION );
-        
+
         return cd;
     }
-    
+
     private void updateLowercaseToOriginalCase()
     {
         Enumeration keys = originalCase.keys();
-        
+
         while ( keys.hasMoreElements() )
         {
             String originalKey = (String) keys.nextElement();
@@ -250,9 +250,9 @@
         {
             return;
         }
-        
+
         String lowercaseKey = originalKey.toLowerCase();
-        
+
         if ( !lowercaseToOriginalCase.containsKey( lowercaseKey ) )
         {
             lowercaseToOriginalCase.put( lowercaseKey, originalKey );
@@ -274,20 +274,20 @@
 
         Hashtable out = new Hashtable();
         Enumeration keys = in.keys();
-        
+
         while ( keys.hasMoreElements() )
         {
-            Object key     = keys.nextElement();
+            Object key = keys.nextElement();
             Object origVal = in.get( key );
-            Object val     = copyValue( origVal );
+            Object val = copyValue( origVal );
 
             String s = (String) key;
             String lower = s.toLowerCase();
-            
+
             if ( !s.equals( lower ) )
             {
                 Object lowerVal = in.get( lower );
-                
+
                 if ( null != lowerVal )
                 {
                     key = lower;
@@ -304,19 +304,20 @@
         {
             return null;
         }
-        
+
         if ( in.getClass().isArray() )
         {
             return copyArray( in );
         }
-        else if ( in instanceof Vector )
-        {
-            return copyVector( (Vector) in );
-        }
         else
-        {
-            return in;
-        }
+            if ( in instanceof Vector )
+            {
+                return copyVector( (Vector) in );
+            }
+            else
+            {
+                return in;
+            }
     }
 
     static private Vector copyVector( Vector in )
@@ -325,15 +326,15 @@
         {
             return null;
         }
-        
+
         Vector out = new Vector();
         Enumeration elements = in.elements();
-        
+
         while ( elements.hasMoreElements() )
         {
             out.addElement( copyValue( elements.nextElement() ) );
         }
-        
+
         return out;
     }
 
@@ -343,21 +344,20 @@
         {
             return null;
         }
-        
+
         int length = Array.getLength( in );
-        
+
         Object out = Array.newInstance( in.getClass().getComponentType(), length );
-        
+
         for ( int ii = 0; ii < length; ++ii )
         {
             Array.set( out, ii, copyValue( Array.get( in, ii ) ) );
         }
-        
+
         return out;
     }
 
-    static void validateDictionary( Dictionary dictionary )
-            throws IllegalArgumentException
+    static void validateDictionary( Dictionary dictionary ) throws IllegalArgumentException
     {
         if ( dictionary == null )
         {
@@ -365,31 +365,29 @@
         }
 
         Enumeration keys = dictionary.keys();
-        
+
         while ( keys.hasMoreElements() )
         {
             Object key = keys.nextElement();
-            
+
             if ( key.getClass() != String.class )
             {
-                throw new IllegalArgumentException( "The key " + key
-                        + " is not of type java.lang.String." );
+                throw new IllegalArgumentException( "The key " + key + " is not of type java.lang.String." );
             }
-            
+
             try
             {
                 validateValue( dictionary.get( key ) );
             }
-            catch (IllegalArgumentException e)
+            catch ( IllegalArgumentException e )
             {
-                throw new IllegalArgumentException( "The value for key " + key
-                        + " is not of correct type: " + e.getMessage() );
+                throw new IllegalArgumentException( "The value for key " + key + " is not of correct type: "
+                        + e.getMessage() );
             }
         }
     }
 
-    static private void validateValue( Object value )
-            throws IllegalArgumentException
+    static private void validateValue( Object value ) throws IllegalArgumentException
     {
         if ( value == null )
         {
@@ -397,47 +395,45 @@
         }
 
         Class valueClass = value.getClass();
-        
+
         if ( valueClass.isArray() )
         {
             validateArray( value );
         }
-        else if ( valueClass == Vector.class )
-        {
-            validateVector( (Vector) value );
-        }
         else
-        {
-            if ( !allowedObjectTypes.containsKey( valueClass ) )
+            if ( valueClass == Vector.class )
             {
-                throw new IllegalArgumentException( valueClass.toString()
-                        + " is not an allowed type." );
+                validateVector( (Vector) value );
+            }
+            else
+            {
+                if ( !allowedObjectTypes.containsKey( valueClass ) )
+                {
+                    throw new IllegalArgumentException( valueClass.toString() + " is not an allowed type." );
+                }
             }
-        }
     }
 
     static private void validateArray( Object array )
     {
         Class componentType = array.getClass().getComponentType();
-        
+
         int length = Array.getLength( array );
-        
+
         if ( componentType.isArray() || componentType == Vector.class )
         {
             for ( int ii = 0; ii < length; ++ii )
             {
                 Object o = Array.get( array, ii );
-                
+
                 if ( o != null )
                 {
                     Class objectClass = o.getClass();
-                    
+
                     if ( objectClass != componentType )
                     {
-                        throw new IllegalArgumentException(
-                                "Objects with different type in array. " + "Found "
-                                + objectClass.toString() + " " + "Expected "
-                                + componentType.toString() );
+                        throw new IllegalArgumentException( "Objects with different type in array. " + "Found "
+                                + objectClass.toString() + " " + "Expected " + componentType.toString() );
                     }
                     validateValue( o );
                 }
@@ -445,32 +441,28 @@
         }
         else
         {
-            if ( !allowedPrimitiveTypes.containsKey( componentType )
-                    && !allowedObjectTypes.containsKey( componentType ) )
+            if ( !allowedPrimitiveTypes.containsKey( componentType ) && !allowedObjectTypes.containsKey( componentType ) )
             {
-                throw new IllegalArgumentException( "Illegal component type for arrays: "
-                                + componentType.toString() );
+                throw new IllegalArgumentException( "Illegal component type for arrays: " + componentType.toString() );
             }
-            
+
             for ( int ii = 0; ii < length; ++ii )
             {
                 Object o = Array.get( array, ii );
-                
+
                 if ( o != null )
                 {
                     Class objectClass = o.getClass();
-                    
+
                     if ( componentType.isPrimitive() )
                     {
                         objectClass = (Class) classToPrimitiveType.get( objectClass );
                     }
-                    
+
                     if ( objectClass != componentType )
                     {
-                        throw new IllegalArgumentException(
-                                "Objects with different type in array. " + "Found "
-                                + objectClass.toString() + " " + "Expected "
-                                + componentType.toString() );
+                        throw new IllegalArgumentException( "Objects with different type in array. " + "Found "
+                                + objectClass.toString() + " " + "Expected " + componentType.toString() );
                     }
                 }
             }
@@ -486,4 +478,3 @@
         }
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDispatcher.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDispatcher.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDispatcher.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDispatcher.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDispatcher.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationDispatcher.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationDispatcher.java Sat Sep 10 14:05:06 2005
@@ -15,11 +15,14 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.util.Hashtable;
 
+import org.apache.configuration.ConfigurationFactory;
 import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class is responsible for dispatching configurations to
@@ -28,6 +31,9 @@
  */
 final class ConfigurationDispatcher
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( ConfigurationDispatcher.class );
+
     /**
      * The PluginManager to use.
      */
@@ -43,7 +49,7 @@
     /**
      * Construct a ConfigurationDispatcher given a ConfigurationServicesTracker.
      * 
-     * @param tracker The ConfigurationServicesTracker to use.
+     * @param pm The PluginManager to use.
      */
     ConfigurationDispatcher( PluginManager pm )
     {
@@ -55,12 +61,12 @@
         synchronized ( targetServiceToQueue )
         {
             Object targetService = serviceReferenceToTargetService.get( sr );
-            
+
             if ( targetService == null )
             {
                 return null;
             }
-            
+
             return (UpdateQueue) targetServiceToQueue.get( targetService );
         }
     }
@@ -70,19 +76,19 @@
         synchronized ( targetServiceToQueue )
         {
             Object targetService = serviceReferenceToTargetService.get( sr );
-            
+
             if ( targetService == null )
             {
-                targetService = Activator.bc.getService( sr );
-                
+                targetService = ConfigurationFactory.bc.getService( sr );
+
                 if ( targetService == null )
                 {
-                    Activator.LOG.error( "Failed getting target service to build new queue for." );
+                    log.error( "Failed getting target service to build new queue for." );
                     return;
                 }
                 serviceReferenceToTargetService.put( sr, targetService );
             }
-            
+
             if ( !targetServiceToQueue.containsKey( targetService ) )
             {
                 targetServiceToQueue.put( targetService, new UpdateQueue( pm ) );
@@ -95,37 +101,36 @@
         synchronized ( targetServiceToQueue )
         {
             Object targetService = serviceReferenceToTargetService.remove( sr );
-            
+
             if ( targetService == null )
             {
-                Activator.LOG.error( "Missing target service for a ServiceReference in removeQueueFor(ServiceReference)" );
+                log.error( "Missing target service for a ServiceReference in removeQueueFor(ServiceReference)" );
             }
-            else if ( !serviceReferenceToTargetService.contains( targetService ) )
-            {
-                UpdateQueue uq = (UpdateQueue) targetServiceToQueue.remove( targetService );
-                
-                if ( uq == null )
+            else
+                if ( !serviceReferenceToTargetService.contains( targetService ) )
                 {
-                    Activator.LOG.error( "Missing UpdateQueue for a ServiceReference in removeQueueFor(ServiceReference)" );
+                    UpdateQueue uq = (UpdateQueue) targetServiceToQueue.remove( targetService );
+
+                    if ( uq == null )
+                    {
+                        log.error( "Missing UpdateQueue for a ServiceReference in removeQueueFor(ServiceReference)" );
+                    }
                 }
-            }
         }
     }
 
-    public void dispatchUpdateFor( ServiceReference sr, String pid,
-            String factoryPid, ConfigurationDictionary cd )
+    public void dispatchUpdateFor( ServiceReference sr, String pid, String factoryPid, ConfigurationDictionary cd )
     {
         UpdateQueue uq = getQueueFor( sr );
-        
+
         if ( uq == null )
         {
-            Activator.LOG.error( "Missing UpdateQueue for " + factoryPid );
+            log.error( "Missing UpdateQueue for " + factoryPid );
             return;
         }
-        
+
         Update u = new Update( sr, pid, factoryPid, cd );
 
         uq.enqueue( u );
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationImpl.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationImpl.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/ConfigurationImpl.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java Sat Sep 10 14:05:06 2005
@@ -15,7 +15,7 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.io.IOException;
 import java.util.Dictionary;
@@ -23,36 +23,40 @@
 import org.osgi.framework.Constants;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * The configuration information for a ManagedService
- * or ManagedServiceFactory object.
+ * The configuration information for a ManagedService or ManagedServiceFactory object.
  */
 class ConfigurationImpl implements Configuration
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( ConfigurationImpl.class );
+
     private final ConfigurationAdminFactory factory;
     private final String factoryPid;
     private final String servicePid;
-    
+
     private String bundleLocation;
     private boolean deleted = false;
-    
+
     private ConfigurationDictionary properties;
-    
+
     ConfigurationImpl( ConfigurationAdminFactory factory, String bundleLocation, String factoryPid, String servicePid )
     {
         this( factory, bundleLocation, factoryPid, servicePid, null );
     }
 
-    ConfigurationImpl( ConfigurationAdminFactory factory, String bundleLocation, String factoryPid,
-            String servicePid, ConfigurationDictionary properties )
+    ConfigurationImpl( ConfigurationAdminFactory factory, String bundleLocation, String factoryPid, String servicePid,
+            ConfigurationDictionary properties )
     {
         this.bundleLocation = bundleLocation;
-        this.factory        = factory;
-        this.factoryPid     = factoryPid;
-        this.servicePid     = servicePid;
-        this.properties     = properties;
-        
+        this.factory = factory;
+        this.factoryPid = factoryPid;
+        this.servicePid = servicePid;
+        this.properties = properties;
+
         if ( this.properties == null )
         {
             this.properties = new ConfigurationDictionary();
@@ -62,11 +66,11 @@
     ConfigurationImpl( ConfigurationAdminFactory factory, ConfigurationDictionary properties )
     {
         this.bundleLocation = (String) properties.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
-        this.factoryPid     = (String) properties.get( ConfigurationAdmin.SERVICE_FACTORYPID );
-        this.servicePid     = (String) properties.get( Constants.SERVICE_PID);
-        
-        this.factory        = factory;
-        this.properties     = properties;
+        this.factoryPid = (String) properties.get( ConfigurationAdmin.SERVICE_FACTORYPID );
+        this.servicePid = (String) properties.get( Constants.SERVICE_PID );
+
+        this.factory = factory;
+        this.properties = properties;
     }
 
     public void delete() throws IOException
@@ -97,15 +101,15 @@
     public Dictionary getProperties()
     {
         throwIfDeleted();
-        
+
         if ( properties == null )
         {
             return null;
         }
-        
+
         return properties.createCopyAndRemoveLocation();
     }
-    
+
     public ConfigurationDictionary getConfigurationDictionary()
     {
         return properties;
@@ -114,11 +118,11 @@
     public void setBundleLocation( String bundleLocation )
     {
         throwIfDeleted();
-        
+
         this.bundleLocation = bundleLocation;
-        
+
         ConfigurationDictionary old = properties;
-        
+
         if ( properties == null )
         {
             properties = new ConfigurationDictionary();
@@ -127,9 +131,9 @@
         {
             properties = properties.createCopy();
         }
-        
+
         properties.remove( ConfigurationAdminFactory.DYNAMIC_BUNDLE_LOCATION );
-        
+
         if ( bundleLocation == null )
         {
             properties.remove( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
@@ -138,21 +142,21 @@
         {
             properties.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, bundleLocation );
         }
-        
+
         try
         {
             update();
         }
-        catch (IOException e)
+        catch ( IOException e )
         {
             properties = old;
         }
     }
-    
+
     public void update( Dictionary properties ) throws IOException
     {
         throwIfDeleted();
-        
+
         ConfigurationDictionary.validateDictionary( properties );
 
         ConfigurationDictionary old = this.properties;
@@ -170,39 +174,39 @@
         {
             update();
         }
-        catch (IOException e)
+        catch ( IOException e )
         {
             properties = old;
             throw e;
         }
-        catch (Exception e)
+        catch ( Exception e )
         {
-            Activator.LOG.error( "Error while updating properties.", e );
+            log.error( "Error while updating properties.", e );
             properties = old;
         }
     }
-    
+
     public void update() throws IOException
     {
         throwIfDeleted();
         ensureAutoPropertiesAreWritten();
         factory.update( this );
     }
-    
+
     void ensureAutoPropertiesAreWritten()
     {
         if ( properties == null )
         {
             return;
         }
-        
+
         this.properties.put( Constants.SERVICE_PID, getPid() );
-        
+
         if ( getFactoryPid() != null )
         {
             this.properties.put( ConfigurationAdmin.SERVICE_FACTORYPID, getFactoryPid() );
         }
-        
+
         if ( getBundleLocation() != null )
         {
             this.properties.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, getBundleLocation() );
@@ -217,4 +221,3 @@
         }
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/PluginManager.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/PluginManager.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/PluginManager.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/PluginManager.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/PluginManager.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/PluginManager.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/PluginManager.java Sat Sep 10 14:05:06 2005
@@ -15,24 +15,30 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Vector;
 
+import org.apache.configuration.ConfigurationFactory;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.ConfigurationPlugin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class is responsible for managing ConfigurationPlugins.
  */
 final class PluginManager
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( PluginManager.class );
+
     private final static String CM_RANKING = "service.cmRanking";
-    private final static String CM_TARGET  = ConfigurationPlugin.CM_TARGET;
+    private final static String CM_TARGET = ConfigurationPlugin.CM_TARGET;
 
     /**
      * Sorted Vector of ServiceReferences to ConfigurationPlugins.
@@ -53,36 +59,36 @@
      * Hashtable mapping a ServiceReference to its ranking (Integer).
      */
     Hashtable rankings = new Hashtable();
-    
+
     /**
      * Handle ConfigurationPlugin ServiceEvents.
      * 
      * @param serviceReference ServiceReference of the plugin the event concerns
      * @param eventType Type of the event that caused the change
      */
-    public synchronized void configurationPluginChanged(
-            ServiceReference serviceReference, int eventType )
+    public synchronized void configurationPluginChanged( ServiceReference serviceReference, int eventType )
     {
         Object rankingProperty = serviceReference.getProperty( CM_RANKING );
-        
+
         if ( rankingProperty == null )
         {
-            rankingProperty = new Integer(0);
-        }
-        else if ( rankingProperty.getClass() != Integer.class )
-        {
-            rankingProperty = new Integer(0);
+            rankingProperty = new Integer( 0 );
         }
+        else
+            if ( rankingProperty.getClass() != Integer.class )
+            {
+                rankingProperty = new Integer( 0 );
+            }
 
         Long serviceId = (Long) serviceReference.getProperty( Constants.SERVICE_ID );
-        
+
         if ( serviceId == null )
         {
-            Activator.LOG.error( "Missing service id for a ConfigurationPlugin" );
+            log.error( "Missing service id for a ConfigurationPlugin" );
             return;
         }
 
-        int ranking = ( (Integer)rankingProperty ).intValue();
+        int ranking = ( (Integer) rankingProperty ).intValue();
 
         switch ( eventType )
         {
@@ -91,13 +97,13 @@
                 insertPluginReference( serviceReference, ranking );
                 break;
             case ServiceEvent.MODIFIED:
-                int oldRanking = ( (Integer)rankings.get( serviceId ) ).intValue();
-            
+                int oldRanking = ( (Integer) rankings.get( serviceId ) ).intValue();
+
                 if ( ranking == oldRanking )
                 {
                     return;
                 }
-                
+
                 removePluginReference( serviceId, oldRanking );
                 rankings.put( serviceId, rankingProperty );
                 insertPluginReference( serviceReference, ranking );
@@ -124,14 +130,16 @@
         {
             insertPluginReference( serviceReference, ranking, preModificationPlugins );
         }
-        else if ( 0 <= ranking && ranking <= 1000 )
-        {
-            insertPluginReference( serviceReference, ranking, modifyingPlugins );
-        }
-        else if ( ranking > 1000 )
-        {
-            insertPluginReference( serviceReference, ranking, postModificationPlugins );
-        }
+        else
+            if ( 0 <= ranking && ranking <= 1000 )
+            {
+                insertPluginReference( serviceReference, ranking, modifyingPlugins );
+            }
+            else
+                if ( ranking > 1000 )
+                {
+                    insertPluginReference( serviceReference, ranking, postModificationPlugins );
+                }
     }
 
     /**
@@ -140,23 +148,22 @@
      * @param serviceReference The ServiceReference.
      * @param pluginsVector The vector.
      */
-    private void insertPluginReference( ServiceReference serviceReference,
-            int ranking, Vector pluginsVector )
+    private void insertPluginReference( ServiceReference serviceReference, int ranking, Vector pluginsVector )
     {
         int ii;
-        
+
         for ( ii = 0; ii < pluginsVector.size(); ++ii )
         {
-            ServiceReference nextReference = (ServiceReference) pluginsVector.elementAt(ii);
+            ServiceReference nextReference = (ServiceReference) pluginsVector.elementAt( ii );
             Long serviceId = (Long) nextReference.getProperty( Constants.SERVICE_ID );
             Integer rankingOfNextReference = (Integer) rankings.get( serviceId );
-            
+
             if ( ranking < rankingOfNextReference.intValue() )
             {
                 break;
             }
         }
-        
+
         pluginsVector.insertElementAt( serviceReference, ii );
     }
 
@@ -173,24 +180,26 @@
         {
             removePluginReference( serviceId, preModificationPlugins );
         }
-        else if ( 0 <= ranking && ranking <= 1000 )
-        {
-            removePluginReference( serviceId, modifyingPlugins );
-        }
-        else if ( ranking > 1000 )
-        {
-            removePluginReference( serviceId, postModificationPlugins );
-        }
+        else
+            if ( 0 <= ranking && ranking <= 1000 )
+            {
+                removePluginReference( serviceId, modifyingPlugins );
+            }
+            else
+                if ( ranking > 1000 )
+                {
+                    removePluginReference( serviceId, postModificationPlugins );
+                }
     }
 
     private void removePluginReference( Object serviceId, Vector pluginsVector )
     {
         for ( int ii = 0; ii < pluginsVector.size(); ++ii )
         {
-            ServiceReference serviceReference = (ServiceReference) pluginsVector.elementAt(ii);
-            
+            ServiceReference serviceReference = (ServiceReference) pluginsVector.elementAt( ii );
+
             Long currentId = (Long) serviceReference.getProperty( Constants.SERVICE_ID );
-            
+
             if ( currentId.equals( serviceId ) )
             {
                 pluginsVector.removeElementAt( ii );
@@ -202,24 +211,23 @@
     /**
      * Call all applicable ConfigurationPlugins given a pid and a dictionary.
      * 
-     * @param pid The pid of the target ManagedService(Factory).
+     * @param targetServiceReference The ServiceReference of the target ManagedService[Factory].
      * @param dictionary The configuration dictionary to be modified.
      * @return The description of what the method returns.
      */
-    public synchronized ConfigurationDictionary callPluginsAndCreateACopy(
-            ServiceReference targetServiceReference,
+    public synchronized ConfigurationDictionary callPluginsAndCreateACopy( ServiceReference targetServiceReference,
             ConfigurationDictionary dictionary )
     {
         if ( targetServiceReference == null )
         {
             return dictionary;
         }
-        
+
         if ( dictionary == null )
         {
             return null;
         }
-        
+
         callPlugins( targetServiceReference, dictionary, preModificationPlugins, false );
 
         dictionary = callPlugins( targetServiceReference, dictionary, modifyingPlugins, true );
@@ -230,7 +238,7 @@
         {
             dictionary = dictionary.createCopyAndRemoveLocation();
         }
-        
+
         return dictionary;
     }
 
@@ -251,7 +259,7 @@
         String pid = (String) targetServiceReference.getProperty( Constants.SERVICE_PID );
         ConfigurationDictionary currentDictionary = dictionary;
         Enumeration e = plugins.elements();
-        
+
         while ( e.hasMoreElements() )
         {
             ServiceReference pluginReference = (ServiceReference) e.nextElement();
@@ -259,37 +267,36 @@
             // Only call the plugin if no cm.target is specified or if it
             // matches the pid of the target service
             String cmTarget = (String) pluginReference.getProperty( CM_TARGET );
-            
+
             if ( cmTarget == null || cmTarget.equals( pid ) )
             {
-                ConfigurationPlugin plugin = (ConfigurationPlugin) Activator.bc.getService( pluginReference );
-                
+                ConfigurationPlugin plugin = (ConfigurationPlugin) ConfigurationFactory.bc.getService( pluginReference );
+
                 if ( plugin == null )
                 {
                     continue;
                 }
-                
+
                 ConfigurationDictionary dictionaryCopy = currentDictionary.createCopyAndRemoveLocation();
-                
+
                 try
                 {
                     plugin.modifyConfiguration( targetServiceReference, dictionaryCopy );
-                    
+
                     ConfigurationDictionary.validateDictionary( dictionary );
-                    
+
                     if ( allowModification )
                     {
                         currentDictionary = dictionaryCopy;
                     }
                 }
-                catch (Exception exception)
+                catch ( Exception exception )
                 {
-                    Activator.LOG.error( "Exception thrown by plugin: " + exception.getMessage() );
+                    log.error( "Exception thrown by plugin: " + exception.getMessage() );
                 }
             }
         }
-        
+
         return currentDictionary;
     }
 }
-

Copied: directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/Update.java (from r279417, directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Update.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/Update.java?p2=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/Update.java&p1=directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Update.java&r1=279417&r2=280040&rev=280040&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/Update.java (original)
+++ directory/sandbox/trunk/osgi-spec/trunk/configuration/src/main/java/org/apache/configuration/impl/Update.java Sat Sep 10 14:05:06 2005
@@ -15,8 +15,9 @@
  *
  */
 
-package org.apache.configuration;
+package org.apache.configuration.impl;
 
+import org.apache.configuration.ConfigurationFactory;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
@@ -30,12 +31,11 @@
     final ConfigurationDictionary configuration;
     ConfigurationDictionary processedConfiguration = null;
 
-    public Update( ServiceReference sr, String pid, String factoryPid,
-            ConfigurationDictionary configuration )
+    public Update( ServiceReference sr, String pid, String factoryPid, ConfigurationDictionary configuration )
     {
-        this.sr            = sr;
-        this.pid           = pid;
-        this.factoryPid    = factoryPid;
+        this.sr = sr;
+        this.pid = pid;
+        this.factoryPid = factoryPid;
         this.configuration = configuration;
     }
 
@@ -45,16 +45,16 @@
         {
             return;
         }
-        
+
         Object targetService = getTargetService();
-        
+
         if ( targetService == null )
         {
             return;
         }
-        
+
         processedConfiguration = pm.callPluginsAndCreateACopy( sr, configuration );
-        
+
         if ( factoryPid == null )
         {
             update( (ManagedService) targetService );
@@ -65,37 +65,36 @@
         }
     }
 
-    private void update( ManagedService targetService )
-            throws ConfigurationException
+    private void update( ManagedService targetService ) throws ConfigurationException
     {
         if ( targetService == null )
         {
             return;
         }
-        
+
         targetService.updated( processedConfiguration );
     }
 
-    private void update( ManagedServiceFactory targetService )
-            throws ConfigurationException
+    private void update( ManagedServiceFactory targetService ) throws ConfigurationException
     {
         if ( targetService == null )
         {
             return;
         }
-        
+
         if ( configuration == null )
         {
             targetService.deleted( pid );
         }
-        else if ( processedConfiguration == null )
-        {
-            targetService.updated( pid, null );
-        }
         else
-        {
-            targetService.updated( pid, configuration );
-        }
+            if ( processedConfiguration == null )
+            {
+                targetService.updated( pid, null );
+            }
+            else
+            {
+                targetService.updated( pid, configuration );
+            }
     }
 
     private Object getTargetService()
@@ -104,8 +103,7 @@
         {
             return null;
         }
-        
-        return Activator.bc.getService( sr );
+
+        return ConfigurationFactory.bc.getService( sr );
     }
 }
-