I created https://issues.apache.org/jira/browse/KARAF-7736

best regards

jakub

On Thu, Jun 15, 2023 at 5:10 PM Jean-Baptiste Onofré <j...@nanthrax.net> wrote:
>
> Good point. Can you please create a Jira, I will improve this part ?
>
> Thanks,
> Regards
> JB
>
> On Wed, Jun 14, 2023 at 7:22 PM Jakub Herkel <jher...@gmail.com> wrote:
> >
> > I checked ConfigurationPID and pid is create by this method :
> >
> >     public static ConfigurationPID parseFilename(final String filename) {
> >         final String pid = filename.substring(0, filename.lastIndexOf('.'));
> >         return parsePid(pid);
> >     }
> >
> > 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.
> >
> > Jakub
> >
> > On Wed, Jun 14, 2023 at 7:30 AM Jean-Baptiste Onofré <j...@nanthrax.net> 
> > wrote:
> > >
> > > Hi
> > >
> > > Yes, by default the suffix is .cfg.json
> > > (https://github.com/apache/karaf/blob/main/config/src/main/java/org/apache/karaf/config/core/impl/JsonConfigInstaller.java#L49).
> > >
> > > You can override the suffix by using karaf.json.config.extension
> > > system property (in the etc/config.properties for instance) or
> > > KARAF_JSON_CONFIG_EXTENSION env variable.
> > >
> > > Regards
> > > JB
> > >
> > > On Tue, Jun 13, 2023 at 8:45 PM Jakub Herkel <jher...@gmail.com> wrote:
> > > >
> > > > Hello,
> > > >
> > > > I tried to use a  json configuration with Karaf 4.4.3. For example I
> > > > created a test.cfg.json:
> > > > {
> > > >   "test1":"testString",
> > > >   "test2":false
> > > > }
> > > >
> > > > I can see that Karaf read this config viac config:list
> > > >
> > > > 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
> > > >
> > > > 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.
> > > > So is there any way how to create json configuration with service pid
> > > > without .cfg suffix? I.e service.pid = test.
> > > >
> > > > Thanks for any advice
> > > >
> > > > with best regards
> > > >
> > > > Jakub

Reply via email to