You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Bengt Rodehav <be...@rodehav.com> on 2010/05/26 22:44:34 UTC

File install 3.0.0 - avoiding property substitution

I'm using the File Install component and cannot find a way to set values
like "${abc}" (without the quotes). File install insists on performing
property substitution which I do not want in this case. I noticed that this
seems to have been addressed in version 3.0.0 but I cannot get it to work.
My question is: How can I set a value to "${abc}" (without the quotes)
without File install trying to perform property substitution?

/Bengt

Re: File install 3.0.0 - avoiding property substitution

Posted by Bengt Rodehav <be...@rodehav.com>.
Yeah, that makes more sense.

2010/5/28 Guillaume Nodet <gn...@gmail.com>

> I think the loop is correct, even though very weird.
> I guess it should read as:
>
> if (stopDelim >= 0)
> {
>   while (true)
>   {
>      ...
>    }
> }
>
> On Fri, May 28, 2010 at 11:01, Bengt Rodehav <be...@rodehav.com> wrote:
>
> > JIRA is raised: https://issues.apache.org/jira/browse/FELIX-2366
> >
> > I tried your workaround and it works. Thanks.
> >
> > BTW, when looking at the source code I find something a bit fishy. The
> loop
> > that tries to find the DELIM_START looks like this:
> >
> >        // Find the matching starting "${" variable delimiter
> >        // by looping until we find a start delimiter that is
> >        // greater than the stop delimiter we have found.
> >        int startDelim = val.indexOf(DELIM_START);
> >        while (stopDelim >= 0)
> >        {
> >            int idx = val.indexOf(DELIM_START, startDelim +
> > DELIM_START.length());
> >            if ((idx < 0) || (idx > stopDelim))
> >            {
> >                break;
> >            }
> >            else if (idx < stopDelim)
> >            {
> >                startDelim = idx;
> >            }
> >        }
> >
> > Should the loop condition really be "while(stopDelim >=0)". I haven't
> seen
> > any erroneous behaviour but I cannot see that the stopDelim variable is
> > ever
> > changed within the loop which means that the loop will run once or not at
> > all. Shouldn't the loop condition use "startDelim"?
> >
> > /Bengt
> >
> > 2010/5/28 Guillaume Nodet <gn...@gmail.com>
> >
> > > This looks like a bug.  Could you please raise a JIRA for that ?
> > > As a workaround, you can try:
> > >  file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}${#}
> > > It will force a substitution, and thus will remove the escape chars.
> > >
> > > On Fri, May 28, 2010 at 10:11, Bengt Rodehav <be...@rodehav.com>
> wrote:
> > >
> > > > Hello Guillaume,
> > > >
> > > > Thanks for your reply. However, if I escape the string the way you
> > > > describe,
> > > > then the backslash will remain in the string. The result will be:
> > > >
> > > > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> > > >
> > > > What I want is:
> > > >
> > > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > > >
> > > > Otherwise the string will not be usable for Camel. Is there a way to
> > > > accomplish this? In general terms one usually has a way to "quote"
> > > > substrings in order to avoid substitution but the quotes themselves
> > > should
> > > > be removed from the string. In this case backslash is the quoting
> > > character
> > > > but it's not removed from the end result.
> > > >
> > > > I think also that it would be good if one could escape substrings and
> > not
> > > > only indiviudal characters (by enclosing substrings with quotes) but
> > that
> > > > has lower priority for me if I can get the above to work.
> > > >
> > > > I've been looking at the source code in file install (3.0) and
> > understand
> > > > why this is happening. The method of interest is substVars in class
> > > > org.apache.felix.fileinstall.internal.Util. The logic tries to find
> > > > matching DELIM_START (${) and DELIM_STOP (}). When I escape either of
> > > these
> > > > (by specifying a backslash before "${" and/or "}"), the logic will
> > never
> > > > find matching DELIM_START and DELIM_STOP which causes the method to
> > > > immediately return without performing property substitution. The
> logic
> > at
> > > > the end of the method (that removes the backslashes) is never
> reached.
> > > >
> > > > /Bengt
> > > >
> > > > 2010/5/27 Guillaume Nodet <gn...@gmail.com>
> > > >
> > > > > Sure, we had the same problem in Karaf and i've fixed that as part
> of
> > > > > https://issues.apache.org/jira/browse/FELIX-2307
> > > > > Basically, just add '\' before the '{' and '}' and it should work:
> > > > >
> > > > > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> > > > >
> > > > >
> > > > > On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com>
> > > wrote:
> > > > >
> > > > > > Hello everyone,
> > > > > >
> > > > > > My question didn't get much attention on my first attempt so I'll
> > > make
> > > > > > another one...
> > > > > >
> > > > > > Maybe a clarifaction of what I'm trying to do helps. I'm using
> > Karaf
> > > as
> > > > a
> > > > > > deployment container for Camel routes. I start services, using
> file
> > > > > > install,
> > > > > > that house camel routes. The routes are configurable using the
> > > > > > configuration
> > > > > > admin via file install. E g I have a general file transfer route
> in
> > > > Camel
> > > > > > that looks like this:
> > > > > >
> > > > > > from(mFromUri).to(mToUri);
> > > > > >
> > > > > > ...where "mFromUri" and "mToUri" are properties configured via
> > > > > > configuration
> > > > > > admin. Camel itself supports a "property concept" and an example
> of
> > a
> > > > > > "mFromUri" I might want to use is:
> > > > > >
> > > > > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > > > > >
> > > > > > This will cause Camel to poll the inbox folder and archive
> > completed
> > > > > files
> > > > > > in a backup folder that is named with todays date.
> > > > > >
> > > > > > However, since file install always does property substitution
> > itself
> > > > (in
> > > > > > this case I want Camel to do it - not file install), the URI sent
> > to
> > > > > Camel
> > > > > > will be:
> > > > > >
> > > > > > file://inbox?move=backup//
> > > > > >
> > > > > > This is because the strings ${date:now:yyyMMdd} and ${file:name}
> > will
> > > > be
> > > > > > transformed to empty strings since file install will regard them
> as
> > > > > > properties that are not defined.
> > > > > >
> > > > > > How can I work around this? Any clues?
> > > > > >
> > > > > > /Bengt
> > > > > >
> > > > > >
> > > > > > 2010/5/26 Bengt Rodehav <be...@rodehav.com>
> > > > > >
> > > > > > > I'm using the File Install component and cannot find a way to
> set
> > > > > values
> > > > > > > like "${abc}" (without the quotes). File install insists on
> > > > performing
> > > > > > > property substitution which I do not want in this case. I
> noticed
> > > > that
> > > > > > this
> > > > > > > seems to have been addressed in version 3.0.0 but I cannot get
> it
> > > to
> > > > > > work.
> > > > > > > My question is: How can I set a value to "${abc}" (without the
> > > > quotes)
> > > > > > > without File install trying to perform property substitution?
> > > > > > >
> > > > > > > /Bengt
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers,
> > > > > Guillaume Nodet
> > > > > ------------------------
> > > > > Blog: http://gnodet.blogspot.com/
> > > > > ------------------------
> > > > > Open Source SOA
> > > > > http://fusesource.com
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > > ------------------------
> > > Blog: http://gnodet.blogspot.com/
> > > ------------------------
> > > Open Source SOA
> > > http://fusesource.com
> > >
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: File install 3.0.0 - avoiding property substitution

Posted by Guillaume Nodet <gn...@gmail.com>.
I think the loop is correct, even though very weird.
I guess it should read as:

if (stopDelim >= 0)
{
   while (true)
   {
      ...
   }
}

On Fri, May 28, 2010 at 11:01, Bengt Rodehav <be...@rodehav.com> wrote:

> JIRA is raised: https://issues.apache.org/jira/browse/FELIX-2366
>
> I tried your workaround and it works. Thanks.
>
> BTW, when looking at the source code I find something a bit fishy. The loop
> that tries to find the DELIM_START looks like this:
>
>        // Find the matching starting "${" variable delimiter
>        // by looping until we find a start delimiter that is
>        // greater than the stop delimiter we have found.
>        int startDelim = val.indexOf(DELIM_START);
>        while (stopDelim >= 0)
>        {
>            int idx = val.indexOf(DELIM_START, startDelim +
> DELIM_START.length());
>            if ((idx < 0) || (idx > stopDelim))
>            {
>                break;
>            }
>            else if (idx < stopDelim)
>            {
>                startDelim = idx;
>            }
>        }
>
> Should the loop condition really be "while(stopDelim >=0)". I haven't seen
> any erroneous behaviour but I cannot see that the stopDelim variable is
> ever
> changed within the loop which means that the loop will run once or not at
> all. Shouldn't the loop condition use "startDelim"?
>
> /Bengt
>
> 2010/5/28 Guillaume Nodet <gn...@gmail.com>
>
> > This looks like a bug.  Could you please raise a JIRA for that ?
> > As a workaround, you can try:
> >  file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}${#}
> > It will force a substitution, and thus will remove the escape chars.
> >
> > On Fri, May 28, 2010 at 10:11, Bengt Rodehav <be...@rodehav.com> wrote:
> >
> > > Hello Guillaume,
> > >
> > > Thanks for your reply. However, if I escape the string the way you
> > > describe,
> > > then the backslash will remain in the string. The result will be:
> > >
> > > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> > >
> > > What I want is:
> > >
> > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > >
> > > Otherwise the string will not be usable for Camel. Is there a way to
> > > accomplish this? In general terms one usually has a way to "quote"
> > > substrings in order to avoid substitution but the quotes themselves
> > should
> > > be removed from the string. In this case backslash is the quoting
> > character
> > > but it's not removed from the end result.
> > >
> > > I think also that it would be good if one could escape substrings and
> not
> > > only indiviudal characters (by enclosing substrings with quotes) but
> that
> > > has lower priority for me if I can get the above to work.
> > >
> > > I've been looking at the source code in file install (3.0) and
> understand
> > > why this is happening. The method of interest is substVars in class
> > > org.apache.felix.fileinstall.internal.Util. The logic tries to find
> > > matching DELIM_START (${) and DELIM_STOP (}). When I escape either of
> > these
> > > (by specifying a backslash before "${" and/or "}"), the logic will
> never
> > > find matching DELIM_START and DELIM_STOP which causes the method to
> > > immediately return without performing property substitution. The logic
> at
> > > the end of the method (that removes the backslashes) is never reached.
> > >
> > > /Bengt
> > >
> > > 2010/5/27 Guillaume Nodet <gn...@gmail.com>
> > >
> > > > Sure, we had the same problem in Karaf and i've fixed that as part of
> > > > https://issues.apache.org/jira/browse/FELIX-2307
> > > > Basically, just add '\' before the '{' and '}' and it should work:
> > > >
> > > > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> > > >
> > > >
> > > > On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com>
> > wrote:
> > > >
> > > > > Hello everyone,
> > > > >
> > > > > My question didn't get much attention on my first attempt so I'll
> > make
> > > > > another one...
> > > > >
> > > > > Maybe a clarifaction of what I'm trying to do helps. I'm using
> Karaf
> > as
> > > a
> > > > > deployment container for Camel routes. I start services, using file
> > > > > install,
> > > > > that house camel routes. The routes are configurable using the
> > > > > configuration
> > > > > admin via file install. E g I have a general file transfer route in
> > > Camel
> > > > > that looks like this:
> > > > >
> > > > > from(mFromUri).to(mToUri);
> > > > >
> > > > > ...where "mFromUri" and "mToUri" are properties configured via
> > > > > configuration
> > > > > admin. Camel itself supports a "property concept" and an example of
> a
> > > > > "mFromUri" I might want to use is:
> > > > >
> > > > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > > > >
> > > > > This will cause Camel to poll the inbox folder and archive
> completed
> > > > files
> > > > > in a backup folder that is named with todays date.
> > > > >
> > > > > However, since file install always does property substitution
> itself
> > > (in
> > > > > this case I want Camel to do it - not file install), the URI sent
> to
> > > > Camel
> > > > > will be:
> > > > >
> > > > > file://inbox?move=backup//
> > > > >
> > > > > This is because the strings ${date:now:yyyMMdd} and ${file:name}
> will
> > > be
> > > > > transformed to empty strings since file install will regard them as
> > > > > properties that are not defined.
> > > > >
> > > > > How can I work around this? Any clues?
> > > > >
> > > > > /Bengt
> > > > >
> > > > >
> > > > > 2010/5/26 Bengt Rodehav <be...@rodehav.com>
> > > > >
> > > > > > I'm using the File Install component and cannot find a way to set
> > > > values
> > > > > > like "${abc}" (without the quotes). File install insists on
> > > performing
> > > > > > property substitution which I do not want in this case. I noticed
> > > that
> > > > > this
> > > > > > seems to have been addressed in version 3.0.0 but I cannot get it
> > to
> > > > > work.
> > > > > > My question is: How can I set a value to "${abc}" (without the
> > > quotes)
> > > > > > without File install trying to perform property substitution?
> > > > > >
> > > > > > /Bengt
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > > ------------------------
> > > > Blog: http://gnodet.blogspot.com/
> > > > ------------------------
> > > > Open Source SOA
> > > > http://fusesource.com
> > > >
> > >
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > Open Source SOA
> > http://fusesource.com
> >
>



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

Re: File install 3.0.0 - avoiding property substitution

Posted by Bengt Rodehav <be...@rodehav.com>.
JIRA is raised: https://issues.apache.org/jira/browse/FELIX-2366

I tried your workaround and it works. Thanks.

BTW, when looking at the source code I find something a bit fishy. The loop
that tries to find the DELIM_START looks like this:

        // Find the matching starting "${" variable delimiter
        // by looping until we find a start delimiter that is
        // greater than the stop delimiter we have found.
        int startDelim = val.indexOf(DELIM_START);
        while (stopDelim >= 0)
        {
            int idx = val.indexOf(DELIM_START, startDelim +
DELIM_START.length());
            if ((idx < 0) || (idx > stopDelim))
            {
                break;
            }
            else if (idx < stopDelim)
            {
                startDelim = idx;
            }
        }

Should the loop condition really be "while(stopDelim >=0)". I haven't seen
any erroneous behaviour but I cannot see that the stopDelim variable is ever
changed within the loop which means that the loop will run once or not at
all. Shouldn't the loop condition use "startDelim"?

/Bengt

2010/5/28 Guillaume Nodet <gn...@gmail.com>

> This looks like a bug.  Could you please raise a JIRA for that ?
> As a workaround, you can try:
>  file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}${#}
> It will force a substitution, and thus will remove the escape chars.
>
> On Fri, May 28, 2010 at 10:11, Bengt Rodehav <be...@rodehav.com> wrote:
>
> > Hello Guillaume,
> >
> > Thanks for your reply. However, if I escape the string the way you
> > describe,
> > then the backslash will remain in the string. The result will be:
> >
> > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> >
> > What I want is:
> >
> > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> >
> > Otherwise the string will not be usable for Camel. Is there a way to
> > accomplish this? In general terms one usually has a way to "quote"
> > substrings in order to avoid substitution but the quotes themselves
> should
> > be removed from the string. In this case backslash is the quoting
> character
> > but it's not removed from the end result.
> >
> > I think also that it would be good if one could escape substrings and not
> > only indiviudal characters (by enclosing substrings with quotes) but that
> > has lower priority for me if I can get the above to work.
> >
> > I've been looking at the source code in file install (3.0) and understand
> > why this is happening. The method of interest is substVars in class
> > org.apache.felix.fileinstall.internal.Util. The logic tries to find
> > matching DELIM_START (${) and DELIM_STOP (}). When I escape either of
> these
> > (by specifying a backslash before "${" and/or "}"), the logic will never
> > find matching DELIM_START and DELIM_STOP which causes the method to
> > immediately return without performing property substitution. The logic at
> > the end of the method (that removes the backslashes) is never reached.
> >
> > /Bengt
> >
> > 2010/5/27 Guillaume Nodet <gn...@gmail.com>
> >
> > > Sure, we had the same problem in Karaf and i've fixed that as part of
> > > https://issues.apache.org/jira/browse/FELIX-2307
> > > Basically, just add '\' before the '{' and '}' and it should work:
> > >
> > > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> > >
> > >
> > > On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com>
> wrote:
> > >
> > > > Hello everyone,
> > > >
> > > > My question didn't get much attention on my first attempt so I'll
> make
> > > > another one...
> > > >
> > > > Maybe a clarifaction of what I'm trying to do helps. I'm using Karaf
> as
> > a
> > > > deployment container for Camel routes. I start services, using file
> > > > install,
> > > > that house camel routes. The routes are configurable using the
> > > > configuration
> > > > admin via file install. E g I have a general file transfer route in
> > Camel
> > > > that looks like this:
> > > >
> > > > from(mFromUri).to(mToUri);
> > > >
> > > > ...where "mFromUri" and "mToUri" are properties configured via
> > > > configuration
> > > > admin. Camel itself supports a "property concept" and an example of a
> > > > "mFromUri" I might want to use is:
> > > >
> > > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > > >
> > > > This will cause Camel to poll the inbox folder and archive completed
> > > files
> > > > in a backup folder that is named with todays date.
> > > >
> > > > However, since file install always does property substitution itself
> > (in
> > > > this case I want Camel to do it - not file install), the URI sent to
> > > Camel
> > > > will be:
> > > >
> > > > file://inbox?move=backup//
> > > >
> > > > This is because the strings ${date:now:yyyMMdd} and ${file:name} will
> > be
> > > > transformed to empty strings since file install will regard them as
> > > > properties that are not defined.
> > > >
> > > > How can I work around this? Any clues?
> > > >
> > > > /Bengt
> > > >
> > > >
> > > > 2010/5/26 Bengt Rodehav <be...@rodehav.com>
> > > >
> > > > > I'm using the File Install component and cannot find a way to set
> > > values
> > > > > like "${abc}" (without the quotes). File install insists on
> > performing
> > > > > property substitution which I do not want in this case. I noticed
> > that
> > > > this
> > > > > seems to have been addressed in version 3.0.0 but I cannot get it
> to
> > > > work.
> > > > > My question is: How can I set a value to "${abc}" (without the
> > quotes)
> > > > > without File install trying to perform property substitution?
> > > > >
> > > > > /Bengt
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > > ------------------------
> > > Blog: http://gnodet.blogspot.com/
> > > ------------------------
> > > Open Source SOA
> > > http://fusesource.com
> > >
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: File install 3.0.0 - avoiding property substitution

Posted by Guillaume Nodet <gn...@gmail.com>.
This looks like a bug.  Could you please raise a JIRA for that ?
As a workaround, you can try:
  file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}${#}
It will force a substitution, and thus will remove the escape chars.

On Fri, May 28, 2010 at 10:11, Bengt Rodehav <be...@rodehav.com> wrote:

> Hello Guillaume,
>
> Thanks for your reply. However, if I escape the string the way you
> describe,
> then the backslash will remain in the string. The result will be:
>
> file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
>
> What I want is:
>
> file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
>
> Otherwise the string will not be usable for Camel. Is there a way to
> accomplish this? In general terms one usually has a way to "quote"
> substrings in order to avoid substitution but the quotes themselves should
> be removed from the string. In this case backslash is the quoting character
> but it's not removed from the end result.
>
> I think also that it would be good if one could escape substrings and not
> only indiviudal characters (by enclosing substrings with quotes) but that
> has lower priority for me if I can get the above to work.
>
> I've been looking at the source code in file install (3.0) and understand
> why this is happening. The method of interest is substVars in class
> org.apache.felix.fileinstall.internal.Util. The logic tries to find
> matching DELIM_START (${) and DELIM_STOP (}). When I escape either of these
> (by specifying a backslash before "${" and/or "}"), the logic will never
> find matching DELIM_START and DELIM_STOP which causes the method to
> immediately return without performing property substitution. The logic at
> the end of the method (that removes the backslashes) is never reached.
>
> /Bengt
>
> 2010/5/27 Guillaume Nodet <gn...@gmail.com>
>
> > Sure, we had the same problem in Karaf and i've fixed that as part of
> > https://issues.apache.org/jira/browse/FELIX-2307
> > Basically, just add '\' before the '{' and '}' and it should work:
> >
> > file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
> >
> >
> > On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com> wrote:
> >
> > > Hello everyone,
> > >
> > > My question didn't get much attention on my first attempt so I'll make
> > > another one...
> > >
> > > Maybe a clarifaction of what I'm trying to do helps. I'm using Karaf as
> a
> > > deployment container for Camel routes. I start services, using file
> > > install,
> > > that house camel routes. The routes are configurable using the
> > > configuration
> > > admin via file install. E g I have a general file transfer route in
> Camel
> > > that looks like this:
> > >
> > > from(mFromUri).to(mToUri);
> > >
> > > ...where "mFromUri" and "mToUri" are properties configured via
> > > configuration
> > > admin. Camel itself supports a "property concept" and an example of a
> > > "mFromUri" I might want to use is:
> > >
> > > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> > >
> > > This will cause Camel to poll the inbox folder and archive completed
> > files
> > > in a backup folder that is named with todays date.
> > >
> > > However, since file install always does property substitution itself
> (in
> > > this case I want Camel to do it - not file install), the URI sent to
> > Camel
> > > will be:
> > >
> > > file://inbox?move=backup//
> > >
> > > This is because the strings ${date:now:yyyMMdd} and ${file:name} will
> be
> > > transformed to empty strings since file install will regard them as
> > > properties that are not defined.
> > >
> > > How can I work around this? Any clues?
> > >
> > > /Bengt
> > >
> > >
> > > 2010/5/26 Bengt Rodehav <be...@rodehav.com>
> > >
> > > > I'm using the File Install component and cannot find a way to set
> > values
> > > > like "${abc}" (without the quotes). File install insists on
> performing
> > > > property substitution which I do not want in this case. I noticed
> that
> > > this
> > > > seems to have been addressed in version 3.0.0 but I cannot get it to
> > > work.
> > > > My question is: How can I set a value to "${abc}" (without the
> quotes)
> > > > without File install trying to perform property substitution?
> > > >
> > > > /Bengt
> > > >
> > >
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > Open Source SOA
> > http://fusesource.com
> >
>



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

Re: File install 3.0.0 - avoiding property substitution

Posted by Bengt Rodehav <be...@rodehav.com>.
Hello Guillaume,

Thanks for your reply. However, if I escape the string the way you describe,
then the backslash will remain in the string. The result will be:

file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}

