com.adobe.repository.infomodel.bean
Class Lock

java.lang.Object
  extended by com.adobe.repository.infomodel.bean.Lock
All Implemented Interfaces:
java.io.Serializable

public class Lock
extends java.lang.Object
implements java.io.Serializable

A lock on a specific logical resource. Repository locking is modeled after the WEBDAV locking specification. Locks are either shared or exclusive. Only one exclusive lock may exist on a logical resource at a time, while multiple shared locks may exist on the same logical resource.

See Also:
Serialized Form

Field Summary
static int ATTRIBUTE_DEPTH
          Contains the attribute identifier value which represents the depth.
static int ATTRIBUTE_EXPIRY_DATE
          Contains the attribute identifier value which represents the expiration date.
static int ATTRIBUTE_LOCK_TOKEN
          Contains the attribute identifier value which represents the lock token.
static int ATTRIBUTE_OWNER_ID
          Contains the attribute identifier value which represents the owner.
static int ATTRIBUTE_OWNER_USER_ID
          Contains the attribute identifier value which represents the owner's user identifier.
static int ATTRIBUTE_RESOURCE_ID
          Contains the attribute identifier value which represents Lock instances.
static int ATTRIBUTE_TYPE
          Contains the attribute identifier value which represents the Lock type.
static short DEPTH_INFINITE
          Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection and all members, or immediate children.
static short DEPTH_ONE
          Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection and its internal members, or immediate children.
static short DEPTH_ZERO
          Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection only and none of its internal members, or immediate children.
static int NEVER_EXPIRE
          Constant used to indicate that the lock will never expire.
static int OBJECT_TYPE_LOCK
          Contains the object type value which represents Lock instances.
static short SCOPE_EXCLUSIVE
          Constant used to indicated exclusive lock scope.
static short SCOPE_SHARED
          Constant used to indicated shared lock scope.
 
Constructor Summary
Lock()
          Default constructor.
 
Method Summary
 java.util.Date getCreateTime()
          Retrieves the time at which this lock was first created.
 short getDepth()
          Retrieves the lock's depth.
 long getExpiryDate()
          Retrieves the timestamp at which this lock will expire.
 java.lang.String getLockToken()
          Retrieves this lock's token, which must be supplied during unlockResource() calls, in order to successfully remove this lock.
 long getOid()
          Do not use this method.
 java.lang.String getOwnerId()
          Retrieves the User Manager object identifier of the user who owns this lock.
 java.lang.String getOwnerUserId()
          Retrieves the user identifier of the User Manager principal who owns this lock.
 Id getResourceId()
          Retrieves the identifier of the resource on which this lock exists.
 short getType()
          Retrieves the lock scope.
 java.util.Date getUpdateTime()
          Retrieves the time at which this lock was last modified.
 boolean isProjected(int attribute)
          Determines whether the supplied attribute or composed object is projected.
 void setCreateTime(java.util.Date createTime)
          Sets the time at which this lock was first created.
 void setDepth(short depth)
          Sets the lock depth.
 void setExpiryDate(long expiryDate)
          Sets this lock's expiration date.
 void setLockToken(java.lang.String lockToken)
          Sets this lock's token.
 void setOid(long oid)
          Sets this lock's numerical object identifier.
 void setOwnerId(java.lang.String ownerId)
          Sets the lock's owner.
 void setOwnerUserId(java.lang.String ownerUserId)
          Sets the user identifier of the User Manager principal who owns this lock.
 void setRepositoryLoadProfile(RepositoryLoadProfile loadProfile)
          Sets the Repository load profile for this lock.
 void setResourceId(Id resourceId)
          Sets the identifier of the resource on which this lock exists.
 void setType(short type)
          Sets this lock's scope.
 void setUpdateTime(java.util.Date updateTime)
          Sets the time at which this lock was last modified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPTH_ZERO

public static final short DEPTH_ZERO
Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection only and none of its internal members, or immediate children.

See Also:
Constant Field Values

DEPTH_ONE

public static final short DEPTH_ONE
Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection and its internal members, or immediate children.

See Also:
Constant Field Values

DEPTH_INFINITE

public static final short DEPTH_INFINITE
Depth constant indicating that a lock/unlock operation should apply to a resource or a resource collection and all members, or immediate children.

See Also:
Constant Field Values

SCOPE_SHARED

public static final short SCOPE_SHARED
Constant used to indicated shared lock scope.

See Also:
Constant Field Values

SCOPE_EXCLUSIVE

public static final short SCOPE_EXCLUSIVE
Constant used to indicated exclusive lock scope.

See Also:
Constant Field Values

NEVER_EXPIRE

public static final int NEVER_EXPIRE
Constant used to indicate that the lock will never expire.

See Also:
Constant Field Values

OBJECT_TYPE_LOCK

public static final int OBJECT_TYPE_LOCK
Contains the object type value which represents Lock instances.

See Also:
Constant Field Values

ATTRIBUTE_RESOURCE_ID

public static final int ATTRIBUTE_RESOURCE_ID
Contains the attribute identifier value which represents Lock instances.

See Also:
Constant Field Values

ATTRIBUTE_OWNER_ID

public static final int ATTRIBUTE_OWNER_ID
Contains the attribute identifier value which represents the owner.

See Also:
Constant Field Values

ATTRIBUTE_OWNER_USER_ID

public static final int ATTRIBUTE_OWNER_USER_ID
Contains the attribute identifier value which represents the owner's user identifier.

See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final int ATTRIBUTE_TYPE
Contains the attribute identifier value which represents the Lock type.

See Also:
Constant Field Values

