The properties passed to Configuration.update SHOULD convert multi-item values into String[] ?

Description

This MAY not be a bug but a problem with convention. I'll let others decide.

Currently in confman, if the properties file contains multi-valued keys, e.g.

event.topics.2=org/osgi/service/log/LogEntry/LOG_DEBUG, org/osgi/service/log/LogEntry/LOG_INFO

the 2nd parameter to ManagedServiceFactory#updated( serverPid:String, propsictionary )
will receive a Properties<String, String> such that

props.get( "event.topics" ) will return the String "org/osgi/service/log/LogEntry/LOG_DEBUG,org/osgi/service/log/LogEntry/LOG_INFO"

Question: should props.get( "event.topics" ) return a String[] instead ?

In the class
http://scm.ops4j.org/browse/~raw,r=8678/OPS4J/qa/pax/pax-confman-0.2.0/propsloader/src/main/java/org/ops4j/pax/configmanager/internal/ManagedFactoryPropertiesProcessor.java

the code that transmutes the properties file into a Properties instance is:

private final Properties filterProps( String[] keys, Properties prop, int instance )
{
Properties retval = new Properties();

for( int i=0; i<keys.length; i++)
{
String key = keys[i] + "." + instance;
String value = prop.getProperty( key );

if( value == null )
continue;

retval.put( keys[i], value );
}

return retval;
}

Environment

None

Activity

Show:
DamianG
February 26, 2008, 8:26 AM

-1: keep plain Strings, no String[]

NiclasH
February 26, 2008, 9:06 AM

I suggest we keep PropsLoader as it is for legacy compatibility and create a NEW one for the new ConfMan effort.

Ilya Shinkarenko
July 5, 2012, 2:07 PM

+1 for String[]

The reason is:

I use the BND @Meta.OCD annotation which allows to declare certain service properties as multiple (cardinality = Integer.MAX_VALUE):

This makes it possible to nicely edit the multiple properties in the Felix Web Console, please see the attached screenshot.

However, the default service parameters are defined in a property file via PAX ConfMan and as you see in the screenshot it is configured not quite as I would like to have it.

Thanks.

Assignee

NiclasH

Reporter

Gavin Bong

Labels

None

Components

Affects versions

Priority

Major
Configure