com.myJava.file.driver.remote
Class AbstractRemoteFileSystemDriver

java.lang.Object
  extended by com.myJava.file.driver.AbstractFileSystemDriver
      extended by com.myJava.file.driver.remote.AbstractRemoteFileSystemDriver
All Implemented Interfaces:
FileSystemDriver
Direct Known Subclasses:
FTPFileSystemDriver

public abstract class AbstractRemoteFileSystemDriver
extends AbstractFileSystemDriver


Author:
Olivier PETRUCCI

Areca Build ID : 7299034069467778562

Field Summary
protected  java.util.ArrayList alternateProxies
           
protected static int BUFFER_SIZE
           
protected  java.util.Map localInputFiles
           
protected  java.io.File localRootDirectory
           
protected  int maxProxies
           
protected  AbstractProxy proxy
           
protected  java.lang.String strLocalRootDirectory
           
protected static boolean USE_BUFFER
           
 
Fields inherited from class com.myJava.file.driver.AbstractFileSystemDriver
CHECK_PATH
 
Fields inherited from interface com.myJava.file.driver.FileSystemDriver
ACCESS_EFFICIENCY_AVERAGE, ACCESS_EFFICIENCY_GOOD, ACCESS_EFFICIENCY_POOR
 
Constructor Summary
AbstractRemoteFileSystemDriver(java.io.File localRootDirectory)
           
 
Method Summary
protected  java.lang.String buildNewOwnerId(java.lang.String role)
           
 boolean canRead(java.io.File file)
           
 boolean canWrite(java.io.File file)
           
 boolean createNewFile(java.io.File file)
           
 boolean delete(java.io.File file)
           
 boolean directFileAccessSupported()
           
protected  void disconnect()
           
 boolean exists(java.io.File file)
           
 void flush()
           
 java.io.File getAbsoluteFile(java.io.File file)
           
 java.lang.String getAbsolutePath(java.io.File file)
           
 short getAccessEfficiency()
          Tells whether accesses are fast or not
protected  AbstractProxy getAvailableProxy(java.lang.String owner)
           
 java.io.InputStream getCachedFileInputStream(java.io.File file)
          Ensures that a local copy of the file exists and return an InputStream on this file
 java.io.OutputStream getCachedFileOutputStream(java.io.File file)
          Returns an OutputStream for the given File
This outputStream will be cached, and written only during call to "flush"
 java.io.File getCanonicalFile(java.io.File file)
           
 java.lang.String getCanonicalPath(java.io.File file)
           
protected  FictiveFile getFictiveLocalFile(java.io.File file)
           
 java.io.InputStream getFileInputStream(java.io.File file)
           
 java.io.OutputStream getFileOutputStream(java.io.File file)
           
 java.io.OutputStream getFileOutputStream(java.io.File file, boolean append)
           
 java.io.OutputStream getFileOutputStream(java.io.File file, boolean append, OutputStreamListener listener)
           
 FileCacheableInformations getInformations(java.io.File file)
          Returns a global set of file informations (length, lastmodified, ...)
 java.lang.String getName(java.io.File file)
           
protected  java.lang.String getNormalizedLocalRoot()
           
 java.lang.String getParent(java.io.File file)
           
 java.io.File getParentFile(java.io.File file)
           
 java.lang.String getPath(java.io.File file)
           
protected  void initFictiveLocalFile(FictiveFile file)
           
 boolean isAbsolute(java.io.File file)
           
 boolean isContentSensitive()
          Returns true if the driver is sensitive to the content.
 boolean isDirectory(java.io.File file)
           
 boolean isFile(java.io.File file)
           
 long lastModified(java.io.File file)
           
 long length(java.io.File file)
           
 java.lang.String[] list(java.io.File file)
           
 java.lang.String[] list(java.io.File file, java.io.FilenameFilter filter)
           
 java.io.File[] listFiles(java.io.File file)
           
 java.io.File[] listFiles(java.io.File file, java.io.FileFilter filter)
           
 java.io.File[] listFiles(java.io.File file, java.io.FilenameFilter filter)
           
 boolean mkdir(java.io.File file)
           
 void mount()
           
protected  void releaseProxy(AbstractProxy proxy, java.lang.String owner)
           
