KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > buddyreplication > BuddyGroup


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.buddyreplication;
8
9 import org.jgroups.Address;
10
11 import java.io.Serializable JavaDoc;
12 import java.util.List JavaDoc;
13 import java.util.Vector JavaDoc;
14
15 /**
16  * Value object that represents a buddy group
17  *
18  * @author <a HREF="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
19  */

20 public class BuddyGroup implements Serializable JavaDoc //Externalizable
21
{
22    /**
23     * Serial version.
24     */

25    private static final long serialVersionUID = 5391883716108410301L;
26
27    private String JavaDoc groupName;
28
29    private Address dataOwner;
30
31    /**
32     * Vector<Address> - a list of JGroups addresses
33     */

34    List JavaDoc<Address> buddies = new Vector JavaDoc<Address>();//Collections.synchronizedList(new ArrayList());
35

36    // List buddies = new ArrayList();
37

38    public String JavaDoc getGroupName()
39    {
40       return groupName;
41    }
42
43    public void setGroupName(String JavaDoc groupName)
44    {
45       this.groupName = groupName;
46    }
47
48    public Address getDataOwner()
49    {
50       return dataOwner;
51    }
52
53    public void setDataOwner(Address dataOwner)
54    {
55       this.dataOwner = dataOwner;
56    }
57
58    public List JavaDoc<Address> getBuddies()
59    {
60       return buddies;
61    }
62
63    public void setBuddies(List JavaDoc<Address> buddies)
64    {
65       this.buddies = buddies;
66    }
67
68    // public void writeExternal(ObjectOutput out) throws IOException
69
// {
70
// out.writeObject(groupName);
71
// out.writeObject(dataOwner);
72
// out.writeObject(buddies);
73
// }
74
//
75
// public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
76
// {
77
// groupName = (String) in.readObject();
78
// dataOwner = (IpAddress) in.readObject();
79
// buddies = (List) in.readObject();
80
// }
81

82    public String JavaDoc toString()
83    {
84       StringBuffer JavaDoc b = new StringBuffer JavaDoc("BuddyGroup: (");
85       b.append("dataOwner: ").append(dataOwner).append(", ");
86       b.append("groupName: ").append(groupName).append(", ");
87       b.append("buddies: ").append(buddies).append(")");
88       return b.toString();
89    }
90
91 }
92
Popular Tags