Jakub Herkel created KARAF-7736:
-----------------------------------
Summary: Service PID for a JSON configuration
Key: KARAF-7736
URL: https://issues.apache.org/jira/browse/KARAF-7736
Project: Karaf
Issue Type: Improvement
Reporter: Jakub Herkel
I tried to use a json configuration with Karaf 4.4.3. For example I
created a test.cfg.json:
{code:java}
{
"test1":"testString",
"test2":false
} {code}
I can see that Karaf read this config viac config:list
{code:java}
Pid: test.cfg
BundleLocation: ?
Properties:
felix.fileinstall.filename =
file:/home/jakub/java/apache-karaf-4.4.3/etc/test.cfg.json
service.pid = test.cfg
test1 = testString
test2 = false {code}
But what is little surprise for me is that a service pid is
"test.cfg". I assume that cfg.json is an extension for json files in
the Karaf and the service pid is constructed as <pid>.cfg.json. We
have lot of blueprints where config (with cfg extension) is referenced
with "<pid>.cfg" scheme. That is why I will have to change lot of
files if it is necessary to append .cfg for every
cm:managed-properties elements.
Service PID for JSON is created by this method
{code:java}
public static ConfigurationPID parseFilename(final String filename) {
final String pid = filename.substring(0, filename.lastIndexOf('.'));
return parsePid(pid);
} {code}
As for me it would be better if parseFilename created pid also from a
file extension, what do you mean? Pid will be the same i.e .cfg
.config .cfg.json all will have the same pid.{color:#888888}
{color}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)