Class Dsmlv2Engine
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.engine.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 Summary
Constructors Constructor Description Dsmlv2Engine(String host, int port, String user, String password)
Creates a new instance of Dsmlv2Engine.Dsmlv2Engine(LdapConnection connection, String user, String password)
Creates a new instance of Dsmlv2Engine.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchResponseDsml
getBatchResponse()
LdapConnection
getConnection()
boolean
isGenerateSoapResp()
void
processDSML(InputStream inputStream, OutputStream out)
Uses the default UTF-8 encoding for processing the DSMLvoid
processDSML(InputStream inputStream, String inputEncoding, OutputStream out)
Processes the DSML request(s) from the given input stream with the specified encoding and writes the response to the output streamString
processDSML(String dsmlInput)
Processes the file given and return the result of the operationsvoid
processDSMLFile(File file, OutputStream respStream)
Process the given file and optionally writing the output to the output stream(if not null)String
processDSMLFile(String fileName)
Processes the file given and return the result of the operationsvoid
setGenerateSoapResp(boolean generateSoapResp)
-
-
-
Constructor Detail
-
Dsmlv2Engine
public Dsmlv2Engine(String host, int port, String user, String password)
Creates a new instance of Dsmlv2Engine.- Parameters:
host
- the server hostport
- the server portuser
- the server admin Dnpassword
- 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 connectionuser
- the user name to be used to bind this connection to the serverpassword
- 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 parserIOException
- 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 filerespStream
- the output stream to which response will be written, skipped if null- Throws:
Exception
- If the processing fails
-
processDSML
public void processDSML(InputStream inputStream, OutputStream out) throws Exception
Uses the default UTF-8 encoding for processing the DSML- Parameters:
inputStream
- The Stream containing the DSML to processout
- The Stream where to put the result- Throws:
Exception
- If we had an error while processing the DSML- See Also:
processDSML(InputStream, String, OutputStream)
-
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 requestinputEncoding
- encoding to be used while reading the DSML request dataout
- the output stream to which DSML response will be written- Throws:
Exception
- If the processing fails
-
isGenerateSoapResp
public boolean isGenerateSoapResp()
- Returns:
- the generateSoapResp
-
setGenerateSoapResp
public void setGenerateSoapResp(boolean generateSoapResp)
- Parameters:
generateSoapResp
- the generateSoapResp to set
-
getBatchResponse
public BatchResponseDsml getBatchResponse()
- Returns:
- the batchResponse
-
getConnection
public LdapConnection getConnection()
- Returns:
- the connection
-
-