You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2012/06/11 11:53:12 UTC

svn commit: r1348779 - in /felix/trunk: fileinstall/pom.xml fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java utils/src/main/java/org/apache/felix/utils/properties/Properties.java

Author: gnodet
Date: Mon Jun 11 09:53:12 2012
New Revision: 1348779

URL: http://svn.apache.org/viewvc?rev=1348779&view=rev
Log:
[FELIX-3847] Variables are not preserved during write-back if they are defined as framework properties

Modified:
    felix/trunk/fileinstall/pom.xml
    felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
    felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java

Modified: felix/trunk/fileinstall/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/pom.xml?rev=1348779&r1=1348778&r2=1348779&view=diff
==============================================================================
--- felix/trunk/fileinstall/pom.xml (original)
+++ felix/trunk/fileinstall/pom.xml Mon Jun 11 09:53:12 2012
@@ -58,7 +58,7 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.utils</artifactId>
-      <version>1.1.0</version>
+      <version>1.1.3-SNAPSHOT</version>
       <scope>provided</scope>
     </dependency>
   </dependencies>

Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java?rev=1348779&r1=1348778&r2=1348779&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java (original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java Mon Jun 11 09:53:12 2012
@@ -117,7 +117,7 @@ public class ConfigInstaller implements 
                 if( file != null && file.isFile()   ) {
                     if( fileName.endsWith( ".cfg" ) )
                     {
-                        org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties( file );
+                        org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties( file, context );
                         for( Enumeration e  = dict.keys(); e.hasMoreElements(); )
                         {
                             String key = e.nextElement().toString();

Modified: felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java?rev=1348779&r1=1348778&r2=1348779&view=diff
==============================================================================
--- felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java (original)
+++ felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java Mon Jun 11 09:53:12 2012
@@ -41,6 +41,8 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
+import org.osgi.framework.BundleContext;
+
 /**
  * <p>
  * Enhancement of the standard <code>Properties</code>
@@ -84,12 +86,18 @@ public class Properties extends Abstract
     private List<String> header;
     private List<String> footer;
     private File location;
+    private BundleContext context;
 
     public Properties() {
     }
 
     public Properties(File location) throws IOException {
+      this(location, null);
+    }
+
+    public Properties(File location, BundleContext context) throws IOException {
         this.location = location;
+        this.context = context;
         if(location.exists())
             load(location);
     }
@@ -339,7 +347,13 @@ public class Properties extends Abstract
                                new ArrayList<String>(reader.getValueLines())));
         }
         footer = new ArrayList<String>(reader.getCommentLines());
-        InterpolationHelper.performSubstitution(storage);
+        if(context != null)
+        {
+            InterpolationHelper.performSubstitution(storage, context);
+        }
+        else {
+            InterpolationHelper.performSubstitution(storage);
+        }
     }
 
     /**