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 Profile
profile
static java.lang.String
QUERIES_PARAMETER
The key for the queries parameterstatic java.lang.String
VERSION_PARAMETER
The 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 boolean
canServe(Format f)
Check whether the format is acceptable.protected void
execute()
Runs service.protected Format
getDefaultFormat()
protected java.lang.String
getQueryString()
Get the XML which represents the queries to be saved.protected Output
makeXMLOutput(java.io.PrintWriter out, java.lang.String separator)
Make the XML output given the HttpResponse's PrintWriter.protected void
postInit()
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 void
validateState()
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:
getDefaultFormat
in classWebService
- Returns:
- The default format constant for this service.
-
canServe
protected boolean canServe(Format f)
Description copied from class:WebService
Check whether the format is acceptable. By default returns true. Services with a particular set of accepted formats should override this and check.- Overrides:
canServe
in classWebService
- Parameters:
f
- The format to check.- Returns:
- whether or not this format is acceptable.
-
postInit
protected void postInit()
Description copied from class:WebService
Subclasses can hook in here to do common behaviour that needs to happen after initialisation.- Overrides:
postInit
in classWebService
-
validateState
protected void validateState()
Description copied from class:WebService
Subclasses can put initialisation checks here. The main use case is for confirming authentication.- Overrides:
validateState
in classWebService
-
execute
protected void execute() throws java.lang.Exception
Description copied from class:WebService
Runs 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:
execute
in 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.IOException
Get 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:WebService
Make the XML output given the HttpResponse's PrintWriter.- Overrides:
makeXMLOutput
in classWebService
- Parameters:
out
- The PrintWriter from the HttpResponse.separator
- the line-separator for the client's platform.- Returns:
- An Output that produces good XML.
-
-