Class QueryUploadService
- java.lang.Object
-
- org.intermine.webservice.server.WebService
-
- org.intermine.webservice.server.query.QueryUploadService
-
- Direct Known Subclasses:
QueryUpdateService
public class QueryUploadService extends WebService
A service to enable queries to be uploaded programmatically.- Author:
- Alexis Kalderimis
-
-
Field Summary
Fields Modifier and Type Field Description protected Profileprofilestatic java.lang.StringQUERIES_PARAMETERThe key for the queries parameterstatic java.lang.StringVERSION_PARAMETERThe key for the version parameter-
Fields inherited from class org.intermine.webservice.server.WebService
dataPackageOutput, DEFAULT_CALLBACK, im, os, out, output, request, response, webProperties
-
-
Constructor Summary
Constructors Constructor Description QueryUploadService(InterMineAPI im)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanServe(Format f)Check whether the format is acceptable.protected voidexecute()Runs service.protected FormatgetDefaultFormat()protected java.lang.StringgetQueryString()Get the XML which represents the queries to be saved.protected OutputmakeXMLOutput(java.io.PrintWriter out, java.lang.String separator)Make the XML output given the HttpResponse's PrintWriter.protected voidpostInit()Subclasses can hook in here to do common behaviour that needs to happen after initialisation.protected java.util.Map<java.lang.String,java.lang.String>saveQueries(java.util.Map<java.lang.String,PathQuery> toSave)Save the given queries.protected voidvalidateState()Subclasses can put initialisation checks here.-
Methods inherited from class org.intermine.webservice.server.WebService
cleanUp, formatIsFlatFile, formatIsJSON, formatIsJSONP, formatIsXML, getAuthenticatedUser, getCallback, getColumnHeaderStyle, getDefaultFileName, getDefaultOutput, getDefaultOutput, getExtension, getFormat, getIntParameter, getIntParameter, getLineBreak, getListManager, getOptionalParameter, getOptionalParameter, getPermission, getProperty, getRawOutput, getRequestFileName, getRequiredParameter, hasCallback, initState, isAuthenticated, isGzip, isUncompressed, isZip, makeJSONOutput, service, setFormat, setNameSpace, wantsColumnHeaders, wantsDataPackage
-
-
-
-
Field Detail
-
QUERIES_PARAMETER
public static final java.lang.String QUERIES_PARAMETER
The key for the queries parameter- See Also:
- Constant Field Values
-
VERSION_PARAMETER
public static final java.lang.String VERSION_PARAMETER
The key for the version parameter- See Also:
- Constant Field Values
-
profile
protected Profile profile
-
-
Constructor Detail
-
QueryUploadService
public QueryUploadService(InterMineAPI im)
Constructor.- Parameters:
im- A reference to the API configuration and settings bundle.
-
-
Method Detail
-
getDefaultFormat
protected Format getDefaultFormat()
- Overrides:
getDefaultFormatin classWebService- Returns:
- The default format constant for this service.
-
canServe
protected boolean canServe(Format f)
Description copied from class:WebServiceCheck whether the format is acceptable. By default returns true. Services with a particular set of accepted formats should override this and check.- Overrides:
canServein classWebService- Parameters:
f- The format to check.- Returns:
- whether or not this format is acceptable.
-
postInit
protected void postInit()
Description copied from class:WebServiceSubclasses can hook in here to do common behaviour that needs to happen after initialisation.- Overrides:
postInitin classWebService
-
validateState
protected void validateState()
Description copied from class:WebServiceSubclasses can put initialisation checks here. The main use case is for confirming authentication.- Overrides:
validateStatein classWebService
-
execute
protected void execute() throws java.lang.ExceptionDescription copied from class:WebServiceRuns service. This is abstract method, that must be defined in subclasses and so performs something useful. Standard procedure is overwrite this method in subclasses and let this method to be called from WebService.doGet method that encapsulates logic common for all web services else you can overwrite doGet method in your web service class and manage all the things alone.- Specified by:
executein classWebService- Throws:
java.lang.Exception- if some error occurs
-
saveQueries
protected java.util.Map<java.lang.String,java.lang.String> saveQueries(java.util.Map<java.lang.String,PathQuery> toSave)
Save the given queries.- Parameters:
toSave- The queries to save.- Returns:
- A mapping from given name to the name they were actually saved under.
-
getQueryString
protected java.lang.String getQueryString() throws java.io.IOExceptionGet the XML which represents the queries to be saved.- Returns:
- The XML.
- Throws:
java.io.IOException- If we can't read from the request.
-
makeXMLOutput
protected Output makeXMLOutput(java.io.PrintWriter out, java.lang.String separator)
Description copied from class:WebServiceMake the XML output given the HttpResponse's PrintWriter.- Overrides:
makeXMLOutputin classWebService- Parameters:
out- The PrintWriter from the HttpResponse.separator- the line-separator for the client's platform.- Returns:
- An Output that produces good XML.
-
-