public final class CmsLockUtil extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CmsLockUtil.LockedFile
Helper to handle the lock reports together with the files.
|
Modifier and Type | Method and Description |
---|---|
static CmsLockActionRecord |
ensureLock(CmsObject cms,
CmsResource resource)
Static helper method to lock a resource.
|
static java.io.Closeable |
withLockedResources(CmsObject cms,
CmsResource... resources)
Utility method for locking and unlocking a set of resources conveniently with the try-with syntax
from Java 1.7.
|
public static CmsLockActionRecord ensureLock(CmsObject cms, CmsResource resource) throws CmsException
cms
- the CMS context to useresource
- the resource to lockCmsException
- if something goes wrongpublic static java.io.Closeable withLockedResources(CmsObject cms, CmsResource... resources) throws java.lang.Exception
This method locks a set of resources and returns a Closeable instance that will unlock the locked resources when its close() method is called.
cms
- the CMS contextresources
- the resources to lockjava.lang.Exception
- if something goes wrong