FTP temp file not being created correctly on Windows (Camel 2.7.2) ?

2011-07-15 Thread dlj
Hi,

I have the following route which sends a file from my local file system via
FTP to a folder that does not yet exist
on the remote server.

ctx.addRoutes( new RouteBuilder() {
@Override
public void configure() throws Exception 
{
from( "file://target/in?recursive=true&delay=5000")
.to(
"ftp://account:secret@host//target/out/?fileName=${file:name}&tempFileName=  
  ${file:onlyname}.part&stepwise=false");
}   
} );

The route uses the tempFileName URI option to create a temp file which is
then renamed after the transfer is complete.

On Linux the route works correctly, but on Windows the .part file is not
being created on the FTP server in the correct sub-folder relative to the
FTP directory name, but instead is created in the root FTP directory. Camel
then attempts to the rename the file, but if the actual destination folder
does not exist, a "Cannot rename File from :"
GenericFileOperationFailedException is thrown.

I think the problem is in the createTempFileName() on the
GenericFileProducer which calculates the temp file
destination by looking for the last file separator on the fileName. The File
separator being defined as '/' on the 
producer sub-class, but the original file name still contains the windows
file separator. This seems to mess up the calculation of the the tempName.

Not sure if I'm using the DSL correctly, or I can tweak my route to get the
desired behaviour?

Cheers,

Dave.

--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-temp-file-not-being-created-correctly-on-Windows-Camel-2-7-2-tp4591581p4591581.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FTP temp file not being created correctly on Windows (Camel 2.7.2) ?

2011-07-19 Thread dlj
Unfortunately that didn't work. It looks like the problem may lay in
GenericFileProducer.createTempFileName(). The method attempts to normalizes
the filename, but the normalizePath( filename ) method on the
RemoteFileProducer doesn't do anything except return the path as-is. At this
point, the filename still contains a mixture of Unix and Windows file
separators.

In the same method, the code which calculates the path to ultimately build
the temp file name on the ftp server, uses the '/' returned by the
RemoteFileProducer.getFileSeparator() to figure out the full of the path
using the filename which still contains a mixture of separators. The
calculation returns the result effectively ignoring the windows portion of
the path which I assume is not the desired behaviour. Later, the temp file
is ftp'ed, but when the rename occurs from the temp file to the actual
destination folder, then if the folder doesn't exist it fails.

Could the RemoteFileProducer.normalizePath() method be changed to call the
normalizePath() on the ftp endpoint configuration. Not sure if this is a
sensible solution, if there's wider regression impacts to consider or
there's a better way?. Thanks.

--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-temp-file-not-being-created-correctly-on-Windows-Camel-2-7-2-tp4591581p4613459.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FTP temp file not being created correctly on Windows (Camel 2.7.2) ?

2011-07-20 Thread dlj
Thanks very much Claus.

--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-temp-file-not-being-created-correctly-on-Windows-Camel-2-7-2-tp4591581p4616485.html
Sent from the Camel - Users mailing list archive at Nabble.com.