com.ibm.agletx.patterns
Class Meeting

java.lang.Object
  extended bycom.ibm.agletx.patterns.Meeting
All Implemented Interfaces:
java.io.Serializable

public final class Meeting
extends java.lang.Object
implements java.io.Serializable

This Meeting class abstracts light synchronization between multiple aglets by using a meeting concept. A meeting is established by creating a meeting object and distribute it among the aglets which suppose to participate in the meeting. A meeting object includes:
1. the meeting place (URL)
2. a meeting identifier
3. an optional list of agletIDs, named colleagues, of aglets which are expected to be presented at the meeting place
4. an optional object (named attachedInfo) describing additional information regarding the meeting (e.g. list or number of participants, minimum number of required participants).

Upon arrival to the meeting, an aglet notifies its arrival via the ready method. As a result all aglets already presented are notified of its arrival by receiving a special message (its kind is that of the meeting ID) with the agletID of this newly arrived aglet.

Version:
1.0 96/12/28
Author:
Yariv Aridor
See Also:
Serialized Form

Field Summary
private  java.util.Vector _colleagues
           
private  java.lang.String _id
           
private  java.lang.Object _info
           
private  java.lang.String _place
           
 
Constructor Summary
Meeting(java.lang.String place)
          A Constructor
Meeting(java.lang.String place, java.util.Vector colleagues)
          A Constructor
 
Method Summary
private  java.util.Vector append(java.util.Vector v1, java.util.Vector v2)
           
private  void checkColleagues(java.util.Vector c)
           
private  void checkColleaguesArePresent(AgletContext ctx, java.util.Vector c)
           
 java.lang.Object getAttachedInfo()
           
private  java.net.URL getHostingURL(AgletContext ctx)
           
 java.lang.String getID()
           
 java.lang.String getPlace()
           
 java.util.Enumeration ready(Aglet ag)
          Accepts an aglet to a meeting.
private static java.util.Vector ready0(AgletID aid, AgletContext ctx, java.lang.String id, Aglet ag)
           
 void setAttachedInfo(java.lang.Object obj)
           
 void setColleagues(java.util.Vector colleagues)
           
 void setID(java.lang.String id)
           
private static java.util.Vector toVector(ReplySet rs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_id

private java.lang.String _id

_place

private java.lang.String _place

_colleagues

private java.util.Vector _colleagues

_info

private java.lang.Object _info
Constructor Detail

Meeting

public Meeting(java.lang.String place)
A Constructor

Parameters:
place - the meeting place.

Meeting

public Meeting(java.lang.String place,
               java.util.Vector colleagues)
        throws AgletException
A Constructor

Parameters:
place - the meeting place.
colleagues - the colleagues
Throws:
AgletException - if colleagues is invalid (should include only AgletID objects)
Method Detail

append

private java.util.Vector append(java.util.Vector v1,
                                java.util.Vector v2)

checkColleagues

private void checkColleagues(java.util.Vector c)
                      throws AgletException
Throws:
AgletException

checkColleaguesArePresent

private void checkColleaguesArePresent(AgletContext ctx,
                                       java.util.Vector c)
                                throws AgletException
Throws:
AgletException

getAttachedInfo

public java.lang.Object getAttachedInfo()

getHostingURL

private java.net.URL getHostingURL(AgletContext ctx)

getID

public java.lang.String getID()

getPlace

public java.lang.String getPlace()

ready

public java.util.Enumeration ready(Aglet ag)
                            throws AgletException
Accepts an aglet to a meeting.

Returns:
enumeration of the agletID of all presented aglets.
Throws:
AgletException - if wrong meeting place or if any of the colleagues is not presented.

ready0

private static java.util.Vector ready0(AgletID aid,
                                       AgletContext ctx,
                                       java.lang.String id,
                                       Aglet ag)
                                throws AgletException
Throws:
AgletException

setAttachedInfo

public void setAttachedInfo(java.lang.Object obj)

setColleagues

public void setColleagues(java.util.Vector colleagues)
                   throws AgletException
Throws:
AgletException

setID

public void setID(java.lang.String id)

toVector

private static java.util.Vector toVector(ReplySet rs)
                                  throws AgletException
Throws:
AgletException