org.hackystat.dailyprojectdata.resource.cache
Class CacheResource

java.lang.Object
  extended by org.restlet.Handler
      extended by org.restlet.resource.Resource
          extended by org.hackystat.dailyprojectdata.resource.dailyprojectdata.DailyProjectDataResource
              extended by org.hackystat.dailyprojectdata.resource.cache.CacheResource

public class CacheResource
extends DailyProjectDataResource

This resource responds to requests of form:

DELETE {host}/cache
This one clears all entries associated with the authorized user; in other words, all projects that this user owns will have any cached DPDs removed.

It also responds to

DELETE {host}/cache/{user}/{project}
This one clears only those cached DPD instances for the specified project owned by that user. In this case, the authorized user must be in the project specified by (project, user).

Author:
Philip Johnson

Field Summary
 
Fields inherited from class org.hackystat.dailyprojectdata.resource.dailyprojectdata.DailyProjectDataResource
authUser, badAuth, project, requestStartTime, server, timestamp, uriString, uriUser
 
Constructor Summary
CacheResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
          The default constructor.
 
Method Summary
 boolean allowDelete()
          Indicate the DELETE method is supported.
 boolean allowGet()
          Indicate that GET is not supported.
 void removeRepresentations()
          Returns 200 if cache delete command succeeded.
 org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
          Get is not supported, but the method must be implemented.
 
Methods inherited from class org.hackystat.dailyprojectdata.resource.dailyprojectdata.DailyProjectDataResource
getSensorBaseClient, getStringRepresentation, logRequest, logRequest, setStatusError, setStatusError
 
Methods inherited from class org.restlet.resource.Resource
acceptRepresentation, allowPost, allowPut, delete, getPreferredRepresentation, getPreferredVariant, getRepresentation, getVariants, handleDelete, handleGet, handlePost, handlePut, init, isAvailable, isModifiable, isNegotiateContent, isReadable, post, put, represent, setAvailable, setModifiable, setNegotiateContent, setReadable, setVariants, storeRepresentation
 
Methods inherited from class org.restlet.Handler
allowHead, allowOptions, generateRef, getAllowedMethods, getApplication, getContext, getLogger, getMatrix, getQuery, getRequest, getResponse, handleHead, handleOptions, setContext, setRequest, setResponse, updateAllowedMethods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheResource

public CacheResource(org.restlet.Context context,
                     org.restlet.data.Request request,
                     org.restlet.data.Response response)
The default constructor.

Parameters:
context - The context.
request - The request.
response - The response.
Method Detail

removeRepresentations

public void removeRepresentations()
Returns 200 if cache delete command succeeded. If deleting the entire cache, then the authUser must be the UriUser. If deleting a project cache, then the authUser must be in the project identified by UriUser and project.

Overrides:
removeRepresentations in class org.restlet.resource.Resource

allowDelete

public boolean allowDelete()
Indicate the DELETE method is supported.

Overrides:
allowDelete in class org.restlet.resource.Resource
Returns:
True.

allowGet

public boolean allowGet()
Indicate that GET is not supported.

Overrides:
allowGet in class org.restlet.resource.Resource
Returns:
False.

represent

public org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
Get is not supported, but the method must be implemented.

Specified by:
represent in class DailyProjectDataResource
Parameters:
variant - Ignored.
Returns:
Null.