com.myJava.file.driver.event
Class EventFileSystemDriver

java.lang.Object
  extended by com.myJava.file.driver.AbstractFileSystemDriver
      extended by com.myJava.file.driver.AbstractLinkableFileSystemDriver
          extended by com.myJava.file.driver.event.EventFileSystemDriver
All Implemented Interfaces:
FileSystemDriver, LinkableFileSystemDriver

public class EventFileSystemDriver
extends AbstractLinkableFileSystemDriver
implements LinkableFileSystemDriver


Author:
Olivier PETRUCCI

Areca Build ID : 7299034069467778562

Field Summary
 
Fields inherited from class com.myJava.file.driver.AbstractLinkableFileSystemDriver
predecessor
 
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
EventFileSystemDriver(FileSystemDriver predecessor, java.lang.String identifier)
           
EventFileSystemDriver(FileSystemDriver predecessor, java.lang.String identifier, FileSystemDriverListener listener)
           
 
Method Summary
 void addListener(FileSystemDriverListener listener)
           
 void applyMetaData(FileMetaData p, java.io.File f)
          Applies the attributes provided as argument
protected  FileSystemDriverEvent buildEvent(java.lang.String event, java.io.File f)
           
 boolean canRead(java.io.File file)
           
 boolean canWrite(java.io.File file)
           
 boolean createNewFile(java.io.File file)
           
 boolean createSymbolicLink(java.io.File symlink, java.lang.String realPath)
          Create a Symbolic link
 boolean delete(java.io.File file)
           
 void deleteOnExit(java.io.File f)
           
 boolean equals(java.lang.Object o)
           
 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
 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)
           
 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)
           
 java.lang.String getIdentifier()
           
 FileCacheableInformations getInformations(java.io.File file)
          Returns a global set of file informations (length, lastmodified, ...)
 FileMetaData getMetaData(java.io.File f, boolean onlyBasicAttributes)
          Returns the file's attributes
 java.lang.String getName(java.io.File file)
           
 java.lang.String getParent(java.io.File file)
           
 java.io.File getParentFile(java.io.File file)
           
 java.lang.String getPath(java.io.File file)
           
 int hashCode()
           
 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)
           
 boolean isHidden(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)
           
 boolean mkdirs(java.io.File file)
           
 boolean renameTo(java.io.File source, java.io.File dest)
           
 boolean setLastModified(java.io.File file, long time)
           
 boolean setReadOnly(java.io.File file)
           
 boolean supportsLongFileNames()
           
protected  void throwStartEvent(FileSystemDriverEvent event)
           
protected  void throwStopEvent(FileSystemDriverEvent event)
           
 java.lang.String toString()
           
 void unmount()
           
static FileSystemDriver wrapDriver(FileSystemDriver driver, java.lang.String identifier, java.util.List listeners)
           
 
Methods inherited from class com.myJava.file.driver.AbstractLinkableFileSystemDriver
getPredecessor, mount, setPredecessor
 
Methods inherited from class com.myJava.file.driver.AbstractFileSystemDriver
checkFilePath, normalizeIfNeeded
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.myJava.file.driver.LinkableFileSystemDriver
getPredecessor
 
Methods inherited from interface com.myJava.file.driver.FileSystemDriver
mount
 

Constructor Detail

EventFileSystemDriver

public EventFileSystemDriver(FileSystemDriver predecessor,
                             java.lang.String identifier)

EventFileSystemDriver

public EventFileSystemDriver(FileSystemDriver predecessor,
                             java.lang.String identifier,
                             FileSystemDriverListener listener)
Method Detail

wrapDriver

public static FileSystemDriver wrapDriver(FileSystemDriver driver,
                                          java.lang.String identifier,
                                          java.util.List listeners)

getIdentifier

public java.lang.String getIdentifier()

addListener

public void addListener(FileSystemDriverListener listener)

throwStartEvent

protected void throwStartEvent(FileSystemDriverEvent event)

throwStopEvent

protected void throwStopEvent(FileSystemDriverEvent event)

buildEvent

protected FileSystemDriverEvent buildEvent(java.lang.String event,
                                           java.io.File f)

applyMetaData

public void applyMetaData(FileMetaData p,
                          java.io.File f)
                   throws java.io.IOException
Description copied from interface: FileSystemDriver
Applies the attributes provided as argument

