openr66.context.filesystem
Class R66File

java.lang.Object
  extended by goldengate.common.file.filesystembased.FilesystemBasedFileImpl
      extended by openr66.context.filesystem.R66File
All Implemented Interfaces:
goldengate.common.file.FileInterface

public class R66File
extends goldengate.common.file.filesystembased.FilesystemBasedFileImpl

File representation

Author:
frederic bregier

Field Summary
 
Fields inherited from class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
currentFile, isAppend, isReady, session
 
Constructor Summary
R66File(R66Session session, R66Dir dir, String path)
          This constructor is for External file
R66File(R66Session session, R66Dir dir, String path, boolean append)
           
 
Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 boolean closeFile()
           
 boolean delete()
           
 boolean exists()
           
 String getBasename()
           
static String getBasename(String path)
           
protected  FileChannel getFileChannel()
           
protected  FileOutputStream getFileOutputStream(boolean append)
          Returns the FileOutputStream in Out mode associated with the current file.
protected  RandomAccessFile getRandomFile()
           
 R66Session getSession()
           
 File getTrueFile()
          This method is a good to have in a true FileInterface implementation.
 boolean isDirectory()
           
 boolean isExternal()
           
 boolean isFile()
           
 long length()
           
 boolean renameTo(String path)
           
 boolean renameTo(String path, boolean external)
          Move the current file to the path as destination
 void replaceFilename(String filename, boolean isExternal)
          Replace the current file with the new filename after closing the previous one.
 void retrieveBlocking(AtomicBoolean running)
          Start the retrieve (send to the remote host the local file)
 String toString()
           
 
Methods inherited from class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
abortFile, checkIdentify, clear, get, getDir, getFile, getFileFromPath, getMarker, getPosition, getRelativePath, isInReading, isInWriting, readDataBlock, restartMarker, retrieve, setPosition, store, writeDataBlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

R66File

public R66File(R66Session session,
               R66Dir dir,
               String path,
               boolean append)
        throws goldengate.common.command.exception.CommandAbstractException
Parameters:
session -
dir -
path -
append -
Throws:
goldengate.common.command.exception.CommandAbstractException

R66File

public R66File(R66Session session,
               R66Dir dir,
               String path)
This constructor is for External file

Parameters:
session -
dir -
path -
Method Detail

retrieveBlocking

public void retrieveBlocking(AtomicBoolean running)
                      throws OpenR66RunnerErrorException,
                             OpenR66ProtocolSystemException
Start the retrieve (send to the remote host the local file)

Parameters:
running - When false, should stop the runner
Throws:
OpenR66RunnerErrorException
OpenR66ProtocolSystemException

getTrueFile

public File getTrueFile()
This method is a good to have in a true FileInterface implementation.

Returns:
the File associated with the current FileInterface operation

getBasename

public String getBasename()
Returns:
the basename of the current file

getBasename

public static String getBasename(String path)
Parameters:
path -
Returns:
the basename from the given path

getSession

public R66Session getSession()
Specified by:
getSession in interface goldengate.common.file.FileInterface
Overrides:
getSession in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl

canRead

public boolean canRead()
                throws goldengate.common.command.exception.CommandAbstractException
Specified by:
canRead in interface goldengate.common.file.FileInterface
Overrides:
canRead in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

canWrite

public boolean canWrite()
                 throws goldengate.common.command.exception.CommandAbstractException
Specified by:
canWrite in interface goldengate.common.file.FileInterface
Overrides:
canWrite in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

delete

public boolean delete()
               throws goldengate.common.command.exception.CommandAbstractException
Specified by:
delete in interface goldengate.common.file.FileInterface
Overrides:
delete in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

exists

public boolean exists()
               throws goldengate.common.command.exception.CommandAbstractException
Specified by:
exists in interface goldengate.common.file.FileInterface
Overrides:
exists in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

getFileChannel

protected FileChannel getFileChannel()
Overrides:
getFileChannel in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl

getRandomFile

protected RandomAccessFile getRandomFile()
Overrides:
getRandomFile in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl

getFileOutputStream

protected FileOutputStream getFileOutputStream(boolean append)
Returns the FileOutputStream in Out mode associated with the current file.

Overrides:
getFileOutputStream in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Parameters:
append - True if the FileOutputStream should be in append mode
Returns:
the FileOutputStream (OUT)

isDirectory

public boolean isDirectory()
                    throws goldengate.common.command.exception.CommandAbstractException
Specified by:
isDirectory in interface goldengate.common.file.FileInterface
Overrides:
isDirectory in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

isFile

public boolean isFile()
               throws goldengate.common.command.exception.CommandAbstractException
Specified by:
isFile in interface goldengate.common.file.FileInterface
Overrides:
isFile in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

length

public long length()
            throws goldengate.common.command.exception.CommandAbstractException
Specified by:
length in interface goldengate.common.file.FileInterface
Overrides:
length in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

renameTo

public boolean renameTo(String path)
                 throws goldengate.common.command.exception.CommandAbstractException
Specified by:
renameTo in interface goldengate.common.file.FileInterface
Overrides:
renameTo in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

renameTo

public boolean renameTo(String path,
                        boolean external)
                 throws goldengate.common.command.exception.CommandAbstractException
Move the current file to the path as destination

Parameters:
path -
external - if True, the path is outside authentication control
Returns:
True if the operation is done
Throws:
goldengate.common.command.exception.CommandAbstractException

replaceFilename

public void replaceFilename(String filename,
                            boolean isExternal)
                     throws goldengate.common.command.exception.CommandAbstractException
Replace the current file with the new filename after closing the previous one.

Parameters:
filename -
isExternal -
Throws:
goldengate.common.command.exception.CommandAbstractException

closeFile

public boolean closeFile()
                  throws goldengate.common.command.exception.CommandAbstractException
Specified by:
closeFile in interface goldengate.common.file.FileInterface
Overrides:
closeFile in class goldengate.common.file.filesystembased.FilesystemBasedFileImpl
Throws:
goldengate.common.command.exception.CommandAbstractException

isExternal

public boolean isExternal()
Returns:
True if this file is outside OpenR66 Base directory

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.