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 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 create parametersjava.io.IOException
public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params) throws java.io.IOException
createFile
in interface DiskInterface
sess
- 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 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.public 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 pos) 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 returnpos
- 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
- SrvSessiontree
- TreeConnectionsearchPath
- Stringattrib
- intjava.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
protected 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
- FileStateDBException
protected 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.IOException
public 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 DeviceInterface
sess
- Server sessiontree
- Tree connectionpublic void treeClosed(SrvSession sess, TreeConnection tree)
treeClosed
in interface DeviceInterface
sess
- Server sessiontree
- Tree connectionprotected final boolean hasDebug()
public final void getDiskInformation(DiskDeviceContext ctx, SrvDiskInfo info) throws java.io.IOException
getDiskInformation
in interface DiskSizeInterface
ctx
- DiskDeviceContextinfo
- SrvDiskInfojava.io.IOException
public boolean hasStreamsEnabled(SrvSession sess, TreeConnection tree)
hasStreamsEnabled
in interface NTFSStreamsInterface
sess
- SrvSessiontree
- TreeConnectionpublic StreamInfo getStreamInformation(SrvSession sess, TreeConnection tree, StreamInfo streamInfo) throws java.io.IOException
getStreamInformation
in interface NTFSStreamsInterface
sess
- SrvSessiontree
- TreeConnectionstreamInfo
- StreamInfojava.io.IOException
public StreamInfoList getStreamList(SrvSession sess, TreeConnection tree, java.lang.String fileName) throws java.io.IOException
getStreamList
in interface NTFSStreamsInterface
sess
- SrvSessiontree
- TreeConnectionfileName
- Stringjava.io.IOException
protected final NetworkFile createStream(SrvSession sess, TreeConnection tree, FileOpenParams params, FileState parent, DBDeviceContext dbCtx) throws java.io.IOException
sess
- SrvSessiontree
- TreeConnectionparams
- FileOpenParamsparent
- FileStatedbCtx
- DBDeviceContextjava.io.IOException
protected final NetworkFile openStream(SrvSession sess, TreeConnection tree, FileOpenParams params, FileState parent, DBDeviceContext dbCtx) throws java.io.IOException
sess
- SrvSessiontree
- TreeConnectionparams
- FileOpenParamsparent
- FileStatedbCtx
- DBDeviceContextjava.io.IOException
protected final void closeStream(SrvSession sess, TreeConnection tree, NetworkFile stream) throws java.io.IOException
sess
- Session detailstree
- Tree connectionstream
- Network file detailsjava.io.IOException
protected final void deleteStream(SrvSession sess, TreeConnection tree, java.lang.String name) throws java.io.IOException
sess
- SrvSessiontree
- TreeConnectionname
- Stringjava.io.IOException
protected 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 NTFSStreamsInterface
sess
- SrvSessiontree
- TreeConnectionoldName
- StringnewName
- StringoverWrite
- booleanjava.io.IOException
public VolumeInfo getVolumeInformation(DiskDeviceContext ctx)
getVolumeInformation
in interface DiskVolumeInterface
ctx
- DiskDeviceContextpublic LockManager getLockManager(SrvSession sess, TreeConnection tree)
getLockManager
in interface FileLockingInterface
sess
- SrvSessiontree
- TreeConnectionpublic OpLockManager getOpLockManager(SrvSession sess, TreeConnection tree)
getOpLockManager
in interface OpLockInterface
sess
- SrvSessiontree
- TreeConnectionpublic boolean isOpLocksEnabled(SrvSession sess, TreeConnection tree)
isOpLocksEnabled
in interface OpLockInterface
sess
- SrvSessiontree
- TreeConnectionpublic java.lang.String buildPathForFileId(SrvSession sess, TreeConnection tree, int dirid, int fileid) throws java.io.FileNotFoundException
buildPathForFileId
in interface FileIdInterface
sess
- SrvSessiontree
- TreeConnectiondirid
- intfileid
- java.io.FileNotFoundException
public boolean hasSymbolicLinksEnabled(SrvSession sess, TreeConnection tree)
hasSymbolicLinksEnabled
in interface SymbolicLinkInterface
sess
- SrvSessiontree
- TreeConnectionpublic java.lang.String readSymbolicLink(SrvSession sess, TreeConnection tree, java.lang.String path) throws AccessDeniedException, java.io.FileNotFoundException
readSymbolicLink
in interface SymbolicLinkInterface
sess
- SrvSessiontree
- TreeConnectionpath
- StringAccessDeniedException
java.io.FileNotFoundException
public int getSecurityDescriptorLength(SrvSession sess, TreeConnection tree, NetworkFile netFile) throws SMBSrvException
getSecurityDescriptorLength
in interface SecurityDescriptorInterface
sess
- Server sessiontree
- Tree connectionnetFile
- Network fileSMBSrvException
public SecurityDescriptor loadSecurityDescriptor(SrvSession sess, TreeConnection tree, NetworkFile netFile) throws SMBSrvException
loadSecurityDescriptor
in interface SecurityDescriptorInterface
sess
- Server sessiontree
- Tree connectionnetFile
- Network fileSMBSrvException
public void saveSecurityDescriptor(SrvSession sess, TreeConnection tree, NetworkFile netFile, SecurityDescriptor secDesc) throws SMBSrvException
saveSecurityDescriptor
in interface SecurityDescriptorInterface
sess
- Server sessiontree
- Tree connectionnetFile
- Network filesecDesc
- Security descriptorSMBSrvException
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.