protected  void removeLocalInputFile(java.io.File file)
           
 boolean renameTo(java.io.File source, java.io.File dest)
           
 boolean supportsLongFileNames()
           
protected abstract  java.lang.String translateToLocal(java.lang.String remoteFile)
           
protected abstract  java.lang.String translateToRemote(java.io.File localFile)
           
 void unmount()
           
 
Methods inherited from class com.myJava.file.driver.AbstractFileSystemDriver
applyMetaData, checkFilePath, createSymbolicLink, deleteOnExit, getMetaData, isHidden, mkdirs, normalizeIfNeeded, setLastModified, setReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localRootDirectory

protected java.io.File localRootDirectory

strLocalRootDirectory

protected java.lang.String strLocalRootDirectory

USE_BUFFER

protected static boolean USE_BUFFER

BUFFER_SIZE

protected static int BUFFER_SIZE

localInputFiles

protected java.util.Map localInputFiles

proxy

protected AbstractProxy proxy

maxProxies

protected int maxProxies

alternateProxies

protected java.util.ArrayList alternateProxies
Constructor Detail

AbstractRemoteFileSystemDriver

public AbstractRemoteFileSystemDriver(java.io.File localRootDirectory)
Method Detail

translateToLocal

protected abstract java.lang.String translateToLocal(java.lang.String remoteFile)

translateToRemote

protected abstract java.lang.String translateToRemote(java.io.File localFile)

getNormalizedLocalRoot

protected java.lang.String getNormalizedLocalRoot()

createNewFile

public boolean createNewFile(java.io.File file)
                      throws java.io.IOException
Specified by:
createNewFile in interface FileSystemDriver
Overrides:
createNewFile in class AbstractFileSystemDriver
Throws:
java.io.IOException

length

public long length(java.io.File file)
Specified by:
length in interface FileSystemDriver
Overrides:
length in class AbstractFileSystemDriver

lastModified

public long lastModified(java.io.File file)
Specified by:
lastModified in interface FileSystemDriver
Overrides:
lastModified in class AbstractFileSystemDriver

isDirectory

public boolean isDirectory(java.io.File file)
Specified by:
isDirectory in interface FileSystemDriver
Overrides:
isDirectory in class AbstractFileSystemDriver

exists

public boolean exists(java.io.File file)
Specified by:
exists in interface FileSystemDriver
Overrides:
exists in class AbstractFileSystemDriver

getFictiveLocalFile

protected FictiveFile getFictiveLocalFile(java.io.File file)

initFictiveLocalFile

protected void initFictiveLocalFile(FictiveFile file)

getAvailableProxy

protected AbstractProxy getAvailableProxy(java.lang.String owner)

releaseProxy

protected void releaseProxy(AbstractProxy proxy,
                            java.lang.String owner)

getCachedFileOutputStream

public java.io.OutputStream getCachedFileOutputStream(java.io.File file)
                                               throws java.io.IOException
Description copied from interface: FileSystemDriver
Returns an OutputStream for the given File
This outputStream will be cached, and written only during call to "flush"

Throws:
java.io.IOException

getAccessEfficiency

public short getAccessEfficiency()
Description copied from interface: FileSystemDriver
Tells whether accesses are fast or not


canRead

public boolean canRead(java.io.File file)

canWrite

public boolean canWrite(java.io.File file)

supportsLongFileNames

public boolean supportsLongFileNames()

isFile

public boolean isFile(java.io.File file)
Specified by:
isFile in interface FileSystemDriver
Overrides:
isFile in class AbstractFileSystemDriver

getAbsoluteFile

public java.io.File getAbsoluteFile(java.io.File file)
Specified by:
getAbsoluteFile in interface FileSystemDriver
Overrides:
getAbsoluteFile in class AbstractFileSystemDriver

getAbsolutePath

public java.lang.String getAbsolutePath(java.io.File file)
Specified by:
getAbsolutePath in interface FileSystemDriver
Overrides:
getAbsolutePath in class AbstractFileSystemDriver

getCanonicalFile

public java.io.File getCanonicalFile(java.io.File file)
                              throws java.io.IOException
Specified by:
getCanonicalFile in interface FileSystemDriver
Overrides:
getCanonicalFile in class AbstractFileSystemDriver
Throws:
java.io.IOException

