public final class CIFSDiskSession extends DiskSession
The CIFSDiskSession class extends the DiskSession class and provides CIFS protocol specific implementations for the DiskSession methods.
An CIFSDiskSession object will be created by the SessionFactory static class when the negotiated SMB dialect indicates that the remote server supports an SMB dialect greater than Core or CorePlus.
The SessionFactory.OpenDisk() method is used to create a session to a remote disk share. A PCShare object specifies the remote server and share to connect to, along with any required access control.
Attributes, DefaultInformationLevel, WriteDate, WriteTimeClosed, DBGDumpPacket, DBGHexDump, DBGPacketType, DBGSigning, DEFAULT_BUFSIZE, m_pkt, m_treeid, NO_TRANSACTION, SecurityModeShare, SecurityModeUser| Modifier | Constructor and Description |
|---|---|
protected |
CIFSDiskSession(PCShare shr,
int dialect)
Class constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAsynchronousRequest(AsynchRequest req)
Add an asynchronous request to the list of pending requests
|
void |
checkForAsynchReceive(int waitTime)
Process incoming data checking for asynchronous response packets from the server
|
void |
CloseSession()
Close this connection with the remote server share.
|
void |
CreateDirectory(java.lang.String dir)
Create a new directory on the remote file server.
|
SMBFile |
CreateFile(java.lang.String fname)
Create and open a file on the remote file server.
|
void |
DeleteDirectory(java.lang.String dir)
Delete the specified directory on the remote file server.
|
void |
DeleteFile(java.lang.String fname,
int attr)
Delete the specified file on the remote file server.
|
protected void |
fileClosed(CIFSFile cifsFile)
File closed, remove from the oplocked file list
|
DiskInfo |
getDiskInformation()
Get disk information for this remote disk.
|
FileInfo |
getFileInformation(java.lang.String fname,
int level)
Get file information for the specified file.
|
TransactBuffer |
getFileInformationRaw(java.lang.String fname,
int level)
Get file information for the specified file.
|
SymLink |
getSymLinkDetails(java.lang.String linkPath)
Return the details for a symlink file/folder
|
VolumeInfo |
getVolumeInformation()
Get the disk volume information
|
boolean |
isDirectory(java.lang.String dir)
Check if the specified file name is a directory.
|
void |
NTCancel(AsynchRequest areq)
Cancel an outstanding request.
|
CIFSFile |
NTCreate(java.lang.String name,
int access,
int attrib,
int sharing,
int exists,
long initSize,
int createOpt)
Perform an NTCreateAndX SMB to create/open a file or directory
|
protected CIFSFile |
NTCreateInternal(java.lang.String name,
int createFlags,
int access,
int attrib,
int sharing,
int exists,
long initSize,
int createOpt,
boolean throwErr)
Perform an NTCreateAndX SMB to create/open a file or directory
|
CIFSFile |
NTCreateWithOplock(java.lang.String name,
int oplockFlags,
OplockInterface oplockIface,
int access,
int attrib,
int sharing,
int exists,
long initSize,
int createOpt)
Perform an NTCreateAndX SMB to create/open a file with an oplock
|
DeviceAttributesInfo |
NTGetDeviceAttributes()
Get the device attributes information
|
DeviceInfo |
NTGetDeviceInfo()
Get the device information
|
FileInfo |
NTGetFileInformation(int fid,
int level)
Get file information for the specified open file/directory, returning the requested
information level
|
TransactBuffer |
NTGetFileInformationRaw(int fid,
int level)
Get file information for the specified open file/directory, returning the requested
information level
|
DataBuffer |
NTIOCtl(int ctrlCode,
int fid,
boolean fsctl,
byte[] data,
int dlen,
int filter)
NT I/O control
|
AsynchRequest |
NTNotifyChange(AsynchRequest areq)
Add a change notification filter for the specified directory
|
AsynchRequest |
NTNotifyChange(int fid,
int filter,
boolean watchTree,
DirectoryWatcher handler,
boolean autoResub)
Add a change notification filter for the specified directory
|
SecurityDescriptor |
NTQuerySecurityDescriptor(int fid,
int flags)
Perform an NT query security descriptor transaction for the specified file or directory
|
void |
NTSetDeleteOnClose(int fid,
boolean delFlag)
Set the delete on close flag for an open file
|
void |
NTSetEndOfFile(int fid,
long pos)
Set the end of file position for the open file
|
void |
NTSetFileAllocation(int fid,
long alloc)
Set the file allocation size for the open file
|
void |
NTSetFileInformation(FileInfo finfo,
int level)
Set file information that allows setting different information levels
|
void |
NTSetSecurityDescriptor(int fid,
SecurityDescriptor secdesc,
int flags)
Set the security descriptor for the specified file/directory
|
SMBFile |
OpenFile(java.lang.String fname,
int flags)
Open a file on the remote file server.
|
protected void |
processAsynchResponse(SMBPacket pkt)
Process an asynchronous response packet
|
void |
refreshFileInformation(SMBFile smbFile)
Refresh the file information for an open file
|
protected AsynchRequest |
removeAsynchronousRequest(AsynchRequest req)
Remove an asynchronous request from the pending list
|
protected AsynchRequest |
removeAsynchronousRequest(int id)
Remove an asynchronous request from the pending list
|
boolean |
RenameFile(java.lang.String curnam,
java.lang.String newnam,
int attr)
Rename a file, or set of files, on the remote file server.
|
void |
setFileAttributes(java.lang.String fname,
int attrib)
Set file attributes for the specified file, using the file name
|
void |
setFileInformation(SMBFile file,
FileInfo finfo)
Set file information for the specified file, using the file id
|
void |
setFileInformation(java.lang.String fname,
FileInfo finfo)
Set file information for the specified file.
|
SearchContext |
StartSearch(java.lang.String dir,
int attr,
int level)
Start a search of the specified directory returning information for each file/directory
found.
|
DeleteFile, FileExists, finalize, getFileInformation, getWorkingDirectory, isClosed, isValidFilePath, OpenInputStream, OpenOutputStream, RenameFile, setWorkingDirectory, StartSearchallocatePacket, disableSMBSigning, enableSMBSigning, getCapabilities, getDefaultFlags, getDefaultFlags2, getDeviceType, getDialect, getDialectString, getDomain, getEncryptionKey, getLANManagerType, getMaximumMultiplexedRequests, getMaximumPacketSize, getMaximumVirtualCircuits, getNextMultiplexId, getNextSessionId, getOperatingSystem, getPassword, getPCShare, getProcessId, getSecurityMode, getServer, getSession, getSessionId, getShareName, getSMBSequence, getTreeId, getUserId, getUserName, hasActiveTransaction, hasDataAvailable, hasDebug, hasDebugOption, hasEncryptionKey, hasSMBSigning, isActive, isGuest, isUnicode, pingServer, pingServer, setCapabilities, setDebug, setDefaultFlags, setDefaultFlags2, setDeviceType, setDialect, setDialectString, setDomain, setEncryptionKey, setGuest, setLANManagerType, setMaximumMultiplexedRequests, setMaximumPacketSize, setMaximumVirtualCircuits, setOperatingSystem, setPassword, setProcessId, setSecurityMode, setServer, setSession, setShareName, setSMBSequence, setTransactionMID, setTreeId, setUserId, setUserName, signTxPacket, supportsLargeFiles, supportsLevel2Oplocks, supportsLockAndRead, supportsNTFind, supportsNTSmbs, supportsNTStatusCodes, supportsRawMode, supportsRPCAPIs, supportsUnicode, toString, verifyRxPacketprotected CIFSDiskSession(PCShare shr, int dialect)
shr - Remote server details.dialect - SMB dialect that this session is usingpublic void CloseSession()
throws java.io.IOException,
SMBException
CloseSession in class DiskSessionjava.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final void CreateDirectory(java.lang.String dir)
throws java.io.IOException,
SMBException
CreateDirectory in class DiskSessiondir - Directory name string. If the directory name does not have a leading '\' the
current working directory for this session will be prepended to the string.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final SMBFile CreateFile(java.lang.String fname) throws java.io.IOException, SMBException
CreateFile in class DiskSessionfname - Remote file name string.java.io.IOException - If an I/O error occursSMBException - If an SMB error occurspublic final void DeleteDirectory(java.lang.String dir)
throws java.io.IOException,
SMBException
DeleteDirectory in class DiskSessiondir - Directory name string. If the directory name does not have a leading '\' the
current working directory for this session will be preprended to the string.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final void DeleteFile(java.lang.String fname,
int attr)
throws java.io.IOException,
SMBException
DeleteFile in class DiskSessionfname - File name of the remote file to delete. If the file name does not have a leading
'\' the current working directory for this session will be prepended to the
string.attr - File attributes of the file(s) to delete.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final DiskInfo getDiskInformation() throws java.io.IOException, SMBException
getDiskInformation in class DiskSessionjava.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final FileInfo getFileInformation(java.lang.String fname, int level) throws java.io.IOException, java.io.FileNotFoundException, SMBException
getFileInformation in class DiskSessionfname - File name of the file to return information for.level - Information level requiredjava.io.IOException - If an I/O error occurs.java.io.FileNotFoundException - If the remote file does not exist.SMBException - If an SMB level error occursFileInfoLevelpublic final VolumeInfo getVolumeInformation() throws java.io.IOException, SMBException
getVolumeInformation in class DiskSessionjava.io.IOException - If an I/O error occursSMBException - If an SMB level error occursjava.io.FileNotFoundException - If the remote file does not exist.public final boolean isDirectory(java.lang.String dir)
throws java.io.IOException,
SMBException
isDirectory in class DiskSessiondir - Directory name string. If the directory name does not have a leading '\' the
current working directory for this session will be preprended to the string.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final SMBFile OpenFile(java.lang.String fname, int flags) throws java.io.IOException, SMBException
OpenFile in class DiskSessionfname - Remote file name string.flags - File open option flags.java.io.IOException - If an I/O error occursSMBException - If an SMB level error occurspublic final boolean RenameFile(java.lang.String curnam,
java.lang.String newnam,
int attr)
throws java.io.IOException,
SMBException
RenameFile in class DiskSessioncurnam - Current file name string, may contain wildcards. If the path does not start
with a '\' the current working directory string will be preprended.newnam - New file name.attr - Search attributes, to determine which file(s) to rename.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occursFileAttributepublic final void setFileInformation(java.lang.String fname,
FileInfo finfo)
throws java.io.IOException,
SMBException
setFileInformation in class DiskSessionfname - File name of the file to set information for.finfo - File information containing the new values.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final void setFileInformation(SMBFile file, FileInfo finfo) throws java.io.IOException, SMBException
setFileInformation in class DiskSessionfile - File to set information for.finfo - File information containing the new values.java.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occurspublic final void setFileAttributes(java.lang.String fname,
int attrib)
throws java.io.IOException,
SMBException
setFileAttributes in class DiskSessionfname - File name of the file to set information for.attrib - File attributes maskjava.io.IOException - If an I/O error occurs.SMBException - If an SMB level error occursFileAttributepublic final SearchContext StartSearch(java.lang.String dir, int attr, int level) throws java.io.IOException, SMBException
StartSearch in class DiskSessiondir - Directory to start searching. If the directory string does not start with a '\'
then the directory name is prepended with the current working directory.attr - Search attributes, to determine the types of files/directories returned. @see
org.alfresco.jlan.server.filesys.FileAttributelevel - Information level requiredjava.io.IOException - If an I/O error occursSMBException - If an SMB level error occurspublic final CIFSFile NTCreate(java.lang.String name, int access, int attrib, int sharing, int exists, long initSize, int createOpt) throws java.io.IOException, SMBException
name - File/directory nameaccess - Desired access mode.attrib - Required file attributes.sharing - Shared access modeexists - Action to take if file/directory exists.initSize - Initial file allocation size, in bytescreateOpt - Create file optionsjava.io.IOExceptionSMBException - If an SMB level error occursAccessMode,
FileAttribute,
FileActionpublic final CIFSFile NTCreateWithOplock(java.lang.String name, int oplockFlags, OplockInterface oplockIface, int access, int attrib, int sharing, int exists, long initSize, int createOpt) throws java.io.IOException, SMBException
name - File/directory nameoplockFlags - intaccess - Desired access mode.attrib - Required file attributes.sharing - Shared access modeexists - Action to take if file/directory exists.initSize - Initial file allocation size, in bytescreateOpt - Create file optionsjava.io.IOExceptionSMBException - If an SMB level error occursAccessMode,
FileAttribute,
FileActionpublic final SecurityDescriptor NTQuerySecurityDescriptor(int fid, int flags) throws java.io.IOException, SMBException
fid - File identifier, via SMBFile.getFileId() of an open file.flags - Security descriptor elements to return (Owner, Group, SACL, DACL).java.io.IOExceptionSMBException - If an SMB level error occursSecurityDescriptorpublic final void NTSetSecurityDescriptor(int fid,
SecurityDescriptor secdesc,
int flags)
throws java.io.IOException,
SMBException,
SaveException
fid - File identifier, via SMBFile.getFileId() of an open file.secdesc - Security descriptorflags - Fields to set (Owner, Group, SACL, DACL).java.io.IOException - If a network error occursSMBException - If an SMB level error occursSaveException - If the security descriptor cannot be storedSecurityDescriptorpublic final AsynchRequest NTNotifyChange(int fid, int filter, boolean watchTree, DirectoryWatcher handler, boolean autoResub) throws java.io.IOException, SMBException
fid - File id, from SMBFile.getFileId() of an open directory. The directory should be
opened using the NTCreate() method.filter - Directory watch filter flags. @see org.alfresco.jlan.client.nt.NotifyChange.watchTree - true to watch sub-directories, false to watch the specified directory onlyhandler - DirectoryWatcher implementation. @see
org.alfresco.jlan.client.smb.DirectoryWatcherautoResub - true to automatically resubmit the notification filter after an event is
receivedjava.io.IOExceptionSMBException - If an SMB level error occurspublic final AsynchRequest NTNotifyChange(AsynchRequest areq) throws java.io.IOException, SMBException
areq - AsynchRequestjava.io.IOExceptionSMBException - If an SMB level error occurspublic final void NTCancel(AsynchRequest areq) throws java.io.IOException, SMBException
req - AsynchRequestjava.io.IOExceptionSMBException - If an SMB level error occurspublic final DataBuffer NTIOCtl(int ctrlCode, int fid, boolean fsctl, byte[] data, int dlen, int filter) throws java.io.IOException, SMBException
ctrlCode - intfid - intfsctl - booleandata - byte[]dlen - intfilter - intjava.io.IOExceptionSMBException - If an SMB level error occurspublic final FileInfo NTGetFileInformation(int fid, int level) throws java.io.IOException, SMBException
fid - File id for the file or directory, from SMBFile.getFileId().level - Information level. @see org.alfresco.jlan.smb.FileInfoLeveljava.io.IOExceptionSMBException - If an SMB level error occurspublic final TransactBuffer NTGetFileInformationRaw(int fid, int level) throws java.io.IOException, SMBException
fid - File id for the file or directory, from SMBFile.getFileId().level - Information level. @see org.alfresco.jlan.smb.FileInfoLeveljava.io.IOExceptionSMBException - If an SMB level error occurspublic final void NTSetFileInformation(FileInfo finfo, int level) throws java.io.IOException, SMBException
finfo - FileInfolevel - Information level. @see org.alfresco.jlan.smb.FileInfoLeveljava.io.IOExceptionSMBException - If an SMB level error occurspublic final void NTSetDeleteOnClose(int fid,
boolean delFlag)
throws java.io.IOException,
SMBException
fid - File id for the file or directory, from SMBFile.getFileId().delFlag - true to delete the file on close, or false to clear a previous delete on close
requestjava.io.IOExceptionSMBException - If an SMB level error occurspublic final void NTSetEndOfFile(int fid,
long pos)
throws java.io.IOException,
SMBException
fid - File id for the file or directory, from SMBFile.getFileId().pos - New end of file positionjava.io.IOExceptionSMBException - If an SMB level error occurspublic final void NTSetFileAllocation(int fid,
long alloc)
throws java.io.IOException,
SMBException
fid - File id for the file or directory, from SMBFile.getFileId().alloc - New file allocation sizejava.io.IOExceptionSMBException - If an SMB level error occurspublic final DeviceInfo NTGetDeviceInfo() throws java.io.IOException, SMBException
java.io.IOExceptionSMBExceptionpublic final DeviceAttributesInfo NTGetDeviceAttributes() throws java.io.IOException, SMBException
java.io.IOExceptionSMBExceptionpublic final TransactBuffer getFileInformationRaw(java.lang.String fname, int level) throws java.io.IOException, java.io.FileNotFoundException, SMBException
fname - File name of the file to return information for.level - Information level required. @see org.alfresco.jlan.smb.FileInfoLeveljava.io.IOException - If an I/O error occurs.java.io.FileNotFoundException - If the remote file does not exist.SMBException - If an SMB level error occurspublic final SymLink getSymLinkDetails(java.lang.String linkPath) throws java.lang.Exception
linkPath - Stringjava.lang.Exceptionpublic final void checkForAsynchReceive(int waitTime)
throws java.io.IOException,
SMBException
waitTime - Receive timeout in milliseconds, zero for no timeout or -1 to not wait for
datajava.io.IOExceptionSMBExceptionpublic void refreshFileInformation(SMBFile smbFile) throws java.io.IOException, SMBException
smbFile - SMBFilejava.io.IOExceptionSMBExceptionprotected void processAsynchResponse(SMBPacket pkt)
processAsynchResponse in class Sessionpkt - SMBPacketprotected final void addAsynchronousRequest(AsynchRequest req)
req - AsynchRequestprotected final AsynchRequest removeAsynchronousRequest(int id)
id - intprotected final AsynchRequest removeAsynchronousRequest(AsynchRequest req)
req - AsynchRequestprotected final CIFSFile NTCreateInternal(java.lang.String name, int createFlags, int access, int attrib, int sharing, int exists, long initSize, int createOpt, boolean throwErr) throws java.io.IOException, SMBException
name - File/directory namecreateFlags - intaccess - Desired access mode.attrib - Required file attributes.sharing - Shared access modeexists - Action to take if file/directory exists.initSize - Initial file allocation size, in bytescreateOpt - Create file optionsthrowErr - Throw errors from the CIFS packet exchangejava.io.IOExceptionSMBException - If an SMB level error occursAccessMode,
FileAttribute,
FileActionprotected final void fileClosed(CIFSFile cifsFile)
cifsFile - CIFSFileCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.