Class AbstractGemmaEndpoint

    • Field Detail

      • NAMESPACE_URI

        public static final String NAMESPACE_URI
        Namespace of both request and response.
      • manualAuthenticationService

        protected gemma.gsec.authentication.ManualAuthenticationService manualAuthenticationService
    • Constructor Detail

      • AbstractGemmaEndpoint

        public AbstractGemmaEndpoint()
    • 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 - document
        msg - 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 - document
        values - a collection of the values (in String format) to be returned to the client
        elementName - 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 element
        tagName - 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 element
        tagName - tag name
        Returns:
        last value
      • getOptionalNodeValue

        protected String getOptionalNodeValue​(Element requestElement,
                                              String tagName)
      • 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 hierarchy
        tagName - 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
      • 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 wrapper
        document - document
        filename - - no xml extension is required