View Javadoc

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.arm;
20  
21  import java.io.Externalizable;
22  
23  
24  /**
25   *  Event types implementing the <code>ARMEvent</code> interface may be
26   *  passed to the replication manager to notify it of certain events.
27   *  The event itself must provide the <code>handle()</code> method,
28   *  enabling the replication manager to invoke the event handler.  That
29   *  is, events provide self-handling.  <p>
30   *
31   *  Note that events must also implement the <code>Externalizable</code>
32   *  interface.
33   *
34   *  @see jgroup.arm.EDPresentEvent
35   *  @see jgroup.arm.ViewChangeEvent
36   *  @see jgroup.arm.ReplicaPingEvent
37   *  @author Hein Meling
38   *  @since Jgroup 1.2
39   */
40  public interface ARMEvent
41    extends Externalizable
42  {
43  
44    /**
45     *  This method must implement the actual handling of the event, as
46     *  recevied by the replication manager.
47     *
48     *  @param distScheme
49     *    access point to the replication manager for external events
50     * 
51     */
52    public void handle(DistributionScheme distScheme)
53      throws Exception;
54  
55    /**
56     *  Returns the groupd identifier associated with this event.
57     *  If the event is not associated with any group, it should
58     *  return -1.
59     */
60    public int getGroupId();
61  
62    /**
63     *  Retreive an object associated with this event.  This method may
64     *  return <code>null</code> if the event internals need not or should
65     *  not be exposed externally.
66     */
67    public Object getObject();
68  
69  } // END ARMEvent