LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.peer
Class LyTransaction

java.lang.Object
  extended by leon.peer.LyTransaction

public class LyTransaction
extends java.lang.Object

This class represents a transaction managed by the transaction manager. A transaction is associated with a user session (LyDataSession) and a data provider (LyDataProvider). When a transaction is open, all requests for the data provider in the user session are stored in the transaction.

See Also:
LyDataProvider, LyRequestEncoder, LyConnection, LyTransactionManager

Nested Class Summary
static class LyTransaction.Operation
          Operation types.
static class LyTransaction.Status
          Statuses of the transaction.
 
Field Summary
static java.lang.String __VERSION
           
static java.lang.String TRANSACTION_TIMEOUT
          Constant for user transaction timeout parameter in the property file.
static java.lang.String USER_TRANSACTION_NAME
          Constant for user transaction name parameter in the property file.
 
Method Summary
 void addDataProvider(LyDataProvider provider)
          Add a data provider to this transaction.
 void addNotification(LyEventNotifier notifier, LyEventNotifier.EventType notification, LyClass peerClass, java.lang.Object object, LyValueSet values)
          Internal method to register notifications on the transaction.
 void begin()
          To begin this transaction.
 void commit()
          To commit the transaction.
 LyResponse createObject(LyDataSource dataSource, java.lang.Object peer, LyResponseListener listener, LyClassBinding classBinding)
          Create a new object on the specified data source.
 LyResponse deleteObject(LyDataSource dataSource, java.lang.Object peer, LyResponseListener listener, LyClassBinding classBinding)
          Delete an object on the specified data source.
 LyResponse deleteObjects(LyDataSource dataSource, java.util.Vector<java.lang.Object> peers, LyResponseListener listener, LyClassBinding classBinding)
          Delete a list of objects on the specified data source.
 LyApplication getApplication()
          Accessor to the user parent application.
 LyConnection getConnection(LyDataProvider provider)
          To get the connection associated with this transaction and the specified provider.
 LyEnvironment getEnvironment()
          Accessor to the environment of this transaction.
 java.util.Vector<LyDataProvider> getProviders()
          Get all data providers of this transaction.
 LyDataSession getSession()
          Accessor to the associated user session.
 int getSize(LyDataSource dataSource, LyFilter peerFilter, LyClassBinding classBinding)
          Return the number of objects within the specified data source matching the given filter.
 LyTransaction.Status getStatus()
          Accessor to the current status.
 java.lang.Thread getThread()
          Accessor to the associated thread.
 java.rmi.server.UID getUID()
          Internal method to get the unique identifier of the user transaction.
 LyResponse loadObject(LyDataSource dataSource, LyObjectId peerId, java.util.Vector<LyField> peerFields, LyResponseListener listener, LyClassBinding classBinding)
          Method to load an object from its id on the specified data source.
 LyResponse loadObjects(LyDataSource dataSource, java.util.Vector<LyField> peerFields, LySort peerSort, LyFilter peerFilter, int n, LyResponseListener listener, LyClassBinding classBinding)
          Method for loading objects on the specified data source.
 boolean prepareCommit()
          This method is called before a commit operation.
 void rollback()
          To rollback the transaction.
 LyResponse setObject(LyDataSource dataSource, java.lang.Object peer, LyResponseListener listener, LyClassBinding classBinding)
          Set an object on the specified data source.
 LyResponse setObjects(LyDataSource dataSource, java.util.Vector<java.lang.Object> peers, LyResponseListener listener, LyClassBinding classBinding)
          Set a list of objects on the specified data source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

USER_TRANSACTION_NAME

public static final java.lang.String USER_TRANSACTION_NAME
Constant for user transaction name parameter in the property file.

See Also:
Constant Field Values

TRANSACTION_TIMEOUT

public static final java.lang.String TRANSACTION_TIMEOUT
Constant for user transaction timeout parameter in the property file.

See Also:
Constant Field Values
Method Detail

getStatus

public final LyTransaction.Status getStatus()
Accessor to the current status.

Returns:
the current status

getApplication

public final LyApplication getApplication()
Accessor to the user parent application.

Returns:
the parent application

getSession

public final LyDataSession getSession()
Accessor to the associated user session.

Returns:
the associated session

getEnvironment

public final LyEnvironment getEnvironment()
Accessor to the environment of this transaction.

Returns:
the corresponding environment (session or application environment)

getThread

public final java.lang.Thread getThread()
Accessor to the associated thread.

Returns:
the associated thread

addDataProvider

public final void addDataProvider(LyDataProvider provider)
Add a data provider to this transaction.

Parameters:
provider - the added data provider

getUID

public java.rmi.server.UID getUID()
Internal method to get the unique identifier of the user transaction.

Returns:
The unique identifier of the user transaction.

begin

public void begin()
To begin this transaction.


prepareCommit

public boolean prepareCommit()
This method is called before a commit operation. For each connection of this transaction, the method prepareCommit is called and if at least one of the connections can't commit, this method stops and returns false.

Returns:
true if the commit can be made, else returns false.

commit

public void commit()
To commit the transaction. All registered notifications are sent.


