public abstract class ModelDataService extends java.lang.Object implements ModelDataServiceConstants
import csip.ModelDataService; @Path("m/myservice/1.0") public class MyService extends ModelDataService { public void doProcess() { // service implementation. } }
Modifier and Type | Field and Description |
---|---|
protected SessionLogger |
LOG |
csip.ModelDataService.Task |
mt |
ARCHIVED, ASYNC, CANCELED, DENIED, ERROR, FAILED, FINISHED, FORM_PARAM, GEOMETRY, HEADER_REQUEST_FILE, HEADER_WEBHOOK, IN, INTENT, KEY_ARCHIVE, KEY_CLOUD_NODE, KEY_COORDINATES, KEY_COSU, KEY_CPU_TIME, KEY_DATA, KEY_DESC, KEY_EXPIRATION_DATE, KEY_FIRST_POLL, KEY_KEEP_RESULTS, KEY_LOG, KEY_METAINFO, KEY_MODE, KEY_NAME, KEY_NEXT_POLL, KEY_OF, KEY_PARAMETER, KEY_PARAMETERSETS, KEY_PATH, KEY_PROGRESS, KEY_REPORT, KEY_REQ_IP, KEY_REQUEST_FILE, KEY_REQUEST_RESULTS, KEY_RESULT, KEY_SERVICE_URL, KEY_STATUS, KEY_SUUID, KEY_TSTAMP, KEY_TYPE, KEY_TZ, KEY_UNIT, KEY_URL, KEY_VALUE, KEY_WEBHOOK, LOG_FILE, MAX, MIN, OK, OUT, QUEUED, RANGE, REPORT_DESC, REPORT_DIM, REPORT_DIM0, REPORT_FILE, REPORT_NAME, REPORT_TYPE, REPORT_UNITS, REPORT_VALUE, REQUEST_FILE, RESPONSE_FILE, RESULT_FILE, RUNNING, STARTED, SUBMITTED, SYNC, TIMEDOUT, UNIT, UNKNOWN, VALUE
Constructor and Description |
---|
ModelDataService() |
Modifier and Type | Method and Description |
---|---|
protected PayloadAttachments |
attachments()
Get access to the all payload attachments.
|
protected ServiceConfiguration |
config()
Get access to the service configuration settings.
|
protected COSU |
cosu()
Get cosu information.
|
java.lang.String |
describeJSON(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest httpReq)
Describe the service as JSON.
|
protected abstract void |
doProcess()
Workflow step 2: The process method.
|
protected void |
doReport()
Create a report.
|
javax.ws.rs.core.Response |
execute(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest httpReq,
org.glassfish.jersey.media.multipart.FormDataMultiPart multipart)
Handler for model services.
|
javax.ws.rs.core.Response |
execute(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest httpReq,
java.lang.String requestStr)
Service Handler for non-multipart requests.
|
protected PayloadFormData |
formdata()
Get the formdata payload parameter.
|
protected org.codehaus.jettison.json.JSONArray |
getCapabilities()
Get the service capabilities.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getConfigInfo()
Overwrite this method if there is configuration information that should be
communicated if requested.
|
protected java.lang.Object |
getParam()
Deprecated.
use the parameter() API
|
protected java.util.Map<java.lang.String,org.codehaus.jettison.json.JSONObject> |
getParamMap()
Deprecated.
use the parameter() API
|
protected java.lang.String |
getSUID()
Get the simulation unique identifier (128 byte UUID).
|
protected PayloadMetaInfo |
metainfo()
Get access to metainfo content of the payload
|
protected void |
onCancel()
Call back method when a service is externally canceled to allow for
cleanup, etc.
|
protected PayloadParameter |
parameter()
Get the payload parameter API
|
protected void |
postProcess()
Workflow step 3: create the response the data.
|
protected void |
preProcess()
Workflow step 1: process the request data.
|
protected PayloadResults |
report()
For populating payload report data
|
protected PayloadRequest |
request()
Get request information.
|
protected ServiceResources |
resources()
Get the service resources (@Resources annotations).
|
protected PayloadResults |
results()
For populating service results.
|
protected ServiceAnnotations |
service()
Get the service annotations other that @Resources
|
protected void |
setProgress(int progress)
Set the progress as a numerical value (0..100)
|
protected void |
setProgress(java.lang.String progress)
Set the progress as a string message.
|
protected Velocity |
velocity()
Get a Velocity instance.
|
protected SessionWorkspace |
workspace()
Access the workspace for the service,
|
public csip.ModelDataService.Task mt
protected SessionLogger LOG
protected final PayloadFormData formdata()
protected final PayloadMetaInfo metainfo()
protected final PayloadParameter parameter()
protected final PayloadAttachments attachments()
protected final PayloadResults results()
protected final PayloadResults report()
protected final ServiceResources resources()
protected final ServiceAnnotations service()
protected final ServiceConfiguration config()
protected final SessionWorkspace workspace()
protected final PayloadRequest request()
protected final COSU cosu()
protected final Velocity velocity()
protected org.codehaus.jettison.json.JSONArray getCapabilities()
protected void preProcess() throws java.lang.Exception
java.lang.Exception
- if pre-processing fails.protected abstract void doProcess() throws java.lang.Exception
java.lang.Exception
- if processing fails.protected void postProcess() throws java.lang.Exception
java.lang.Exception
- if post-processing fails.protected void onCancel()
protected void doReport() throws java.lang.Exception
java.lang.Exception
- if report creation fails.protected final java.lang.String getSUID()
@Deprecated protected final java.util.Map<java.lang.String,org.codehaus.jettison.json.JSONObject> getParamMap()
@Deprecated protected final java.lang.Object getParam()
@GET @Produces(value="application/json") public final java.lang.String describeJSON(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.servlet.http.HttpServletRequest httpReq)
uriInfo
- the URI Info (injected)httpReq
- the servlet request (injected)protected java.util.Map<java.lang.String,java.lang.Object> getConfigInfo()
@POST @Produces(value="application/json") @Consumes(value="application/json") public final javax.ws.rs.core.Response execute(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.servlet.http.HttpServletRequest httpReq, java.lang.String requestStr)
uriInfo
- The UriInfo contexthttpReq
- the servlet requestrequestStr
- the request string@POST @Produces(value="application/json") @Consumes(value="multipart/form-data") public final javax.ws.rs.core.Response execute(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.servlet.http.HttpServletRequest httpReq, org.glassfish.jersey.media.multipart.FormDataMultiPart multipart)
uriInfo
- the context infohttpReq
- the servlet requestmultipart
- multi part input.protected void setProgress(java.lang.String progress) throws ServiceException
progress
- a meaningful messageServiceException
- if there are problems.protected void setProgress(int progress) throws ServiceException
progress
- a value between 0 and 100;ServiceException
- if progress arguments are out of range(c) 2012-2022, OMSLab, Colorado State University.