goldengate.common.file.passthrough
Class PassthroughBasedDirImpl

java.lang.Object
  extended by goldengate.common.file.AbstractDir
      extended by goldengate.common.file.passthrough.PassthroughBasedDirImpl
All Implemented Interfaces:
DirInterface

public abstract class PassthroughBasedDirImpl
extends AbstractDir

Directory implementation for Passthrough Based. It is just an empty shell since in pass through mode, no directories or files really exist. If one wants to implement special actions, he/she just has to extend this class and override the default empty implementation.

Author:
Frederic Bregier

Field Summary
static PassthroughFileFactory factory
          Factory for PassthroughFile
protected  PassthroughFile pdir
          Passthrough object
 
Fields inherited from class goldengate.common.file.AbstractDir
currentDir, ISUNIX, optsMLSx, roots, session
 
Fields inherited from interface goldengate.common.file.DirInterface
SEPARATOR, SEPARATORCHAR
 
Constructor Summary
PassthroughBasedDirImpl(SessionInterface session, OptsMLSxInterface optsMLSx)
           
 
Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 boolean changeDirectory(String path)
          Change directory with the one given as argument
 boolean exists()
           
 String fileFull(String path, boolean lsFormat)
          Give for 1 file all informations from the given path (could be a file or a directory)
 long getCRC(String path)
          Get the CRC of the given FileInterface
protected  File getFileFromPath(String path)
          Get the File from this path, checking first its validity
 long getFreeSpace()
           
 byte[] getMD5(String path)
          Get the MD5 of the given FileInterface
 String getModificationTime(String path)
          Return the Modification time for the path
protected  String getRelativePath(File file)
          Get the relative path (without mount point)
 byte[] getSHA1(String path)
          Get the SHA-1 of the given FileInterface
protected  File getTrueFile(String path)
          Get the true file from the path
 boolean isDirectory(String path)
          Is the given path a directory and exists
 boolean isFile(String path)
          Is the given path a file and exists
protected  boolean isFullTime()
          Decide if Full time or partial time as in 'ls' command
 List<String> list(String path)
          List all files from the given path (could be a file or a directory)
 List<String> listFull(String path, boolean lsFormat)
          List all files with other informations from the given path (could be a file or a directory)
 String mkdir(String directory)
          Create the directory associated with the String as path
 String rmdir(String directory)
          Delete the directory associated with the String as path
 FileInterface setUniqueFile()
          Set a new unique path as the current FileInterface from the current Directory (STOU)
