java.lang.Object
org.apache.jena.graph.impl.SimpleEventManager
- All Implemented Interfaces:
GraphEventManager,GraphListener
Simple implementation of GraphEventManager for GraphBase to use.
The listeners are held as an [Array]List.
This class also holds the utility method notifyingRemove, which wraps iterators so that their .remove() operation notifies the specified graph of the removal.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAnswer true iff there is at least one attached listener.voidnotifyAddArray(Graph g, Triple[] ts) Method called when an array of triples has been added to the graph.voidnotifyAddGraph(Graph g, Graph added) Method called when another graphghas been used to specify the triples added to our attached graph.voidnotifyAddIterator(Graph g, Iterator<Triple> it) Method called when an iterator [of triples] has been added to the graphvoidnotifyAddIterator(Graph g, List<Triple> it) Notify all attached listeners that an iterator [of triples] has been added to the graph; its content has been captured in the listtriples.voidnotifyAddList(Graph g, List<Triple> L) Method called when a list [of triples] has been added to the graph.voidnotifyAddTriple(Graph g, Triple t) Method called when a single triple has been added to the graph.voidnotifyDeleteArray(Graph g, Triple[] ts) Method called when an array of triples has been deleted from the graph.voidnotifyDeleteGraph(Graph g, Graph removed) Method to call when another graph has been used to specify the triples deleted from our attached graph.voidnotifyDeleteIterator(Graph g, Iterator<Triple> it) Method called when an iterator [of triples] has been deleted from the graph.voidnotifyDeleteIterator(Graph g, List<Triple> L) Notify all attached listeners that an iterator [of triples] has been removed from the graph; its content has been captured in the listtriples.voidnotifyDeleteList(Graph g, List<Triple> L) Method called when a list [of triples] has been deleted from the graph.voidnotifyDeleteTriple(Graph g, Triple t) Method called when a single triple has been deleted from the graph.voidnotifyEvent(Graph source, Object event) method to call for a general event.static ExtendedIterator<Triple>notifyingRemove(Graph g, Iterator<Triple> i) Answer an iterator which wrapsito ensure that if a .remove() is executed on it, the graphgwill be notified.register(GraphListener listener) Attachedlistenerto this manager; notification events sent to the manager are sent to all registered listeners.unregister(GraphListener listener) Iflisteneris attached to this manager, detach it, otherwise do nothing.
-
Constructor Details
-
SimpleEventManager
public SimpleEventManager()
-
-
Method Details
-
register
Description copied from interface:GraphEventManagerAttachedlistenerto this manager; notification events sent to the manager are sent to all registered listeners. A listener may be registered multiple times, in which case it's called multiple times per event. A listener will be notified of an event if it is registered before the Graph method call that initiated the event, and was not unregistered before that method call returned. In addition, a listener may (or may not) be notified of an event if it is registered before such a method returns or is unregistered after such a method is called. For example, it may unregister itself in response to the event. If the registration and/or unregistration occur on different threads the usual thread uncertainties in such statements apply.- Specified by:
registerin interfaceGraphEventManager- Parameters:
listener- a listener to be fed events- Returns:
- this manager, for cascading
-
unregister
Description copied from interface:GraphEventManagerIflisteneris attached to this manager, detach it, otherwise do nothing. Only a single registration is removed.- Specified by:
unregisterin interfaceGraphEventManager- Parameters:
listener- the listener to be detached from the graph- Returns:
- this manager, for cascading
-
listening
public boolean listening()Description copied from interface:GraphEventManagerAnswer true iff there is at least one attached listener.- Specified by:
listeningin interfaceGraphEventManager- Returns:
- true iff there is at least one attached listener
-
notifyAddTriple
Description copied from interface:GraphListenerMethod called when a single triple has been added to the graph.- Specified by:
notifyAddTriplein interfaceGraphListener
-
notifyAddArray
Description copied from interface:GraphListenerMethod called when an array of triples has been added to the graph.- Specified by:
notifyAddArrayin interfaceGraphListener
-
notifyAddList
Description copied from interface:GraphListenerMethod called when a list [of triples] has been added to the graph.- Specified by:
notifyAddListin interfaceGraphListener
-
notifyAddIterator
Description copied from interface:GraphEventManagerNotify all attached listeners that an iterator [of triples] has been added to the graph; its content has been captured in the listtriples.- Specified by:
notifyAddIteratorin interfaceGraphEventManager
-
notifyAddIterator
Description copied from interface:GraphListenerMethod called when an iterator [of triples] has been added to the graph- Specified by:
notifyAddIteratorin interfaceGraphListener
-
notifyAddGraph
Description copied from interface:GraphListenerMethod called when another graphghas been used to specify the triples added to our attached graph.- Specified by:
notifyAddGraphin interfaceGraphListener- Parameters:
g- the graph of triples added
-
notifyDeleteTriple
Description copied from interface:GraphListenerMethod called when a single triple has been deleted from the graph.- Specified by:
notifyDeleteTriplein interfaceGraphListener
-
notifyDeleteArray
Description copied from interface:GraphListenerMethod called when an array of triples has been deleted from the graph.- Specified by:
notifyDeleteArrayin interfaceGraphListener
-
notifyDeleteList
Description copied from interface:GraphListenerMethod called when a list [of triples] has been deleted from the graph.- Specified by:
notifyDeleteListin interfaceGraphListener
-
notifyDeleteIterator
Description copied from interface:GraphEventManagerNotify all attached listeners that an iterator [of triples] has been removed from the graph; its content has been captured in the listtriples.- Specified by:
notifyDeleteIteratorin interfaceGraphEventManager
-
notifyDeleteIterator
Description copied from interface:GraphListenerMethod called when an iterator [of triples] has been deleted from the graph.- Specified by:
notifyDeleteIteratorin interfaceGraphListener
-
notifyDeleteGraph
Description copied from interface:GraphListenerMethod to call when another graph has been used to specify the triples deleted from our attached graph.- Specified by:
notifyDeleteGraphin interfaceGraphListener- Parameters:
g- the graph of triples added
-
notifyEvent
Description copied from interface:GraphListenermethod to call for a general event.valueis usually aGraphEvents. Special attention is drawn toGraphEvents.removeAlland events whoseGraphEvents.getTitle()is"remove"(seeGraphEvents.remove(Node, Node, Node). Unlike other notifications, the listener cannot tell which triples have been modified, since they have already been deleted by the time this event is sent, and the event does not include a record of them.- Specified by:
notifyEventin interfaceGraphListener
-
notifyingRemove
Answer an iterator which wrapsito ensure that if a .remove() is executed on it, the graphgwill be notified.
-