org.apache.camel.component.file.strategy
Class RenameFileProcessStrategy

java.lang.Object
  extended by org.apache.camel.component.file.strategy.FileProcessStrategySupport
      extended by org.apache.camel.component.file.strategy.RenameFileProcessStrategy
All Implemented Interfaces:
FileProcessStrategy

public class RenameFileProcessStrategy
extends FileProcessStrategySupport

A strategy to rename a file

Version:
$Revision: 1925 $

Constructor Summary
RenameFileProcessStrategy()
           
RenameFileProcessStrategy(boolean lock)
           
RenameFileProcessStrategy(boolean lock, FileRenamer commitRenamer, FileRenamer beginRenamer)
           
RenameFileProcessStrategy(boolean lock, String namePrefix, String namePostfix)
           
RenameFileProcessStrategy(boolean lock, String namePrefix, String namePostfix, String preNamePrefix, String preNamePostfix)
           
 
Method Summary
 boolean begin(FileEndpoint endpoint, FileExchange exchange, File file)
          Called when work is about to begin on this file.
 void commit(FileEndpoint endpoint, FileExchange exchange, File file)
          Releases any file locks and possibly deletes or moves the file after successful processing
 FileRenamer getBeginRenamer()
           
 FileRenamer getCommitRenamer()
           
 void setBeginRenamer(FileRenamer beginRenamer)
           
 void setCommitRenamer(FileRenamer commitRenamer)
           
 
Methods inherited from class org.apache.camel.component.file.strategy.FileProcessStrategySupport
getLockFileRenamer, isLockFile, rollback, setLockFile, setLockFileRenamer, unlockFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenameFileProcessStrategy

public RenameFileProcessStrategy()

RenameFileProcessStrategy

public RenameFileProcessStrategy(boolean lock)

RenameFileProcessStrategy

public RenameFileProcessStrategy(boolean lock,
                                 String namePrefix,
                                 String namePostfix)

RenameFileProcessStrategy

public RenameFileProcessStrategy(boolean lock,
                                 String namePrefix,
                                 String namePostfix,
                                 String preNamePrefix,
                                 String preNamePostfix)

RenameFileProcessStrategy

public RenameFileProcessStrategy(boolean lock,
                                 FileRenamer commitRenamer,
                                 FileRenamer beginRenamer)
Method Detail

begin

public boolean begin(FileEndpoint endpoint,
                     FileExchange exchange,
                     File file)
              throws Exception
Description copied from interface: FileProcessStrategy
Called when work is about to begin on this file. This method may attempt to acquire some file lock before returning true; returning false if the file lock could not be obtained so that the file should be ignored.

Specified by:
begin in interface FileProcessStrategy
Overrides:
begin in class FileProcessStrategySupport
Parameters:
endpoint - the endpoint
exchange - the exchange
file - the file
Returns:
true if the file can be processed (such as if a file lock could be obtained)
Throws:
Exception - can be thrown in case of errors

commit

public void commit(FileEndpoint endpoint,
                   FileExchange exchange,
                   File file)
            throws Exception
Description copied from interface: FileProcessStrategy
Releases any file locks and possibly deletes or moves the file after successful processing

Specified by:
commit in interface FileProcessStrategy
Overrides:
commit in class FileProcessStrategySupport
Parameters:
endpoint - the endpoint
exchange - the exchange
file - the file
Throws:
Exception - can be thrown in case of errors

getBeginRenamer

public FileRenamer getBeginRenamer()

setBeginRenamer

public void setBeginRenamer(FileRenamer beginRenamer)

getCommitRenamer

public FileRenamer getCommitRenamer()

setCommitRenamer

public void setCommitRenamer(FileRenamer commitRenamer)


Copyright © 2009 IONA Open Source Community. All Rights Reserved.