|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgcs.GcsConnection
gcsImplementations.spreadGcs.SpreadGcsConnection
public class SpreadGcsConnection
Spread back-end implementation of the GcsConnection.
GcsConnection| Constructor Summary | |
|---|---|
SpreadGcsConnection()
|
|
| Method Summary | |
|---|---|
void |
add(GcsAdvancedMessageListener listener)
Sets up the GcsAdvancedMessageListener listener. |
void |
add(GcsBasicMessageListener listener)
Sets up the GcsBasicMessageListener listener. |
void |
connect(GcsSettings settings,
java.lang.String privateName,
boolean priority,
boolean groupMembership)
Allows connecting to the RestGroups server. |
void |
disconnect()
Allows disconnecting from the RestGroups server. |
GcsGroup |
getPrivateGroup()
Returns the GcsGroup object representing the private group for
this connection. |
void |
multicast(GcsMessage message)
Sends the message encapsulated in the GcsMessage object to groups
specified in this object. |
void |
multicast(GcsMessage[] messages)
Sends multiple messages encapsulated in the GcsMessage objects to
groups specified inside those objects. |
boolean |
poll()
Checks for unread messages for this connection. |
GcsMessage |
receive()
Returns next unread message for this connection if available. |
GcsMessage[] |
receive(int numMessages)
Returns next numMessages for this connection if available. |
void |
remove(GcsAdvancedMessageListener listener)
Deactivates the GcsAdvancedMessageListener listener for this
connection. |
void |
remove(GcsBasicMessageListener listener)
Deactivates the GcsBasicMessageListener listener for this
connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SpreadGcsConnection()
| Method Detail |
|---|
public void add(GcsAdvancedMessageListener listener)
throws GcsException
GcsConnectionGcsAdvancedMessageListener listener. Once it is done,
every time a membership or regular message is received
GcsAdvancedMessageListener.membershipMessageReceived(GcsMessage)
or GcsAdvancedMessageListener.regularMessageReceived(GcsMessage)
method is called, respectively.
add in class GcsConnectionlistener - object implementing the GcsAdvancedMessageListener
interface
GcsExceptionGcsConnection.remove(GcsAdvancedMessageListener)
public void add(GcsBasicMessageListener listener)
throws GcsException
GcsConnectionGcsBasicMessageListener listener. Once it is done,
every time a regular message is received,
GcsBasicMessageListener.messageReceived(GcsMessage) method is
called. Membership messages are omitted.
add in class GcsConnectionlistener - object implementing the GcsBasicMessageListener
interface
GcsExceptionGcsConnection.remove(GcsBasicMessageListener)
public void connect(GcsSettings settings,
java.lang.String privateName,
boolean priority,
boolean groupMembership)
throws GcsException
GcsConnection
connect in class GcsConnectionsettings - stores parameters concerning the RestGroups serverprivateName - name describing this connections userpriority - defines if this is a priority connectiongroupMembership - defines if the membership messages are being received on this
connection
GcsException - if the connection could not be established
public void disconnect()
throws GcsException
GcsConnection
disconnect in class GcsConnectionGcsException - if difficulties during disconnecting from the RestGroups
server were encountered or the connection has not been
established
public GcsGroup getPrivateGroup()
throws GcsException
GcsConnectionGcsGroup object representing the private group for
this connection.
getPrivateGroup in class GcsConnectionGcsException
public void multicast(GcsMessage message)
throws GcsException
GcsConnectionGcsMessage object to groups
specified in this object.
multicast in class GcsConnectionmessage - a message to be send
GcsException - if errors were encountered during sending the message or the
connection is broken
public void multicast(GcsMessage[] messages)
throws GcsException
GcsConnectionGcsMessage objects to
groups specified inside those objects.
multicast in class GcsConnectionmessages - array of messages to be send
GcsException - if errors were encountered during sending the messages or the
connection is broken
public boolean poll()
throws GcsException
GcsConnection
poll in class GcsConnectionGcsException - if errors were encountered during checking for new messages
or the connection is broken
public GcsMessage receive()
throws GcsException,
java.io.InterruptedIOException
GcsConnection
receive in class GcsConnectionGcsException - if errors were encountered during reception of the message or
the connection is broken
java.io.InterruptedIOException
public GcsMessage[] receive(int numMessages)
throws GcsException,
java.io.InterruptedIOException
GcsConnection
receive in class GcsConnectionnumMessages - number of messages to be returned
GcsException - if errors were encountered during reception of the messages
or the connection is broken
java.io.InterruptedIOException
public void remove(GcsAdvancedMessageListener listener)
throws GcsException
GcsConnectionGcsAdvancedMessageListener listener for this
connection. Once its done, both membership and regular messages will be
stored on the server until the listener will be setup again or method
GcsConnection.receive() (GcsConnection.receive(int)) called.
remove in class GcsConnectionlistener - the listener to be removed from this connection
GcsException - if errors were encountered during removal of the listener or
if it was never set up.GcsConnection.add(GcsAdvancedMessageListener)
public void remove(GcsBasicMessageListener listener)
throws GcsException
GcsConnectionGcsBasicMessageListener listener for this
connection. Once its done, regular messages will be stored on the server
until the listener will be setup again or method (GcsConnection.receive() (
GcsConnection.receive(int)) called.
remove in class GcsConnectionlistener - the listener to be removed from this connection
GcsException - if errors were encountered during removal of the listener or
if it was never set up.GcsConnection.add(GcsBasicMessageListener)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||