rollback

public void rollback()
To rollback the transaction. Return to the initial state before starting the transaction.


getConnection

public LyConnection getConnection(LyDataProvider provider)
To get the connection associated with this transaction and the specified provider.

Parameters:
provider - the provider to get the connection
Returns:
a connection from the specified provider with auto commit mode disabled.

deleteObject

public LyResponse deleteObject(LyDataSource dataSource,
                               java.lang.Object peer,
                               LyResponseListener listener,
                               LyClassBinding classBinding)
Delete an object on the specified data source.

Parameters:
dataSource - The data source for deleting the object.
peer - Object to delete.
listener - Listener of the response.
classBinding - Binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the deletion.
See Also:
LyDataSource.deleteObject(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

deleteObjects

public LyResponse deleteObjects(LyDataSource dataSource,
                                java.util.Vector<java.lang.Object> peers,
                                LyResponseListener listener,
                                LyClassBinding classBinding)
Delete a list of objects on the specified data source.

Parameters:
dataSource - The data source for deleting the objects.
peers - List of objects to delete.
listener - Listener of the response.
classBinding - Binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the deletion.
See Also:
LyDataSource.deleteObjects(java.util.Vector, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

createObject

public LyResponse createObject(LyDataSource dataSource,
                               java.lang.Object peer,
                               LyResponseListener listener,
                               LyClassBinding classBinding)
Create a new object on the specified data source.

Parameters:
dataSource - The data source for creating the object.
peer - Object to create.
listener - Listener of the response.
classBinding - Binding between logical class and physical class. This binding may contain extra information required for encoding the request.
Returns:
Response to the creation.
See Also:
LyDataSource.createObject(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

setObject

public LyResponse setObject(LyDataSource dataSource,
                            java.lang.Object peer,
                            LyResponseListener listener,
                            LyClassBinding classBinding)
Set an object on the specified data source.

Parameters:
dataSource - The data source for setting the object.
peer - Object to modify.
listener - Listener of the response.
classBinding - Binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the modification.
See Also:
LyDataSource.setObject(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

setObjects

public LyResponse setObjects(LyDataSource dataSource,
                             java.util.Vector<java.lang.Object> peers,
                             LyResponseListener listener,
                             LyClassBinding classBinding)
Set a list of objects on the specified data source.

Parameters:
dataSource - The data source for setting the objects.
peers - List of objects to modify.
listener - Listener of the response.
classBinding - Binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the modification.
See Also:
LyDataSource.setObjects(java.util.Vector, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

loadObject

public LyResponse loadObject(LyDataSource dataSource,
                             LyObjectId peerId,
                             java.util.Vector<LyField> peerFields,
                             LyResponseListener listener,
                             LyClassBinding classBinding)
Method to load an object from its id on the specified data source. Load fields of an object from a given object id.

Parameters:
dataSource - The data source for loading the object.
peerId - Object identifier corresponding to the object to load.
peerFields - Fields to load (null means all fields).
listener - Listener of the response.
classBinding - binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the loading.
See Also:
LyDataSource.loadObject(leon.data.LyObjectId, java.util.Vector, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

loadObjects

public LyResponse loadObjects(LyDataSource dataSource,
                              java.util.Vector<LyField> peerFields,
                              LySort peerSort,
                              LyFilter peerFilter,
                              int n,
                              LyResponseListener listener,
                              LyClassBinding classBinding)
Method for loading objects on the specified data source. Load fields of a specified number of objects sorted by a given sort and that match a given filter.

Parameters:
dataSource - The data source for loading the objects.
peerFields - Fields to load (null means all fields).
peerSort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
peerFilter - Gives filter criteria, or null if there is no filter (all objects).
n - Indicates the number of objects to load (-1 means no limit).
listener - Listener of the response.
classBinding - binding between logical class and physical class This binding may contain extra information required for encoding the request.
Returns:
Response to the loading.
See Also:
LyDataSource.loadObjects(java.util.Vector, leon.info.LySort, leon.info.LyFilter, int, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)

getSize

public int getSize(LyDataSource dataSource,
                   LyFilter peerFilter,
                   LyClassBinding classBinding)
Return the number of objects within the specified data source matching the given filter.

Parameters:
dataSource - The data source for getting the number of objects.
peerFilter - Filter applied on objects for counting.
classBinding - Binding between logical class and physical class. This binding may contain extra information required for encoding the request (such as extra filter).
Returns:
Number of objects matching the given filter in this data source.
See Also:
LyDataSource.getSize()

addNotification

public void addNotification(LyEventNotifier notifier,
                            LyEventNotifier.EventType notification,
                            LyClass peerClass,
                            java.lang.Object object,
                            LyValueSet values)
Internal method to register notifications on the transaction. For internal use only.

Parameters:
notifier - the notifier to send the notification.
notification - the type of the added notification.
peerClass - the class of the object.
object - the object on which is the notification.
values - old values of the object when the notification is a modification (else null).

getProviders

public java.util.Vector<LyDataProvider> getProviders()
Get all data providers of this transaction.

Returns:
a Vector of the data providers.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com