What I want is:

file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}

Otherwise the string will not be usable for Camel. Is there a way to
accomplish this? In general terms one usually has a way to "quote"
substrings in order to avoid substitution but the quotes themselves should
be removed from the string. In this case backslash is the quoting character
but it's not removed from the end result.

I think also that it would be good if one could escape substrings and not
only indiviudal characters (by enclosing substrings with quotes) but that
has lower priority for me if I can get the above to work.

I've been looking at the source code in file install (3.0) and understand
why this is happening. The method of interest is substVars in class
org.apache.felix.fileinstall.internal.Util. The logic tries to find
matching DELIM_START (${) and DELIM_STOP (}). When I escape either of these
(by specifying a backslash before "${" and/or "}"), the logic will never
find matching DELIM_START and DELIM_STOP which causes the method to
immediately return without performing property substitution. The logic at
the end of the method (that removes the backslashes) is never reached.

/Bengt

2010/5/27 Guillaume Nodet <gn...@gmail.com>

> Sure, we had the same problem in Karaf and i've fixed that as part of
> https://issues.apache.org/jira/browse/FELIX-2307
> Basically, just add '\' before the '{' and '}' and it should work:
>
> file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}
>
>
> On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com> wrote:
>
> > Hello everyone,
> >
> > My question didn't get much attention on my first attempt so I'll make
> > another one...
> >
> > Maybe a clarifaction of what I'm trying to do helps. I'm using Karaf as a
> > deployment container for Camel routes. I start services, using file
> > install,
> > that house camel routes. The routes are configurable using the
> > configuration
> > admin via file install. E g I have a general file transfer route in Camel
> > that looks like this:
> >
> > from(mFromUri).to(mToUri);
> >
> > ...where "mFromUri" and "mToUri" are properties configured via
> > configuration
> > admin. Camel itself supports a "property concept" and an example of a
> > "mFromUri" I might want to use is:
> >
> > file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
> >
> > This will cause Camel to poll the inbox folder and archive completed
> files
> > in a backup folder that is named with todays date.
> >
> > However, since file install always does property substitution itself (in
> > this case I want Camel to do it - not file install), the URI sent to
> Camel
> > will be:
> >
> > file://inbox?move=backup//
> >
> > This is because the strings ${date:now:yyyMMdd} and ${file:name} will be
> > transformed to empty strings since file install will regard them as
> > properties that are not defined.
> >
> > How can I work around this? Any clues?
> >
> > /Bengt
> >
> >
> > 2010/5/26 Bengt Rodehav <be...@rodehav.com>
> >
> > > I'm using the File Install component and cannot find a way to set
> values
> > > like "${abc}" (without the quotes). File install insists on performing
> > > property substitution which I do not want in this case. I noticed that
> > this
> > > seems to have been addressed in version 3.0.0 but I cannot get it to
> > work.
> > > My question is: How can I set a value to "${abc}" (without the quotes)
> > > without File install trying to perform property substitution?
> > >
> > > /Bengt
> > >
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: File install 3.0.0 - avoiding property substitution

