org.apache.directory.api.dsmlv2
Class Dsmlv2Parser

java.lang.Object
  extended by org.apache.directory.api.dsmlv2.Dsmlv2Parser

public class Dsmlv2Parser
extends Object

This class represents the DSMLv2 Parser. It can be used to parse a plain DSMLv2 Request input document or the one inside a SOAP envelop.

Author:
Apache Directory Project

Constructor Summary
Dsmlv2Parser()
          Creates a new instance of Dsmlv2Parser.
Dsmlv2Parser(boolean storeMsgInBatchReq)
          Creates a new instance of Dsmlv2Parser.
Dsmlv2Parser(Dsmlv2Grammar grammar)
          Creates a new instance of Dsmlv2Parser.
 
Method Summary
 BatchRequestDsml getBatchRequest()
          Gets the Batch Request or null if the it has not been parsed yet
 DsmlDecorator<? extends Request> getNextRequest()
          Gets the next Request or null if there's no more request
 void parse()
          Launches the parsing on the input This method will parse the whole DSML document, without considering the flag storeMsgInBatchReq
 void parseAllRequests()
          Parses all the requests
 void parseBatchRequest()
          Launches the parsing of the Batch Request only
 void setInput(InputStream inputStream, String inputEncoding)
          Sets the input stream the parser is going to process
 void setInput(String str)
          Sets the input string the parser is going to parse
 void setInputFile(String fileName)
          Sets the input file the parser is going to parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dsmlv2Parser

public Dsmlv2Parser()
             throws org.xmlpull.v1.XmlPullParserException
Creates a new instance of Dsmlv2Parser.

Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs during the initialization of the parser

Dsmlv2Parser

public Dsmlv2Parser(boolean storeMsgInBatchReq)
             throws org.xmlpull.v1.XmlPullParserException
Creates a new instance of Dsmlv2Parser.

Parameters:
storeMsgInBatchReq - flag to set if the parsed requests should b stored
Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs during the initialization of the parser

Dsmlv2Parser

public Dsmlv2Parser(Dsmlv2Grammar grammar)
             throws org.xmlpull.v1.XmlPullParserException
Creates a new instance of Dsmlv2Parser.

Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs during the initialization of the parser
Method Detail

setInputFile

public void setInputFile(String fileName)
                  throws FileNotFoundException,
                         org.xmlpull.v1.XmlPullParserException
Sets the input file the parser is going to parse

Parameters:
fileName - the name of the file
Throws:
FileNotFoundException - if the file does not exist
org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser

setInput

public void setInput(InputStream inputStream,
                     String inputEncoding)
              throws org.xmlpull.v1.XmlPullParserException
Sets the input stream the parser is going to process

Parameters:
inputStream - contains a raw byte input stream of possibly unknown encoding (when inputEncoding is null)
inputEncoding - if not null it MUST be used as encoding for inputStream
Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser

setInput

public void setInput(String str)
              throws org.xmlpull.v1.XmlPullParserException
Sets the input string the parser is going to parse

Parameters:
str - the string the parser is going to parse
Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser

parse

public void parse()
           throws org.xmlpull.v1.XmlPullParserException,
                  IOException
Launches the parsing on the input This method will parse the whole DSML document, without considering the flag storeMsgInBatchReq

Throws:
org.xmlpull.v1.XmlPullParserException - when an unrecoverable error occurs
IOException - when an IO execption occurs

parseBatchRequest

public void parseBatchRequest()
                       throws org.xmlpull.v1.XmlPullParserException
Launches the parsing of the Batch Request only

Throws:
org.xmlpull.v1.XmlPullParserException - if an error occurs in the parser

getBatchRequest

public BatchRequestDsml getBatchRequest()
Gets the Batch Request or null if the it has not been parsed yet

Returns:
the Batch Request or null if the it has not been parsed yet

getNextRequest

public DsmlDecorator<? extends Request> getNextRequest()
                                                throws org.xmlpull.v1.XmlPullParserException
Gets the next Request or null if there's no more request

Returns:
the next Request or null if there's no more request
Throws:
org.xmlpull.v1.XmlPullParserException - when an error occurs during the parsing

parseAllRequests

public void parseAllRequests()
                      throws org.xmlpull.v1.XmlPullParserException
Parses all the requests

Throws:
org.xmlpull.v1.XmlPullParserException - when an error occurs during the parsing


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.