Package ubic.gemma.web.services
Class AbstractGemmaEndpoint
- java.lang.Object
-
- org.springframework.xml.transform.TransformerObjectSupport
-
- org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint
-
- ubic.gemma.web.services.AbstractGemmaEndpoint
-
- All Implemented Interfaces:
org.springframework.ws.server.endpoint.PayloadEndpoint
- Direct Known Subclasses:
ArrayDesignIdentifierByNameEndpoint
,ArrayDesignUsedEndpoint
,DEDVfromEEIDGeneIDEndpoint
,DEDVRankEndpoint
,DifferentialExpressionProbeResultEndpoint
,ExperimentAnnotationEndpoint
,ExperimentDEDVEndpoint
,ExperimentIDbyTaxonEndpoint
,ExperimentIdEndpoint
,ExperimentNameEndpoint
,ExperimentNumSamplesEndpoint
,ExpressionExperimentSetIDsEndpoint
,Gene2GOdescriptionEndpoint
,Gene2GoTermEndpoint
,Gene2ProbeEndpoint
,GeneByNCBIIdEndpoint
,GeneCoexpressionEndpoint
,GeneCoexpressionSearchEndpoint
,GeneDetailsByGeneIDEndpoint
,GeneIDbyTaxonEndpoint
,GeneIdEndpoint
,GeneNameEndpoint
,GeneOverlapEndpoint
,GoTerm2GeneEndpoint
,Probe2GeneEndpoint
public abstract class AbstractGemmaEndpoint extends org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint
Abstracts out the security and a few constants.- Author:
- gavin, klc
-
-
Field Summary
Fields Modifier and Type Field Description static String
DELIMITER
protected gemma.gsec.authentication.ManualAuthenticationService
manualAuthenticationService
static String
NAMESPACE_URI
Namespace of both request and response.protected static String
REQUEST
protected static String
RESPONSE
-
Constructor Summary
Constructors Constructor Description AbstractGemmaEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
authenticate()
protected Element
buildBadResponse(Document document, String msg)
protected Element
buildWrapper(Document document, Collection<String> values, String elementName)
Function to handle the constructing of output in xml format for returning the response to the client.protected String
encode(Object[] data)
protected Collection<String>
getArrayValues(Element requestElement, String tagName)
protected String
getLastSingleNodeValue(Element requestElement, String tagName)
basically Delegates to getSingleNodeValue and returns the just the last value.protected String
getNodeValue(Element requestElement, String tagName)
protected String
getOptionalNodeValue(Element requestElement, String tagName)
protected Collection<String>
getSingleNodeValue(Element requestElement, String tagName)
Function that handles the retrieval of xml input.protected Document
readReport(InputStream is)
Looks to parse a previously generated xml report that was saved to disk.protected Document
readReport(String filename)
uses the default path of gemmaData/datafile/xml/ to look for reports.protected Document
readReport(String path, String fileName)
protected void
setLocalName(String localName)
void
setManualAuthenticationService(gemma.gsec.authentication.ManualAuthenticationService map)
protected void
writeReport(Element responseWrapper, Document document, String filename)
This method should/can only be used when the wrapper is manually built in the specific endpoints (ie.-
Methods inherited from class org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint
createDocumentBuilder, createDocumentBuilderFactory, getDocumentElement, invoke, invokeInternal, setAlwaysTransform, setExpandEntityReferences, setNamespaceAware, setValidating
-
-
-
-
Field Detail
-
NAMESPACE_URI
public static final String NAMESPACE_URI
Namespace of both request and response.
-
DELIMITER
public static final String DELIMITER
- See Also:
- Constant Field Values
-
REQUEST
protected static final String REQUEST
- See Also:
- Constant Field Values
-
RESPONSE
protected static final String RESPONSE
- See Also:
- Constant Field Values
-
manualAuthenticationService
protected gemma.gsec.authentication.ManualAuthenticationService manualAuthenticationService
-
-
Method Detail
-
setManualAuthenticationService
public void setManualAuthenticationService(gemma.gsec.authentication.ManualAuthenticationService map)
-
authenticate
protected boolean authenticate()
-
buildBadResponse
protected Element buildBadResponse(Document document, String msg)
- Parameters:
document
- documentmsg
- msg- Returns:
- Function to handle construction of output in xml for a bad response
-
buildWrapper
protected Element buildWrapper(Document document, Collection<String> values, String elementName)
Function to handle the constructing of output in xml format for returning the response to the client. Use this method for simple value returns such as single value or a single array of values. building Mapped values is not supported with this method. If values being passed in are null or contain no values, then a string msg will be returned- Parameters:
document
- documentvalues
- a collection of the values (in String format) to be returned to the clientelementName
- element name- Returns:
- element
-
encode
protected String encode(Object[] data)
- Parameters:
data
- data- Returns:
- a string delimited representation of the objects array passed in.
-
getArrayValues
protected Collection<String> getArrayValues(Element requestElement, String tagName)
- Parameters:
requestElement
- erquest elementtagName
- tag name- Returns:
- A method written for array input from MATLAB clients. A more generic method to use is getNodeValues(). Column Arrays and Horizontal Arrays from MATLAB both work, but it must be passed in directly (i.e. EEArray.ee_ids)
-
getLastSingleNodeValue
protected String getLastSingleNodeValue(Element requestElement, String tagName)
basically Delegates to getSingleNodeValue and returns the just the last value.- Parameters:
requestElement
- request elementtagName
- tag name- Returns:
- last value
-
getSingleNodeValue
protected Collection<String> getSingleNodeValue(Element requestElement, String tagName)
Function that handles the retrieval of xml input. Use this method if there is only one value in the input but generically, this method can also store multiple input values as well. This will depend on how the xml is parsed by the client. OLDTODO Still need to test on different types of client requests.- Parameters:
requestElement
- - xml request in node hierarchytagName
- tag name- Returns:
- a collection contain one string element
-
readReport
protected Document readReport(InputStream is) throws IOException
Looks to parse a previously generated xml report that was saved to disk. Returns null if it fails to do so.- Parameters:
is
- from an existing xml file- Returns:
- An XML document
- Throws:
IOException
- IO problems
-
readReport
protected Document readReport(String filename) throws IOException
uses the default path of gemmaData/datafile/xml/ to look for reports.- Parameters:
filename
- needs the xml suffix- Returns:
- document
- Throws:
IOException
- IO problems
-
readReport
protected Document readReport(String path, String fileName) throws IOException
- Throws:
IOException
-
setLocalName
protected void setLocalName(String localName)
-
writeReport
protected void writeReport(Element responseWrapper, Document document, String filename)
This method should/can only be used when the wrapper is manually built in the specific endpoints (ie. not using the buildWrapper() in AbstractGemmaEndpoint).- Parameters:
responseWrapper
- - Manually built wrapperdocument
- documentfilename
- - no xml extension is required
-
-