You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/03/30 19:29:12 UTC
karaf git commit: KARAF-4441 - Deal with factoryPid when creating the
cfg file corresponding to a feature element
Repository: karaf
Updated Branches:
refs/heads/master 47e207c05 -> 9de101e5e
KARAF-4441 - Deal with factoryPid when creating the cfg file corresponding to a feature <config/> element
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9de101e5
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9de101e5
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9de101e5
Branch: refs/heads/master
Commit: 9de101e5ec13011c02d3c64865eaf822bdc8ac02
Parents: 47e207c
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Mar 30 19:28:41 2016 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Mar 30 19:28:41 2016 +0200
----------------------------------------------------------------------
.../internal/service/FeatureConfigInstaller.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/9de101e5/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
index f040ac2..be99704 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
@@ -104,7 +104,7 @@ public class FeatureConfigInstaller {
cfgProps.put(CONFIG_KEY, key);
cfg.update(cfgProps);
try {
- updateStorage(pid[0], props);
+ updateStorage(pid[0], pid[1], props);
} catch (Exception e) {
LOGGER.warn("Can't update cfg file", e);
}
@@ -120,7 +120,7 @@ public class FeatureConfigInstaller {
if (update) {
cfg.update(properties);
try {
- updateStorage(pid[0], props);
+ updateStorage(pid[0], pid[1], props);
} catch (Exception e) {
LOGGER.warn("Can't update cfg file", e);
}
@@ -236,11 +236,16 @@ public class FeatureConfigInstaller {
}
}
- protected void updateStorage(String pid, Dictionary props) throws IOException {
+ protected void updateStorage(String pid, String factoryPid, Dictionary props) throws Exception {
if (storage != null) {
// get the cfg file
- File cfgFile = new File(storage, pid + ".cfg");
- Configuration cfg = configAdmin.getConfiguration(pid, null);
+ File cfgFile;
+ if (factoryPid != null) {
+ cfgFile = new File(storage, pid + "-" + factoryPid + ".cfg");
+ } else {
+ cfgFile = new File(storage, pid + ".cfg");
+ }
+ Configuration cfg = findExistingConfiguration(configAdmin, factoryPid, pid);
// update the cfg file depending of the configuration
if (cfg != null && cfg.getProperties() != null) {
Object val = cfg.getProperties().get(FILEINSTALL_FILE_NAME);