restgroupsServer
Class ProfileEntity

java.lang.Object
  extended by restgroupsServer.ProfileEntity

public class ProfileEntity
extends java.lang.Object

For each correctly connected client an object of this class is created. All information about the client (user name, identifier, sessionId) as well as group communication system session objects are stored within this class.

Author:
tkob

Constructor Summary
ProfileEntity(java.util.UUID sessionId, java.lang.String username, java.lang.String identifier, java.lang.Boolean groupMembership, java.lang.Boolean priority, long connectionThreadID)
          The constructor of the class.
 
Method Summary
 void disconnectFromGcs()
          Disconnects the client from the group communication system.
 GcsConnection getConnection()
          Returns the connection object.
 long getConnectionThreadID()
          Returns the clients connectionThreadId.
 boolean getGroupMembership()
          Returns the clients groupMembership.
 java.util.Map<java.lang.String,GcsGroup> getGroups()
          Returns the map of gcs groups.
 java.lang.String getIdentifier()
          Returns the clients identifier.
 GcsMessageListener getMessageListener()
          Returns the clients messageListener.
 ProfileResourceReturnRepresentation getReturnRepresentationReference()
          Returns the client returnRepresentationReference.
 java.util.UUID getSessionId()
          Returns the clients sessionId.
 java.lang.String getUsername()
          Return the clients username.
 void setConnection(GcsConnection connection)
          Sets the clients connection object.
 void setConnectionThreadID(long connectionThreadID)
          Sets the clients connectionThreadId.
 void setGroupMembership(boolean groupMembership)
          Sets the clients groupMembership.
 void setGroups(java.util.Map<java.lang.String,GcsGroup> groups)
          Sets the new map of gcs groups.
 void setIdentifier(java.lang.String identifier)
          Sets the client identifier.
 void setMessageListener(GcsMessageListener messageListener)
          Sets the clients messagesListener
 void setReturnRepresentationReference(ProfileResourceReturnRepresentation returnRepresentationReference)
          Sets the clients returnRepresentationReference.
 void setSessionId(java.util.UUID sessionId)
          Sets the clients sessionId.
 void setUsername(java.lang.String username)
          Sets the clients username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileEntity

public ProfileEntity(java.util.UUID sessionId,
                     java.lang.String username,
                     java.lang.String identifier,
                     java.lang.Boolean groupMembership,
                     java.lang.Boolean priority,
                     long connectionThreadID)
              throws GcsException
The constructor of the class. Is called in the ProfileResource.createProfile(org.restlet.representation.Representation) method. This constructor calls the connectToGcs() method.

Parameters:
sessionId - clients sessionId
username - clients username
identifier - clients identifier
groupMembership - true if the client wants to receive membership messages
priority - determines whether the client wants to established priority connection with the group communication system
connectionThreadID - ID of the thread used for checking if the client is alive
Throws:
GcsException - if the group communication system session for the client could not be established
Method Detail

disconnectFromGcs

public void disconnectFromGcs()
                       throws GcsException
Disconnects the client from the group communication system. If the client has been receiving messages through blocking connection ( MailboxBlockingResource.retrieveMessages()), the listener is deactivated.

Throws:
GcsException

setConnection

public void setConnection(GcsConnection connection)
Sets the clients connection object.

Parameters:
connection - new connection object

getConnection

public GcsConnection getConnection()
Returns the connection object.

Returns:
the connection object

setGroups

public void setGroups(java.util.Map<java.lang.String,GcsGroup> groups)
Sets the new map of gcs groups.

Parameters:
groups - new map if gcs groups

getGroups

public java.util.Map<java.lang.String,GcsGroup> getGroups()
Returns the map of gcs groups.

Returns:
the map of gcs groups

setIdentifier

public void setIdentifier(java.lang.String identifier)
Sets the client identifier.

Parameters:
identifier - the clients new identifier

getIdentifier

public java.lang.String getIdentifier()
Returns the clients identifier.

Returns:
the clients new identifier

setSessionId

public void setSessionId(java.util.UUID sessionId)
Sets the clients sessionId.

Parameters:
sessionId - the clients new sessionId

getSessionId

public java.util.UUID getSessionId()
Returns the clients sessionId.

Returns:
the clients new sessionId

setUsername

public void setUsername(java.lang.String username)
Sets the clients username.

Parameters:
username - the clients new username

getUsername

public java.lang.String getUsername()
Return the clients username.

Returns:
the clients username

setConnectionThreadID

public void setConnectionThreadID(long connectionThreadID)
Sets the clients connectionThreadId.

Parameters:
connectionThreadID - the clients new connectionThreadId

getConnectionThreadID

public long getConnectionThreadID()
Returns the clients connectionThreadId.

Returns:
the clients connectionThreadId

setGroupMembership

public void setGroupMembership(boolean groupMembership)
Sets the clients groupMembership.

Parameters:
groupMembership - the clients new groupMembership

getGroupMembership

public boolean getGroupMembership()
Returns the clients groupMembership.

Returns:
the clients groupMembership

setMessageListener

public void setMessageListener(GcsMessageListener messageListener)
Sets the clients messagesListener

Parameters:
messageListener - the clients new messageListener

getMessageListener

public GcsMessageListener getMessageListener()
Returns the clients messageListener.

Returns:
the clients messageListener

setReturnRepresentationReference

public void setReturnRepresentationReference(ProfileResourceReturnRepresentation returnRepresentationReference)
Sets the clients returnRepresentationReference.

Parameters:
returnRepresentationReference - the clients returnRepresentationReference

getReturnRepresentationReference

public ProfileResourceReturnRepresentation getReturnRepresentationReference()
Returns the client returnRepresentationReference.

Returns:
the client returnRepresentationReference