|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.biomoby.service.MobyServlet
@mobyService(name="MobyServlet", type="Testing", provider="moby.ucalgary.ca", author="gordonp@ucalgary.ca", in={}, out={}, description="No-operation base service implementation") public class MobyServlet
This the base implementation of a MOBY servlet that can be easily extended to provide a meaningful service (by overriding processRequest()). Please see the documentation on how to use this servlet.
Field Summary | |
---|---|
static String |
ADMIN_MODE
|
static int |
INIT_OUTPUT_BUFFER_SIZE
|
static String |
MOBY_AUTHORITATIVE_PARAM
|
static String |
MOBY_CENTRAL_URL_PARAM
|
static String |
MOBY_CONTACT_PARAM
|
static String |
MOBY_INPUT_PARAM
|
static String |
MOBY_OUTPUT_PARAM
|
static String |
MOBY_PROVIDER_URI_PARAM
|
static String |
MOBY_SECONDARYINPUT_PARAM
|
static String |
MOBY_SERVICE_DESC_PARAM
|
static String |
MOBY_SERVICENAME_PARAM
|
static String |
MOBY_SERVICETYPE_PARAM
|
static String |
MODE_HTTP_PARAM
|
static String |
RDF_MODE
|
Constructor Summary | |
---|---|
MobyServlet()
|
Method Summary | |
---|---|
MobyService |
createServiceFromConfig(javax.servlet.http.HttpServletRequest request)
|
void |
destroy()
By default, this method does nothing. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
Central |
getCentralImpl()
Returns the Moby Central server that the service is associated with, based on the web.xml and the servlet annotation. |
MobyContentInstance |
getMobyContents(javax.servlet.http.HttpServletRequest request)
|
String |
getServiceName()
Reads the service name from the mobyService annotation. |
void |
init()
If you override this method, be sure to call super.init() |
void |
log(String msg)
|
void |
log(String msg,
Exception ex)
|
static void |
main(String[] args)
Expects one argument, an example MOBY XML input file or URL. |
void |
processRequest(MobyDataJob request,
MobyDataJob result)
The real worker method: implementing classes must override this method to do something useful. |
void |
processRequests(MobyContentInstance requestContents,
MobyContentInstance resultContents)
By default, this method will sequentially execute the individual jobs from the request payload (processRequest). |
void |
setCoCInitParameter(String param,
String value)
|
static void |
setMainTerminationExit(boolean b)
Determines whether call to main() that terminate on error should call System.exit() or not. |
static MobyPrimaryData |
stringToPrimaryDataTemplate(String spec,
Map<String,MobyDataTypeTemplate> runTimeTemplates)
Strings have the form name:objectType:namespace, with ":namespace" optional If the input is expected to be a Collection, then the syntax is name:Collection(objectType):namespace |
static MobySecondaryData |
stringToSecondaryDataTemplate(String template)
Strings have the form name:paramType:default:spec where spec depends on the parameter type. |
static void |
validateArguments(MobyDataJob job,
MobyService service,
String errMessagePrefix)
Throws an exception if the data in the job does not match the input spec of the service. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
service |
Methods inherited from class javax.servlet.GenericServlet |
---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MOBY_CENTRAL_URL_PARAM
public static final String MOBY_AUTHORITATIVE_PARAM
public static final String MOBY_CONTACT_PARAM
public static final String MOBY_SERVICE_DESC_PARAM
public static final String MOBY_PROVIDER_URI_PARAM
public static final String MOBY_SERVICETYPE_PARAM
public static final String MOBY_SERVICENAME_PARAM
public static final String MOBY_INPUT_PARAM
public static final String MOBY_SECONDARYINPUT_PARAM
public static final String MOBY_OUTPUT_PARAM
public static final String MODE_HTTP_PARAM
public static final String RDF_MODE
public static final String ADMIN_MODE
public static final int INIT_OUTPUT_BUFFER_SIZE
Constructor Detail |
---|
public MobyServlet()
Method Detail |
---|
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
doPost
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public MobyContentInstance getMobyContents(javax.servlet.http.HttpServletRequest request) throws Exception
Exception
public static void validateArguments(MobyDataJob job, MobyService service, String errMessagePrefix) throws Exception
Exception
public void log(String msg)
log
in class javax.servlet.GenericServlet
public void log(String msg, Exception ex)
public void init()
init
in class javax.servlet.GenericServlet
public Central getCentralImpl()
public void setCoCInitParameter(String param, String value)
public MobyService createServiceFromConfig(javax.servlet.http.HttpServletRequest request) throws Exception
Exception
public String getServiceName()
public static MobySecondaryData stringToSecondaryDataTemplate(String template) throws Exception
db:String:nr:[nr,nt,est,swissprot]
e.g. filter:Boolean:true
e.g. hits:Integer:100:[0,]
Exception
public static MobyPrimaryData stringToPrimaryDataTemplate(String spec, Map<String,MobyDataTypeTemplate> runTimeTemplates) throws Exception
Exception
public void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
public void processRequests(MobyContentInstance requestContents, MobyContentInstance resultContents) throws Exception
resultContents
- is a Map prepopulated with Exception
public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception
request
- the request to process, with params guaranteed to be of the type specified in the mobyService annotation, or values overriding the annjotation in a WAR file's WEB-INF/web.xml
Exception
public static void setMainTerminationExit(boolean b)
public static void main(String[] args) throws Exception
Exception
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |