restgroupsClient
Class RestGroupsClient

java.lang.Object
  extended by restgroupsClient.RestGroupsClient

public class RestGroupsClient
extends java.lang.Object

This class wraps communication with the RestGroups server in simple methods.

Author:
tkob

Constructor Summary
RestGroupsClient(java.lang.String username, java.lang.String daemonUri)
          Constructor, creates for given username simple referrer identifier.
RestGroupsClient(java.lang.String username, java.lang.String daemonUri, java.lang.String reffererIdentifier)
          Constructor.
 
Method Summary
 boolean connect()
          Creates new session for the client on the RestGroups server.
 boolean disconnect()
          Disconnects form the RestGroups server.
 void endConnectionThread()
          Ends permanent connection thread.
 boolean finishBlockingMessagesReception()
          Ends process of blocking reception of messages.
 java.lang.String getPrivateGroupName()
          Returns the client's private group name.
 boolean isConnectionThreadActive()
          Returns true if the connection with the RestGroups server is established and works properly.
 boolean joinGroup(java.lang.String groupName)
          Used for joining the group which name is given by the argument.
 boolean joinGroupOld(java.lang.String groupName)
          Deprecated. 
 boolean leaveGroup(java.lang.String groupName)
          Used for leaving the group which name is given by the argument.
 boolean leaveGroupOld(java.lang.String groupName)
          Deprecated. 
 boolean multicast(java.util.List<RestGroupsMessage> messages)
          Used for multicasting the given by the argument list of messages.
 boolean multicast(RestGroupsMessage message)
          Used for multicasting the given by the argument message.
 boolean pollForMessages(java.lang.Boolean[] waitingMessages)
          Used for checking the availability of new messages.
 boolean receiveMessages(java.util.List<RestGroupsMessage> messages)
          Used for non blocking reception of messages
 boolean receiveMessagesBlocking(java.util.List<RestGroupsMessage> messages)
          Starts process of blocking reception of messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestGroupsClient

public RestGroupsClient(java.lang.String username,
                        java.lang.String daemonUri,
                        java.lang.String reffererIdentifier)
Constructor.

Parameters:
username - the client's desired username
daemonUri - the RestGroups server URI
reffererIdentifier - the client's identifier

RestGroupsClient

public RestGroupsClient(java.lang.String username,
                        java.lang.String daemonUri)
Constructor, creates for given username simple referrer identifier.

Parameters:
username - the client's desired username
daemonUri - the RestGroups server URI
Method Detail

isConnectionThreadActive

public boolean isConnectionThreadActive()
Returns true if the connection with the RestGroups server is established and works properly.

Returns:
true if the connection with the RestGroups server is established and works properly, false otherwise

getPrivateGroupName

public java.lang.String getPrivateGroupName()
Returns the client's private group name.

Returns:
the client's private group name

connect

public boolean connect()
Creates new session for the client on the RestGroups server.

Returns:
true if creating new RestGroups session was successful, false otherwise

disconnect

public boolean disconnect()
Disconnects form the RestGroups server.

Returns:
true if disconnecting from the RestGroups server was successful, false otherwise

joinGroupOld

@Deprecated
public boolean joinGroupOld(java.lang.String groupName)
Deprecated. 


joinGroup

public boolean joinGroup(java.lang.String groupName)
Used for joining the group which name is given by the argument.

Parameters:
groupName - name of the group the client wants to join
Returns:
true if joining the new group was successful, false otherwise

leaveGroupOld

@Deprecated
public boolean leaveGroupOld(java.lang.String groupName)
Deprecated. 


leaveGroup

public boolean leaveGroup(java.lang.String groupName)
Used for leaving the group which name is given by the argument.

Parameters:
groupName - name of the group the client wants to leave
Returns:
true if leaving the group was successful, false otherwise

multicast

public boolean multicast(RestGroupsMessage message)
Used for multicasting the given by the argument message.

Parameters:
message - message to be sent
Returns:
true if multicasting the message was successful, false otherwise

multicast

public boolean multicast(java.util.List<RestGroupsMessage> messages)
Used for multicasting the given by the argument list of messages.

Parameters:
messages - list of messages to be sent
Returns:
true if multicasting of the messages was successful, false otherwise

pollForMessages

public boolean pollForMessages(java.lang.Boolean[] waitingMessages)
Used for checking the availability of new messages.

Parameters:
waitingMessages - used for passing the information about availability of new messages
Returns:
true if checking the availability of new messages was successful, false otherwise

receiveMessages

public boolean receiveMessages(java.util.List<RestGroupsMessage> messages)
Used for non blocking reception of messages

Parameters:
messages - an empty list of messages
Returns:
true if reception of new messages was successful, false otherwise

receiveMessagesBlocking

public boolean receiveMessagesBlocking(java.util.List<RestGroupsMessage> messages)
Starts process of blocking reception of messages.

Parameters:
messages - an empty list of messages
Returns:
true if reception of messages was successful, false otherwise

finishBlockingMessagesReception

public boolean finishBlockingMessagesReception()
Ends process of blocking reception of messages.

Returns:
true if ending process of blocking reception of messages was successful, false otherwise

endConnectionThread

public void endConnectionThread()
Ends permanent connection thread.