You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Justin Edelson <ju...@gmail.com> on 2010/03/18 02:07:59 UTC

correct syntax for multi-valued properties in fileinstall cfg files?

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-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: correct syntax for multi-valued properties in fileinstall cfg files?

Posted by Justin Edelson <ju...@gmail.com>.
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
> <justinedelson@gmail.com <ma...@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
>     <justinedelson@gmail.com <ma...@gmail.com>
>     > <mailto:justinedelson@gmail.com <ma...@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-unsubscribe@felix.apache.org
>     <ma...@felix.apache.org>
>     >     <mailto:users-unsubscribe@felix.apache.org
>     <ma...@felix.apache.org>>
>     >     For additional commands, e-mail: users-help@felix.apache.org
>     <ma...@felix.apache.org>
>     >     <mailto:users-help@felix.apache.org
>     <ma...@felix.apache.org>>
>     >
>     >
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: correct syntax for multi-valued properties in fileinstall cfg files?

Posted by Chris Custine <ch...@gmail.com>.
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 <ju...@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 <justinedelson@gmail.com
> > <ma...@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-unsubscribe@felix.apache.org
> >     <ma...@felix.apache.org>
> >     For additional commands, e-mail: users-help@felix.apache.org
> >     <ma...@felix.apache.org>
> >
> >
>
>

Re: correct syntax for multi-valued properties in fileinstall cfg files?

Posted by Chris Custine <ch...@gmail.com>.
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 <ju...@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-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>