Actually and fwiw, FileInstall registers a ManagedServiceFactory, not a
ManagedService.
See
https://github.com/apache/felix/blob/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java#L342

2016-09-14 21:15 GMT+02:00 David Jencks <david.a.jen...@gmail.com>:

>
> > On Sep 14, 2016, at 11:49 AM, Leschke, Scott <slesc...@medline.com>
> wrote:
> >
> > Like I said, fileinstall was just used as an example.  I’m not really
> interested in fileinstall although as far as I understand, if there are
> mulitiple org.apache.felix.fileinstall_*.cfg files, say
> org.apache.felix.fileinstall_1.cfg and org.apache.felix.fileinstall_2.cfg
> there will be one service created for each .cfg file.  Perhaps the
> terminology I used was incorrect, but that was what I intended.
>
> I don’t think your understanding is correct.  The metatype for fileinstall
> shows a pid, not a factory pid, so you should only be able to create one
> fileinstall instance.  However, although fileinstall is a bad example, what
> you want to do is reasonable.
> >
> > Assuming that’s correct, the question is basically how you would be able
> to identify the configuration/service pair.  I gather from your response
> that this really isn’t possible without augmenting the configuration with
> ID information or using a more explicit Managed Service Factory. Is that
> correct?
>
> I don’t understand how you are creating the configurations in the first
> place.  If you are doing it by writing out files for fileinstall to read,
> then it looks like you can use a fileinstall-installed property. If you are
> creating the configs in code using config admin, it’s not clear to me
> whether or not fileinstall saves them.  In this case how do you expect to
> tell the configs apart unless you include some kind if id you can recognize?
>
> From a cursory inspection of fileinstall, it looks to me as if it includes
> the original file name in the configuration with the key
> “felix.fileinstall.filename” so you could use that as the id.  I don’t
> understand what you mean by “more explicit Managed Service Factory”.
>
> So the filter to ca.listConfigurations would look like
>
> (&(service.factoryPid=<factorypid>)(felix.fileinstall.filename=<
> filename>))
>
> david jencks
> >
> > Scott
> >
> > From: David Jencks [mailto:david.a.jen...@gmail.com]
> > Sent: Wednesday, September 14, 2016 1:35 PM
> > To: user@karaf.apache.org
> > Subject: Re: Configuration Admin
> >
> > I doubt I understand your question as written, as fileinstall has a pid
> rather than a factory pid you can only have one configuration for it.
> >
> > Assuming you actually want to configure multiple configurations for a
> given factory pid,
> > - I’d advise you to write a management agent that uses the config admin
> interfaces rather than trying to deal directly with the particular storage
> format fileinstall happens to use right now.
> > - I’d include a meaningful id in your configurations that let you
> identify which is which.  I actually thought fileinstall made this easy or
> required it, but I don’t use fileinstall and could be wrong.
> > - you can construct a filter including the id to retrieve the
> configuration of interest from config admin.
> >
> > In osgi R7 it’s extremely likely that this will be easier as it’s
> proposed that you can create a factory configuration using a known factory
> pid and known id and the resulting pid will include the id.
> >
> > hope this helps…
> > david jencks
> >
> > On Sep 14, 2016, at 11:23 AM, Leschke, Scott <slesc...@medline.com>
> wrote:
> >
> > Not specifically a Karaf question but I’ll start here.
> >
> > If I would like to be able to modify the component instance
> configurations (created from a factory) programmatically, but from the CA
> api, it’s unclear to me how I associate a configuration record to its
> corresponding instance?
> >
> > As an example, if I have multiple configurations of
> org.apache.felix.fileinstall and I want to modify a specific configuration
> programitically, how do I associate the configuration record with the
> proper configuration (.cfg file)?  This isn’t my actual use case but for
> explanatory purposes it works.
> >
> > Scott
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gno...@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Reply via email to