lumis.portal.filesystem
Class FileSystemManager

Package class diagram package FileSystemManager
java.lang.Object
  extended by lumis.portal.filesystem.FileSystemManager
All Implemented Interfaces:
IFileSystemManager

public class FileSystemManager
extends Object
implements IFileSystemManager

Implementation of the file system manager.

Since:
4.1.0

Nested Class Summary
static class FileSystemManager.WriteFileCommand
          Command used to perform the write operation of a file.
 
Constructor Summary
FileSystemManager()
           
 
Method Summary
 void copyFile(PortalFile source, PortalFile destination)
          Performs a file copy.
 void lockFileForRead(File file)
          Locks a file for reading operations.
 void lockFileForWrite(File file)
          Locks a file for writing operations.
 void unlockFileForRead(File file)
          Unlocks a file locked by IFileSystemManager.lockFileForRead(File).
 void unlockFileForWrite(File file)
          Unlocks a file locked by IFileSystemManager.lockFileForWrite(File).
 void writeFile(PortalFile file, byte[] content)
          Writes content in the specified file.
 void writeFile(PortalFile file, InputStream content)
          Writes content in the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemManager

public FileSystemManager()
Method Detail

lockFileForRead

public void lockFileForRead(File file)
Description copied from interface: IFileSystemManager
Locks a file for reading operations. This lock is obeyed only by threads in the same JVM that also use a lock method available in this manager.

Many threads may acquire read locks simultaneously, but if a thread acquire a write lock for a file, no other thread can acquire any lock. If the file is already locked anyway that this thread cannot acquire the lock, it is blocked until the lock can be acquired.

IFileSystemManager.unlockFileForRead(File) must be executed after this method. A try/finally block should be used in order to guarantee this.

Specified by:
lockFileForRead in interface IFileSystemManager
Parameters:
file - the file to be locked.
See Also:
IFileSystemManager.unlockFileForRead(File), IFileSystemManager.lockFileForWrite(File)

unlockFileForRead

public void unlockFileForRead(File file)
Description copied from interface: IFileSystemManager
Unlocks a file locked by IFileSystemManager.lockFileForRead(File).

Specified by:
unlockFileForRead in interface IFileSystemManager
Parameters:
file - the file to be unlocked.
See Also:
IFileSystemManager.lockFileForRead(File)

lockFileForWrite

public void lockFileForWrite(File file)
Description copied from interface: IFileSystemManager
Locks a file for writing operations. This lock is obeyed only by threads in the same JVM that also use a lock method available in this manager.

Many threads may acquire read locks simultaneously, but if a thread acquire a write lock for a file, no other thread can acquire any lock. If the file is already locked anyway that this thread cannot acquire the lock, it is blocked until the lock can be acquired.

IFileSystemManager.unlockFileForWrite(File) must be executed after this method. A try/finally block should be used in order to guarantee this.

Specified by:
lockFileForWrite in interface IFileSystemManager
Parameters:
file - the file to be locked.
See Also:
IFileSystemManager.unlockFileForWrite(File), IFileSystemManager.lockFileForRead(File)

unlockFileForWrite

public void unlockFileForWrite(File file)
Description copied from interface: IFileSystemManager
Unlocks a file locked by IFileSystemManager.lockFileForWrite(File).

Specified by:
unlockFileForWrite in interface IFileSystemManager
Parameters:
file - the file to be unlocked.
See Also:
IFileSystemManager.lockFileForWrite(File)

writeFile

public void writeFile(PortalFile file,
                      byte[] content)
               throws IOException
Description copied from interface: IFileSystemManager
Writes content in the specified file. The change is replicated across the cluster.

Specified by:
writeFile in interface IFileSystemManager
Parameters:
file - the file to write. If it already exists it is overwritten.
content - the content.
Throws:
IOException

writeFile

public void writeFile(PortalFile file,
                      InputStream content)
               throws IOException
Description copied from interface: IFileSystemManager
Writes content in the specified file. The change is replicated across the cluster.

Specified by:
writeFile in interface IFileSystemManager
Parameters:
file - the file to write. If it already exists it is overwritten.
content - the content.
Throws:
IOException

copyFile

public void copyFile(PortalFile source,
                     PortalFile destination)
              throws IOException
Description copied from interface: IFileSystemManager
Performs a file copy. The copy operation is repeated across the cluster.

Specified by:
copyFile in interface IFileSystemManager
Parameters:
source - the source file.
destination - the destination file. If it already exists it is overwritten.
Throws:
IOException


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.