Posted by Guillaume Nodet <gn...@gmail.com>.
Sure, we had the same problem in Karaf and i've fixed that as part of
https://issues.apache.org/jira/browse/FELIX-2307
Basically, just add '\' before the '{' and '}' and it should work:

file://inbox?move=backup/$\{date:now:yyyMMdd\}/$\{file:name\}


On Thu, May 27, 2010 at 23:22, Bengt Rodehav <be...@rodehav.com> wrote:

> Hello everyone,
>
> My question didn't get much attention on my first attempt so I'll make
> another one...
>
> Maybe a clarifaction of what I'm trying to do helps. I'm using Karaf as a
> deployment container for Camel routes. I start services, using file
> install,
> that house camel routes. The routes are configurable using the
> configuration
> admin via file install. E g I have a general file transfer route in Camel
> that looks like this:
>
> from(mFromUri).to(mToUri);
>
> ...where "mFromUri" and "mToUri" are properties configured via
> configuration
> admin. Camel itself supports a "property concept" and an example of a
> "mFromUri" I might want to use is:
>
> file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}
>
> This will cause Camel to poll the inbox folder and archive completed files
> in a backup folder that is named with todays date.
>
> However, since file install always does property substitution itself (in
> this case I want Camel to do it - not file install), the URI sent to Camel
> will be:
>
> file://inbox?move=backup//
>
> This is because the strings ${date:now:yyyMMdd} and ${file:name} will be
> transformed to empty strings since file install will regard them as
> properties that are not defined.
>
> How can I work around this? Any clues?
>
> /Bengt
>
>
> 2010/5/26 Bengt Rodehav <be...@rodehav.com>
>
> > I'm using the File Install component and cannot find a way to set values
> > like "${abc}" (without the quotes). File install insists on performing
> > property substitution which I do not want in this case. I noticed that
> this
> > seems to have been addressed in version 3.0.0 but I cannot get it to
> work.
> > My question is: How can I set a value to "${abc}" (without the quotes)
> > without File install trying to perform property substitution?
> >
> > /Bengt
> >
>



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

