restgroupsServer
Class BaseResource

java.lang.Object
  extended by org.restlet.resource.UniformResource
      extended by org.restlet.resource.ServerResource
          extended by restgroupsServer.BaseResource
Direct Known Subclasses:
GroupMembershipResource, MailboxBlockingResource, MailboxNonBlockingResource, MailboxPollResource, MessageMulticastResource, MessageUnicastResource, ProfileResource, ProfilesPilotResource

public class BaseResource
extends org.restlet.resource.ServerResource

Every time a client who is already registered in the RestGroups sends a request (i.e. he wants to check for messages), appropriate data structures are pulled out. The client is identified by a token which is passed with the requests cookies.

Author:
tkob

Field Summary
protected  ProfileEntity mySession
           
 
Constructor Summary
BaseResource()
           
 
Method Summary
 void doInit()
          Pulls out from the request the session cookie holding identifier of the client.
protected  GcsFactory getFactory()
          Returns a factory for gcs objects.
protected  java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> getProfileEntities()
          Returns profileEntities hash-map from the main application.
protected  java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> getProfileEntitiesThreadIDs()
          Returns profileEntitiesThreadIDs hash-map from the main application.
protected  java.util.concurrent.ConcurrentMap<java.lang.String,ProfilesPilotEntity> getProfilesPilotEntities()
          Returns profilesPilotEntities hash-map from the main application.
protected  java.lang.String getRequestSessionId()
          Retrieves sessionId from the requests cookie.
protected  void printProfileEntities()
          Prints the content of the profileEntities hash-table.
protected  void printProfilesPilotEntities()
          Prints the content of the profilesPilotEntities.
protected  void setResponseSessionId(java.lang.String sessionToken)
          Sets given by the argument sessionId as the responses cookie.
 
Methods inherited from class org.restlet.resource.ServerResource
delete, delete, describeVariants, doConditionalHandle, doHandle, doHandle, doNegotiatedHandle, get, get, getConverterService, getInfo, getInfo, getMetadataService, getPreferredVariant, getVariants, handle, head, head, isAnnotated, isConditional, isExisting, isInRole, isNegotiated, options, options, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setChallengeRequests, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, setNegotiated, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
 
Methods inherited from class org.restlet.resource.UniformResource
doCatch, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getContext, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMethod, getOriginalRef, getProtocol, getQuery, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestEntity, getResponse, getResponseAttributes, getResponseEntity, getRootRef, getServerInfo, getStatus, init, isConfidential, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySession

protected ProfileEntity mySession
Constructor Detail

BaseResource

public BaseResource()
Method Detail

getProfileEntities

protected java.util.concurrent.ConcurrentMap<java.lang.String,ProfileEntity> getProfileEntities()
Returns profileEntities hash-map from the main application.

Returns:
profileEntities hash-map

getProfileEntitiesThreadIDs

protected java.util.concurrent.ConcurrentMap<java.lang.Long,ProfileEntity> getProfileEntitiesThreadIDs()
Returns profileEntitiesThreadIDs hash-map from the main application.

Returns:
profileEntitiesThreadIDs hash-map

getProfilesPilotEntities

protected java.util.concurrent.ConcurrentMap<java.lang.String,ProfilesPilotEntity> getProfilesPilotEntities()
Returns profilesPilotEntities hash-map from the main application.

Returns:
profilesPilotEntities hash-map

getFactory

protected GcsFactory getFactory()
Returns a factory for gcs objects.

Returns:
a factory for gcs objects

getRequestSessionId

protected java.lang.String getRequestSessionId()
Retrieves sessionId from the requests cookie.

Returns:
sessionId from the requests cookie

setResponseSessionId

protected void setResponseSessionId(java.lang.String sessionToken)
Sets given by the argument sessionId as the responses cookie.

Parameters:
sessionToken - sessionId to be set as the responses cookie

doInit

public void doInit()
Pulls out from the request the session cookie holding identifier of the client. If the client has already been registered in the RestGroups, ProfileEntity object concerning this client is retrieved and assigned to the mySession variable. Otherwise null is assigned to the mySession variable.

Overrides:
doInit in class org.restlet.resource.UniformResource

printProfileEntities

protected void printProfileEntities()
Prints the content of the profileEntities hash-table. For debugging purposes.


printProfilesPilotEntities

protected void printProfilesPilotEntities()
Prints the content of the profilesPilotEntities. For debugging purposes.