[FELIX-2699] Disable writing configuration back to .cfg files

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1040674 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
index 4711033..bbb8e1f 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
@@ -100,6 +100,18 @@
 
     public void configurationEvent(ConfigurationEvent configurationEvent)
     {
+        // Check if writing back configurations has been disabled.
+        {
+            Object obj = this.context.getProperty( DirectoryWatcher.DISABLE_CONFIG_SAVE );
+            if (obj instanceof String) {
+                obj = new Boolean((String) obj );
+            }
+            if( Boolean.FALSE.equals( obj ) )
+            {
+                return;
+            }
+        }
+
         if (configurationEvent.getType() == ConfigurationEvent.CM_UPDATED)
         {
             try
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
index 08b3e17..3792642 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
@@ -89,6 +89,7 @@
     public final static String START_NEW_BUNDLES = "felix.fileinstall.bundles.new.start";
     public final static String USE_START_TRANSIENT = "felix.fileinstall.bundles.startTransient";
     public final static String NO_INITIAL_DELAY = "felix.fileinstall.noInitialDelay";
+    public final static String DISABLE_CONFIG_SAVE = "felix.fileinstall.disableConfigSave";
     public final static String START_LEVEL = "felix.fileinstall.start.level";
 
     static final SecureRandom random = new SecureRandom();