|
 |
|
|
org.eclipse.emf.transaction
Class ResourceSetListenerImpl
java.lang.Object
org.eclipse.emf.transaction.ResourceSetListenerImpl
-
All Implemented Interfaces:
-
EventListener,
ResourceSetListener,
ResourceSetListener.Internal
-
Direct Known Subclasses:
-
DemultiplexingListener,
TriggerListener
-
public class ResourceSetListenerImpl
- extends
Object
- implements
ResourceSetListener.Internal
Default implementation of a resource-set listener, useful for extending to
implement only the callbacks of interest to the client.
-
See Also:
-
ResourceSetChangeEvent
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ResourceSetListenerImpl
protected ResourceSetListenerImpl()
- Initializes me with the default filter.
ResourceSetListenerImpl
protected ResourceSetListenerImpl(
NotificationFilter filter)
- Initializes me with the specified filter.
-
Parameters:
-
filter - a filter, or null to request the default
getFilter
public
NotificationFilter getFilter()
-
Description copied from interface:
ResourceSetListener
- Provides a filter to select which notifications should be sent to this
listener. If none is provided, the default is the
NotificationFilter.NOT_TOUCH filter.
Note that, if a listener's filter does not match any of the
notifications that were received during a transaction, then it is not
invoked at all. Thus, the notification lists received in the
ResourceSetChangeEvent s will never be empty.
Note also that a listener's filter must not change over time, or
unpredictable behaviour will occur. In particular, the editing domain
is free to obtain the filter from the listener only once when the
listener is added and never request it thereafter. Also, it is not
expected the the same filter object's condition can change over time.
-
-
Specified by:
-
getFilter
in interface
ResourceSetListener
-
-
Returns:
- the filter used to select notifications, or
null to
obtain the default
transactionAboutToCommit
public
Command transactionAboutToCommit(
ResourceSetChangeEvent event)
throws
RollbackException
- The default implementation of this method does nothing, returning
no trigger command.
-
-
Specified by:
-
transactionAboutToCommit
in interface
ResourceSetListener
-
-
Parameters:
-
event - the event object describing the changes that occurred in
the resource set
-
Returns:
- an optional command to perform additional changes. Can be
null if no changes are required
-
Throws:
-
RollbackException
- to force a roll-back of the current transaction
resourceSetChanged
public void resourceSetChanged(
ResourceSetChangeEvent event)
- The default implementation of this method does nothing.
-
-
Specified by:
-
resourceSetChanged
in interface
ResourceSetListener
-
-
Parameters:
-
event - the event object describing the changes that occurred in
the resource set
isAggregatePrecommitListener
public boolean isAggregatePrecommitListener()
- By default, assume that we want individual transaction pre-commit.
-
-
Specified by:
-
isAggregatePrecommitListener
in interface
ResourceSetListener
-
-
Returns:
-
true if I should be invoked only for pre-commit of
the root transaction; false , otherwise
isPrecommitOnly
public boolean isPrecommitOnly()
- By default, assume that we do not only want pre-commit events but also
post-commit events.
-
-
Specified by:
-
isPrecommitOnly
in interface
ResourceSetListener
-
-
Returns:
-
true if I only am interested in pre-commit events;
false , otherwise
isPostcommitOnly
public boolean isPostcommitOnly()
- By default, assume that we do not only want post-commit events but also
pre-commit events.
-
-
Specified by:
-
isPostcommitOnly
in interface
ResourceSetListener
-
-
Returns:
-
true if I only am interested in post-commit events;
false , otherwise
getTarget
protected
TransactionalEditingDomain getTarget()
- Queries the transactional editing domain, if any, to which I am
listening. Note the assumption of the most common case in which a
listener is only attached to a single domain.
-
-
-
Returns:
- the editing domain that I listen to, or
null if none -
Since:
- 1.3
setTarget
public void setTarget(
TransactionalEditingDomain domain)
-
Remembers the new editing domain that I am now
listening to, if it is not
null .
-
-
Specified by:
-
setTarget
in interface
ResourceSetListener.Internal
-
-
Parameters:
-
domain - an editing domain to which I have been attached. Note that
nothing precludes the addition of a listener to more than
one editing domain -
Since:
- 1.3
unsetTarget
public void unsetTarget(
TransactionalEditingDomain domain)
- If the specified domain is the one that I
remembered, then I forget it because I am no longer listening to it.
-
-
Specified by:
-
unsetTarget
in interface
ResourceSetListener.Internal
-
-
Parameters:
-
domain - an editing domain from which I have been detached. Note
that I may very will still be attached to other domains
than this -
Since:
- 1.3
|
|
|