01: /*
02: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: [See end of file]
04: $Id: GraphEventManager.java,v 1.16 2008/01/02 12:06:55 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.graph;
08:
09: import java.util.*;
10:
11: /**
12: The component of a graph responsible for managing events and listeners.
13: The interface extends GraphListener because most of the notificiations are
14: the same; the special case to note is that an event manager expects to be
15: handed iterator events as lists, not as iterators.
16:
17: @author kers
18: */
19: public interface GraphEventManager extends GraphListener {
20: /**
21: Attached <code>listener</code> to this manager; notification events
22: sent to the manager are sent to all registered listeners. A listener may
23: be registered multiple times, in which case it's called multiple times per
24: event.
25:
26: @param listener a listener to be fed events
27: @return this manager, for cascading
28: */
29: GraphEventManager register(GraphListener listener);
30:
31: /**
32: If <code>listener</code> is attached to this manager, detach it, otherwise
33: do nothing. Only a single registration is removed.
34:
35: @param listener the listener to be detached from the graph
36: @return this manager, for cascading
37: */
38: GraphEventManager unregister(GraphListener listener);
39:
40: /**
41: Answer true iff there is at least one attached listener.
42: @return true iff there is at least one attached listener
43: */
44: boolean listening();
45:
46: /**
47: Notify all attached listeners that an iterator [of triples] has been added to
48: the graph; its content has been captured in the list <code>triples</code>.
49: */
50: void notifyAddIterator(Graph g, List triples);
51:
52: /**
53: Notify all attached listeners that an iterator [of triples] has been removed from
54: the graph; its content has been captured in the list <code>triples</code>.
55: */
56: void notifyDeleteIterator(Graph g, List triples);
57: }
58:
59: /*
60: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
61: All rights reserved.
62:
63: Redistribution and use in source and binary forms, with or without
64: modification, are permitted provided that the following conditions
65: are met:
66:
67: 1. Redistributions of source code must retain the above copyright
68: notice, this list of conditions and the following disclaimer.
69:
70: 2. Redistributions in binary form must reproduce the above copyright
71: notice, this list of conditions and the following disclaimer in the
72: documentation and/or other materials provided with the distribution.
73:
74: 3. The name of the author may not be used to endorse or promote products
75: derived from this software without specific prior written permission.
76:
77: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
78: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
79: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
80: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
81: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
82: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
83: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
84: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
85: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
86: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87: */
|