|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Handler
org.restlet.resource.Resource
org.hackystat.sensorbase.resource.sensorbase.SensorBaseResource
public abstract class SensorBaseResource
An abstract superclass for all SensorBase resources that supplies common initialization and validation processing.
Initialization processing includes:
Validation processing involves a set of "validated" methods. These check the values of various parameters in the request, potentially initializing instance variables as a result. If the validation process fails, these methods set the Restlet Status value appropriately and return false.
Field Summary | |
---|---|
protected java.lang.String |
authUser
The authenticated user, retrieved from the ChallengeResponse, or null. |
protected Project |
project
The project corresponding to the projectName, or null. |
protected ProjectManager |
projectManager
The ProjectManager. |
protected java.lang.String |
projectName
The projectName found within the URL string, or null. |
protected java.lang.String |
responseMsg
Everyone generally wants to create one of these, so declare it here. |
protected SdtManager |
sdtManager
The SdtManager. |
protected SensorDataManager |
sensorDataManager
The SensorDataManager. |
protected Server |
server
The server. |
protected java.lang.String |
uriUser
To be retrieved from the URL as the 'user' template parameter, or null. |
protected User |
user
The user instance corresponding to the user indicated in the URI string, or null. |
protected UserManager |
userManager
The UserManager. |
Constructor Summary | |
---|---|
SensorBaseResource(org.restlet.Context context,
org.restlet.data.Request request,
org.restlet.data.Response response)
Provides the following representational variants: TEXT_XML. |
Method Summary | |
---|---|
static org.restlet.resource.StringRepresentation |
getStringRepresentation(java.lang.String xmlData)
Creates and returns a new Restlet StringRepresentation built from xmlData. |
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 |
setStatusBadTimestamp(java.lang.String timestamp)
Called when an exception is caught while processing a request. |
protected void |
setStatusInternalError(java.lang.Exception e)
Called when an exception is caught while processing a request. |
protected void |
setStatusMiscError(java.lang.String msg)
Called when a miscellaneous "one off" error is caught during processing. |
protected boolean |
validateAuthUserIsAdmin()
Returns true if the authorized user is the administrator. |
protected boolean |
validateAuthUserIsAdminOrUriUser()
Returns true if the authorized user is either the admin or user in the URI string. |
protected boolean |
validateProjectOwner()
Returns true if the authorized user is the owner of the project in the URL string. |
protected boolean |
validateProjectViewer()
Returns true if the authorized user can view the project definition. |
protected boolean |
validateUriProjectName()
Returns true if the project name in the URI string is defined in the ProjectManager. |
protected boolean |
validateUriUserIsUser()
Returns true if the user in the URI string is defined in the UserManager. |
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 |
---|
protected java.lang.String authUser
protected java.lang.String uriUser
protected User user
protected java.lang.String projectName
protected Project project
protected ProjectManager projectManager
protected UserManager userManager
protected SdtManager sdtManager
protected SensorDataManager sensorDataManager
protected Server server
protected java.lang.String responseMsg
Constructor Detail |
---|
public SensorBaseResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
context
- The context.request
- The request object.response
- The response object.Method Detail |
---|
public abstract org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
represent
in class org.restlet.resource.Resource
variant
- The variant requested.
public static org.restlet.resource.StringRepresentation getStringRepresentation(java.lang.String xmlData)
xmlData
- The xml data as a string.
protected boolean validateAuthUserIsAdmin()
protected boolean validateUriUserIsUser()
protected boolean validateUriProjectName()
protected boolean validateProjectOwner()
protected boolean validateAuthUserIsAdminOrUriUser()
protected boolean validateProjectViewer()
protected void setStatusBadTimestamp(java.lang.String timestamp)
timestamp
- The timestamp that could not be parsed.protected void setStatusInternalError(java.lang.Exception e)
e
- The exception that was caught.protected void setStatusMiscError(java.lang.String msg)
msg
- A description of the error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |