Repository: karaf Updated Branches: refs/heads/karaf-3.0.x 65a5426c3 -> 54f01bd92
[KARAF-4489] Introduce configCfgStore property in etc/org.apache.karaf.features.cfg to define if the features service automatically creates cfg file for <config/> element Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/54f01bd9 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/54f01bd9 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/54f01bd9 Branch: refs/heads/karaf-3.0.x Commit: 54f01bd921e8a15208547e27630a737aea8865d5 Parents: 65a5426 Author: Jean-Baptiste Onofré <[email protected]> Authored: Thu Apr 14 10:29:13 2016 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Thu Apr 14 10:29:13 2016 +0200 ---------------------------------------------------------------------- .../resources/etc/org.apache.karaf.features.cfg | 5 +++++ .../karaf/features/internal/FeatureConfigInstaller.java | 10 +++++++++- .../src/main/resources/OSGI-INF/blueprint/blueprint.xml | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/54f01bd9/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg ---------------------------------------------------------------------- diff --git a/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg b/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg index 9bc5df1..90a4b3f 100644 --- a/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg +++ b/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg @@ -47,3 +47,8 @@ featuresBoot=config,standard,region,package,kar,ssh,management # Defines if the boot features are started in asynchronous mode (in a dedicated thread) # featuresBootAsynchronous=false + +# +# Store cfg file for config element in feature +# +#configCfgStore=true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/karaf/blob/54f01bd9/features/core/src/main/java/org/apache/karaf/features/internal/FeatureConfigInstaller.java ---------------------------------------------------------------------- diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/FeatureConfigInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/FeatureConfigInstaller.java index ca6a7dc..2e8cc8b 100644 --- a/features/core/src/main/java/org/apache/karaf/features/internal/FeatureConfigInstaller.java +++ b/features/core/src/main/java/org/apache/karaf/features/internal/FeatureConfigInstaller.java @@ -47,12 +47,20 @@ public class FeatureConfigInstaller { private final ConfigurationAdmin configAdmin; private File storage; + private boolean configCfgStore = true; public FeatureConfigInstaller(ConfigurationAdmin configAdmin) { this.configAdmin = configAdmin; this.storage = new File(System.getProperty("karaf.etc")); + this.configCfgStore = true; } + public FeatureConfigInstaller(ConfigurationAdmin configAdmin, boolean configCfgStore) { + this.configAdmin = configAdmin; + this.storage = new File(System.getProperty("karaf.etc")); + this.configCfgStore = configCfgStore; + } + private String[] parsePid(String pid) { int n = pid.indexOf('-'); if (n > 0) { @@ -208,7 +216,7 @@ public class FeatureConfigInstaller { } protected void updateStorage(String pid, Dictionary props) throws IOException { - if (storage != null) { + if (storage != null && configCfgStore) { // get the cfg file File cfgFile = new File(storage, pid + ".cfg"); Configuration cfg = configAdmin.getConfiguration(pid, null); http://git-wip-us.apache.org/repos/asf/karaf/blob/54f01bd9/features/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/features/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/features/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 8db41f1..617bca9 100644 --- a/features/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/features/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -36,6 +36,7 @@ <ext:property name="respectStartLvlDuringFeatureUninstall" value="true"/> <ext:property name="featuresBootAsynchronous" value="false"/> <ext:property name="overrides" value="file:$(karaf.etc)/overrides.properties"/> + <ext:property name="configCfgStore" value="true"/> </ext:default-properties> <ext:location>file:$(karaf.etc)/org.apache.karaf.features.cfg</ext:location> </ext:property-placeholder> @@ -62,6 +63,7 @@ </bean> <bean id="configInstaller" class="org.apache.karaf.features.internal.FeatureConfigInstaller"> <argument ref="configAdmin"/> + <argument value="$[configCfgStore]"/> </bean> <bean id="featuresService" class="org.apache.karaf.features.internal.FeaturesServiceImpl" init-method="start" destroy-method="stop">
