KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > tribe > channel > ReliableGroupChannelWithViews


1 /**
2  * Tribe: Group communication library.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: tribe@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): ______________________.
23  */

24
25 package org.objectweb.tribe.channel;
26
27 import java.util.ArrayList JavaDoc;
28
29 import org.objectweb.tribe.common.Address;
30 import org.objectweb.tribe.common.Group;
31 import org.objectweb.tribe.common.GroupIdentifier;
32 import org.objectweb.tribe.common.Member;
33 import org.objectweb.tribe.gms.GroupMembershipListener;
34 import org.objectweb.tribe.gms.GroupMembershipService;
35 import org.objectweb.tribe.views.View;
36 import org.objectweb.tribe.views.ViewListener;
37
38 /**
39  * This class defines a ReliableGroupChannelWithViews. It is built on top of a
40  * ReliableGroupChannelWithGms to which it adds view synchrony.
41  *
42  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
43  * @version 1.0
44  */

45 public class ReliableGroupChannelWithViews extends ReliableGroupChannelWithGms
46     implements
47       GroupMembershipListener
48 {
49   private View currentView;
50   private ArrayList JavaDoc listeners;
51
52   /**
53    * Creates a new <code>ReliableGroupChannelWithViews</code> object
54    *
55    * @param gms The GroupMembershipService to use
56    */

57   public ReliableGroupChannelWithViews(GroupMembershipService gms)
58   {
59     super(gms);
60     gms.registerGroupMembershipListener(this);
61     listeners = new ArrayList JavaDoc();
62   }
63
64   /**
65    * Register a new ViewListener.
66    *
67    * @param listener the listener to register
68    */

69   public void registerViewListener(ViewListener listener)
70   {
71     synchronized (listener)
72     {
73       listeners.add(listener);
74     }
75   }
76
77   /**
78    * Unregister a view ViewListener.
79    *
80    * @param listener the listener to unregister
81    */

82   public void unregisterViewListener(ViewListener listener)
83   {
84     synchronized (listener)
85     {
86       listeners.remove(listener);
87     }
88   }
89
90   //
91
// GroupMembershipListener interface
92
//
93

94   /**
95    * @see org.objectweb.tribe.gms.GroupMembershipListener#joinMember(org.objectweb.tribe.common.Member,
96    * org.objectweb.tribe.common.GroupIdentifier)
97    */

98   public void joinMember(Member m, GroupIdentifier gid)
99   {
100     // TODO Auto-generated method stub
101

102   }
103
104   /**
105    * @see org.objectweb.tribe.gms.GroupMembershipListener#quitMember(org.objectweb.tribe.common.Member,
106    * org.objectweb.tribe.common.GroupIdentifier)
107    */

108   public void quitMember(Member m, GroupIdentifier gid)
109   {
110     // TODO Auto-generated method stub
111

112   }
113
114   /**
115    * @see org.objectweb.tribe.gms.GroupMembershipListener#groupComposition(org.objectweb.tribe.common.Group,
116    * org.objectweb.tribe.common.Address)
117    */

118   public void groupComposition(Group g, Address sender)
119   {
120     // TODO Auto-generated method stub
121

122   }
123
124   /**
125    * @see org.objectweb.tribe.gms.GroupMembershipListener#failedMember(org.objectweb.tribe.common.Member,
126    * org.objectweb.tribe.common.GroupIdentifier,
127    * org.objectweb.tribe.common.Member)
128    */

129   public void failedMember(Member failed, GroupIdentifier gid, Member sender)
130   {
131     // TODO Auto-generated method stub
132

133   }
134 }
Popular Tags