felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r805305 - /felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
Date Tue, 18 Aug 2009 07:52:51 GMT
Author: fmeschbe
Date: Tue Aug 18 07:52:51 2009
New Revision: 805305

URL: http://svn.apache.org/viewvc?rev=805305&view=rev
Log:
Consolidate "update" flag setting with configuraiton property
update setting

Modified:
    felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java

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=805305&r1=805304&r2=805305&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
Tue Aug 18 07:52:51 2009
@@ -352,9 +352,6 @@
 
             configureFromPersistence( properties );
 
-            // ensure configuration is being delivered
-            setDelivered( false );
-
             configurationManager.updated( this );
         }
     }
@@ -372,10 +369,9 @@
 
             setAutoProperties( newProperties, staticallyBound );
 
+            // persist new configuration
             localPersistenceManager.store( pid, newProperties );
 
-            configure( newProperties );
-
             // if this is a factory configuration, update the factory with
             String factoryPid = getFactoryPid();
             if ( factoryPid != null )
@@ -385,12 +381,20 @@
                 {
                     // only write back if the pid was not already registered
                     // with the factory
-                    factory.store();
+                    try
+                    {
+                        factory.store();
+                    }
+                    catch ( IOException ioe )
+                    {
+                        configurationManager.log( LogService.LOG_ERROR, "Failure storing
factory " + factoryPid
+                            + " with new configuration " + pid, ioe );
+                    }
                 }
             }
 
-            // ensure configuration is being delivered
-            setDelivered( false );
+            // finally assign the configuration for use
+            configure( newProperties );
 
             configurationManager.updated( this );
         }
@@ -485,8 +489,7 @@
      */
     boolean isDeleted()
     {
-        PersistenceManager persistenceManager = getPersistenceManager();
-        return persistenceManager == null;
+        return getPersistenceManager() == null;
     }
 
 
@@ -523,23 +526,36 @@
         }
         else
         {
-            this.properties = null;
+            configure( null );
         }
     }
 
-    private void configure( Dictionary properties )
+    private void configure( final Dictionary properties )
     {
-        // remove predefined properties
-        clearAutoProperties( properties );
-
-        // ensure CaseInsensitiveDictionary
-        if ( properties instanceof CaseInsensitiveDictionary )
+        final CaseInsensitiveDictionary newProperties;
+        if ( properties == null )
         {
-            this.properties = ( CaseInsensitiveDictionary ) properties;
+            newProperties = null;
         }
         else
         {
-            this.properties = new CaseInsensitiveDictionary( properties );
+            // remove predefined properties
+            clearAutoProperties( properties );
+
+            // ensure CaseInsensitiveDictionary
+            if ( properties instanceof CaseInsensitiveDictionary )
+            {
+                newProperties = ( CaseInsensitiveDictionary ) properties;
+            }
+            else
+            {
+                newProperties = new CaseInsensitiveDictionary( properties );
+            }
+        }
+
+        synchronized (this) {
+            this.properties = newProperties;
+            this.setDelivered( false );
         }
     }
 



Mime
View raw message