org.hackystat.dailyprojectdata.resource.dailyprojectdata
Class DailyProjectDataResource

java.lang.Object
  extended by org.restlet.Handler
      extended by org.restlet.resource.Resource
          extended by org.hackystat.dailyprojectdata.resource.dailyprojectdata.DailyProjectDataResource
Direct Known Subclasses:
BuildResource, CacheResource, CodeIssueResource, CommitResource, ComplexityResource, CouplingResource, CoverageResource, DevTimeResource, FileMetricResource, IssueChangeResource, IssueResource, PingResource, UnitTestResource

public abstract class DailyProjectDataResource
extends org.restlet.resource.Resource

An abstract superclass for all DailyProjectData resources that supplies common initialization processing. This includes:

Author:
Philip Johnson

Field Summary
protected  java.lang.String authUser
          The authenticated user, retrieved from the ChallengeResponse, or null.
protected  java.lang.String badAuth
          The standard error message returned from invalid authentication.
protected  java.lang.String project
          To be retrieved from the URL as the 'project' template parameter, or null.
protected  long requestStartTime
          Records the time at which each HTTP request was initiated.
protected  Server server
          The server.
protected  java.lang.String timestamp
          To be retrieved from the URL as the 'timestamp' template parameter, or null.
protected  java.lang.String uriString
           
protected  java.lang.String uriUser
          To be retrieved from the URL as the 'email' template parameter, or null.
 
Constructor Summary
DailyProjectDataResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
          Provides the following representational variants: TEXT_XML.
 
Method Summary
 org.hackystat.sensorbase.client.SensorBaseClient getSensorBaseClient()
          Returns a SensorBaseClient instance associated with the User in this request.
 org.restlet.resource.StringRepresentation getStringRepresentation(java.lang.String xmlData)
          Creates and returns a new Restlet StringRepresentation built from xmlData.
protected  void logRequest(java.lang.String requestType)
          Generates a log message indicating the type of request, the elapsed time required, the user who requested the data, and the day.
protected  void logRequest(java.lang.String requestType, java.lang.String... optionalParams)
          Generates a log message indicating the type of request, the elapsed time required, the user who requested the data, and the day.
abstract  org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
          The Restlet getRepresentation method which must be overridden by all concrete Resources.
protected  void setStatusError(java.lang.String msg)
          Called when an error resulting from an exception is caught during processing.
protected  void setStatusError(java.lang.String msg, java.lang.Exception e)
          Called when an error resulting from an exception is caught during processing.
 
Methods inherited from class org.restlet.resource.Resource
acceptRepresentation, allowDelete, allowGet, allowPost, allowPut, delete, getPreferredRepresentation, getPreferredVariant, getRepresentation, getVariants, handleDelete, handleGet, handlePost, handlePut, init, isAvailable, isModifiable, isNegotiateContent, isReadable, post, put, removeRepresentations, 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
 

Field Detail

uriUser

protected java.lang.String uriUser
To be retrieved from the URL as the 'email' template parameter, or null.


project

protected java.lang.String project
To be retrieved from the URL as the 'project' template parameter, or null.


timestamp

protected java.lang.String timestamp
To be retrieved from the URL as the 'timestamp' template parameter, or null.


authUser

protected java.lang.String authUser
The authenticated user, retrieved from the ChallengeResponse, or null.


server

protected Server server
The server.


badAuth

protected java.lang.String badAuth
The standard error message returned from invalid authentication.


requestStartTime

protected long requestStartTime
Records the time at which each HTTP request was initiated.


uriString

protected java.lang.String uriString
Constructor Detail

DailyProjectDataResource

public DailyProjectDataResource(org.restlet.Context context,
                                org.restlet.data.Request request,
                                org.restlet.data.Response response)
Provides the following representational variants: TEXT_XML.

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

represent

public abstract org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
The Restlet getRepresentation method which must be overridden by all concrete Resources.

Overrides:
represent in class org.restlet.resource.Resource
Parameters:
variant - The variant requested.
Returns:
The Representation.

getStringRepresentation

public org.restlet.resource.StringRepresentation getStringRepresentation(java.lang.String xmlData)
Creates and returns a new Restlet StringRepresentation built from xmlData. The xmlData will be prefixed with a processing instruction indicating UTF-8 and version 1.0.

Parameters:
xmlData - The xml data as a string.
Returns:
A StringRepresentation of that xmldata.

getSensorBaseClient

public org.hackystat.sensorbase.client.SensorBaseClient getSensorBaseClient()
Returns a SensorBaseClient instance associated with the User in this request.

Returns:
The SensorBaseClient instance.

logRequest

protected void logRequest(java.lang.String requestType)
Generates a log message indicating the type of request, the elapsed time required, the user who requested the data, and the day.

Parameters:
requestType - The type of DPD request, such as "Commit", "FileMetric", etc.

logRequest

protected void logRequest(java.lang.String requestType,
                          java.lang.String... optionalParams)
Generates a log message indicating the type of request, the elapsed time required, the user who requested the data, and the day.

Parameters:
requestType - The type of DPD request, such as "Commit", "FileMetric", etc.
optionalParams - Any additional parameters to the request.

setStatusError

protected void setStatusError(java.lang.String msg,
                              java.lang.Exception e)
Called when an error resulting from an exception is caught during processing.

Parameters:
msg - A description of the error.
e - A chained exception.

setStatusError

protected void setStatusError(java.lang.String msg)
Called when an error resulting from an exception is caught during processing.

Parameters:
msg - A description of the error.