There is some conversion happening inside DS, i.e. DS will be able to translate a single String object into a String[], but it will do so simply by creating a single-element array. It will not do any parsing of the content of that string.
The client of ConfigAdmin (Karaf) really needs to set the value of the field (in the Dictionary it passes to Configuration.update) to either a String[] or a Collection<String>. If it can't or won't do that, then I think you have no choice but to change your component implementation to accept a single string and parse it yourself. Neil On Wed, Apr 18, 2018 at 3:54 PM, Christian Schneider via osgi-dev < osgi-dev@mail.osgi.org> wrote: > We have a component that requires an array of strings. See the code below > for the config declaration. > > > public @interface Config { > > > @AttributeDefinition(name = "Services list") > > String[] services_list(); > > > } > > This works if we set the config attribute to be an array. It does not seem > to work though > when I configure the config using a .cfg file in karaf. > > As far as I know there I can only use plain strings. So our list can be > represented as Service1,Service2 but this is not automatically converted to > an array. > > What is the best practice to work with this? > > I have seen a StringPlus class in aries rsa that takes care of this but it > would be a manual processing. Is there some way that DS or config admin can > do this for us transparently? > > Christian > > -- > -- > Christian Schneider > http://www.liquid-reality.de > > Computer Scientist > http://www.adobe.com > > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev >
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev