goldengate.common.file
Interface FileInterface

All Known Implementing Classes:
FilesystemBasedFileImpl, PassthroughBasedFileImpl

public interface FileInterface

Interface for File support

Author:
Frederic Bregier

Method Summary
 boolean abortFile()
          Try to abort the current transfer if any
 boolean canRead()
           
 boolean canWrite()
           
 void checkIdentify()
          Check if the authentication is correct
 void clear()
          Set empty this FtpFile, mark it unReady.
 boolean closeFile()
          Close the current FileInterface
 boolean delete()
          Delete the current FileInterface.
 boolean exists()
           
 DirInterface getDir()
           
 String getFile()
           
 DataBlock getMarker()
          Create a restart from context for the current FileInterface
 SessionInterface getSession()
           
 boolean isDirectory()
          Is the current FileInterface a directory and exists
 boolean isFile()
          Is the current FileInterface a file and exists
 boolean isInReading()
           
 boolean isInWriting()
           
 long length()
           
 DataBlock readDataBlock()
          Read a new block for FileInterface
 boolean renameTo(String path)
          Rename the current FileInterface into a new filename from argument
 boolean restartMarker(Restart restart)
          Restart from a Marker for the current FileInterface if any.
 boolean retrieve()
          Ask to retrieve the current FileInterface.
 boolean store()
          Ask to store the current FileInterface.
 void writeDataBlock(DataBlock dataBlock)
          Function called by the DataNetworkHandler when it receives one DataBlock (Store like command)
 

Method Detail

clear

void clear()
           throws CommandAbstractException
Set empty this FtpFile, mark it unReady.

Throws:
CommandAbstractException

checkIdentify

void checkIdentify()
                   throws Reply530Exception
Check if the authentication is correct

Throws:
Reply530Exception

getSession

SessionInterface getSession()
Returns:
the FtpSession

getDir

DirInterface getDir()
Returns:
the FtpDir associated at creation with this file

isDirectory

boolean isDirectory()
                    throws CommandAbstractException
Is the current FileInterface a directory and exists

Returns:
True if it is a directory and it exists
Throws:
CommandAbstractException

isFile

boolean isFile()
               throws CommandAbstractException
Is the current FileInterface a file and exists

Returns:
True if it is a file and it exists
Throws:
CommandAbstractException

getFile

String getFile()
               throws CommandAbstractException
Returns:
the path of the current FileInterface (without mount point if any)
Throws:
CommandAbstractException

closeFile

boolean closeFile()
                  throws CommandAbstractException
Close the current FileInterface

Returns:
True if correctly closed
Throws:
CommandAbstractException

length

long length()
            throws CommandAbstractException
Returns:
the length of the current FileInterface
Throws:
CommandAbstractException

isInWriting

boolean isInWriting()
                    throws CommandAbstractException
Returns:
True if the current FileInterface is in Writing process
Throws:
CommandAbstractException

isInReading

boolean isInReading()
                    throws CommandAbstractException
Returns:
True if the current FileInterface is in Reading process
Throws:
CommandAbstractException

canRead

boolean canRead()
                throws CommandAbstractException
Returns:
True if the current FileInterface is ready for reading
Throws:
CommandAbstractException

canWrite

boolean canWrite()
                 throws CommandAbstractException
Returns:
True if the current FileInterface is ready for writing
Throws:
CommandAbstractException

exists

boolean exists()
               throws CommandAbstractException
Returns:
True if the current FileInterface exists
Throws:
CommandAbstractException

abortFile

boolean abortFile()
                  throws CommandAbstractException
Try to abort the current transfer if any

Returns:
True if everything is ok
Throws:
CommandAbstractException

store

boolean store()
              throws CommandAbstractException
Ask to store the current FileInterface. This command returns quickly since it does not store really. It prepares the object.

Returns:
True if everything is ready
Throws:
CommandAbstractException

retrieve

boolean retrieve()
                 throws CommandAbstractException
Ask to retrieve the current FileInterface. This command returns quickly since it does not retrieve really. It prepares the object.

Returns:
True if everything is ready
Throws:
CommandAbstractException

renameTo

boolean renameTo(String path)
                 throws CommandAbstractException
Rename the current FileInterface into a new filename from argument

Parameters:
path - the new filename (path could be relative or absolute - without mount point)
Returns:
True if the operation is done successfully
Throws:
CommandAbstractException

restartMarker

boolean restartMarker(Restart restart)
                      throws CommandAbstractException
Restart from a Marker for the current FileInterface if any. This function is to be called at the beginning of every transfer so in store and retrieve method.

Parameters:
restart -
Returns:
True if the Marker is OK
Throws:
CommandAbstractException

getMarker

DataBlock getMarker()
                    throws CommandAbstractException
Create a restart from context for the current FileInterface

Returns:
the dataBlock to send to the client
Throws:
CommandAbstractException

delete

boolean delete()
               throws CommandAbstractException
Delete the current FileInterface.

Returns:
True if OK, else False if not (or if the file never exists).
Throws:
CommandAbstractException

writeDataBlock

void writeDataBlock(DataBlock dataBlock)
                    throws FileTransferException
Function called by the DataNetworkHandler when it receives one DataBlock (Store like command)

Parameters:
dataBlock -
Throws:
FileTransferException
FileEndOfTransferException

readDataBlock

DataBlock readDataBlock()
                        throws FileEndOfTransferException,
                               FileTransferException
Read a new block for FileInterface

Returns:
dataBlock
Throws:
FileEndOfTransferException
FileTransferException


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