camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reuben Garrett <reubengarr...@gmail.com>
Subject Re: rename file with camel ftp
Date Mon, 20 Feb 2012 19:49:56 GMT
mcheng,

I don't have an immediate explanation, but I may have a solution.  Did you
observe any Exceptions being thrown?  If so, they could help trace the root
cause.  I suspect, however, that the GenericFile you're obtaining from the
Exchange is just a descriptor of sorts, and that changes to its name do not
automagically rename the underlying file - however I don't know for sure.

Beyond that, you may have better luck using the built-in moving behavior of
the FTP component by specifying a rename target in the endpoint URI's "move"
argument.  By default, bare tokens are interpreted as directories - however
you should be able to use an
Expression<http://camel.apache.org/expression.html>to fine-tune a
rename strategy as described in the File component's user
guide:
http://camel.apache.org/file2.html#File2-FinegrainedcontroloverMoveandPreMoveoption

Hope this helps!
Reuben Garrett

On Sun, Feb 19, 2012 at 01:28, mcheng <hmcheng84@gmail.com> wrote:

> There is a file in ftp server and  I have made some  attempts to rename it,
> but it's always failed.
> Below is my code, can anyone give me some suggestions? I will be very
> appreciated.
>
>
> public void process(Exchange exchange) throws Exception {
>                                GenericFile genericFile = (GenericFile)
> exchange.getIn().getBody();
>                                genericFile.changeFileName("newName");
>                                exchange.getIn().setBody(genericFile);
> }
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/rename-file-with-camel-ftp-tp5496480p5496480.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message