camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: File endpoint getting actual filename ${file:nameonly}
Date Mon, 19 Mar 2012 07:49:33 GMT
On Sun, Mar 18, 2012 at 9:25 PM, Christopher Love
<chris@cnmconsulting.net> wrote:
> Claus
>
> I am getting this error:
>
> Error setting property values; nested exception is
> org.springframework.beans.NotWritablePropertyException: Invalid property
> 'functionStartToken' of bean class
> [org.apache.camel.language.simple.SimpleLanguage]: Bean property
> 'functionStartToken' is not writable or has an invalid setter method. Does
> the parameter type of the setter match the return type of the getter?
>
> With this:
> <bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage">
>      <property name="functionStartToken" value="["/>
>      <property name="functionEndToken" value="]"/>
> </bean>
>

Do you use Camel 2.9.1 ?


>
> Although I am able to set it in resources.groovy.
>
> Even when I set the tokens it still is not working :(
>
> Claus how do you recommend debugging?
>
> Chris
>
> On Sat, Mar 17, 2012 at 3:02 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>
>> Hi
>>
>> Could it be because groovy gstring clashes with the simple tokens?
>>
>> You can change the start/end tokens of Simple to something else to
>> avoid this clash.
>> See the bottom of this page
>> http://camel.apache.org/simple
>>
>>
>> On Sat, Mar 17, 2012 at 12:03 AM, Christopher Love
>> <chris@cnmconsulting.net> wrote:
>> > So I have diagnosed this further.  Does anyone have experience running
>> > Camel with-in a grails application.  For some reason simple language does
>> > not seem to be evaluating properly.  I have created a custom file process
>> > strategy and setting:
>> >
>> > GenericFileExpressionRenamer<T> renamer = new
>> > GenericFileExpressionRenamer<T>();
>> >
>> renamer.setExpression(SimpleBuilder.simple(".failed/${header.CamelFileNameOnly}"));
>> >
>> > The expression for the renamer is not evaluating properly.
>> >
>> > Any ideas on how to get this working in grails?  May have to yank this
>> out
>> > and create another project. UGH!
>> >
>> > Chris
>> >
>> > On Wed, Mar 14, 2012 at 11:11 AM, Christopher Love
>> > <chris@cnmconsulting.net>wrote:
>> >
>> >> .setHeader("foo", header(Exchange.FILE_NAME_ONLY)) gives me a header
>> with  value
>> >> of ${file:onlyname} ... arg ... I am wondering if this is groovy not
>> >> playing nice.  I kinda doubt it, but next step is to write a java unit
>> test
>> >> and recreate.
>> >>
>> >> Here is the logs
>> >>
>> >>  2012-03-14 11:08:15,707 INFO Camel (camelContext) thread #25 -
>> >> file:///u01/www/images/nonprofits-test [com.igive.headers] - <Exchange[
>> >> , Id:ID-goldgriff-19635-1331742082363-2-1
>> >> , ExchangePattern:InOnly
>> >> ,
>> >>
>> Properties:{CamelToEndpoint=log://com.igive.headers?multiline=true&showAll=true,
>> >> CamelBatchComplete=true, CamelBatchSize=1, CamelCreatedTimestamp=Wed
>> Mar 14
>> >> 11:08:15 MDT 2012,
>> >>
>> CamelFileExchangeFile=GenericFile[${file:parent}/.processing/${file:onlyname}],
>> >> CamelBatchIndex=0}
>> >> , Headers:{CamelFileLastModified=Wed Mar 14 11:08:15 MDT 2012,
>> >> CamelFileLength=48215, foo=${file:onlyname},
>> >>
>> CamelFileParent=/u01/www/images/nonprofits-test/${file:parent}/.processing,
>> >> breadcrumbId=ID-goldgriff-19635-1331742082363-2-2,
>> >> CamelFileName=${file:onlyname},
>> >>
>> CamelFilePath=/u01/www/images/nonprofits-test/${file:parent}/.processing/${file:onlyname},
>> >> CamelFileAbsolute=false,
>> >> CamelFileRelativePath=${file:parent}/.processing/${file:onlyname},
>> >> CamelFileNameOnly=${file:onlyname},
>> >>
>> CamelFileAbsolutePath=/u01/www/images/nonprofits-test/${file:parent}/.processing/${file:onlyname}}
>> >> , BodyType:java.io.File
>> >> , Body:[Body is file based:
>> >>
>> /u01/www/images/nonprofits-test/${file:parent}/.processing/${file:onlyname}]
>> >> , Out: null
>> >> ]>
>> >>
>> >>  On Wed, Mar 14, 2012 at 11:01 AM, Claus Ibsen <claus.ibsen@gmail.com
>> >wrote:
>> >>
>> >>> Hi
>> >>>
>> >>> All the file name from the simple language is headers on the message.
>> >>> So they are already there.
>> >>>
>> >>> The only name is the header with this key: Exchange.FILE_NAME_ONLY
>> >>>
>> >>> So you can copy it to a foo header as follows:
>> >>> .setHeader("foo", header(Exchange.FILE_NAME_ONLY))
>> >>>
>> >>>
>> >>>
>> >>> On Wed, Mar 14, 2012 at 5:24 PM, chrislovecnm <clove@cnmconsulting.net
>> >
>> >>> wrote:
>> >>> > How do I access the file name?  I have tried accessing the headers
>> >>> which gets
>> >>> > me ${file:nameonly} but not the file name itself.  How do I evaluate
>> >>> this?
>> >>> >
>> >>> > Here is my route:
>> >>> >
>> >>> >
>> >>> >
>> >>>
>> from("file:///u01/www/images/nonprofits-test?move=.done&preMove=.processing&filter=#nonpFileFilter&minDepth=2&recursive=true")
>> >>> >
>> >>> >
>> >>>
>> from("file:///u01/www/images/nonprofits-test?move=.done&preMove=.processing&filter=#nonpFileFilter&minDepth=2&recursive=true")
>> >>> >                                .setHeader("test-this",
>> >>> simple("\${file:onlyname}"))
>> >>> >                                .setHeader("test-this-again",
>> >>> constant("\${file:onlyname}"))
>> >>> >                                .setHeader("test-this-again2",
>> >>> simple(CamelConstants.CAMEL_FILE_NAME))
>> >>> >                                .setHeader("test-this-again3",
>> >>> > simple(CamelConstants.CAMEL_FILE_NAME_ONLY))
>> >>> >
>> >>> >
>> >>> > This is coded in grails / groovy so the \${file:name} should be
>> >>> evaluated to
>> >>> > ${file:name}, but all I get is ${file:nameonly}. I also have the
>> string
>> >>> in
>> >>> > java code, just in-case running it in groovy is playing havoc.
>> >>> >
>> >>> > Thanks in advance
>> >>> >
>> >>> > Chris
>> >>> >
>> >>> > --
>> >>> > View this message in context:
>> >>>
>> http://camel.465427.n5.nabble.com/File-endpoint-getting-actual-filename-file-nameonly-tp5565342p5565342.html
>> >>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Claus Ibsen
>> >>> -----------------
>> >>> FuseSource
>> >>> Email: cibsen@fusesource.com
>> >>> Web: http://fusesource.com
>> >>> Twitter: davsclaus, fusenews
>> >>> Blog: http://davsclaus.blogspot.com/
>> >>> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Chris Love
>> >> clove@cnmconsulting.net
>> >> (303) 929-8509
>> >> http://www.cnmconsulting.net
>> >> Calendar: http://j.mp/cnmCalendar
>> >> Follow me on twitter: @chrislovecnm
>> >>
>> >
>> >
>> >
>> > --
>> > Chris Love
>> > clove@cnmconsulting.net
>> > (303) 929-8509
>> > http://www.cnmconsulting.net
>> > Calendar: http://j.mp/cnmCalendar
>> > Follow me on twitter: @chrislovecnm
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
>
>
> --
> Chris Love
> clove@cnmconsulting.net
> (303) 929-8509
> http://www.cnmconsulting.net
> Calendar: http://j.mp/cnmCalendar
> Follow me on twitter: @chrislovecnm



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message