public class Dsmlv2Engine extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.directory.api.dsmlv2.request.BatchRequestDsml |
batchRequest
The batch request.
|
protected org.apache.directory.api.dsmlv2.reponse.BatchResponseDsml |
batchResponse
The batch response.
|
protected org.apache.directory.ldap.client.api.LdapConnection |
connection
The LDAP connection
|
protected boolean |
continueOnError
The continue on error flag.
|
protected boolean |
exit
The exit flag.
|
protected boolean |
generateSoapResp
flag to indicate to generate the response in a SOAP envelope
|
protected org.apache.directory.api.dsmlv2.request.Dsmlv2Grammar |
grammar |
protected org.apache.directory.api.dsmlv2.Dsmlv2Parser |
parser
The DSVMv2 parser.
|
protected String |
password
The password.
|
protected String |
user
The user.
|
| Constructor and Description |
|---|
Dsmlv2Engine(org.apache.directory.ldap.client.api.LdapConnection connection,
String user,
String password)
Creates a new instance of Dsmlv2Engine.
|
Dsmlv2Engine(String host,
int port,
String user,
String password)
Creates a new instance of Dsmlv2Engine.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
bind(int messageId)
Binds to the ldap server
|
org.apache.directory.api.dsmlv2.reponse.BatchResponseDsml |
getBatchResponse() |
org.apache.directory.ldap.client.api.LdapConnection |
getConnection() |
boolean |
isGenerateSoapResp() |
protected void |
processBatchRequest()
Processes the BatchRequest
Parsing and Getting BatchRequest
Getting and registering options from BatchRequest
|
void |
processDSML(InputStream inputStream,
OutputStream out)
Uses the default UTF-8 encoding for processing the DSML
|
void |
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 stream
|
protected void |
processDSML(OutputStream outStream)
Processes the DSML batch request and writes the response of each operation will be
written to the given response stream if it is not null
|
String |
processDSML(String dsmlInput)
Processes the file given and return the result of the operations
|
void |
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 operations
|
protected void |
processRequest(org.apache.directory.api.dsmlv2.DsmlDecorator<? extends org.apache.directory.api.ldap.model.message.Request> request,
BufferedWriter respWriter)
Processes a single request
|
void |
setGenerateSoapResp(boolean generateSoapResp) |
protected void |
writeResponse(BufferedWriter respWriter,
org.apache.directory.api.dsmlv2.DsmlDecorator<?> respDsml)
Writes the response to the writer of the underlying output stream
|
protected String user
protected String password
protected org.apache.directory.ldap.client.api.LdapConnection connection
protected org.apache.directory.api.dsmlv2.Dsmlv2Parser parser
protected boolean continueOnError
protected boolean exit
protected org.apache.directory.api.dsmlv2.request.BatchRequestDsml batchRequest
protected org.apache.directory.api.dsmlv2.reponse.BatchResponseDsml batchResponse
protected org.apache.directory.api.dsmlv2.request.Dsmlv2Grammar grammar
protected boolean generateSoapResp
public Dsmlv2Engine(String host, int port, String user, String password)
host - the server hostport - the server portuser - the server admin Dnpassword - the server admin's passwordpublic Dsmlv2Engine(org.apache.directory.ldap.client.api.LdapConnection connection,
String user,
String password)
connection - an unbound active connectionuser - the user name to be used to bind this connection to the serverpassword - user's credentialspublic String processDSML(String dsmlInput) throws org.xmlpull.v1.XmlPullParserException
dsmlInput - the DSMLv2 formatted request inputorg.xmlpull.v1.XmlPullParserException - if an error occurs in the parserpublic String processDSMLFile(String fileName) throws org.xmlpull.v1.XmlPullParserException, FileNotFoundException
fileName - the path to the fileorg.xmlpull.v1.XmlPullParserException - if an error occurs in the parserFileNotFoundException - if the file does not existpublic void processDSMLFile(File file, OutputStream respStream) throws Exception
file - the DSML filerespStream - the output stream to which response will be written, skipped if nullException - If the processing failspublic void processDSML(InputStream inputStream, OutputStream out) throws Exception
ExceptionprocessDSML(InputStream, String, OutputStream)public void processDSML(InputStream inputStream, String inputEncoding, OutputStream out) throws Exception
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 writtenException - If the processing failsprotected void processDSML(OutputStream outStream) throws IOException
outStream - the stream to which the responses will be written, can be nullIOException - If we had an issue while reading or writing the dataprotected void writeResponse(BufferedWriter respWriter, org.apache.directory.api.dsmlv2.DsmlDecorator<?> respDsml) throws IOException
respWriter - The writer used to write the responserespDsml - The decorator containing the responseIOException - If we had an error while writing the DSML responsepublic boolean isGenerateSoapResp()
public void setGenerateSoapResp(boolean generateSoapResp)
generateSoapResp - the generateSoapResp to setpublic org.apache.directory.api.dsmlv2.reponse.BatchResponseDsml getBatchResponse()
public org.apache.directory.ldap.client.api.LdapConnection getConnection()
protected void processRequest(org.apache.directory.api.dsmlv2.DsmlDecorator<? extends org.apache.directory.api.ldap.model.message.Request> request,
BufferedWriter respWriter)
throws Exception
request - the request to processrespWriter - The writer used to store the DSML responseException - If we had an error while processing the requestprotected void processBatchRequest()
throws org.xmlpull.v1.XmlPullParserException
org.xmlpull.v1.XmlPullParserException - if an error occurs in the parserprotected void bind(int messageId)
throws org.apache.directory.api.ldap.model.exception.LdapException,
org.apache.directory.api.asn1.EncoderException,
org.apache.directory.api.asn1.DecoderException,
IOException
messageId - the message Idorg.apache.directory.api.asn1.EncoderException - If we had an issue while encoding the requestorg.apache.directory.api.asn1.DecoderException - If we had an issue while decoding the requestIOException - If we had an issue while transmitting the request or re ceiving the responseorg.apache.directory.api.ldap.model.exception.LdapExceptionCopyright © 2003–2014 The Apache Software Foundation. All rights reserved.