com.sap.engine.services.applocking

Interface LogicalLocking

All Superinterfaces:
com.sap.engine.frame.core.locking.LockingConstants, Remote

public interface LogicalLocking
extends com.sap.engine.frame.core.locking.LockingConstants, Remote

Provides methods similar to the LockingContext, except that the owner may not be set explicitely. Instead the owner is automatically determined by the current user-session and the current transaction (every user-session/transaction has exactly one owner assigned). Because of this every method has instead of the parameter "owner" a parameter "lifetime", which determines which of the owners shall be used.

All locks are removed automatically when the session/transaction is ends.

Restriction: it is not alowed to make locks for the user-session of the system-user. This is done because of security-reasons.

Restriction: the parameter 'name' must always start with the namespace, for which this instance of the LogicalLocking was created (see LogicalLockingFactory). For example if the namespace is "XY", then valid names are "XY4711", "XY0815", "XYmeier".

See Also:
LockingContext

Field Summary
 
Fields inherited from interface com.sap.engine.frame.core.locking.LockingConstants
FILL_CHARACTER, LIFETIME_TRANSACTION, LIFETIME_USERSESSION, MAX_ARGUMENT_LENGTH, MAX_NAME_LENGTH, MAX_OWNER_LENGTH, MAX_USER_LENGTH, MODE_EXCLUSIVE_CUMULATIVE, MODE_EXCLUSIVE_NONCUMULATIVE, MODE_OPTIMISTIC, MODE_OPTIMISTIC_TO_EXCLUSIVE, MODE_SHARED, OWNER_WILDCARD_CHARACTER, WILDCARD_CHARACTER_MULTI, WILDCARD_CHARACTER_SINGLE
 
Method Summary
 void assertLifetime(byte lifetime)
          Returns if locking is currently allowed for the given lifetime.
 String getCurrentOwner(byte lifetime)
          Returns the current owner-id, to which all locks belong.
 long getUniqueIncreasingNumber()
          Returns a number with the following properties: every method-call returns a higher number than the previous ones the number contains the timestamp of the central server, so this will work correctly in a distrubuted environment and also after a restart of the cluster This number can be used for every purpose, it is not locking-specific.
 void lock(byte lifetime, String[] name, String[] argument, char[] mode)
          Locks several arguments, which belong to a name.
 void lock(byte lifetime, String[] name, String[] argument, char[] mode, int timeout)
          Locks several arguments, which belong to a name.
 void lock(byte lifetime, String name, String argument, char mode)
          Locks an argument, which belongs to a name.
 void lock(byte lifetime, String name, String argument, char mode, int timeout)
          Locks an argument, which belongs to a name.
 void unlock(byte lifetime, String[] name, String[] argument, char[] mode)
          Unlocks a several arguments, which belongs to a name.
 void unlock(byte lifetime, String[] name, String[] argument, char[] mode, boolean asynchronous)
          Unlocks a several arguments, which belongs to a name.
 void unlock(byte lifetime, String name, String argument, char mode)
          Unlocks an argument, which belongs to a name.
 void unlock(byte lifetime, String name, String argument, char mode, boolean asynchronous)
          Unlocks an argument, which belongs to a name.
 void unlockAll(byte lifetime)
          Unlocks all names/arguments.
 void unlockAll(byte lifetime, boolean asynchronous)
          Unlocks all names/arguments.
 

Method Detail

lock

public void lock(byte lifetime,
                 String name,
                 String argument,
                 char mode)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 IllegalArgumentException
Locks an argument, which belongs to a name.

Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.LockException - if the argument is already locked
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

lock

public void lock(byte lifetime,
                 String name,
                 String argument,
                 char mode,
                 int timeout)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 IllegalArgumentException
Locks an argument, which belongs to a name.

Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
timeout - time period in milliseconds within this the lock will be requested several times if there is a lock collision
Throws:
com.sap.engine.frame.core.locking.LockException - if the argument is already locked
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

lock

public void lock(byte lifetime,
                 String[] name,
                 String[] argument,
                 char[] mode)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 IllegalArgumentException
Locks several arguments, which belong to a name.

Parameters:
name - The names, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The arguments which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modes can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.LockException - if the argument is already locked
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

lock

public void lock(byte lifetime,
                 String[] name,
                 String[] argument,
                 char[] mode,
                 int timeout)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 IllegalArgumentException
Locks several arguments, which belong to a name.

Parameters:
name - The names, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The arguments which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modes can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
timeout - time period in milliseconds within the locks will be requested several times if there is a lock collision
Throws:
com.sap.engine.frame.core.locking.LockException - if the argument is already locked
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlock

public void unlock(byte lifetime,
                   String name,
                   String argument,
                   char mode)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   IllegalArgumentException
Unlocks an argument, which belongs to a name. By default the unlock may be done asynchronously.

Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlock

public void unlock(byte lifetime,
                   String name,
                   String argument,
                   char mode,
                   boolean asynchronous)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   IllegalArgumentException
Unlocks an argument, which belongs to a name.

Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlock

public void unlock(byte lifetime,
                   String[] name,
                   String[] argument,
                   char[] mode)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   IllegalArgumentException
Unlocks a several arguments, which belongs to a name. By default the unlock may be done asynchronously.

Parameters:
name - The namea, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argumenta which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modea can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlock

public void unlock(byte lifetime,
                   String[] name,
                   String[] argument,
                   char[] mode,
                   boolean asynchronous)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   IllegalArgumentException
Unlocks a several arguments, which belongs to a name.

Parameters:
name - The namea, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argumenta which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modea can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlockAll

public void unlockAll(byte lifetime)
               throws com.sap.engine.frame.core.locking.TechnicalLockException,
                      IllegalArgumentException
Unlocks all names/arguments. By default the unlock may be done asynchronously.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

unlockAll

public void unlockAll(byte lifetime,
                      boolean asynchronous)
               throws com.sap.engine.frame.core.locking.TechnicalLockException,
                      IllegalArgumentException
Unlocks all names/arguments.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

assertLifetime

public void assertLifetime(byte lifetime)
                    throws com.sap.engine.frame.core.locking.TechnicalLockException,
                           IllegalArgumentException
Returns if locking is currently allowed for the given lifetime. For example LIFETIME_TRANSACTION is not possible, if there is no transaction active.

This method is typically not needed to use the locking. It is meant mainly for debugging-purposes and to support better tracing.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException - if the lifetime is currently not allowed.
IllegalArgumentException

getCurrentOwner

public String getCurrentOwner(byte lifetime)
                       throws com.sap.engine.frame.core.locking.TechnicalLockException,
                              IllegalArgumentException
Returns the current owner-id, to which all locks belong. It is dependent on the current session or the current transaction.

This method is not needed to use the locking. It is meant mainly for debugging-purposes and to support better tracing.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
com.sap.engine.frame.core.locking.TechnicalLockException
IllegalArgumentException

getUniqueIncreasingNumber

public long getUniqueIncreasingNumber()
                               throws com.sap.engine.frame.core.locking.TechnicalLockException
Returns a number with the following properties: This number can be used for every purpose, it is not locking-specific.

ATTENTION: if the system-time of the central server is changed this will probably not work correctly any more.

Throws:
com.sap.engine.frame.core.locking.TechnicalLockException


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.