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

java.lang.Object
  extended by org.apache.camel.component.file.strategy.FileProcessStrategySupport
All Implemented Interfaces:
FileProcessStrategy
Direct Known Subclasses:
DeleteFileProcessStrategy, NoOpFileProcessStrategy, RenameFileProcessStrategy

public abstract class FileProcessStrategySupport
extends Object
implements FileProcessStrategy

Base class for FileProcessStrategy implementation to extend.

Version:
$Revision: 51995 $

Constructor Summary
protected FileProcessStrategySupport()
           
protected FileProcessStrategySupport(boolean lockFile)
           
protected FileProcessStrategySupport(boolean lockFile, FileRenamer lockFileRenamer)
           
 
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 getLockFileRenamer()
           
 boolean isLockFile()
           
 void rollback(FileEndpoint endpoint, FileExchange exchange, File file)
          Releases any file locks and possibly deletes or moves the file after unsuccessful processing
 void setLockFile(boolean lockFile)
           
 void setLockFileRenamer(FileRenamer lockFileRenamer)
           
protected  void unlockFile(FileEndpoint endpoint, FileExchange exchange, File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileProcessStrategySupport

protected FileProcessStrategySupport()

FileProcessStrategySupport

protected FileProcessStrategySupport(boolean lockFile)

FileProcessStrategySupport

protected FileProcessStrategySupport(boolean lockFile,
                                     FileRenamer lockFileRenamer)
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
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
Parameters:
endpoint - the endpoint
exchange - the exchange
file - the file
Throws:
Exception - can be thrown in case of errors

rollback

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

Specified by:
rollback in interface FileProcessStrategy
Parameters:
endpoint - the endpoint
exchange - the exchange
file - the file

isLockFile

public boolean isLockFile()

setLockFile

public void setLockFile(boolean lockFile)

getLockFileRenamer

public FileRenamer getLockFileRenamer()

setLockFileRenamer

public void setLockFileRenamer(FileRenamer lockFileRenamer)

unlockFile

protected void unlockFile(FileEndpoint endpoint,
                          FileExchange exchange,
                          File file)
                   throws Exception
Throws:
Exception


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