felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: correct syntax for multi-valued properties in fileinstall cfg files?
Date Mon, 07 Feb 2011 09:32:55 GMT
Well, that's already in fileinstall since some time.
Though the extension has to be slightly different, iirc, it needs to
be ".config"

On Sun, Feb 6, 2011 at 16:48, Carl Hall <carl@hallwaytech.com> wrote:
> Reposting to dev since this is a development question.  I can get a
> patch in for this pretty soon once the direction agreed upon.
>
>
> ---------- Forwarded message ----------
> From: Carl Hall <carl@hallwaytech.com>
> Date: Thu, Jan 27, 2011 at 7:35 PM
> Subject: Re: correct syntax for multi-valued properties in fileinstall
> cfg files?
> To: users@felix.apache.org
>
>
> What if the syntax that is used by the config admin is used for this?
> The processing in ConfigurationHandler can be abstracted and
> fileinstall already has a dependency on config admin.  The code has
> been used in Felix for a while, so we would get free testing with it.
> :)
>
> The syntax is this:
> value = type ( "[" values "]" | "(" values ")" | simple ) .
> values = value { "," value } .
> simple = "{" stringsimple "}" .
> type = // 1-char type code .
> stringsimple = // quoted string representation of the value .
>
> Examples of this,
> * ["thing1","thing2"] => String[2]
> * i[10,250,365] => int[3]
>
> I would like to add this feature, so any discussion on how best to
> proceed is greatly welcomed.
>
>
>
> On Thu, 18 Mar 2010 13:19:36 -0700 Justin Edelson said,
>
> Ah, so the
>>     header ::= <header> ( ':' | '=' ) <value> ( '\<nl> <value>
) *
>
> part is saying that a single value can be split over multiple lines...
> gotcha.
>
> I think the scr javadoc annotation way is reasonable, although it's not
> backwards-compatible.
>
> Justin
>
>
>
> On 3/18/10 4:03 PM, Chris Custine wrote:
>> OK, I see what you are after now :-)  The fileinstall config handler
>> doesn't currently support multivalue properties, so whatever you set on
>> a property value gets parsed as a single string (the code simply uses
>> load(inputstream) from the Properties class).  This functionality could
>> probably be added, but we would have to decide on a way to differentiate
>> between scalar values and arrays ("this, is, one, string" vs. String[]
>> property = {"this","is","one","string"} ).  Another option would be to
>> support syntax similar to the scr javadoc annotations and munge the
>> properties into an array (value.1="this", value.2="is", etc
>> become String[] property = {"this","is", etc} ).  If you are interested
>> in that feature, please create a Jira and someone will take a look.
>>  http://issues.apache.org/jira/browse/FELIX
>>
>> Until then, you could either add your own config admin code to do
>> something like this, or you can add a method with a single string
>> argument to accept the property and then parse and process into your
>> component after it is set by scr from the config admin.
>>
>> Thanks,
>> Chris
>>
>> --
>> Chris Custine
>> FUSESource :: http://fusesource.com
>> My Blog :: http://blog.organicelement.com
>> Apache ServiceMix :: http://servicemix.apache.org
>> Apache Felix :: http://felix.apache.org
>> Apache Directory Server :: http://directory.apache.org
>>
>>
>> On Thu, Mar 18, 2010 at 10:11 AM, Justin Edelson
>> <justinedel...@gmail.com <mailto:justinedel...@gmail.com>> wrote:
>>
>>     Thanks Chris.
>>
>>     I was actually referring to the configuration files (with .cfg
>>     extension) which is described here:
>>
>> http://felix.apache.org/site/apache-felix-file-install.html#ApacheFelixFileInstall-Configurations
>>
>>     I would like to set a property to a String array. With scr qdox
>>     annotations, this would look like this:
>>        /**
>>         * @scr.property values.1="/foo" values.2="/bar"
>>         */
>>
>>     I saw this line in the documentation:
>>     header ::= <header> ( ':' | '=' ) <value> ( '\<nl> <value>
) *
>>
>>     which implied to me that the syntax I used below would work.
>>
>>     If no one knows, I'll look through the code. Maybe this isn't possible.
>>
>>     Justin
>>
>>
>>     On 3/17/10 11:37 PM, Chris Custine wrote:
>>     > There really aren't any config properties for fileinstall that accept
>>     > multiple values as far as I know.  If you need to monitor multiple
>>     > directories you can create multiple config files as shown in the
>>     > fileinstall docs
>>     > here:
>>
>> http://felix.apache.org/site/apache-felix-file-install.html#ApacheFelixFileInstall-WatchingmultipledirectorieswithFileInstall
>>     >
>>     > Chris
>>     >
>>
>> <http://felix.apache.org/site/apache-felix-file-install.html#ApacheFelixFileInstall-WatchingmultipledirectorieswithFileInstall>
>>     > --
>>     > Chris Custine
>>     > FUSESource :: http://fusesource.com
>>     > My Blog :: http://blog.organicelement.com
>>     > Apache ServiceMix :: http://servicemix.apache.org
>>     > Apache Felix :: http://felix.apache.org
>>     > Apache Directory Server :: http://directory.apache.org
>>     >
>>     >
>>     > On Wed, Mar 17, 2010 at 7:07 PM, Justin Edelson
>>     <justinedel...@gmail.com <mailto:justinedel...@gmail.com>
>>     > <mailto:justinedel...@gmail.com <mailto:justinedel...@gmail.com>>>
>>     wrote:
>>     >
>>     >     What is the correct syntax for multi-valued properties in a
>>     fileinstall
>>     >     cfg file? I tried a few variations on:
>>     >
>>     >     name=value1 \
>>     >      value2 \
>>     >      value3
>>     >
>>     >     but they didn't work.
>>     >
>>     >     Thanks,
>>     >     Justin
>>     >
>>     >
>>     ---------------------------------------------------------------------
>>     >     To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
>>     <mailto:users-unsubscr...@felix.apache.org>
>>     >     <mailto:users-unsubscr...@felix.apache.org
>>     <mailto:users-unsubscr...@felix.apache.org>>
>>     >     For additional commands, e-mail: users-h...@felix.apache.org
>>     <mailto:users-h...@felix.apache.org>
>>     >     <mailto:users-h...@felix.apache.org
>>     <mailto:users-h...@felix.apache.org>>
>>     >
>>     >
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message