public class DBDiskDriver extends java.lang.Object implements DiskInterface, DiskSizeInterface, DiskVolumeInterface, NTFSStreamsInterface, FileLockingInterface, FileIdInterface, SymbolicLinkInterface, OpLockInterface, SecurityDescriptorInterface
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DBStreamList |
static int |
DefaultNFSDirMode |
static int |
DefaultNFSFileMode |
static int |
MaxFileNameLen |
static long |
MaxTimestampValue |
| Constructor and Description |
|---|
DBDiskDriver() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
buildPathForFileId(SrvSession sess,
TreeConnection tree,
int dirid,
int fileid)
Convert a file id to a share relative path
|
void |
closeFile(SrvSession sess,
TreeConnection tree,
NetworkFile file)
Close the specified file
|
protected void |
closeStream(SrvSession sess,
TreeConnection tree,
NetworkFile stream)
Close an NTFS stream
|
DeviceContext |
createContext(java.lang.String shareName,
org.springframework.extensions.config.ConfigElement args)
Parse/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 entry
|
protected NetworkFile |
createStream(SrvSession sess,
TreeConnection tree,
FileOpenParams params,
FileState parent,
DBDeviceContext dbCtx)
Create a new stream with the specified parent 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
|
protected void |
deleteStream(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Delete a stream within a file
|
int |
fileExists(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Check if the specified file exists, and it is a file.
|
protected int |
findParentDirectoryId(DBDeviceContext ctx,
java.lang.String path,
boolean filePath)
Find the directory id for the parent directory in the specified path
|
protected int[] |
findParentDirectoryIdList(DBDeviceContext ctx,
java.lang.String path,
boolean filePath)
Find the directory ids for the specified path list
|
void |
flushFile(SrvSession sess,
TreeConnection tree,
NetworkFile file)
Flush buffered data for the specified file
|
void |
getDiskInformation(DiskDeviceContext ctx,
SrvDiskInfo info)
Return disk information about a shared filesystem
|
protected DBFileInfo |
getFileDetails(java.lang.String path,
DBDeviceContext dbCtx)
Get the file id for a file
|
protected DBFileInfo |
getFileDetails(java.lang.String path,
DBDeviceContext dbCtx,
FileState fstate)
Get the file id for a file
|
protected int |
getFileId(java.lang.String path,
java.lang.String name,
int dirId,
DBDeviceContext dbCtx)
Get the file id for a file
|
DBFileInfo |
getFileInfo(java.lang.String path,
int dirId,
int fid,
DBDeviceContext dbCtx)
Return file information about the specified file, using the internal file id
|
FileInfo |
getFileInformation(SrvSession sess,
TreeConnection tree,
java.lang.String name)
Return file information about the specified file
|
protected FileState |
getFileState(java.lang.String path,
DBDeviceContext ctx,
boolean create)
Get the cached file state for the specified path
|
LockManager |
getLockManager(SrvSession sess,
TreeConnection tree)
Return the lock manager implementation
|
OpLockManager |
getOpLockManager(SrvSession sess,
TreeConnection tree)
Return the oplock manager implementation
|
protected void |
getRetentionDetailsForState(DBDeviceContext dbCtx,
FileState fstate)
Load the retention details for a file state, if enabled
|
int |
getSecurityDescriptorLength(SrvSession sess,
TreeConnection tree,
NetworkFile netFile)
Return the security descriptor length for the specified file
|
DBFileInfo |
getStreamInfo(FileState parent,
java.lang.String[] paths,
DBDeviceContext dbCtx)
Get the details for a file stream
|
StreamInfo |
getStreamInformation(SrvSession sess,
TreeConnection tree,
StreamInfo streamInfo)
Get the stream information for the specified file stream
|
StreamInfoList |
getStreamList(SrvSession sess,
TreeConnection tree,
java.lang.String fileName)
Return the list of available streams for the specified file
|
VolumeInfo |
getVolumeInformation(DiskDeviceContext ctx)
Return the volume information
|
protected boolean |
hasDebug()
Check if general debug output is enabled
|
boolean |
hasStreamsEnabled(SrvSession sess,
TreeConnection tree)
Determine if NTFS streams support is enabled.
|
boolean |
hasSymbolicLinksEnabled(SrvSession sess,
TreeConnection tree)
Determine if symbolic links are enabled
|
boolean |
isOpLocksEnabled(SrvSession sess,
TreeConnection tree)
Enable/disable oplock support
|
boolean |
isReadOnly(SrvSession sess,
DeviceContext ctx)
Determine if the disk device is read-only.
|
SecurityDescriptor |
loadSecurityDescriptor(SrvSession sess,
TreeConnection tree,
NetworkFile netFile)
Load a security descriptor for the specified file
|
protected StreamInfoList |
loadStreamList(FileState fstate,
DBFileInfo finfo,
DBDeviceContext dbCtx,
boolean dbLoad)
Load the stream list for the specified file
|
NetworkFile |
openFile(SrvSession sess,
TreeConnection tree,
FileOpenParams params)
Open a file
|
protected NetworkFile |
openStream(SrvSession sess,
TreeConnection tree,
FileOpenParams params,
FileState parent,
DBDeviceContext dbCtx)
Open an existing stream with the specified parent file
|
int |
readFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
byte[] buf,
int bufPos,
int siz,
long pos)
Read a block of data from a file
|
java.lang.String |
readSymbolicLink(SrvSession sess,
TreeConnection tree,
java.lang.String path)
Read the link data for a symbolic link
|
void |
renameFile(SrvSession sess,
TreeConnection tree,
java.lang.String oldName,
java.lang.String newName)
Rename a file
|
void |
renameStream(SrvSession sess,
TreeConnection tree,
java.lang.String oldName,
java.lang.String newName,
boolean overWrite)
Rename a stream
|
void |
saveSecurityDescriptor(SrvSession sess,
TreeConnection tree,
NetworkFile netFile,
SecurityDescriptor secDesc)
Save the security descriptor for the specified 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 search of the file system
|
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
|
public static final java.lang.String DBStreamList
public static final int DefaultNFSFileMode
public static final int DefaultNFSDirMode
public static final int MaxFileNameLen
public static final long MaxTimestampValue
public void closeFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException
closeFile in interface DiskInterfacesess - Session detailstree - Tree connectionfile - Network file detailsjava.io.IOExceptionpublic void createDirectory(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
createDirectory in interface DiskInterfacesess - Session detailstree - Tree connectionparams - Directory create parametersjava.io.IOExceptionpublic NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
createFile in interface DiskInterfacesess - SrvSessiontree - TreeConnectionparams - FileOpenParamsjava.io.IOException - If an error occurs.public void deleteDirectory(SrvSession sess, TreeConnection tree, java.lang.String dir) throws java.io.IOException
deleteDirectory in interface DiskInterfacesess - Session detailstree - Tree connectiondir - Path of directory to deletejava.io.IOExceptionpublic void deleteFile(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
deleteFile in interface DiskInterfacesess - Session detailstree - Tree connectionname - Name of file to deletejava.io.IOExceptionpublic int fileExists(SrvSession sess, TreeConnection tree, java.lang.String name)
fileExists in interface DiskInterfacesess - Session detailstree - Tree connectionname - File nameFileStatuspublic void flushFile(SrvSession sess, TreeConnection tree, NetworkFile file) throws java.io.IOException
flushFile in interface DiskInterfacesess - Session detailstree - Tree connectionfile - Network filejava.io.IOExceptionpublic FileInfo getFileInformation(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
getFileInformation in interface DiskInterfacesess - Session detailstree - Tree connectionname - File namejava.io.IOExceptionpublic boolean isReadOnly(SrvSession sess, DeviceContext ctx) throws java.io.IOException
isReadOnly in interface DiskInterfacesess - Session detailsctx - Device contextjava.io.IOException - If an error occurs.public NetworkFile openFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
openFile in interface DiskInterfacesess - Session detailstree - Tree connectionparams - File open parametersjava.io.IOExceptionpublic int readFile(SrvSession sess, TreeConnection tree, NetworkFile file, byte[] buf, int bufPos, int siz, long pos) throws java.io.IOException
readFile in interface DiskInterfacesess - Session detailstree - Tree connectionfile - Network filebuf - Buffer to return data tobufPos - Starting position in the return buffersiz - Maximum size of data to returnpos - File offset to read datajava.io.IOExceptionpublic void renameFile(SrvSession sess, TreeConnection tree, java.lang.String oldName, java.lang.String newName) throws java.io.IOException
renameFile in interface DiskInterfacesess - Session detailstree - Tree connectionoldName - Existing file namenewName - New file namejava.io.IOExceptionpublic long seekFile(SrvSession sess, TreeConnection tree, NetworkFile file, long pos, int typ) throws java.io.IOException
seekFile in interface DiskInterfacesess - Session detailstree - Tree connectionfile - Network filepos - New file positiontyp - Seek typejava.io.IOExceptionpublic void setFileInformation(SrvSession sess, TreeConnection tree, java.lang.String name, FileInfo info) throws java.io.IOException
setFileInformation in interface DiskInterfacesess - Session detailstree - Tree connectionname - File nameinfo - File information to be setjava.io.IOExceptionpublic SearchContext startSearch(SrvSession sess, TreeConnection tree, java.lang.String searchPath, int attrib) throws java.io.FileNotFoundException
startSearch in interface DiskInterfacesess - SrvSessiontree - TreeConnectionsearchPath - Stringattrib - intjava.io.FileNotFoundExceptionpublic void truncateFile(SrvSession sess, TreeConnection tree, NetworkFile file, long siz) throws java.io.IOException
truncateFile in interface DiskInterfacesess - 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 DiskInterfacesess - 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 DeviceInterfaceshareName - Stringargs - ConfigElementDeviceContextExceptionprotected final DBFileInfo getFileDetails(java.lang.String path, DBDeviceContext dbCtx)
path - StringdbCtx - DBDeviceContextprotected final DBFileInfo getFileDetails(java.lang.String path, DBDeviceContext dbCtx, FileState fstate)
path - StringdbCtx - DBDeviceContextfstate - FileStateprotected final int getFileId(java.lang.String path,
java.lang.String name,
int dirId,
DBDeviceContext dbCtx)
path - Stringname - StringdirId - intdbCtx - DBDeviceContextprotected final void getRetentionDetailsForState(DBDeviceContext dbCtx, FileState fstate) throws DBException
dbCtx - DBDeviceContextfstate - FileStateDBExceptionprotected final int findParentDirectoryId(DBDeviceContext ctx, java.lang.String path, boolean filePath)
ctx - DBDeviceContextpath - StringfilePath - booleanprotected final int[] findParentDirectoryIdList(DBDeviceContext ctx, java.lang.String path, boolean filePath)
ctx - DBDeviceContextpath - StringfilePath - booleanpublic DBFileInfo getFileInfo(java.lang.String path, int dirId, int fid, DBDeviceContext dbCtx)
path - StringdirId - intfid - intdbCtx - DBDeviceContextjava.io.IOExceptionpublic DBFileInfo getStreamInfo(FileState parent, java.lang.String[] paths, DBDeviceContext dbCtx)
parent - FileStatepaths - String[]dbCtx - DBDeviceContextprotected final FileState getFileState(java.lang.String path, DBDeviceContext ctx, boolean create)
path - Stringctx - DBDeviceContextcreate - booleanpublic void treeOpened(SrvSession sess, TreeConnection tree)
treeOpened in interface DeviceInterfacesess - Server sessiontree - Tree connectionpublic void treeClosed(SrvSession sess, TreeConnection tree)
treeClosed in interface DeviceInterfacesess - Server sessiontree - Tree connectionprotected final boolean hasDebug()
public final void getDiskInformation(DiskDeviceContext ctx, SrvDiskInfo info) throws java.io.IOException
getDiskInformation in interface DiskSizeInterfacectx - DiskDeviceContextinfo - SrvDiskInfojava.io.IOExceptionpublic boolean hasStreamsEnabled(SrvSession sess, TreeConnection tree)
hasStreamsEnabled in interface NTFSStreamsInterfacesess - SrvSessiontree - TreeConnectionpublic StreamInfo getStreamInformation(SrvSession sess, TreeConnection tree, StreamInfo streamInfo) throws java.io.IOException
getStreamInformation in interface NTFSStreamsInterfacesess - SrvSessiontree - TreeConnectionstreamInfo - StreamInfojava.io.IOExceptionpublic StreamInfoList getStreamList(SrvSession sess, TreeConnection tree, java.lang.String fileName) throws java.io.IOException
getStreamList in interface NTFSStreamsInterfacesess - SrvSessiontree - TreeConnectionfileName - Stringjava.io.IOExceptionprotected final NetworkFile createStream(SrvSession sess, TreeConnection tree, FileOpenParams params, FileState parent, DBDeviceContext dbCtx) throws java.io.IOException
sess - SrvSessiontree - TreeConnectionparams - FileOpenParamsparent - FileStatedbCtx - DBDeviceContextjava.io.IOExceptionprotected final NetworkFile openStream(SrvSession sess, TreeConnection tree, FileOpenParams params, FileState parent, DBDeviceContext dbCtx) throws java.io.IOException
sess - SrvSessiontree - TreeConnectionparams - FileOpenParamsparent - FileStatedbCtx - DBDeviceContextjava.io.IOExceptionprotected final void closeStream(SrvSession sess, TreeConnection tree, NetworkFile stream) throws java.io.IOException
sess - Session detailstree - Tree connectionstream - Network file detailsjava.io.IOExceptionprotected final void deleteStream(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
sess - SrvSessiontree - TreeConnectionname - Stringjava.io.IOExceptionprotected final StreamInfoList loadStreamList(FileState fstate, DBFileInfo finfo, DBDeviceContext dbCtx, boolean dbLoad)
fstate - FileStatefinfo - DBFileInfodbCtx - DBDeviceContextdbLoad - booleanpublic void renameStream(SrvSession sess, TreeConnection tree, java.lang.String oldName, java.lang.String newName, boolean overWrite) throws java.io.IOException
renameStream in interface NTFSStreamsInterfacesess - SrvSessiontree - TreeConnectionoldName - StringnewName - StringoverWrite - booleanjava.io.IOExceptionpublic VolumeInfo getVolumeInformation(DiskDeviceContext ctx)
getVolumeInformation in interface DiskVolumeInterfacectx - DiskDeviceContextpublic LockManager getLockManager(SrvSession sess, TreeConnection tree)
getLockManager in interface FileLockingInterfacesess - SrvSessiontree - TreeConnectionpublic OpLockManager getOpLockManager(SrvSession sess, TreeConnection tree)
getOpLockManager in interface OpLockInterfacesess - SrvSessiontree - TreeConnectionpublic boolean isOpLocksEnabled(SrvSession sess, TreeConnection tree)
isOpLocksEnabled in interface OpLockInterfacesess - SrvSessiontree - TreeConnectionpublic java.lang.String buildPathForFileId(SrvSession sess, TreeConnection tree, int dirid, int fileid) throws java.io.FileNotFoundException
buildPathForFileId in interface FileIdInterfacesess - SrvSessiontree - TreeConnectiondirid - intfileid - java.io.FileNotFoundExceptionpublic boolean hasSymbolicLinksEnabled(SrvSession sess, TreeConnection tree)
hasSymbolicLinksEnabled in interface SymbolicLinkInterfacesess - SrvSessiontree - TreeConnectionpublic java.lang.String readSymbolicLink(SrvSession sess, TreeConnection tree, java.lang.String path) throws AccessDeniedException, java.io.FileNotFoundException
readSymbolicLink in interface SymbolicLinkInterfacesess - SrvSessiontree - TreeConnectionpath - StringAccessDeniedExceptionjava.io.FileNotFoundExceptionpublic int getSecurityDescriptorLength(SrvSession sess, TreeConnection tree, NetworkFile netFile) throws SMBSrvException
getSecurityDescriptorLength in interface SecurityDescriptorInterfacesess - Server sessiontree - Tree connectionnetFile - Network fileSMBSrvExceptionpublic SecurityDescriptor loadSecurityDescriptor(SrvSession sess, TreeConnection tree, NetworkFile netFile) throws SMBSrvException
loadSecurityDescriptor in interface SecurityDescriptorInterfacesess - Server sessiontree - Tree connectionnetFile - Network fileSMBSrvExceptionpublic void saveSecurityDescriptor(SrvSession sess, TreeConnection tree, NetworkFile netFile, SecurityDescriptor secDesc) throws SMBSrvException
saveSecurityDescriptor in interface SecurityDescriptorInterfacesess - Server sessiontree - Tree connectionnetFile - Network filesecDesc - Security descriptorSMBSrvExceptionCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.