Package org.apache.sis.storage.event
Class CascadedStoreEvent<E extends CascadedStoreEvent<E>>
java.lang.Object
java.util.EventObject
org.apache.sis.storage.event.StoreEvent
org.apache.sis.storage.event.CascadedStoreEvent<E>
- Type Parameters:
E
- the type of the event subclass.
- All Implemented Interfaces:
Serializable
,Localized
- Direct Known Subclasses:
CloseEvent
An event which, when occurring on a parent resource, is also fired by all children resources.
For example, when an Difference between
By default
Aggregate
(typically a data store) is closed,
a CloseEvent
is automatically fired by all resources that are components of the aggregate.
This is similar to "cascade delete" in SQL databases.
Difference between StoreEvent
and CascadedStoreEvent
By default StoreEvent
s are propagated from children to parents.
For example, when a WarningEvent
occurs in a child resource,
all listeners registered on that resource are notified,
then all listeners registered on the parent resource, and so forth until the root resource.
All those listeners receive the same WarningEvent
instance,
i.e. the event source is always the resource where the warning occurred.
By contrast CascadedStoreEvent
are fired in the opposite direction, from parent to children.
Furthermore, each child creates its own CascadedStoreEvent
. For example if a CloseEvent
is
fired in a DataStore
, then it causes all resources of that data store to fire
their own CloseEvent
declaring themselves as the event source.
- Since:
- 1.3
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
A listener to register on the parent of a resource for cascading an event to the children. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CascadedStoreEvent
(Resource source) Constructs an event that occurred in the given resource. -
Method Summary
Methods inherited from class org.apache.sis.storage.event.StoreEvent
consume, getLocale, getSource, isConsumed, isConsumedForParent
Methods inherited from class java.util.EventObject
toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
-
Constructor Details
-
CascadedStoreEvent
Constructs an event that occurred in the given resource.- Parameters:
source
- the resource where the event occurred.- Throws:
IllegalArgumentException
- if the given source is null.
-
-
Method Details
-
forSource
Creates a new event of the same type than this event but with a different source. This method is invoked for creating the event to be fired by the children of the resource where the original event occurred.- Parameters:
child
- the child resource for which to create the event to cascade.- Returns:
- an event of the same type than this event but with the given resource.
-