public abstract class FileStateCache extends Object
Base class for file state cache implementations.
Modifier and Type | Field and Description |
---|---|
protected static long |
DefaultExpireCheckInterval |
protected static long |
DefaultFileStateExpireInterval |
protected static long |
MinimumExpireCheckInterval |
protected static long |
MinimumFileStateExpireInterval |
Constructor and Description |
---|
FileStateCache()
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLock(FileState fstate,
FileLock lock)
Add a lock to this file
|
boolean |
addOpLock(FileState fstate,
OpLockDetails oplock,
NetworkFile netFile)
Add an oplock
|
void |
addStateCacheListener(FileStateCacheListener l)
Add a file state cache listener
|
void |
addStateListener(FileStateListener l)
Add a file state listener
|
void |
changeOpLockType(OpLockDetails oplock,
int newTyp)
Change an oplock type
|
void |
clearOpLock(FileState fstate)
Clear an oplock
|
FileLock |
createFileLockObject(NetworkFile file,
long offset,
long len,
int pid)
Create a lock object, use the standard FileLock object.
|
abstract void |
dumpCache(boolean dumpAttribs)
Dump the state cache entries to the debug device
|
abstract FileState |
findFileState(String path)
Find the file state for the specified path
|
abstract FileState |
findFileState(String path,
boolean create)
Find the file state for the specified path, and optionally create a new file state if not
found
|
abstract FileState |
findFileState(String path,
boolean create,
int status)
Find the file state for the specified path, and optionally create a new file state if not
found with the specified initial status
|
long |
getCheckInterval()
Return the expired file state checker interval, in milliseconds
|
long |
getFileStateExpireInterval()
Get the file state cache timer, in milliseconds
|
FileStateProxy |
getFileStateProxy(FileState fstate)
Return a file state proxy for the specified file state
|
OpLockDetails |
getOpLock(FileState fstate)
Return the oplock details for a file, or null if there is no oplock
|
protected FileStateCacheListener |
getStateCacheListener()
Return the file state cache listener
|
protected FileStateListener |
getStateListener()
Return the file state listener
|
FileAccessToken |
grantFileAccess(FileOpenParams params,
FileState fstate,
int fileSts)
Grant the required file access
|
boolean |
hasActiveLocks(FileState fstate)
Check if there are active locks on this file
|
boolean |
hasDebug()
Determine if debug output is enabled
|
boolean |
hasDebugExpiredStates()
Determine if additional expired file state debugging is enabled
|
boolean |
hasDumpOnShutdown()
Determine if the state cache entries should be dumped out during shutdown
|
boolean |
hasStateCacheListener()
Check if the file state cache listener has been set
|
boolean |
hasStateListener()
Check if the file state listener has been set
|
void |
initializeCache(org.springframework.extensions.config.ConfigElement config,
ServerConfiguration srvConfig)
Initialize the file state cache
|
boolean |
isCaseSensitive()
Determine if the cache is using case sensitive file names
|
boolean |
isClusteredCache()
Determine if the cache is a clustered cache
|
abstract int |
numberOfStates()
Return the number of states in the cache
|
int |
releaseFileAccess(FileState fstate,
FileAccessToken token)
Release access to a file
|
abstract void |
removeAllFileStates()
Remove all file states from the cache
|
abstract int |
removeExpiredFileStates()
Remove expired file states from the cache
|
abstract FileState |
removeFileState(String path)
Remove the file state for the specified path
|
void |
removeLock(FileState fstate,
FileLock lock)
Remove a lock on this file
|
void |
removeStateCacheListener(FileStateCacheListener l)
Remove a file state cache listener
|
void |
removeStateListener(FileStateListener l)
Remove a file state listener
|
abstract void |
renameFileState(String newPath,
FileState state,
boolean isDir)
Rename a file state, remove the existing entry, update the path and add the state back into
the cache using the new path.
|
void |
requestOplockBreak(String path,
OpLockDetails oplock,
SMBSrvSession sess,
SMBSrvPacket pkt)
Request an oplock break
|
void |
setCaseSensitive(boolean caseSensitive)
Enable/disable case sensitive file names
|
void |
setCheckInterval(long chkIntval)
Set the expired file state checker interval, in milliseconds
|
void |
setDataUpdateCompleted(FileState fstate)
Indicate that a data update has completed for the specified file
|
void |
setDataUpdateInProgress(FileState fstate)
Indicate a data update is in progress for the specified file
|
void |
setDebug(boolean dbg)
Enable/disable debug output
|
void |
setDebugExpiredStates(boolean dbg)
Enable/disable additional debug output for expired file states
|
void |
setDriverDetails(DiskSharedDevice diskDev)
Set the filesystem driver and driver context details, if required by the cache
|
void |
setDumpOnShutdown(boolean dumpOnShut)
Enable/disable dumping of the state cache entries during shutdown
|
void |
setFileStateExpireInterval(long tmo)
Set the default file state cache timer, in milliseconds
|
void |
stateCacheShuttingDown()
Cache shutting down
|
void |
stateCacheStarted()
Cache started
|
protected static final long DefaultExpireCheckInterval
protected static final long MinimumExpireCheckInterval
protected static final long DefaultFileStateExpireInterval
protected static final long MinimumFileStateExpireInterval
public final long getCheckInterval()
public final long getFileStateExpireInterval()
public final boolean isCaseSensitive()
public boolean isClusteredCache()
public final void setFileStateExpireInterval(long tmo)
tmo
- longpublic final void setCheckInterval(long chkIntval)
chkIntval
- longpublic final void setCaseSensitive(boolean caseSensitive)
caseSensitive
- booleanpublic final boolean hasDebug()
public final boolean hasDebugExpiredStates()
public final boolean hasDumpOnShutdown()
public final void setDebug(boolean dbg)
dbg
- booleanpublic final void setDebugExpiredStates(boolean dbg)
dbg
- booleanpublic final void setDumpOnShutdown(boolean dumpOnShut)
dumpOnShut
- booleanpublic final void addStateListener(FileStateListener l)
l
- FileStateListenerpublic final void removeStateListener(FileStateListener l)
l
- FileStateListenerpublic final boolean hasStateListener()
protected final FileStateListener getStateListener()
public final void addStateCacheListener(FileStateCacheListener l)
l
- FileStateCacheListenerpublic final void removeStateCacheListener(FileStateCacheListener l)
l
- FileStateCacheListenerpublic final boolean hasStateCacheListener()
protected final FileStateCacheListener getStateCacheListener()
public abstract int numberOfStates()
public FileStateProxy getFileStateProxy(FileState fstate)
fstate
- FileStatepublic abstract FileState findFileState(String path)
path
- Stringpublic abstract FileState findFileState(String path, boolean create)
path
- Stringcreate
- booleanpublic abstract FileState findFileState(String path, boolean create, int status)
path
- Stringcreate
- booleanstatus
- intpublic abstract FileState removeFileState(String path)
path
- Stringpublic abstract void renameFileState(String newPath, FileState state, boolean isDir)
newPath
- Stringstate
- FileStateisDir
- booleanpublic abstract void removeAllFileStates()
public abstract int removeExpiredFileStates()
public abstract void dumpCache(boolean dumpAttribs)
dumpAttribs
- booleanpublic OpLockDetails getOpLock(FileState fstate)
fstate
- FileStatepublic boolean addOpLock(FileState fstate, OpLockDetails oplock, NetworkFile netFile) throws ExistingOpLockException
fstate
- FileStateoplock
- OpLockDetailsnetFile
- NetworkFileExistingOpLockException
public void clearOpLock(FileState fstate)
fstate
- FileStatepublic void requestOplockBreak(String path, OpLockDetails oplock, SMBSrvSession sess, SMBSrvPacket pkt) throws IOException, DeferFailedException
path
- Stringoplock
- OpLockDetailssess
- SMBSrvSessionpkt
- SMBSrvPacketIOException
DeferFailedException
public void changeOpLockType(OpLockDetails oplock, int newTyp)
oplock
- OpLockDetailsnewTyp
- intpublic FileLock createFileLockObject(NetworkFile file, long offset, long len, int pid)
file
- NetworkFileoffset
- longlen
- longpid
- intpublic boolean hasActiveLocks(FileState fstate)
fstate
- FileStatepublic void addLock(FileState fstate, FileLock lock) throws LockConflictException
fstate
- FileStatelock
- FileLockLockConflictException
public void removeLock(FileState fstate, FileLock lock) throws NotLockedException
fstate
- FileStatelock
- FileLockNotLockedException
public void initializeCache(org.springframework.extensions.config.ConfigElement config, ServerConfiguration srvConfig) throws InvalidConfigurationException
config
- ConfigElementsrvConfig
- ServerConfiguration - not usedInvalidConfigurationException
public void setDriverDetails(DiskSharedDevice diskDev)
diskDev
- DiskSharedDevicepublic void stateCacheStarted()
public void stateCacheShuttingDown()
public FileAccessToken grantFileAccess(FileOpenParams params, FileState fstate, int fileSts) throws FileSharingException, AccessDeniedException, FileExistsException
params
- FileOpenParamsfstate
- FileStatefileSts
- intFileSharingException
AccessDeniedException
FileExistsException
public int releaseFileAccess(FileState fstate, FileAccessToken token)
fstate
- FileStatetoken
- FileAccessTokenpublic void setDataUpdateInProgress(FileState fstate)
fstate
- FileStatepublic void setDataUpdateCompleted(FileState fstate)
fstate
- FileStateCopyright © 2005–2018 Alfresco Software. All rights reserved.