Class Dsmlv2Engine


  • public class Dsmlv2Engine
    extends Object
    This is the DSMLv2Engine. It can be use to execute operations on a LDAP Server and get the results of these operations. The format used for request and responses is the DSMLv2 format.
    Author:
    Apache Directory Project
    • Constructor Detail

      • Dsmlv2Engine

        public Dsmlv2Engine​(String host,
                            int port,
                            String user,
                            String password)
        Creates a new instance of Dsmlv2Engine.
        Parameters:
        host - the server host
        port - the server port
        user - the server admin Dn
        password - the server admin's password
      • Dsmlv2Engine

        public Dsmlv2Engine​(LdapConnection connection,
                            String user,
                            String password)
        Creates a new instance of Dsmlv2Engine.
        Parameters:
        connection - an unbound active connection
        user - the user name to be used to bind this connection to the server
        password - user's credentials
    • Method Detail

      • processDSML

        public String processDSML​(String dsmlInput)
                           throws org.xmlpull.v1.XmlPullParserException
        Processes the file given and return the result of the operations
        Parameters:
        dsmlInput - the DSMLv2 formatted request input
        Returns:
        the XML response in DSMLv2 Format
        Throws:
        org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser
      • processDSMLFile

        public String processDSMLFile​(String fileName)
                               throws org.xmlpull.v1.XmlPullParserException,
                                      IOException
        Processes the file given and return the result of the operations
        Parameters:
        fileName - the path to the file
        Returns:
        the XML response in DSMLv2 Format
        Throws:
        org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser
        IOException - if the file does not exist
      • processDSMLFile

        public void processDSMLFile​(File file,
                                    OutputStream respStream)
                             throws Exception
        Process the given file and optionally writing the output to the output stream(if not null)
        Parameters:
        file - the DSML file
        respStream - the output stream to which response will be written, skipped if null
        Throws:
        Exception - If the processing fails
      • processDSML

        public void processDSML​(InputStream inputStream,
                                String inputEncoding,
                                OutputStream out)
                         throws Exception
        Processes the DSML request(s) from the given input stream with the specified encoding and writes the response to the output stream
        Parameters:
        inputStream - the input stream for DSML batch request
        inputEncoding - encoding to be used while reading the DSML request data
        out - the output stream to which DSML response will be written
        Throws:
        Exception - If the processing fails
      • setGenerateSoapResp

        public void setGenerateSoapResp​(boolean generateSoapResp)
        Parameters:
        generateSoapResp - the generateSoapResp to set