getCanonicalPath

public java.lang.String getCanonicalPath(java.io.File file)
                                  throws java.io.IOException
Specified by:
getCanonicalPath in interface FileSystemDriver
Overrides:
getCanonicalPath in class AbstractFileSystemDriver
Throws:
java.io.IOException

getName

public java.lang.String getName(java.io.File file)
Specified by:
getName in interface FileSystemDriver
Overrides:
getName in class AbstractFileSystemDriver

getParent

public java.lang.String getParent(java.io.File file)
Specified by:
getParent in interface FileSystemDriver
Overrides:
getParent in class AbstractFileSystemDriver

getParentFile

public java.io.File getParentFile(java.io.File file)
Specified by:
getParentFile in interface FileSystemDriver
Overrides:
getParentFile in class AbstractFileSystemDriver

getPath

public java.lang.String getPath(java.io.File file)
Specified by:
getPath in interface FileSystemDriver
Overrides:
getPath in class AbstractFileSystemDriver

isAbsolute

public boolean isAbsolute(java.io.File file)
Specified by:
isAbsolute in interface FileSystemDriver
Overrides:
isAbsolute in class AbstractFileSystemDriver

list

public java.lang.String[] list(java.io.File file,
                               java.io.FilenameFilter filter)
Specified by:
list in interface FileSystemDriver
Overrides:
list in class AbstractFileSystemDriver

list

public java.lang.String[] list(java.io.File file)
Specified by:
list in interface FileSystemDriver
Overrides:
list in class AbstractFileSystemDriver

listFiles

public java.io.File[] listFiles(java.io.File file,
                                java.io.FileFilter filter)
Specified by:
listFiles in interface FileSystemDriver
Overrides:
listFiles in class AbstractFileSystemDriver

listFiles

public java.io.File[] listFiles(java.io.File file,
                                java.io.FilenameFilter filter)
Specified by:
listFiles in interface FileSystemDriver
Overrides:
listFiles in class AbstractFileSystemDriver

directFileAccessSupported

public boolean directFileAccessSupported()

removeLocalInputFile

protected void removeLocalInputFile(java.io.File file)

getCachedFileInputStream

public java.io.InputStream getCachedFileInputStream(java.io.File file)
                                             throws java.io.IOException
Description copied from interface: FileSystemDriver
Ensures that a local copy of the file exists and return an InputStream on this file

Throws:
java.io.IOException

mount

public void mount()
           throws java.io.IOException
Throws:
java.io.IOException

unmount

public void unmount()
             throws java.io.IOException
Throws:
java.io.IOException

disconnect

protected void disconnect()

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

buildNewOwnerId

protected java.lang.String buildNewOwnerId(java.lang.String role)

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file,
                                                boolean append,
                                                OutputStreamListener listener)
                                         throws java.io.IOException
Throws:
java.io.IOException

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file)
                                         throws java.io.IOException
Throws:
java.io.IOException

getInformations

public FileCacheableInformations getInformations(java.io.File file)
Description copied from interface: FileSystemDriver
Returns a global set of file informations (length, lastmodified, ...)


isContentSensitive

public boolean isContentSensitive()
Description copied from interface: FileSystemDriver
Returns true if the driver is sensitive to the content.
In other words, if the driver has a chance to fail during initialization if files pre-exist on its storage location


delete

public boolean delete(java.io.File file)
Specified by:
delete in interface FileSystemDriver
Overrides:
delete in class AbstractFileSystemDriver

mkdir

public boolean mkdir(java.io.File file)
Specified by:
mkdir in interface FileSystemDriver
Overrides:
mkdir in class AbstractFileSystemDriver

renameTo

public boolean renameTo(java.io.File source,
                        java.io.File dest)
Specified by:
renameTo in interface FileSystemDriver
Overrides:
renameTo in class AbstractFileSystemDriver

listFiles

public java.io.File[] listFiles(java.io.File file)
Specified by:
listFiles in interface FileSystemDriver
Overrides:
listFiles in class AbstractFileSystemDriver

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file,
                                                boolean append)
                                         throws java.io.IOException
Throws:
java.io.IOException

getFileInputStream

public java.io.InputStream getFileInputStream(java.io.File file)
                                       throws java.io.IOException
Throws:
java.io.IOException