Class Utils
- java.lang.Object
-
- com.sun.identity.liberty.ws.soapbinding.Utils
-
public class Utils extends Object
This class contains utility methods.
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceBundlebundle
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringBooleanToString(Boolean bool)Converts a Boolean object to a String representing XML boolean.static ListconvertElementToJAXB(List elements)Converts a list oforg.w3c.dom.Elementto a list of JAXB objects.static ObjectconvertElementToJAXB(Element element)Converts aorg.w3c.dom.Elementto a JAXB object.static ElementconvertJAXBToElement(Object jaxbObj)Converts a JAXB object to aorg.w3c.dom.Element.static ElementconvertJAXBToElement(Object jaxbObj, boolean checkIdref)Converts a JAXB object to aorg.w3c.dom.Element.static ListconvertJAXBToElement(List jaxbObjs)Converts a list of JAXB objects to a list oforg.w3c.dom.Elementstatic QNameconvertStringToQName(String str, Element element)Converts a string value to a QName.static jakarta.xml.soap.SOAPMessageDocumentToSOAPMessage(Document doc)Converts Document to SOAPMessagestatic voidenforceProcessingRules(Message message, String requestMessageID, boolean isServer)Enforces message processiong rules defined in the spec.static StringgetDefaultWSFVersion()Returns the default web services version.static StringgetJAXBPackages()Returns a String of JAXB packages seperated by ":".static StringgetNamespaceForPrefix(String prefix, Element e)Gets the XML namespace URI that is mapped to the specified prefix, in the context of the DOM element estatic MapgetNamespacePrefixMapping()Returns JAXB namespace prefix mapping.static StringgetString(String key, Object[] params)Gets localized string from resource bundle.static BooleanStringToBoolean(String str)Converts a value of XML boolean type to Boolean object.
-
-
-
Field Detail
-
bundle
public static ResourceBundle bundle
-
-
Method Detail
-
getNamespacePrefixMapping
public static Map getNamespacePrefixMapping()
Returns JAXB namespace prefix mapping. Key is the namespace and value is the prefix.- Returns:
- a Map of JAXB namespace prefix mapping
-
getJAXBPackages
public static String getJAXBPackages()
Returns a String of JAXB packages seperated by ":".- Returns:
- a String of JAXB packages seperated by ":".
-
DocumentToSOAPMessage
public static jakarta.xml.soap.SOAPMessage DocumentToSOAPMessage(Document doc) throws SOAPBindingException
Converts Document to SOAPMessage- Parameters:
doc- the source Document- Returns:
- SOAPMessage
- Throws:
SOAPBindingException- if an error occurs while converting the document
-
convertJAXBToElement
public static List convertJAXBToElement(List jaxbObjs) throws JAXBException
Converts a list of JAXB objects to a list oforg.w3c.dom.Element- Parameters:
jaxbObjs- a list of JAXB objects- Returns:
- a list of
org.w3c.dom.Element - Throws:
JAXBException- if an error occurs while converting JAXB objects.
-
convertJAXBToElement
public static Element convertJAXBToElement(Object jaxbObj) throws JAXBException
Converts a JAXB object to aorg.w3c.dom.Element.- Parameters:
jaxbObj- a JAXB object- Returns:
- a
org.w3c.dom.Element - Throws:
JAXBException- if an error occurs while converting JAXB object.
-
convertJAXBToElement
public static Element convertJAXBToElement(Object jaxbObj, boolean checkIdref) throws JAXBException
Converts a JAXB object to aorg.w3c.dom.Element.- Parameters:
jaxbObj- a JAXB object- Returns:
- a
org.w3c.dom.Element - Throws:
JAXBException- if an error occurs while converting JAXB object.
-
convertElementToJAXB
public static List convertElementToJAXB(List elements) throws JAXBException
Converts a list oforg.w3c.dom.Elementto a list of JAXB objects.- Parameters:
elements- a list oforg.w3c.dom.Element- Returns:
- a list of JAXB objects
- Throws:
JAXBException- if an error occurs while convertingorg.w3c.dom.Element.
-
convertElementToJAXB
public static Object convertElementToJAXB(Element element) throws JAXBException
Converts aorg.w3c.dom.Elementto a JAXB object.- Parameters:
element- aorg.w3c.dom.Element.- Returns:
- a JAXB object
- Throws:
JAXBException- if an error occurs while convertingorg.w3c.dom.Element
-
StringToBoolean
public static Boolean StringToBoolean(String str) throws Exception
Converts a value of XML boolean type to Boolean object.- Parameters:
str- a value of XML boolean type- Returns:
- a Boolean object
- Throws:
Exception- if there is a syntax error
-
BooleanToString
public static String BooleanToString(Boolean bool)
Converts a Boolean object to a String representing XML boolean.- Parameters:
bool- a Boolean object.- Returns:
- a String representing the boolean value.
-
convertStringToQName
public static QName convertStringToQName(String str, Element element)
Converts a string value to a QName. The prefix of the string value is resolved to a namespace relative to the element.- Parameters:
str- the String to be converted.element- the Element object.- Returns:
- the QName Object.
-
getNamespaceForPrefix
public static String getNamespaceForPrefix(String prefix, Element e)
Gets the XML namespace URI that is mapped to the specified prefix, in the context of the DOM element e- Parameters:
prefix- The namespace prefix to mape- The DOM element in which to calculate the prefix binding- Returns:
- The XML namespace URI mapped to prefix in the context of e
-
enforceProcessingRules
public static void enforceProcessingRules(Message message, String requestMessageID, boolean isServer) throws SOAPBindingException, SOAPFaultException
Enforces message processiong rules defined in the spec.- Parameters:
message- a messagerequestMessageID- the request messageID if we are checking a response message or null if we are checking a request messageisServer- true if this is a server- Throws:
SOAPBindingException- if the message violates rules on client.SOAPFaultException- if the message violates rules on server.
-
getString
public static String getString(String key, Object[] params)
Gets localized string from resource bundle.- Parameters:
key- a key to a resource bundleparams- parameters to MessageFormat- Returns:
- a localized string.
-
getDefaultWSFVersion
public static String getDefaultWSFVersion()
Returns the default web services version.- Returns:
- the default web services version.
-
-