Re: File install 3.0.0 - avoiding property substitution

Posted by Bengt Rodehav <be...@rodehav.com>.
Hello everyone,

My question didn't get much attention on my first attempt so I'll make
another one...

Maybe a clarifaction of what I'm trying to do helps. I'm using Karaf as a
deployment container for Camel routes. I start services, using file install,
that house camel routes. The routes are configurable using the configuration
admin via file install. E g I have a general file transfer route in Camel
that looks like this:

from(mFromUri).to(mToUri);

...where "mFromUri" and "mToUri" are properties configured via configuration
admin. Camel itself supports a "property concept" and an example of a
"mFromUri" I might want to use is:

file://inbox?move=backup/${date:now:yyyMMdd}/${file:name}

This will cause Camel to poll the inbox folder and archive completed files
in a backup folder that is named with todays date.

However, since file install always does property substitution itself (in
this case I want Camel to do it - not file install), the URI sent to Camel
will be:

file://inbox?move=backup//

This is because the strings ${date:now:yyyMMdd} and ${file:name} will be
transformed to empty strings since file install will regard them as
properties that are not defined.

How can I work around this? Any clues?

/Bengt


2010/5/26 Bengt Rodehav <be...@rodehav.com>

> I'm using the File Install component and cannot find a way to set values
> like "${abc}" (without the quotes). File install insists on performing
> property substitution which I do not want in this case. I noticed that this
> seems to have been addressed in version 3.0.0 but I cannot get it to work.
> My question is: How can I set a value to "${abc}" (without the quotes)
> without File install trying to perform property substitution?
>
> /Bengt
>