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: 37863 $

Field Summary
static String DEFAULT_LOCK_FILE_POSTFIX
           
 
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
 FileRenamer getLockFileRenamer()
           
 boolean isLockFile()
           
 void setLockFile(boolean lockFile)
           
 void setLockFileRenamer(FileRenamer lockFileRenamer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOCK_FILE_POSTFIX

public static final String DEFAULT_LOCK_FILE_POSTFIX
See Also:
Constant Field Values
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

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

isLockFile

public boolean isLockFile()

setLockFile

public void setLockFile(boolean lockFile)

getLockFileRenamer

public FileRenamer getLockFileRenamer()

setLockFileRenamer

public void setLockFileRenamer(FileRenamer lockFileRenamer)


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