org.eclipse.emf.transaction.impl
Class ReadWriteValidatorImpl
java.lang.Object
org.eclipse.emf.transaction.impl.ReadWriteValidatorImpl
-
All Implemented Interfaces:
-
TransactionValidator
-
Direct Known Subclasses:
-
ReadOnlyValidatorImpl
-
public class ReadWriteValidatorImpl
- extends
Object
- implements
TransactionValidator
A validator for read/write transactions. It provides all of the notifications
(in order) that occurred during the transaction, and validates them to detect
changes that would violate model integrity.
A read/write validator should be created for the root transaction of any
nested read/write transaction structure, when the root transaction is
activated. As child transactions are activated, they must be
added
to me so that I may correctly track
which notifications were received during which transaction, and at which
time relative to the start and completion of nested transactions.
Whenever a transaction (nested or otherwise) is rolled back, it must be
removed
from me so that I may forget
the notifications received for any changes that it or its nested transactions
made.
-
See Also:
-
ReadOnlyValidatorImpl
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ReadWriteValidatorImpl
public ReadWriteValidatorImpl()
- Initializes me.
add
public void add(
InternalTransaction transaction)
- Adds the specified transaction to me for validation. This must be called
when the transaction is activated.
-
-
Specified by:
-
add
in interface
TransactionValidator
-
-
Parameters:
-
transaction
- the transaction (root or a nested transaction) to add
remove
public void remove(
InternalTransaction transaction)
- Removes the specified transaction from me. This must be called
when the transaction is rolled back, and is recommended also after a
successful commit.
-
-
Specified by:
-
remove
in interface
TransactionValidator
-
-
Parameters:
-
transaction
- the transaction (root or a nested transaction) to remove
getNotificationsForValidation
public
List<
Notification> getNotificationsForValidation(
Transaction tx)
-
Description copied from interface:
TransactionValidator
- Obtains the notifications received, in order, during the execution of
the (possibly nested) transaction(s) that I am validating.
-
-
Specified by:
-
getNotificationsForValidation
in interface
TransactionValidator
-
-
Parameters:
-
tx
- the transaction to be validated
-
Returns:
- the transaction's notifications, or
null
if the
transaction has not started yet
getNotificationsForPrecommit
public
List<
Notification> getNotificationsForPrecommit(
Transaction tx)
-
Description copied from interface:
TransactionValidator
- Obtains the notifications that I need to broadcast in a pre-commit
resource-change event for the specified transaction. Note that this
does not include notifications from "no-triggers" transactions.
-
-
Specified by:
-
getNotificationsForPrecommit
in interface
TransactionValidator
-
-
Parameters:
-
tx
- the transaction to be broadcast
-
Returns:
- those of the transaction's notifications that are eligible to
be broadcast, or
null
if the transaction has not started
getNotificationsForPostcommit
public
List<
Notification> getNotificationsForPostcommit(
Transaction tx)
-
Description copied from interface:
TransactionValidator
- Obtains the notifications that I need to broadcast in a post-commit
resource-change event for the specified transaction. Note that this
does not include notifications from "silent" transactions.
-
-
Specified by:
-
getNotificationsForPostcommit
in interface
TransactionValidator
-
-
Parameters:
-
tx
- the transaction to be broadcast
-
Returns:
- those of the transaction's notifications that are eligible to
be broadcast, or
null
if the transaction has not started
validate
public
IStatus validate(
Transaction tx)
-
Description copied from interface:
TransactionValidator
- Performs the validation step of a commit.
-
-
Specified by:
-
validate
in interface
TransactionValidator
-
-
Parameters:
-
tx
- the transaction to validate
-
Returns:
- the status of validation. If the severity is error or worse,
then the transaction must roll back, and this status
included in the exception
-
See Also:
-
Transaction.commit()
,
RollbackException
createValidator
protected
IValidator<
Notification> createValidator()
- Creates a validator which will be responsible for the transaction validation
-
-
-
Returns:
- the validator
-
Since:
- 1.1
dispose
public void dispose()
-
Description copied from interface:
TransactionValidator
- Disposes me by clearing my state and cleaning up any resources that I
am retaining.
-
-
Specified by:
-
dispose
in interface
TransactionValidator
-