public abstract class FileState
extends java.lang.Object
implements java.io.Serializable
Caches information about a file/directory so that the core server does not need to make calls to the shared device driver.
Modifier and Type | Field and Description |
---|---|
static long |
DefTimeout |
static long |
DeleteTimeout |
static int |
FILE_AVAILABLE |
static int |
FILE_DELETED |
static int |
FILE_DELETEONCLOSE |
static int |
FILE_LOADING |
static int |
FILE_LOADWAIT |
static int |
FILE_RENAMED |
static int |
FILE_SAVED |
static int |
FILE_SAVEWAIT |
static int |
FILE_SAVING |
static int |
FILE_UPDATED |
static java.lang.String |
FileInformation |
static long |
NoTimeout |
static int |
ReasonFileCreated |
static int |
ReasonFileDeleted |
static int |
ReasonFolderCreated |
static int |
ReasonFolderDeleted |
static int |
ReasonNone |
static long |
RenameTimeout |
static java.lang.String |
StreamsList |
static int |
UnknownFileId |
Constructor and Description |
---|
FileState()
Default constructor
|
FileState(java.lang.String fname,
boolean caseSensitive)
Class constructor
|
FileState(java.lang.String fname,
int status,
boolean caseSensitive)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String name,
java.lang.Object attr)
Add an attribute to the file state
|
void |
addLock(FileLock lock)
Add a lock to this file
|
void |
addPseudoFile(PseudoFile pfile)
Add a pseudo file to this folder
|
boolean |
allowsOpen(FileOpenParams params)
Check if the file can be opened depending on any current file opens and the sharing mode of the
first file open
|
boolean |
canReadFile(long offset,
long len,
int pid)
Check if the file is readable for the specified section of the file and process id
|
boolean |
canWriteFile(long offset,
long len,
int pid)
Check if the file is writeable for the specified section of the file and process id
|
void |
clearOpLock()
Clear the oplock
|
int |
decrementOpenCount()
Decrement the file open count
|
void |
DumpAttributes()
Dump the attributes that are attached to the file state
|
boolean |
exists()
Determine if the file/folder exists
|
boolean |
fileExists()
Return the file exists state
|
java.lang.Object |
findAttribute(java.lang.String name)
Find an attribute
|
long |
getAccessDateTime()
Return the access date/time
|
long |
getAllocationSize()
Return the allocation size
|
protected abstract java.util.HashMap |
getAttributeMap(boolean createMap)
Return the map of additional attribute objects attached to this file state, and
optionally create the map if it does not exist
|
long |
getChangeDateTime()
Return the change date/time
|
static java.lang.String |
getChangeReasonString(int reason)
Return file status change reason code as a string
|
abstract int |
getDataStatus()
Return the file data status
|
abstract int |
getFileId()
Get the file id
|
long |
getFileSize()
Return the file size
|
int |
getFileStatus()
Return the file status
|
abstract java.lang.Object |
getFilesystemObject()
Return the filesystem object
|
FileLockList |
getLockList()
Return the active file locks list
|
long |
getModifyDateTime()
Return the modify date/time
|
int |
getOpenCount()
Return the file open count
|
OpLockDetails |
getOpLock()
Return the oplock details
|
java.lang.String |
getPath()
Return the file name/path
|
int |
getProcessId()
Return the PID of the first process to open the file, or -1 if the file is not open
|
PseudoFileList |
getPseudoFileList()
Return the pseudo file list
|
protected abstract PseudoFileList |
getPseudoFileList(boolean createList)
Return the pseudo file list, optionally create a new list
|
long |
getRetentionExpiryDateTime()
Get the retention period expiry date/time for the file/folder
|
long |
getSecondsToExpire(long curTime)
Return the number of seconds left before the file state expires
|
int |
getSharedAccess()
Return the shared access mode
|
java.lang.String |
getStatusAsString()
Return a file status code as a string
|
boolean |
hasAccessDateTime()
Check if the access date/time has been set
|
boolean |
hasActiveLocks()
Check if there are active locks on this file
|
boolean |
hasActiveRetentionPeriod()
Check if the file/folder is under retention
|
boolean |
hasAllocationSize()
Check if the allocation size has been set
|
boolean |
hasChangeDateTime()
Check if the change date/time has been set
|
boolean |
hasDataUpdateInProgress()
Check if there is a data update in progress for this file
|
boolean |
hasExpired(long curTime)
Check if the file state has expired
|
boolean |
hasFileSize()
Check if the allocation size has been set
|
boolean |
hasFilesystemObject()
Check if there is a filesystem object
|
boolean |
hasModifyDateTime()
Check if the modification date/time has been set
|
boolean |
hasOpLock()
Check if the file has an active oplock
|
boolean |
hasPseudoFiles()
Determine if a folder has pseudo files associated with it
|
int |
incrementOpenCount()
Increment the file open count
|
abstract boolean |
isCopyState()
Check if this is a copy file state, or the master file state object
|
boolean |
isDirectory()
Return the directory state
|
boolean |
isPermanentState()
Check if this file state does not expire
|
static java.lang.String |
normalizePath(java.lang.String path)
Normalize the path to uppercase the directory names and keep the case of the file name.
|
static java.lang.String |
normalizePath(java.lang.String path,
boolean caseSensitive)
Normalize the path to uppercase the directory names and keep the case of the file name.
|
int |
numberOfAttributes()
Return the count of attributes on this file state
|
int |
numberOfLocks()
Return the count of active locks on this file
|
void |
removeAllAttributes()
Remove all attributes from the file state
|
java.lang.Object |
removeAttribute(java.lang.String name)
Remove an attribute from the file state
|
void |
removeLock(FileLock lock)
Remove a lock on this file
|
void |
setAllocationSize(long allocSize)
Set the allocation size
|
abstract void |
setDataStatus(int sts)
Set the file data status
|
void |
setExpiryTime(long expire)
Set the file state expiry time
|
abstract void |
setFileId(int id)
Set the file identifier
|
void |
setFileSize(long fileSize)
Set the file size
|
void |
setFileStatus(int status)
Set the file status
|
void |
setFileStatus(int status,
int reason)
Set the file status
|
abstract void |
setFilesystemObject(java.lang.Object filesysObj)
Set the filesystem object
|
void |
setOpenCount(int count)
Set the file open count
|
void |
setOpLock(OpLockDetails oplock)
Set the oplock for this file
|
void |
setPath(java.lang.String path,
boolean caseSensitive)
Set the file path
|
void |
setPathInternal(java.lang.String path)
Set the file path, using a normalized path, no need to normalize
|
void |
setProcessId(int pid)
Set the PID of the process opening the file
|
void |
setRetentionExpiryDateTime(long expires)
Set the retention period expiry date/time
|
void |
setSharedAccess(int mode)
Set the shared access mode, from the first file open
|
java.lang.String |
toString()
Return the file state as a string
|
void |
updateAccessDateTime()
Update the access date/time
|
void |
updateChangeDateTime()
Update the change date/time
|
void |
updateChangeDateTime(long changeTime)
Update the change date/time
|
void |
updateModifyDateTime()
Update the modify date/time
|
void |
updateModifyDateTime(long modTime)
Update the modify date/time
|
protected static java.lang.String |
upperCaseAToZ(java.lang.String path)
Uppercase a-z characters only, leave any multi-national characters as is
|
public static final long NoTimeout
public static final long DefTimeout
public static final long RenameTimeout
public static final long DeleteTimeout
public static final int UnknownFileId
public static final int FILE_LOADWAIT
public static final int FILE_LOADING
public static final int FILE_AVAILABLE
public static final int FILE_UPDATED
public static final int FILE_SAVEWAIT
public static final int FILE_SAVING
public static final int FILE_SAVED
public static final int FILE_DELETED
public static final int FILE_RENAMED
public static final int FILE_DELETEONCLOSE
public static final java.lang.String FileInformation
public static final java.lang.String StreamsList
public static final int ReasonNone
public static final int ReasonFileCreated
public static final int ReasonFolderCreated
public static final int ReasonFileDeleted
public static final int ReasonFolderDeleted
public FileState()
public FileState(java.lang.String fname, boolean caseSensitive)
fname
- StringcaseSensitive
- booleanpublic FileState(java.lang.String fname, int status, boolean caseSensitive)
fname
- Stringstatus
- intcaseSensitive
- booleanpublic final java.lang.String getPath()
public final boolean fileExists()
public final int getFileStatus()
public final boolean isDirectory()
public int getOpenCount()
public abstract int getFileId()
public final int getSharedAccess()
public final int getProcessId()
public abstract int getDataStatus()
public final boolean hasActiveLocks()
public final FileLockList getLockList()
public final boolean isPermanentState()
public final boolean hasActiveRetentionPeriod()
public final long getRetentionExpiryDateTime()
public final boolean exists()
public final boolean allowsOpen(FileOpenParams params)
params
- FileOpenParamspublic int incrementOpenCount()
public int decrementOpenCount()
public final boolean hasExpired(long curTime)
curTime
- longpublic final long getSecondsToExpire(long curTime)
curTime
- longpublic final java.lang.String getStatusAsString()
public void setFileStatus(int status)
status
- intpublic void setFileStatus(int status, int reason)
status
- intreason
- intpublic abstract void setFileId(int id)
id
- intpublic void setExpiryTime(long expire)
expire
- longpublic void setRetentionExpiryDateTime(long expires)
expires
- longpublic void setSharedAccess(int mode)
mode
- intpublic abstract void setDataStatus(int sts)
sts
- intpublic final void addAttribute(java.lang.String name, java.lang.Object attr)
name
- Stringattr
- Objectpublic final java.lang.Object findAttribute(java.lang.String name)
name
- Stringpublic final int numberOfAttributes()
public final java.lang.Object removeAttribute(java.lang.String name)
name
- Stringpublic final void removeAllAttributes()
protected abstract java.util.HashMap getAttributeMap(boolean createMap)
createMap
- booleanpublic final void setPath(java.lang.String path, boolean caseSensitive)
path
- StringcaseSensitive
- booleanpublic final void setPathInternal(java.lang.String path)
path
- Stringpublic void setProcessId(int pid)
pid
- intpublic final int numberOfLocks()
public void addLock(FileLock lock) throws LockConflictException
lock
- FileLockLockConflictException
public void removeLock(FileLock lock) throws NotLockedException
lock
- FileLockNotLockedException
public boolean canReadFile(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic boolean canWriteFile(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic boolean hasOpLock()
public OpLockDetails getOpLock()
public void setOpLock(OpLockDetails oplock) throws ExistingOpLockException
oplock
- OpLockDetailsExistingOpLockException
- If there is an active oplock on this filepublic void clearOpLock()
public boolean hasPseudoFiles()
public PseudoFileList getPseudoFileList()
protected abstract PseudoFileList getPseudoFileList(boolean createList)
createList
- booleanpublic final void addPseudoFile(PseudoFile pfile)
pfile
- PseudoFilepublic final boolean hasAccessDateTime()
public final long getAccessDateTime()
public void updateAccessDateTime()
public final boolean hasChangeDateTime()
public final long getChangeDateTime()
public void updateChangeDateTime()
public void updateChangeDateTime(long changeTime)
changeTime
- longpublic final boolean hasModifyDateTime()
public final long getModifyDateTime()
public void updateModifyDateTime()
public void updateModifyDateTime(long modTime)
modTime
- longpublic final boolean hasFilesystemObject()
public abstract java.lang.Object getFilesystemObject()
public abstract void setFilesystemObject(java.lang.Object filesysObj)
filesysObj
- Objectpublic abstract boolean isCopyState()
public final boolean hasFileSize()
public final long getFileSize()
public void setFileSize(long fileSize)
fileSize
- longpublic final boolean hasAllocationSize()
public final long getAllocationSize()
public void setAllocationSize(long allocSize)
allocSize
- longpublic void setOpenCount(int count)
count
- intpublic boolean hasDataUpdateInProgress()
public static final java.lang.String normalizePath(java.lang.String path)
path
- Stringpublic static final java.lang.String normalizePath(java.lang.String path, boolean caseSensitive)
path
- StringcaseSensitive
- booleanprotected static final java.lang.String upperCaseAToZ(java.lang.String path)
path
- Stringpublic final void DumpAttributes()
public static final java.lang.String getChangeReasonString(int reason)
reason
- intpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.