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, WriteTime
Closed, 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(String dir)
Create a new directory on the remote file server.
|
SMBFile |
CreateFile(String fname)
Create and open a file on the remote file server.
|
void |
DeleteDirectory(String dir)
Delete the specified directory on the remote file server.
|
void |
DeleteFile(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(String fname,
int level)
Get file information for the specified file.
|
TransactBuffer |
getFileInformationRaw(String fname,
int level)
Get file information for the specified file.
|
SymLink |
getSymLinkDetails(String linkPath)
Return the details for a symlink file/folder
|
VolumeInfo |
getVolumeInformation()
Get the disk volume information
|
boolean |
isDirectory(String dir)
Check if the specified file name is a directory.
|
void |
NTCancel(AsynchRequest areq)
Cancel an outstanding request.
|
CIFSFile |
NTCreate(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(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(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(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(String curnam,
String newnam,
int attr)
Rename a file, or set of files, on the remote file server.
|
void |
setFileAttributes(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(String fname,
FileInfo finfo)
Set file information for the specified file.
|
SearchContext |
StartSearch(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, StartSearch
allocatePacket, 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, verifyRxPacket
protected CIFSDiskSession(PCShare shr, int dialect)
shr
- Remote server details.dialect
- SMB dialect that this session is usingpublic void CloseSession() throws IOException, SMBException
CloseSession
in class DiskSession
IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final void CreateDirectory(String dir) throws IOException, SMBException
CreateDirectory
in class DiskSession
dir
- 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.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final SMBFile CreateFile(String fname) throws IOException, SMBException
CreateFile
in class DiskSession
fname
- Remote file name string.IOException
- If an I/O error occursSMBException
- If an SMB error occurspublic final void DeleteDirectory(String dir) throws IOException, SMBException
DeleteDirectory
in class DiskSession
dir
- 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.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final void DeleteFile(String fname, int attr) throws IOException, SMBException
DeleteFile
in class DiskSession
fname
- 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.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final DiskInfo getDiskInformation() throws IOException, SMBException
getDiskInformation
in class DiskSession
IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final FileInfo getFileInformation(String fname, int level) throws IOException, FileNotFoundException, SMBException
getFileInformation
in class DiskSession
fname
- File name of the file to return information for.level
- Information level requiredIOException
- If an I/O error occurs.FileNotFoundException
- If the remote file does not exist.SMBException
- If an SMB level error occursFileInfoLevel
public final VolumeInfo getVolumeInformation() throws IOException, SMBException
getVolumeInformation
in class DiskSession
IOException
- If an I/O error occursSMBException
- If an SMB level error occursFileNotFoundException
- If the remote file does not exist.public final boolean isDirectory(String dir) throws IOException, SMBException
isDirectory
in class DiskSession
dir
- 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.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final SMBFile OpenFile(String fname, int flags) throws IOException, SMBException
OpenFile
in class DiskSession
fname
- Remote file name string.flags
- File open option flags.IOException
- If an I/O error occursSMBException
- If an SMB level error occurspublic final boolean RenameFile(String curnam, String newnam, int attr) throws IOException, SMBException
RenameFile
in class DiskSession
curnam
- 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.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occursFileAttribute
public final void setFileInformation(String fname, FileInfo finfo) throws IOException, SMBException
setFileInformation
in class DiskSession
fname
- File name of the file to set information for.finfo
- File information containing the new values.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final void setFileInformation(SMBFile file, FileInfo finfo) throws IOException, SMBException
setFileInformation
in class DiskSession
file
- File to set information for.finfo
- File information containing the new values.IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final void setFileAttributes(String fname, int attrib) throws IOException, SMBException
setFileAttributes
in class DiskSession
fname
- File name of the file to set information for.attrib
- File attributes maskIOException
- If an I/O error occurs.SMBException
- If an SMB level error occursFileAttribute
public final SearchContext StartSearch(String dir, int attr, int level) throws IOException, SMBException
StartSearch
in class DiskSession
dir
- 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 requiredIOException
- If an I/O error occursSMBException
- If an SMB level error occurspublic final CIFSFile NTCreate(String name, int access, int attrib, int sharing, int exists, long initSize, int createOpt) throws 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 optionsIOException
SMBException
- If an SMB level error occursAccessMode
,
FileAttribute
,
FileAction
public final CIFSFile NTCreateWithOplock(String name, int oplockFlags, OplockInterface oplockIface, int access, int attrib, int sharing, int exists, long initSize, int createOpt) throws 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 optionsIOException
SMBException
- If an SMB level error occursAccessMode
,
FileAttribute
,
FileAction
public final SecurityDescriptor NTQuerySecurityDescriptor(int fid, int flags) throws IOException, SMBException
fid
- File identifier, via SMBFile.getFileId() of an open file.flags
- Security descriptor elements to return (Owner, Group, SACL, DACL).IOException
SMBException
- If an SMB level error occursSecurityDescriptor
public final void NTSetSecurityDescriptor(int fid, SecurityDescriptor secdesc, int flags) throws IOException, SMBException, SaveException
fid
- File identifier, via SMBFile.getFileId() of an open file.secdesc
- Security descriptorflags
- Fields to set (Owner, Group, SACL, DACL).IOException
- If a network error occursSMBException
- If an SMB level error occursSaveException
- If the security descriptor cannot be storedSecurityDescriptor
public final AsynchRequest NTNotifyChange(int fid, int filter, boolean watchTree, DirectoryWatcher handler, boolean autoResub) throws 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
receivedIOException
SMBException
- If an SMB level error occurspublic final AsynchRequest NTNotifyChange(AsynchRequest areq) throws IOException, SMBException
areq
- AsynchRequestIOException
SMBException
- If an SMB level error occurspublic final void NTCancel(AsynchRequest areq) throws IOException, SMBException
areq
- AsynchRequestIOException
SMBException
- If an SMB level error occurspublic final DataBuffer NTIOCtl(int ctrlCode, int fid, boolean fsctl, byte[] data, int dlen, int filter) throws IOException, SMBException
ctrlCode
- intfid
- intfsctl
- booleandata
- byte[]dlen
- intfilter
- intIOException
SMBException
- If an SMB level error occurspublic final FileInfo NTGetFileInformation(int fid, int level) throws IOException, SMBException
fid
- File id for the file or directory, from SMBFile.getFileId().level
- Information level. @see org.alfresco.jlan.smb.FileInfoLevelIOException
SMBException
- If an SMB level error occurspublic final TransactBuffer NTGetFileInformationRaw(int fid, int level) throws IOException, SMBException
fid
- File id for the file or directory, from SMBFile.getFileId().level
- Information level. @see org.alfresco.jlan.smb.FileInfoLevelIOException
SMBException
- If an SMB level error occurspublic final void NTSetFileInformation(FileInfo finfo, int level) throws IOException, SMBException
finfo
- FileInfolevel
- Information level. @see org.alfresco.jlan.smb.FileInfoLevelIOException
SMBException
- If an SMB level error occurspublic final void NTSetDeleteOnClose(int fid, boolean delFlag) throws 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
requestIOException
SMBException
- If an SMB level error occurspublic final void NTSetEndOfFile(int fid, long pos) throws IOException, SMBException
fid
- File id for the file or directory, from SMBFile.getFileId().pos
- New end of file positionIOException
SMBException
- If an SMB level error occurspublic final void NTSetFileAllocation(int fid, long alloc) throws IOException, SMBException
fid
- File id for the file or directory, from SMBFile.getFileId().alloc
- New file allocation sizeIOException
SMBException
- If an SMB level error occurspublic final DeviceInfo NTGetDeviceInfo() throws IOException, SMBException
IOException
SMBException
public final DeviceAttributesInfo NTGetDeviceAttributes() throws IOException, SMBException
IOException
SMBException
public final TransactBuffer getFileInformationRaw(String fname, int level) throws IOException, FileNotFoundException, SMBException
fname
- File name of the file to return information for.level
- Information level required. @see org.alfresco.jlan.smb.FileInfoLevelIOException
- If an I/O error occurs.FileNotFoundException
- If the remote file does not exist.SMBException
- If an SMB level error occurspublic final SymLink getSymLinkDetails(String linkPath) throws Exception
linkPath
- StringException
public final void checkForAsynchReceive(int waitTime) throws IOException, SMBException
waitTime
- Receive timeout in milliseconds, zero for no timeout or -1 to not wait for
dataIOException
SMBException
public void refreshFileInformation(SMBFile smbFile) throws IOException, SMBException
smbFile
- SMBFileIOException
SMBException
protected void processAsynchResponse(SMBPacket pkt)
processAsynchResponse
in class Session
pkt
- 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(String name, int createFlags, int access, int attrib, int sharing, int exists, long initSize, int createOpt, boolean throwErr) throws 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 exchangeIOException
SMBException
- If an SMB level error occursAccessMode
,
FileAttribute
,
FileAction
protected final void fileClosed(CIFSFile cifsFile)
cifsFile
- CIFSFileCopyright © 2005–2018 Alfresco Software. All rights reserved.