Re: Configuration properties ending in .target cause NullPointerException when config:update

2022-05-13 Thread Jean-Baptiste Onofré
Hi Paul, yes and no ;) If you have foo.cfg containing: dataSource.target= then it will work. You are not supposed to call config:update if one property value is null. However, Felix Utils (properties) should check if value if not null before writing value in ConfigurattonHandler. I created

Configuration properties ending in .target cause NullPointerException when config:update

2022-05-13 Thread Paul Spencer
Karaf 4.3.6 I use a configuration property to configure injected objects, via @Reference. Updating a configuration PID containing an property ending in ".target" using config:... results in a NullPointerException *** * etc/foo.cfg *** mydb.target=(osgi.jndi.service.name=myDb) *** *

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