restgroupsServer
Class ProfileResource

java.lang.Object
  extended by org.restlet.resource.UniformResource
      extended by org.restlet.resource.ServerResource
          extended by restgroupsServer.BaseResource
              extended by restgroupsServer.ProfileResource

public class ProfileResource
extends BaseResource

This class handles operations executed on the "/groups/{privateGroupName}" resource. The POST createProfile(Representation) method is used for creating new clients session. {privateGroupName} is a profile name suggested by the client. The client sends the DELETE request (removeProfile() method) if he wants to disconnect from the RestGroups.

Author:
tkob

Field Summary
 
Fields inherited from class restgroupsServer.BaseResource
mySession
 
Constructor Summary
ProfileResource()
           
 
Method Summary
 org.restlet.representation.Representation createProfile(org.restlet.representation.Representation entity)
          The client who wants to connect to the RestGroups server sends two requests: one temporary (see ProfilesPilotResource), and one permanent - POST request to this resource ( createProfile(Representation)).
 void removeProfile()
          This DELETE method is used if the client wants to disconnect from the server.
 
Methods inherited from class restgroupsServer.BaseResource
doInit, getFactory, getProfileEntities, getProfileEntitiesThreadIDs, getProfilesPilotEntities, getRequestSessionId, printProfileEntities, printProfilesPilotEntities, setResponseSessionId
 
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
 

Constructor Detail

ProfileResource

public ProfileResource()
Method Detail

createProfile

@Post
public org.restlet.representation.Representation createProfile(org.restlet.representation.Representation entity)
                                                        throws java.io.IOException
The client who wants to connect to the RestGroups server sends two requests: one temporary (see ProfilesPilotResource), and one permanent - POST request to this resource ( createProfile(Representation)). Both requests should not be separated in time by more than 5 seconds. Calling this POST method appropriate data structures are created and group communication system session set up. Then if the temporary request hasn't been issued yet, processing of this method is suspended until it arrives or the timeout is reached. The status of the response for the temporary request indicates whether connecting to the group communication system was successful. This method returns an ProfileResourceReturnRepresentation instance, which is necessary for detecting client disconnection. If the timeout was reached or connecting to the group communication system ended with failure, an error is returned.

The body of the POST request contains XML document with information about the client. The structure of the XML document is defined in the schemas/profileMessage.xsd schema file.

Parameters:
entity - a XML document with information about the client
Returns:
an instance of ProfileResourceReturnRepresentation if connecting to the group communication system was successful, error otherwise
Throws:
java.io.IOException

removeProfile

@Delete
public void removeProfile()
This DELETE method is used if the client wants to disconnect from the server.