Package org.apache.directory.api.dsmlv2
Class ParserUtils
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.ParserUtils
-
public final class ParserUtils extends Object
This class is a Helper class for the DSML Parser- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description static StringBASE64BINARYBase-64 identifier.static NamespaceDSML_NAMESPACEThe DSML namespacestatic GrammarActionREAD_SOAP_HEADERGrammarAction that reads the SOAP header datastatic StringXML_SCHEMA_INSTANCE_URIW3C XML Schema Instance URI.static StringXML_SCHEMA_URIW3C XML Schema URI.static StringXSDXSD namespace prefix.static StringXSD_COLONXSD namespace prefix with ':'.static NamespaceXSD_NAMESPACEThe XSD namespacestatic StringXSIXSI namespace prefix.static NamespaceXSI_NAMESPACEThe XSI namespace
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddControls(LdapApiService codec, Element element, Collection<Control> controls, boolean isRequest)Adds Controls to the given Element.static Stringbase64Encode(Object value)Encodes the value as a Base64 Stringstatic StringgetXsiTypeAttributeValue(XmlPullParser xpp)Returns the value of the attribute 'type' of the "XMLSchema-instance' namespace if it existsstatic booleanisBase64BinaryValue(XmlPullParser parser, String attrValue)Tells is the given value is a Base64 binary valuestatic booleanisRequestIdNeeded(Dsmlv2Container container)Indicates if a request ID is needed.static booleanneedsBase64Encoding(Object value)Indicates if the value needs to be encoded as Base64static intparseAndVerifyRequestID(String attributeValue, XmlPullParser xpp)Parses and verify the parsed value of the requestIDstatic DocumentstyleDocument(Document document)XML Pretty Printer XSLT Transformation
-
-
-
Field Detail
-
XML_SCHEMA_URI
public static final String XML_SCHEMA_URI
W3C XML Schema URI.- See Also:
- Constant Field Values
-
XML_SCHEMA_INSTANCE_URI
public static final String XML_SCHEMA_INSTANCE_URI
W3C XML Schema Instance URI.- See Also:
- Constant Field Values
-
BASE64BINARY
public static final String BASE64BINARY
Base-64 identifier.- See Also:
- Constant Field Values
-
XSI
public static final String XSI
XSI namespace prefix.- See Also:
- Constant Field Values
-
XSD
public static final String XSD
XSD namespace prefix.- See Also:
- Constant Field Values
-
XSD_COLON
public static final String XSD_COLON
XSD namespace prefix with ':'.- See Also:
- Constant Field Values
-
DSML_NAMESPACE
public static final Namespace DSML_NAMESPACE
The DSML namespace
-
XSD_NAMESPACE
public static final Namespace XSD_NAMESPACE
The XSD namespace
-
XSI_NAMESPACE
public static final Namespace XSI_NAMESPACE
The XSI namespace
-
READ_SOAP_HEADER
public static final GrammarAction READ_SOAP_HEADER
GrammarAction that reads the SOAP header data
-
-
Method Detail
-
getXsiTypeAttributeValue
public static String getXsiTypeAttributeValue(XmlPullParser xpp)
Returns the value of the attribute 'type' of the "XMLSchema-instance' namespace if it exists- Parameters:
xpp- the XPP parser to use- Returns:
- the value of the attribute 'type' of the "XMLSchema-instance' namespace if it exists
-
isBase64BinaryValue
public static boolean isBase64BinaryValue(XmlPullParser parser, String attrValue)
Tells is the given value is a Base64 binary value- Parameters:
parser- the XPP parser to useattrValue- the attribute value- Returns:
- true if the value of the current tag is Base64BinaryEncoded, false if not
-
needsBase64Encoding
public static boolean needsBase64Encoding(Object value)
Indicates if the value needs to be encoded as Base64- Parameters:
value- the value to check- Returns:
- true if the value needs to be encoded as Base64
-
base64Encode
public static String base64Encode(Object value)
Encodes the value as a Base64 String- Parameters:
value- the value to encode- Returns:
- the value encoded as a Base64 String
-
parseAndVerifyRequestID
public static int parseAndVerifyRequestID(String attributeValue, XmlPullParser xpp) throws XmlPullParserException
Parses and verify the parsed value of the requestID- Parameters:
attributeValue- the value of the attributexpp- the XmlPullParser- Returns:
- the int value of the resquestID
- Throws:
XmlPullParserException- if RequestID isn't an Integer and if requestID is below 0
-
addControls
public static void addControls(LdapApiService codec, Element element, Collection<Control> controls, boolean isRequest)
Adds Controls to the given Element.- Parameters:
codec- The LDAP Service to useelement- the element to add the Controls tocontrols- a List of ControlsisRequest- A flag set to true if teh LDapMessage is a request
-
isRequestIdNeeded
public static boolean isRequestIdNeeded(Dsmlv2Container container) throws XmlPullParserException
Indicates if a request ID is needed.- Parameters:
container- the associated container- Returns:
- true if a request ID is needed (ie Processing=Parallel and ResponseOrder=Unordered)
- Throws:
XmlPullParserException- if the batch request has not been parsed yet
-
-