- All Known Subinterfaces:
Deprecated. As of SAP NetWeaver 2007 release, replaced by package
public interface ILockingPolicy
The interface that represents the locking policy of an editor.
Editor locking is the mechanism that deals with the issues of a
multi-user environment. In this environment, multiple users can
work on the same resource simultaneously. If there is no mechanism
to manage the data, a user might work with non-updated data, since
the user's editor state is not synchronized with the current sate
of the resource.
There are two approaches to locking.
- Pessimistic Locking: The resource that the user works on is locked
immediately when it is retrieved. The user can edit the data. If
another user tries to load the same resource, it is available as
read-only. This approach requires the resources to support a method
for locking. PCM objects support pessimistic locking.
- Optimistic Locking: The resource is not immediately locked, but
when a resource is retrieved a special attribute of the resource version
is also supplied. This version is held by the editor until a save
operation. Then the editor compares the version that it holds to the
current version in the persistence layer. If they don't match, it
indicates that the resource has meanwhile been changed by another user
and the save operation fails. Otherwise, it saves the updated resource,
and gives the version a newer value. PCM objects currently do not support
optimistic locking, and this approach is not used in EP 6.0.
The editor framework provides a default implementation of pessimistic
locking for PCM objects. No action is required to use this methodology.
The following lock statuses are available:
- NEW_LOCK: The resource is locked with a new lock.
The editor framework registers this lock, and the editor is opened for
editing (if no other veto is raised)
- EXISTING_LOCK: The resource is already locked by this user and
session so it requires no special treatment. The editor is opened for
editing (if no other veto is raised). Registration is not required.
- RESOURCE_IS_LOCKED: The resource is locked by another entity.
The editor framework opens the editor in read-only mode, and an end-user
message is presented.
- RESOURCE_IN_HOLD: The resource is locked. However, the resource
can be taken if the current user requests. The editor framework presents
a question, and if the user chooses yes, to enforce the lock, the editor
framework calls the
getLock method using the
EditorLockingStatus getLock(IEditorContext context,
- Gets the lock for the specified editor.
The editor framework maintains the locking flow, according to the status
context - the current context of the editor
principal - a security principal trying to get
enforce - indicates whether to get a new lock, even if the resource
is already locked
logger - to log messages
- EditorLockingStatus the lock status
EditorLockingException - if getting a lock fails
EditorResourceException - if an error occurs regarding the resource
that this editor deals with, and an error
message is displayed instead of
the regular editor user interface
- See Also:
This class can be accessed from:
Copyright 2011 SAP AG Complete Copyright Notice