Re: How do I load configuration within a shell command?

2022-05-13 Thread Paul Spencer
JB, Thank you for the answer! Below is the resulting use case. *** * Command use case of getting companyName from customerInfo configuration PID *** import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; @Service @Command(scope = "customer", name = "info")

Re: How do I load configuration within a shell command?

2022-05-13 Thread Jean-Baptiste Onofré
I don't understand your question, sorry ;) You want to display companyName ? String companyName = null; Configuration[] configs = configAdmin.listConfiguration("(service.pid=customerInfo)"); if (configs != null && configs.length == 1) { companyName =

Re: How do I load configuration within a shell command?

2022-05-13 Thread Paul Spencer
JB, The configuration PID files already exist and are used by other components. Below are two use cases that will print the companyName property from the companyInfo configuration PID. The component use case works today. Please complete the command use case. *** * /etc/companyInfo.cfg ***

Re: How do I load configuration within a shell command?

2022-05-13 Thread Jean-Baptiste Onofré
No, you don't need to have a cfg file. You can create the config like this, if the pid doesn't exist, it will be created and populated with config:property-set. Regards JB On Fri, May 13, 2022 at 3:27 PM Paul Spencer wrote: > > JB, > The command needs to use values stored in pid.cfg files,

Re: How do I load configuration within a shell command?

2022-05-13 Thread Paul Spencer
João, I would prefer not to add component bundles whose sole purpose is to pass configuration values from pid.cfg to a command via @Reference. Paul Spencer > On May 13, 2022, at 9:48 AM, João Assunção > wrote: > > Why not have the components implement the required operations as a service, >

Re: How do I load configuration within a shell command?

2022-05-13 Thread João Assunção
Why not have the components implement the required operations as a service, or expose those values in some service operation, and then make the shell command use that service ? João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com

Re: How do I load configuration within a shell command?

2022-05-13 Thread Paul Spencer
JB, The command needs to use values stored in pid.cfg files, like instance specific CustomerName, just like other components. Paul Spencer > On May 13, 2022, at 1:46 AM, Jean-Baptiste Onofré wrote: > > Hi Paul, > > Not sure I understand exactly the request, but you can do: > > config:edit

Re: How do I load configuration within a shell command?

2022-05-12 Thread Jean-Baptiste Onofré
Hi Paul, Not sure I understand exactly the request, but you can do: config:edit pid config:property-list ... config:cancel | config:commit Regards JB On Thu, May 12, 2022 at 6:38 PM Paul Spencer wrote: > > Karaf 4.3.6 > I am looking to load configuration into a shell command, but I do not see