Specified by:
applyMetaData in interface FileSystemDriver
Overrides:
applyMetaData in class AbstractFileSystemDriver
Throws:
java.io.IOException

canRead

public boolean canRead(java.io.File file)
Specified by:
canRead in interface FileSystemDriver

canWrite

public boolean canWrite(java.io.File file)
Specified by:
canWrite in interface FileSystemDriver

getInformations

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

Specified by:
getInformations in interface FileSystemDriver

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

createSymbolicLink

public boolean createSymbolicLink(java.io.File symlink,
                                  java.lang.String realPath)
                           throws java.io.IOException
Description copied from interface: FileSystemDriver
Create a Symbolic link

Specified by:
createSymbolicLink in interface FileSystemDriver
Overrides:
createSymbolicLink in class AbstractFileSystemDriver
Throws:
java.io.IOException

delete

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

deleteOnExit

public void deleteOnExit(java.io.File f)
Specified by:
deleteOnExit in interface FileSystemDriver
Overrides:
deleteOnExit in class AbstractFileSystemDriver

exists

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

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface FileSystemDriver
Overrides:
flush in class AbstractLinkableFileSystemDriver
Throws:
java.io.IOException

getAbsoluteFile

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

getAbsolutePath

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

getAccessEfficiency

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

Specified by:
getAccessEfficiency in interface FileSystemDriver
Overrides:
getAccessEfficiency in class AbstractLinkableFileSystemDriver

getMetaData

public FileMetaData getMetaData(java.io.File f,
                                boolean onlyBasicAttributes)
                         throws java.io.IOException
Description copied from interface: FileSystemDriver
Returns the file's attributes

Specified by:
getMetaData in interface FileSystemDriver
Overrides:
getMetaData in class AbstractFileSystemDriver
Throws:
java.io.IOException

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"

Specified by:
getCachedFileOutputStream in interface FileSystemDriver
Throws:
java.io.IOException

getCanonicalFile

public java.io.File getCanonicalFile(java.io.File file)
                              throws java.io.IOException
Specified by:
getCanonicalFile in interface FileSystemDriver
Overrides:
getCanonicalFile in class AbstractLinkableFileSystemDriver
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 AbstractLinkableFileSystemDriver
Throws:
java.io.IOException

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

Specified by:
getCachedFileInputStream in interface FileSystemDriver
Throws:
java.io.IOException

getFileInputStream

public java.io.InputStream getFileInputStream(java.io.File file)
                                       throws java.io.IOException
Specified by:
getFileInputStream in interface FileSystemDriver
Throws:
java.io.IOException

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file,
                                                boolean append,
                                                OutputStreamListener listener)
                                         throws java.io.IOException
Specified by:
getFileOutputStream in interface FileSystemDriver
Throws:
java.io.IOException

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file,
                                                boolean append)
                                         throws java.io.IOException
Specified by:
getFileOutputStream in interface FileSystemDriver
Throws:
java.io.IOException

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.io.File file)
                                         throws java.io.IOException
Specified by:
getFileOutputStream in interface FileSystemDriver
Throws:
java.io.IOException

getName

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

getParent

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

getParentFile

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

getPath

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

isAbsolute

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

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

Specified by:
isContentSensitive in interface FileSystemDriver

isDirectory

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

isFile

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

isHidden

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

lastModified

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

length

public long length(java.io.File file)
Specified by:
length in interface FileSystemDriver
Overrides:
length 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

listFiles

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

mkdir

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

mkdirs

public boolean mkdirs(java.io.File file)
Specified by:
mkdirs in interface FileSystemDriver
Overrides:
mkdirs 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

setLastModified

public boolean setLastModified(java.io.File file,
                               long time)
Specified by:
setLastModified in interface FileSystemDriver
Overrides:
setLastModified in class AbstractFileSystemDriver

setReadOnly

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

supportsLongFileNames

public boolean supportsLongFileNames()
Specified by:
supportsLongFileNames in interface FileSystemDriver
Overrides:
supportsLongFileNames in class AbstractLinkableFileSystemDriver

unmount

public void unmount()
             throws java.io.IOException
Specified by:
unmount in interface FileSystemDriver
Overrides:
unmount in class AbstractLinkableFileSystemDriver
Throws:
java.io.IOException

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class AbstractLinkableFileSystemDriver