public class EnhJavaFileDiskDriver extends java.lang.Object implements DiskInterface, FileLockingInterface
Modifier and Type | Field and Description |
---|---|
protected static long |
_globalCreateDate |
Constructor and Description |
---|
EnhJavaFileDiskDriver()
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected FileInfo |
buildFileInformation(java.lang.String path,
java.lang.String relPath)
Build the file information for the specified file/directory, if it exists.
|
void |
closeFile(SrvSession sess,
TreeConnection tree,
NetworkFile file)
Close the specified file
|
DeviceContext |
createContext(java.lang.String shareName,
org.springframework.extensions.config.ConfigElement args)
Parse and validate the parameter string and create a device context for this share
|
void |
createDirectory(SrvSession sess,
TreeConnection tree,
FileOpenParams params)
Create a new directory
|
NetworkFile |
createFile(SrvSession sess,
TreeConnection tree,
FileOpenParams params)
Create a new file
|
void |
deleteDirectory(SrvSession sess,
TreeConnection tree,
java.lang.String dir)
Delete a directory
|
void |
deleteFile(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Delete a file
|
int |
fileExists(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Check if the specified file exists, and it is a file.
|
void |
flushFile(SrvSession sess,
TreeConnection tree,
NetworkFile file)
Flush buffered data for the specified file
|
FileInfo |
getFileInformation(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Return file information about the specified file
|
static long |
getGlobalCreateDateTime()
Return the global file creation date/time
|
LockManager |
getLockManager(SrvSession sess,
TreeConnection tree)
Return the lock manager implementation associated with this virtual filesystem
|
boolean |
isReadOnly(SrvSession sess,
DeviceContext ctx)
Determine if the disk device is read-only.
|
protected java.lang.String |
mapPath(java.lang.String path)
Map the input path to a real path, this may require changing the case of various parts of the
path.
|
protected java.lang.String |
mapPath(java.lang.String base,
java.lang.String path)
Map the input path to a real path, this may require changing the case of various parts of the
path.
|
NetworkFile |
openFile(SrvSession sess,
TreeConnection tree,
FileOpenParams params)
Open a file
|
int |
readFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
byte[] buf,
int bufPos,
int siz,
long filePos)
Read a block of data from a file
|
void |
renameFile(SrvSession sess,
TreeConnection tree,
java.lang.String oldName,
java.lang.String newName)
Rename a file
|
long |
seekFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
long pos,
int typ)
Seek to the specified point within a file
|
void |
setFileInformation(SrvSession sess,
TreeConnection tree,
java.lang.String name,
FileInfo info)
Set file information
|
SearchContext |
startSearch(SrvSession sess,
TreeConnection tree,
java.lang.String searchPath,
int attrib)
Start a file search
|
void |
treeClosed(SrvSession sess,
TreeConnection tree)
Connection closed to this device
|
void |
treeOpened(SrvSession sess,
TreeConnection tree)
Connection opened to this disk device
|
void |
truncateFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
long siz)
Truncate a file to the specified size
|
int |
writeFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
byte[] buf,
int bufoff,
int siz,
long fileoff)
Write a block of data to a file
|
protected FileInfo buildFileInformation(java.lang.String path, java.lang.String relPath)
path
- StringrelPath
- Stringpublic void closeFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException
closeFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network file detailsjava.io.IOException
public void createDirectory(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
createDirectory
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- Directory parametersjava.io.IOException
public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
createFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- File open parametersjava.io.IOException
public void deleteDirectory(SrvSession sess, TreeConnection tree, java.lang.String dir) throws java.io.IOException
deleteDirectory
in interface DiskInterface
sess
- Session detailstree
- Tree connectiondir
- Path of directory to deletejava.io.IOException
public void deleteFile(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
deleteFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- Name of file to deletejava.io.IOException
public int fileExists(SrvSession sess, TreeConnection tree, java.lang.String name)
fileExists
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File nameFileStatus
public void flushFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException
flushFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network filejava.io.IOException
public FileInfo getFileInformation(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
getFileInformation
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File namejava.io.IOException
public boolean isReadOnly(SrvSession sess, DeviceContext ctx) throws java.io.IOException
isReadOnly
in interface DiskInterface
sess
- Session detailsctx
- Device contextjava.io.IOException
- If an error occurs.protected final java.lang.String mapPath(java.lang.String path) throws java.io.FileNotFoundException, PathNotFoundException
path
- Share relative pathjava.io.FileNotFoundException
PathNotFoundException
protected final java.lang.String mapPath(java.lang.String base, java.lang.String path) throws java.io.FileNotFoundException, PathNotFoundException
base
- java.lang.Stringpath
- java.lang.Stringjava.io.FileNotFoundException
- The path could not be mapped to a real path.PathNotFoundException
- Part of the path is not validpublic NetworkFile openFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
openFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- File open parametersjava.io.IOException
public int readFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufPos, int siz, long filePos) throws java.io.IOException
readFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network filebuf
- Buffer to return data tobufPos
- Starting position in the return buffersiz
- Maximum size of data to returnfilePos
- File offset to read datajava.io.IOException
public void renameFile(SrvSession sess, TreeConnection tree, java.lang.String oldName, java.lang.String newName) throws java.io.IOException
renameFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionoldName
- Existing file namenewName
- New file namejava.io.IOException
public long seekFile(SrvSession sess, TreeConnection tree, NetworkFile file, long pos, int typ) throws java.io.IOException
seekFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network filepos
- New file positiontyp
- Seek typejava.io.IOException
public void setFileInformation(SrvSession sess, TreeConnection tree, java.lang.String name, FileInfo info) throws java.io.IOException
setFileInformation
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File nameinfo
- File information to be setjava.io.IOException
public SearchContext startSearch(SrvSession sess, TreeConnection tree, java.lang.String searchPath, int attrib) throws java.io.FileNotFoundException
startSearch
in interface DiskInterface
sess
- Session detailstree
- Tree connectionsearchPath
- Search path, may include wildcardsattrib
- Search attributesjava.io.FileNotFoundException
public void truncateFile(SrvSession sess, TreeConnection tree, NetworkFile file, long siz) throws java.io.IOException
truncateFile
in interface DiskInterface
sess
- Server sessiontree
- Tree connectionfile
- Network file detailssiz
- New file lengthjava.io.IOException
- The exception description.public int writeFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufoff, int siz, long fileoff) throws java.io.IOException
writeFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network filebuf
- Data to be writtenbufoff
- Offset of data within the buffersiz
- Number of bytes to be writtenfileoff
- Offset within the file to start writing the datajava.io.IOException
- The exception description.public DeviceContext createContext(java.lang.String shareName, org.springframework.extensions.config.ConfigElement args) throws DeviceContextException
createContext
in interface DeviceInterface
shareName
- Stringargs
- ConfigElementDeviceContextException
public void treeOpened(SrvSession sess, TreeConnection tree)
treeOpened
in interface DeviceInterface
sess
- Server sessiontree
- Tree connectionpublic void treeClosed(SrvSession sess, TreeConnection tree)
treeClosed
in interface DeviceInterface
sess
- Server sessiontree
- Tree connectionpublic static final long getGlobalCreateDateTime()
public LockManager getLockManager(SrvSession sess, TreeConnection tree)
getLockManager
in interface FileLockingInterface
sess
- SrvSessiontree
- TreeConnectionCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.