public class JavaFileDiskDriver extends Object implements DiskInterface
Modifier and Type | Field and Description |
---|---|
protected static long |
_globalCreateDate |
Constructor and Description |
---|
JavaFileDiskDriver()
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected FileInfo |
buildFileInformation(String path,
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(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,
String dir)
Delete a directory
|
void |
deleteFile(SrvSession sess,
TreeConnection tree,
String name)
Delete a file
|
int |
fileExists(SrvSession sess,
TreeConnection tree,
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,
String name)
Return file information about the specified file
|
static long |
getGlobalCreateDateTime()
Return the global file creation date/time
|
boolean |
isReadOnly(SrvSession sess,
DeviceContext ctx)
Determine if the disk device is read-only.
|
protected String |
mapPath(String path)
Map the input path to a real path, this may require changing the case of various parts of the
path.
|
protected String |
mapPath(String base,
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,
String oldName,
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,
String name,
FileInfo info)
Set file information
|
SearchContext |
startSearch(SrvSession sess,
TreeConnection tree,
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(String path, String relPath)
path
- StringrelPath
- Stringpublic void closeFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws IOException
closeFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network file detailsIOException
public void createDirectory(SrvSession sess, TreeConnection tree, FileOpenParams params) throws IOException
createDirectory
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- Directory parametersIOException
public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws IOException
createFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- File open parametersIOException
public void deleteDirectory(SrvSession sess, TreeConnection tree, String dir) throws IOException
deleteDirectory
in interface DiskInterface
sess
- Session detailstree
- Tree connectiondir
- Path of directory to deleteIOException
public void deleteFile(SrvSession sess, TreeConnection tree, String name) throws IOException
deleteFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- Name of file to deleteIOException
public int fileExists(SrvSession sess, TreeConnection tree, String name)
fileExists
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File nameFileStatus
public void flushFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws IOException
flushFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network fileIOException
public FileInfo getFileInformation(SrvSession sess, TreeConnection tree, String name) throws IOException
getFileInformation
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File nameIOException
public boolean isReadOnly(SrvSession sess, DeviceContext ctx) throws IOException
isReadOnly
in interface DiskInterface
sess
- Session detailsctx
- Device contextIOException
- If an error occurs.protected final String mapPath(String path) throws FileNotFoundException, PathNotFoundException
path
- Share relative pathFileNotFoundException
PathNotFoundException
protected final String mapPath(String base, String path) throws FileNotFoundException, PathNotFoundException
base
- java.lang.Stringpath
- java.lang.StringFileNotFoundException
- 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 IOException
openFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionparams
- File open parametersIOException
public int readFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufPos, int siz, long filePos) throws 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 dataIOException
public void renameFile(SrvSession sess, TreeConnection tree, String oldName, String newName) throws IOException
renameFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionoldName
- Existing file namenewName
- New file nameIOException
public long seekFile(SrvSession sess, TreeConnection tree, NetworkFile file, long pos, int typ) throws IOException
seekFile
in interface DiskInterface
sess
- Session detailstree
- Tree connectionfile
- Network filepos
- New file positiontyp
- Seek typeIOException
public void setFileInformation(SrvSession sess, TreeConnection tree, String name, FileInfo info) throws IOException
setFileInformation
in interface DiskInterface
sess
- Session detailstree
- Tree connectionname
- File nameinfo
- File information to be setIOException
public SearchContext startSearch(SrvSession sess, TreeConnection tree, String searchPath, int attrib) throws FileNotFoundException
startSearch
in interface DiskInterface
sess
- Session detailstree
- Tree connectionsearchPath
- Search path, may include wildcardsattrib
- Search attributesFileNotFoundException
public void truncateFile(SrvSession sess, TreeConnection tree, NetworkFile file, long siz) throws IOException
truncateFile
in interface DiskInterface
sess
- Server sessiontree
- Tree connectionfile
- Network file detailssiz
- New file lengthIOException
- The exception description.public int writeFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufoff, int siz, long fileoff) throws 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 dataIOException
- The exception description.public DeviceContext createContext(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()
Copyright © 2005–2017 Alfresco Software. All rights reserved.