1 /*
2 * Copyright (c) 1998-2002 The Jgroup Team.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 *
17 */
18
19 package jgroup.core;
20
21
22 /**
23 * This interface must be implemented by all layers that should be
24 * constructable by runtime parsing of the XML layer composition
25 * framework. Typically, a service interface (e.g., MembershipService)
26 * will extend this interface to avoid additional interface
27 * declarations in the actual layer implementation.
28 *
29 * @author Hein Meling
30 * @since Jgroup 1.2
31 */
32 public interface Layer
33 {
34
35 /**
36 * This is a special interface implemented by layers that has to perform
37 * post construction finalization.
38 *
39 * @author Hein Meling
40 * @since Jgroup 2.1
41 */
42 public interface FinalizeLayer
43 {
44
45 /**
46 * This method is invoked on the layer, once the whole Jgroup group
47 * manager construction has been completed. The <code>complete()</code>
48 * method is supposed to implemented stuff that depends on several
49 * other group manager components having been constructed.
50 *
51 * @param server
52 * The server using a layer implementing the <code>FinalizeLayer</code>
53 * interface.
54 * @exception JgroupException
55 * Thrown if the layer could not be completed.
56 */
57 public void complete(Object server)
58 throws JgroupException;
59
60 } // END FinalizeLayer
61
62
63 /**
64 * Add a listener to this layer. Many layers require to be notified
65 * of events produced by other layers in order to provide its own
66 * functionallity, and this method must be invoked to notify this
67 * layer of an interested listener. A listener may be another layer
68 * or an application server replica.
69 *
70 * @param listener
71 * An <code>Object</code> representation of the listener interface.
72 * This will typically be cast to the appropriate listener interface
73 * type after checking the type with the <tt>instanceof</tt> operator.
74 * @exception IllegalArgumentException
75 * Raised if the given listener object do not implement any of the
76 * listeners provided by this layer.
77 */
78 public void addListener(Object listener);
79
80 } // END Layer