KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > GraphEventManager


1 /*
2   (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: GraphEventManager.java,v 1.13 2005/02/21 11:51:56 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.graph;
8
9 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     /**
22         Attached <code>listener</code> to this manager; notification events
23         sent to the manager are sent to all registered listeners. A listener may
24         be registered multiple times, in which case it's called multiple times per
25         event.
26         
27         @param listener a listener to be fed events
28         @return this manager, for cascading
29     */

30     GraphEventManager register( GraphListener listener );
31     
32     /**
33         If <code>listener</code> is attached to this manager, detach it, otherwise
34         do nothing. Only a single registration is removed.
35         
36         @param listener the listener to be detached from the graph
37         @return this manager, for cascading
38     */

39     GraphEventManager unregister( GraphListener listener );
40     
41     /**
42         Answer true iff there is at least one attached listener.
43         @return true iff there is at least one attached listener
44      */

45     boolean listening();
46     
47     /**
48         Notify all attached listeners that an iterator [of triples] has been added to
49         the graph; its content has been captured in the list <code>triples</code>.
50      */

51     void notifyAddIterator( Graph g, List triples );
52
53     /**
54         Notify all attached listeners that an iterator [of triples] has been removed from
55         the graph; its content has been captured in the list <code>triples</code>.
56      */

57     void notifyDeleteIterator( Graph g, List triples );
58     }
59
60 /*
61     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
62     All rights reserved.
63
64     Redistribution and use in source and binary forms, with or without
65     modification, are permitted provided that the following conditions
66     are met:
67
68     1. Redistributions of source code must retain the above copyright
69        notice, this list of conditions and the following disclaimer.
70
71     2. Redistributions in binary form must reproduce the above copyright
72        notice, this list of conditions and the following disclaimer in the
73        documentation and/or other materials provided with the distribution.
74
75     3. The name of the author may not be used to endorse or promote products
76        derived from this software without specific prior written permission.
77
78     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
79     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
80     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
81     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
82     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
83     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
87     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 */
Popular Tags