protected  List<String> wildcardFiles(String pathWithWildcard)
          Finds all files matching a wildcard expression (based on '?'
 
Methods inherited from class goldengate.common.file.AbstractDir
changeParentDirectory, checkIdentify, clear, consolidatePath, getCanonicalPath, getCorrespondingRoot, getOptsMLSx, getPwd, getSession, initAfterIdentification, initWindowsSupport, isAbsoluteWindows, normalizePath, setFile, validatePath, validatePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface goldengate.common.file.DirInterface
changeDirectoryNotChecked, newFile
 

Field Detail

factory

public static PassthroughFileFactory factory
Factory for PassthroughFile


pdir

protected PassthroughFile pdir
Passthrough object

Constructor Detail

PassthroughBasedDirImpl

public PassthroughBasedDirImpl(SessionInterface session,
                               OptsMLSxInterface optsMLSx)
Parameters:
session -
optsMLSx -
Method Detail

wildcardFiles

protected List<String> wildcardFiles(String pathWithWildcard)
                              throws CommandAbstractException
Finds all files matching a wildcard expression (based on '?', '~' or '*').

Specified by:
wildcardFiles in class AbstractDir
Parameters:
pathWithWildcard - The wildcard expression with a business path.
Returns:
List of String as relative paths matching the wildcard expression. Those files are tested as valid from business point of view. If Wildcard support is not active, if the path contains any wildcards, it will throw an error.
Throws:
CommandAbstractException

getFileFromPath

protected File getFileFromPath(String path)
                        throws CommandAbstractException
Get the File from this path, checking first its validity

Parameters:
path -
Returns:
the FileInterface
Throws:
CommandAbstractException

getTrueFile

protected File getTrueFile(String path)
                    throws CommandAbstractException
Get the true file from the path

Parameters:
path -
Returns:
the true File from the path
Throws:
CommandAbstractException

getRelativePath

protected String getRelativePath(File file)
Get the relative path (without mount point)

Parameters:
file -
Returns:
the relative path

changeDirectory

public boolean changeDirectory(String path)
                        throws CommandAbstractException
Description copied from interface: DirInterface
Change directory with the one given as argument

Returns:
True if the change is valid
Throws:
CommandAbstractException

mkdir

public String mkdir(String directory)
             throws CommandAbstractException
Description copied from interface: DirInterface
Create the directory associated with the String as path

Returns:
the full path of the new created directory
Throws:
CommandAbstractException

rmdir

public String rmdir(String directory)
             throws CommandAbstractException
Description copied from interface: DirInterface
Delete the directory associated with the String as path

Returns:
the full path of the new deleted directory
Throws:
CommandAbstractException

isDirectory

public boolean isDirectory(String path)
                    throws CommandAbstractException
Description copied from interface: DirInterface
Is the given path a directory and exists

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

isFile

public boolean isFile(String path)
               throws CommandAbstractException
Description copied from interface: DirInterface
Is the given path a file and exists

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

getModificationTime

public String getModificationTime(String path)
                           throws CommandAbstractException
Description copied from interface: DirInterface
Return the Modification time for the path

Returns:
the Modification time as a String YYYYMMDDHHMMSS.sss
Throws:
CommandAbstractException

list

public List<String> list(String path)
                  throws CommandAbstractException
Description copied from interface: DirInterface
List all files from the given path (could be a file or a directory)

Returns:
the list of paths
Throws:
CommandAbstractException

listFull

public List<String> listFull(String path,
                             boolean lsFormat)
                      throws CommandAbstractException
Description copied from interface: DirInterface
List all files with other informations from the given path (could be a file or a directory)

lsFormat - True if ls Format, else MLSx format
Returns:
the list of paths and other informations
Throws:
CommandAbstractException

fileFull

public String fileFull(String path,
                       boolean lsFormat)
                throws CommandAbstractException
Description copied from interface: DirInterface
Give for 1 file all informations from the given path (could be a file or a directory)

lsFormat - True if ls Format, else MLSx format
Returns:
the path and other informations
Throws:
CommandAbstractException

isFullTime

protected boolean isFullTime()
Decide if Full time or partial time as in 'ls' command

Returns:
True if Full Time, False is Default (as in 'ls' command)

getFreeSpace

public long getFreeSpace()
                  throws CommandAbstractException
Returns:
the free space of the current Directory
Throws:
CommandAbstractException

setUniqueFile

public FileInterface setUniqueFile()
                            throws CommandAbstractException
Description copied from interface: DirInterface
Set a new unique path as the current FileInterface from the current Directory (STOU)

Returns:
the FileInterface if it is correctly initiate
Throws:
CommandAbstractException

canRead

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

canWrite

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

exists

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

getCRC

public long getCRC(String path)
            throws CommandAbstractException
Description copied from interface: DirInterface
Get the CRC of the given FileInterface

Returns:
the CRC
Throws:
CommandAbstractException

getMD5

public byte[] getMD5(String path)
              throws CommandAbstractException
Description copied from interface: DirInterface
Get the MD5 of the given FileInterface

Returns:
the MD5
Throws:
CommandAbstractException

getSHA1

public byte[] getSHA1(String path)
               throws CommandAbstractException
Description copied from interface: DirInterface
Get the SHA-1 of the given FileInterface

Returns:
the SHA-1
Throws:
CommandAbstractException


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