ATTRIBUTE_DEPTH

public static final int ATTRIBUTE_DEPTH
Contains the attribute identifier value which represents the depth.

See Also:
Constant Field Values

ATTRIBUTE_LOCK_TOKEN

public static final int ATTRIBUTE_LOCK_TOKEN
Contains the attribute identifier value which represents the lock token.

See Also:
Constant Field Values

ATTRIBUTE_EXPIRY_DATE

public static final int ATTRIBUTE_EXPIRY_DATE
Contains the attribute identifier value which represents the expiration date.

See Also:
Constant Field Values
Constructor Detail

Lock

public Lock()
Default constructor.

Method Detail

setRepositoryLoadProfile

public void setRepositoryLoadProfile(RepositoryLoadProfile loadProfile)
Sets the Repository load profile for this lock. The load profile defines the object types and attributes to be returned from (projected in) a repository query. For more information, see RepositoryLoadProfile.

Parameters:
loadProfile - The Repository load profile for this lock.

isProjected

public boolean isProjected(int attribute)
Determines whether the supplied attribute or composed object is projected.

Parameters:
attribute - The attribute or composed object, which can be any one of the LOAD_* constants.
Returns:
true if the supplied attribute or composed object is projected, false otherwise.

getOid

public long getOid()
Do not use this method.

Retrieves this lock's numerical object identifier.

Returns:
This lock's numerical object identifier.

setOid

public void setOid(long oid)
Sets this lock's numerical object identifier. Do not use this method; the Repository will assign its own value.

Parameters:
oid - A positive number representing this lock's numerical object identifier.

getResourceId

public Id getResourceId()
Retrieves the identifier of the resource on which this lock exists.

Returns:
The identifier of the locked resource.

setResourceId

public void setResourceId(Id resourceId)
Sets the identifier of the resource on which this lock exists.

Parameters:
resourceId - The identifier of the resource on which this lock exists.

getOwnerId

public java.lang.String getOwnerId()
Retrieves the User Manager object identifier of the user who owns this lock. The format is as shown in the following example: "04B307F4-87B3-4517-E1C1-151AFB9982C1".

Returns:
The User Manager object identifier of the user who owns this lock.

setOwnerId

public void setOwnerId(java.lang.String ownerId)
Sets the lock's owner. Do not use this method; the Repository will assign lock ownership during lockResource() calls (see ResourceRepository).

Parameters:
ownerId - The lock owner's User Manager object identifier.

getOwnerUserId

public java.lang.String getOwnerUserId()
Retrieves the user identifier of the User Manager principal who owns this lock. The format is as shown in the following example: "juser".

Returns:
The user identifier of the User Manager principal who owns this lock.

setOwnerUserId

public void setOwnerUserId(java.lang.String ownerUserId)
Sets the user identifier of the User Manager principal who owns this lock. Do not use this method; the Repository will assign lock ownership during lockResource() calls (see ResourceRepository).

Parameters:
ownerUserId - The user identifier of the principal who owns this lock.

getType

public short getType()
Retrieves the lock scope. In later releases, scope information will be available from the getScope() method.

Returns:
The lock scope, which is Lock.SCOPE_SHARED or Lock.SCOPE_EXCLUSIVE.

setType

public void setType(short type)
Sets this lock's scope. Do not use this method; the Repository will assign lock scope during lockResource() calls (see ResourceRepository).

Parameters:
type - This lock's scope. It can be Lock.SCOPE_SHARED or Lock.SCOPE_EXCLUSIVE.

getDepth

public short getDepth()
Retrieves the lock's depth.

Returns:
The lock's depth, which can be Lock.DEPTH_ZERO, Lock.DEPTH_ONE, or Lock.DEPTH_INFINITE.

setDepth

public void setDepth(short depth)
Sets the lock depth. Do not use this method; the Repository will assign lock depth during lockResource() calls (see ResourceRepository).

Parameters:
depth - The lock depth, which can be Lock.DEPTH_ZERO, Lock.DEPTH_ONE, or Lock.DEPTH_INFINITE.

getLockToken

public java.lang.String getLockToken()
Retrieves this lock's token, which must be supplied during unlockResource() calls, in order to successfully remove this lock.

This is not required to unlock a resource.

Returns:
The lock token string.

setLockToken

public void setLockToken(java.lang.String lockToken)
Sets this lock's token. Do not use this method; the Repository will assign lock tokens during lockResource() calls (see ResourceRepository).

Parameters:
lockToken - This lock's token.

getExpiryDate

public long getExpiryDate()
Retrieves the timestamp at which this lock will expire.

Returns:
A timestamp comparable to the value returned by System.currentTimeMillis().

setExpiryDate

public void setExpiryDate(long expiryDate)
Sets this lock's expiration date. Do not use this method; the Repository will assign the expiration date during lockResource() calls (see ResourceRepository).

Parameters:
expiryDate - This lock's expiration date, which is a timestamp that is preferably greater than System.currentTimeMillis().

getUpdateTime

public java.util.Date getUpdateTime()
Retrieves the time at which this lock was last modified.

Returns:
The time at which this lock was last modified.

setUpdateTime

public void setUpdateTime(java.util.Date updateTime)
Sets the time at which this lock was last modified.

Parameters:
updateTime - The time at which this lock was last modified.

getCreateTime

public java.util.Date getCreateTime()
Retrieves the time at which this lock was first created.

Returns:
The time at which this lock was first created.

setCreateTime

public void setCreateTime(java.util.Date createTime)
Sets the time at which this lock was first created.

Parameters:
createTime - The time at which this lock was first created.