You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gg...@apache.org on 2018/04/06 10:54:24 UTC
[karaf] branch master updated: [KARAF-5692] Fix config:edit for
factory PID with alias
This is an automated email from the ASF dual-hosted git repository.
ggrzybek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/master by this push:
new fac8b68 [KARAF-5692] Fix config:edit for factory PID with alias
fac8b68 is described below
commit fac8b68d3d58445df62deee53170ce61c43428b1
Author: Grzegorz Grzybek <gg...@redhat.com>
AuthorDate: Fri Apr 6 12:54:07 2018 +0200
[KARAF-5692] Fix config:edit for factory PID with alias
---
.../org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java | 7 ++++++-
config/src/main/resources/org/apache/karaf/config/command/edit.txt | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java b/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
index 898c88c..04757bb 100644
--- a/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
+++ b/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
@@ -154,7 +154,12 @@ public class ConfigRepositoryImpl implements ConfigRepository {
public String createFactoryConfiguration(String factoryPid, String alias, Map<String, Object> properties) throws IOException {
Configuration config = configAdmin.createFactoryConfiguration(factoryPid, "?");
TypedProperties props = new TypedProperties();
- File file = File.createTempFile(factoryPid + "-", ".cfg", new File(System.getProperty("karaf.etc")));
+ File file = null;
+ if (alias != null && !"".equals(alias.trim())) {
+ file = new File(new File(System.getProperty("karaf.etc")), factoryPid + "-" + alias + ".cfg");
+ } else {
+ file = File.createTempFile(factoryPid + "-", ".cfg", new File(System.getProperty("karaf.etc")));
+ }
props.putAll(properties);
props.save(file);
props.put(FILEINSTALL_FILE_NAME, file.toURI().toString());
diff --git a/config/src/main/resources/org/apache/karaf/config/command/edit.txt b/config/src/main/resources/org/apache/karaf/config/command/edit.txt
index d140f0a..699ffc1 100644
--- a/config/src/main/resources/org/apache/karaf/config/command/edit.txt
+++ b/config/src/main/resources/org/apache/karaf/config/command/edit.txt
@@ -9,7 +9,7 @@ Create a factory config by factory pid:
In this case the config is created with a pid like myfactorypid.<generated id>. The file name is myfactorypid-<generated alias>.cfg.
Create a factory config by factory pid and alias:
- > config:edit --factory myfactorypid --alias myalias
+ > config:edit --factory --alias myalias myfactorypid
In this case the config is created with a pid like myfactorypid.<generated id>. The file name is myfactorypid-myalias.cfg.
Edit a config specified by an ldap query
--
To stop receiving notification emails like this one, please contact
ggrzybek@apache.org.