public static final class CmsLockUtil.LockedFile extends java.lang.Object implements java.lang.AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.String |
getEncoding()
Returns the encoding used for the file.
|
CmsFile |
getFile()
Returns the file, or null if reading fails.
|
CmsLockActionRecord |
getLockActionRecord()
Returns the lock action record.
|
boolean |
isCreated()
Returns a flag, indicating if the file is newly created.
|
static CmsLockUtil.LockedFile |
lockResource(CmsObject cms,
CmsResource resource)
Lock and read a file.
|
void |
setCreated(boolean isNew)
Set the flag, indicating if the file was newly created.
|
boolean |
tryUnlock()
Unlocks the resource if it was not formerly locked.
|
public static CmsLockUtil.LockedFile lockResource(CmsObject cms, CmsResource resource) throws CmsException
cms
- the cms user context.resource
- the resource to lock and read.CmsException
- thrown if locking failspublic void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
AutoCloseable.close()
public java.lang.String getEncoding()
CmsFileUtil.getEncoding(CmsObject, CmsResource)
public CmsFile getFile()
public CmsLockActionRecord getLockActionRecord()
public boolean isCreated()
public void setCreated(boolean isNew)
isNew
- flag, indicating if the file was newly created.public boolean tryUnlock()
true
in case the resource was unlocked