com.ibm.websphere.sdox
Class SDOUtil
- java.lang.Object
-
- com.ibm.websphere.sdox.SDOUtil
-
public final class SDOUtil extends java.lang.ObjectThis class provides convenient static utility functions for implementation extended APIs
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringDATATYPE_WRAPPER_URIURI of the DataTypeWrapper Typestatic java.lang.StringOPTION_BO_COMPATIBLEstatic java.lang.StringOPTION_CHANGE_SUMMARYThe HelperContext option OPTION_CHANGE_SUMMARY enables the change summary feature.static java.lang.StringOPTION_COPY_DISCARD_DEFAULT_ATTRIBUTEThe HelperContext option OPTION_COPY_DISCARD_DEFAULT_ATTRIBUTE determines whether or not schema specified default attributes are propagated during a document instance copy operation.static java.lang.StringOPTION_COPY_ON_WRITEThe HelperContext option OPTION_COPY_ON_WRITE determines whether CopyHelper.copy() will perform copy-on-write (when possible).static java.lang.StringOPTION_EAGER_BUFFER_LOADThe HelperContext option OPTION_EAGER_BUFFER_LOAD will load the entire document to its internal buffer but not necessarily parse its contents
Value should be either "true" or "false".static java.lang.StringOPTION_EAGER_ON_LOADThe HelperContext option OPTION_EAGER_ON_LOAD will materialize the entire document/data during the "loading phase" - i.e., during the load() call.static java.lang.StringOPTION_FAST_SERIALIZATIONThe HelperContext option OPTION_FAST_SERIALIZATION will improve the speed of serialization operations by caching namespace information.static java.lang.StringOPTION_LOAD_DISALLOW_UNKNOWN_ITEMSOnly effective if BO-compat flag is on.static java.lang.StringOPTION_LOAD_LARGE_DOCUMENTThe HelperContext option OPTION_LOAD_LARGE_DOCUMENT will improve de-serialization operations for large documents (> 1MB).static java.lang.StringOPTION_LOAD_SKIP_SUBTREEThe HelperContext option OPTION_LOAD_SKIP_SUBTREE will materialize the root level of the document/data during the "loading phase" - i.e., during the load() call.static java.lang.StringOPTION_SAVE_DEFAULT_ATTRIBUTEThe HelperContext option OPTION_SAVE_DISCARD_DEFAULT_ATTRIBUTE instructs the XML serializer to save the default attribute value specified in the XSD.static java.lang.StringOPTION_SAVE_FORCE_NS_DECLARATIONSThe HelperContext option OPTION_SAVE_FORCE_NS_DECLARATIONS specifies a list of QName that would always be serialized.static java.lang.StringOPTION_SAVE_INDENTThe HelperContext option OPTION_SAVE_INDENT specifies whether additional whitespace may be added during serialization.static java.lang.StringOPTION_SAVE_INDENT_LINE_SEPARATORThe HelperContext option OPTION_SAVE_INDENT_LINE_SEPARATOR contains the line separator value to use when the option OPTION_SAVE_INDENT == "true".static java.lang.StringOPTION_SAVE_OMIT_XML_DECLThe HelperContext option OPTION_SAVE_OMIT_XML_DECL specifies whether or not to omit the xml declaration when serializing instance documents.static java.lang.StringOPTION_SAVE_REQUIRED_PREFIXESThe HelperContext option OPTION_SAVE_REQUIRED_PREFIXES specifies a list of QName containing prefix and URI.static java.lang.StringOPTION_SAVE_STANDARD_CHANGE_SUMMARYThe HelperContext option OPTION_SAVE_STANDARD_CHANGE_SUMMARY specifies whether or not the change summary information is serialized using the standard XML format described in the SDO specification.static java.lang.StringOPTION_SAVE_STRIP_WHITESPACEThe HelperContext option OPTION_SAVE_STRIP_WHITESPACE specifies whether to strip whitespace ("true") from serialized output or not ("false").static java.lang.StringOPTION_SAVE_USE_DEFAULT_NSThe HelperContext option OPTION_SAVE_USE_DEFAULT_NS specifies whether or not a QName in a namespace can be serialized in the default namespace.static java.lang.StringOPTION_SCHEMA_ERROR_FAILFASTThe HelperContext option OPTION_SCHEMA_ERROR_FAILFAST enables the schema fail fast mode.static java.lang.StringOPTION_SCHEMA_ERROR_HANDLERThe HelperContext option OPTION_SCHEMA_ERROR_HANDLER specifies the schema error handler to be used by the HelperContext instance.static java.lang.StringOPTION_SCHEMA_FULL_CHECKINGThe HelperContext option OPTION_SCHEMA_FULL_CHECKING enables full checking of schema constraints when loading schema documents.static java.lang.StringOPTION_SCOPE_MANAGERstatic java.lang.StringOPTION_VALIDATE_ON_LOADThe HelperContext option OPTION_VALIDATE_ON_LOAD is a superset of OPTION_EAGER_ON_LOAD in that it will perform a document schema validation in addition to the loading operation discussed in OPTION_EAGER_ON_LOAD.static java.lang.StringOPTION_XML_ATTACHMENT_MARSHALLERThe HelperContext option OPTION_XML_ATTACHMENT_MARSHALLER is used to register a helper object that can determine if a piece of base64Binary data should be serialized as inlined base64 text or as an MTOM attachment reference.static java.lang.StringOPTION_XML_ATTACHMENT_UNMARSHALLERThe HelperContext option OPTION_XML_ATTACHMENT_UNMARSHALLER is used to register a helper object that can resolve MTOM attachment content IDs and return the corresponding content of the attachment.static java.lang.StringOPTION_XML_ERROR_HANDLERThe HelperContext option OPTION_XML_ERROR_HANDLER specifies the xml instance error handler to be used by the HelperContext instance.static java.lang.StringSCA_DEFAULT_SCOPESCA default HelperContext identifier
-
Constructor Summary
Constructors Constructor and Description SDOUtil()
-
Method Summary
Methods Modifier and Type Method and Description static voidaddSDOAliasName(commonj.sdo.Type type, java.lang.String aliasName)Creates an alias name for the specified type.static java.lang.ObjectconvertFromString(commonj.sdo.Type datatype, java.lang.String value)Convert from a string representation of the specified datatype to a value of the type.static java.lang.StringconvertToString(commonj.sdo.Type datatype, java.lang.Object value)Convert a value of the specified datatype to its corresponding string representation.static commonj.sdo.helper.HelperContextcreateHelperContext()Create a helper context with a randomly generated IDstatic commonj.sdo.helper.HelperContextcreateHelperContext(java.util.Map<java.lang.String,java.lang.Object> options)Create a helper context with the specified options and a randomly generated IDstatic java.util.Listdefine(commonj.sdo.helper.XSDHelper xsdHelper, java.util.List<javax.xml.transform.Source> sources)Define a group of schemas contributing to the same target namespace.static java.lang.Objectget(commonj.sdo.Type type, commonj.sdo.Property property)Gets an instance Property (annotation) from the specified Type.static java.util.Map<java.lang.String,java.lang.Object>getAttributes(commonj.sdo.DataObject dataObject)Returns a Map of attributes contained by the specified DataObjectstatic java.util.ListgetInstanceProperties(commonj.sdo.Type type)Gets the list of instance properties (annotations) of the specified Type.static java.lang.StringgetMaxLength(commonj.sdo.Type type)Return the value of the maxLength facet on the specified Type, if availablestatic javax.xml.namespace.QNamegetQName(commonj.sdo.Property property)Return the namespace-qualified name of the specified Propertystatic javax.xml.namespace.QNamegetQName(commonj.sdo.Type type)Return the namespace-qualified name of the specified Typestatic java.util.List<javax.xml.transform.Source>getWSDLSources(commonj.sdo.helper.XSDHelper xsdHelper, java.io.InputStream wsdlInputStream, java.lang.String schemaLocation)Create XSD sources for types representing WSDL components - e.g., messages, parts, etc.static booleanisDataTypeWrapper(commonj.sdo.Type type)Return true if the specified Type is a DataTypeWrapperstatic booleanisElement(commonj.sdo.Property property)Returns whether or not the specified property is mapped to an XML elementstatic booleanisMixed(commonj.sdo.Type type)Return true if mixed content is allowed for the specified Typestatic voidset(commonj.sdo.Type type, commonj.sdo.Property property, java.lang.Object value)Sets an instance Property (annotation) on the specified Type.static voidsetLogging(commonj.sdo.ChangeSummary changeSummary, boolean logging)Suspend or resume logging for the specified ChangeSummarystatic voidunset(commonj.sdo.Type type, commonj.sdo.Property property)Unsets an instance Property (annotation) on the specified Type.static booleanvalidate(commonj.sdo.DataObject dataObject)Check if a data object is compliant to its XSD.
-
-
-
Field Detail
-
DATATYPE_WRAPPER_URI
public static final java.lang.String DATATYPE_WRAPPER_URI
URI of the DataTypeWrapper Type- See Also:
- Constant Field Values
-
SCA_DEFAULT_SCOPE
public static final java.lang.String SCA_DEFAULT_SCOPE
SCA default HelperContext identifier- See Also:
- Constant Field Values
-
OPTION_CHANGE_SUMMARY
public static final java.lang.String OPTION_CHANGE_SUMMARY
The HelperContext option OPTION_CHANGE_SUMMARY enables the change summary feature.
Value should be either "true" or "false".
The default value is "true".- See Also:
- Constant Field Values
-
OPTION_SCHEMA_ERROR_HANDLER
public static final java.lang.String OPTION_SCHEMA_ERROR_HANDLER
The HelperContext option OPTION_SCHEMA_ERROR_HANDLER specifies the schema error handler to be used by the HelperContext instance.
Value must be an instance ofDOMErrorHandler.- See Also:
- Constant Field Values
-
OPTION_SCHEMA_ERROR_FAILFAST
public static final java.lang.String OPTION_SCHEMA_ERROR_FAILFAST
The HelperContext option OPTION_SCHEMA_ERROR_FAILFAST enables the schema fail fast mode.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_SCHEMA_FULL_CHECKING
public static final java.lang.String OPTION_SCHEMA_FULL_CHECKING
The HelperContext option OPTION_SCHEMA_FULL_CHECKING enables full checking of schema constraints when loading schema documents.
Value should be either "true" or "false".
The default value is "true".- See Also:
- Constant Field Values
-
OPTION_XML_ERROR_HANDLER
public static final java.lang.String OPTION_XML_ERROR_HANDLER
The HelperContext option OPTION_XML_ERROR_HANDLER specifies the xml instance error handler to be used by the HelperContext instance.
Value must be an instance ofDOMErrorHandler.- See Also:
- Constant Field Values
-
OPTION_SAVE_USE_DEFAULT_NS
public static final java.lang.String OPTION_SAVE_USE_DEFAULT_NS
The HelperContext option OPTION_SAVE_USE_DEFAULT_NS specifies whether or not a QName in a namespace can be serialized in the default namespace.
Value should be either "true" or "false".
The default value is "true".- See Also:
- Constant Field Values
-
OPTION_SAVE_STRIP_WHITESPACE
public static final java.lang.String OPTION_SAVE_STRIP_WHITESPACE
The HelperContext option OPTION_SAVE_STRIP_WHITESPACE specifies whether to strip whitespace ("true") from serialized output or not ("false").
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_LOAD_DISALLOW_UNKNOWN_ITEMS
public static final java.lang.String OPTION_LOAD_DISALLOW_UNKNOWN_ITEMS
Only effective if BO-compat flag is on. When turned on, an exception is thrown when any of the following is true (after trying all the BO-compat fallbacks, including using root element name as type name, removing _._type from xsi:type, removing "Object" from xsi:type, etc.): - Unexpected root: If the root element doesn't match any element declaration, and it doesn't have a resolvable xsi:type.
- Unexpected element: If an element is not allowed by the parent's type (no matching declaration, no wildcard), and is not allowed by any ancestor type (in case an optional element in the ancestor was removed in a derived type) except for anyType.
- Unexpected attribute: Same as #2 but for attributes.
-
-
- See Also:
- Constant Field Values
-
OPTION_SAVE_REQUIRED_PREFIXES
public static final java.lang.String OPTION_SAVE_REQUIRED_PREFIXES
The HelperContext option OPTION_SAVE_REQUIRED_PREFIXES specifies a list of QName containing prefix and URI.- See Also:
- Constant Field Values
-
OPTION_SAVE_FORCE_NS_DECLARATIONS
public static final java.lang.String OPTION_SAVE_FORCE_NS_DECLARATIONS
The HelperContext option OPTION_SAVE_FORCE_NS_DECLARATIONS specifies a list of QName that would always be serialized.- See Also:
- Constant Field Values
-
OPTION_SAVE_OMIT_XML_DECL
public static final java.lang.String OPTION_SAVE_OMIT_XML_DECL
The HelperContext option OPTION_SAVE_OMIT_XML_DECL specifies whether or not to omit the xml declaration when serializing instance documents.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_SAVE_INDENT
public static final java.lang.String OPTION_SAVE_INDENT
The HelperContext option OPTION_SAVE_INDENT specifies whether additional whitespace may be added during serialization.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_SAVE_INDENT_LINE_SEPARATOR
public static final java.lang.String OPTION_SAVE_INDENT_LINE_SEPARATOR
The HelperContext option OPTION_SAVE_INDENT_LINE_SEPARATOR contains the line separator value to use when the option OPTION_SAVE_INDENT == "true".
The default value is "\n".
-
OPTION_SAVE_STANDARD_CHANGE_SUMMARY
public static final java.lang.String OPTION_SAVE_STANDARD_CHANGE_SUMMARY
The HelperContext option OPTION_SAVE_STANDARD_CHANGE_SUMMARY specifies whether or not the change summary information is serialized using the standard XML format described in the SDO specification.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_SAVE_DEFAULT_ATTRIBUTE
public static final java.lang.String OPTION_SAVE_DEFAULT_ATTRIBUTE
The HelperContext option OPTION_SAVE_DISCARD_DEFAULT_ATTRIBUTE instructs the XML serializer to save the default attribute value specified in the XSD.
Value should be either boolean true or false.
The default value is true.- See Also:
- Constant Field Values
-
OPTION_FAST_SERIALIZATION
public static final java.lang.String OPTION_FAST_SERIALIZATION
The HelperContext option OPTION_FAST_SERIALIZATION will improve the speed of serialization operations by caching namespace information.
Value should be either "true" or "false".
The default value is "true".- See Also:
- Constant Field Values
-
OPTION_EAGER_ON_LOAD
public static final java.lang.String OPTION_EAGER_ON_LOAD
The HelperContext option OPTION_EAGER_ON_LOAD will materialize the entire document/data during the "loading phase" - i.e., during the load() call. Any well-formedness errors are reported immediately, but no validity errors are reported because the data is simply loaded, not validated. As a side note, this happens in a document order, so there are no skipped subtrees.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_EAGER_BUFFER_LOAD
public static final java.lang.String OPTION_EAGER_BUFFER_LOAD
The HelperContext option OPTION_EAGER_BUFFER_LOAD will load the entire document to its internal buffer but not necessarily parse its contents
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_LOAD_SKIP_SUBTREE
public static final java.lang.String OPTION_LOAD_SKIP_SUBTREE
The HelperContext option OPTION_LOAD_SKIP_SUBTREE will materialize the root level of the document/data during the "loading phase" - i.e., during the load() call. The remaining portions of the document/data will be loaded "as needed".
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_VALIDATE_ON_LOAD
public static final java.lang.String OPTION_VALIDATE_ON_LOAD
The HelperContext option OPTION_VALIDATE_ON_LOAD is a superset of OPTION_EAGER_ON_LOAD in that it will perform a document schema validation in addition to the loading operation discussed in OPTION_EAGER_ON_LOAD. At the conclusion of the "loading phase", when this option is enabled ("true"), the document/data will have been loaded in its entirety and both well-formedness and validity errors will have been reported.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_LOAD_LARGE_DOCUMENT
public static final java.lang.String OPTION_LOAD_LARGE_DOCUMENT
The HelperContext option OPTION_LOAD_LARGE_DOCUMENT will improve de-serialization operations for large documents (> 1MB).
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_COPY_DISCARD_DEFAULT_ATTRIBUTE
public static final java.lang.String OPTION_COPY_DISCARD_DEFAULT_ATTRIBUTE
The HelperContext option OPTION_COPY_DISCARD_DEFAULT_ATTRIBUTE determines whether or not schema specified default attributes are propagated during a document instance copy operation.
Value should be either "true" or "false".
The default value is "false".- See Also:
- Constant Field Values
-
OPTION_COPY_ON_WRITE
public static final java.lang.String OPTION_COPY_ON_WRITE
The HelperContext option OPTION_COPY_ON_WRITE determines whether CopyHelper.copy() will perform copy-on-write (when possible).
Value should be either "true" or "false".
The default value is "true".- See Also:
- Constant Field Values
-
OPTION_BO_COMPATIBLE
public static final java.lang.String OPTION_BO_COMPATIBLE
- See Also:
- Constant Field Values
-
OPTION_SCOPE_MANAGER
public static final java.lang.String OPTION_SCOPE_MANAGER
- See Also:
- Constant Field Values
-
OPTION_XML_ATTACHMENT_UNMARSHALLER
public static final java.lang.String OPTION_XML_ATTACHMENT_UNMARSHALLER
The HelperContext option OPTION_XML_ATTACHMENT_UNMARSHALLER is used to register a helper object that can resolve MTOM attachment content IDs and return the corresponding content of the attachment. Value of this property must be an instance of @link XMLAttachmentUnmarshaller. An object should not be registered if the document does not contatin any references to MTOM attachments.- See Also:
- Constant Field Values
-
OPTION_XML_ATTACHMENT_MARSHALLER
public static final java.lang.String OPTION_XML_ATTACHMENT_MARSHALLER
The HelperContext option OPTION_XML_ATTACHMENT_MARSHALLER is used to register a helper object that can determine if a piece of base64Binary data should be serialized as inlined base64 text or as an MTOM attachment reference. Value of this property must be an instance of- See Also:
- Constant Field Values
-
Method Detail
-
createHelperContext
public static commonj.sdo.helper.HelperContext createHelperContext(java.util.Map<java.lang.String,java.lang.Object> options)
Create a helper context with the specified options and a randomly generated ID- Parameters:
Map- of options to be used when constructing the new HelperContext- Returns:
- new HelperContext object
-
createHelperContext
public static commonj.sdo.helper.HelperContext createHelperContext()
Create a helper context with a randomly generated ID- Returns:
- new HelperContext object
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.Object> getAttributes(commonj.sdo.DataObject dataObject)
Returns a Map of attributes contained by the specified DataObject- Parameters:
DataObject- to be inspected- Returns:
- Map of attributes
-
validate
public static boolean validate(commonj.sdo.DataObject dataObject)
Check if a data object is compliant to its XSD.- Parameters:
DataObject- to be validated- Returns:
- true if valid, otherwise false
-
define
public static java.util.List define(commonj.sdo.helper.XSDHelper xsdHelper, java.util.List<javax.xml.transform.Source> sources)Define a group of schemas contributing to the same target namespace. Multiple target namespaces can be defined as well.- Parameters:
xsdHelper-A- list of schema files- Returns:
- A list of defined SDO types
-
getWSDLSources
public static java.util.List<javax.xml.transform.Source> getWSDLSources(commonj.sdo.helper.XSDHelper xsdHelper, java.io.InputStream wsdlInputStream, java.lang.String schemaLocation)Create XSD sources for types representing WSDL components - e.g., messages, parts, etc.- Parameters:
xsdHelper-wsdlInputStream- a .wsdl stream
-
convertToString
public static java.lang.String convertToString(commonj.sdo.Type datatype, java.lang.Object value)Convert a value of the specified datatype to its corresponding string representation.- Parameters:
dataType-value-- Returns:
- string value
-
convertFromString
public static java.lang.Object convertFromString(commonj.sdo.Type datatype, java.lang.String value)Convert from a string representation of the specified datatype to a value of the type.- Parameters:
datatype-value-- Returns:
- object value
-
getInstanceProperties
public static java.util.List getInstanceProperties(commonj.sdo.Type type)
Gets the list of instance properties (annotations) of the specified Type.- Parameters:
type-- Returns:
- list of Property
-
get
public static java.lang.Object get(commonj.sdo.Type type, commonj.sdo.Property property)Gets an instance Property (annotation) from the specified Type.- Parameters:
type-property-- Returns:
- annotation value
-
set
public static void set(commonj.sdo.Type type, commonj.sdo.Property property, java.lang.Object value)Sets an instance Property (annotation) on the specified Type.- Parameters:
type-property-value-
-
unset
public static void unset(commonj.sdo.Type type, commonj.sdo.Property property)Unsets an instance Property (annotation) on the specified Type.- Parameters:
type-property-
-
isMixed
public static boolean isMixed(commonj.sdo.Type type)
Return true if mixed content is allowed for the specified Type- Parameters:
type-- Returns:
- true if mixed, otherwise false.
-
getMaxLength
public static java.lang.String getMaxLength(commonj.sdo.Type type)
Return the value of the maxLength facet on the specified Type, if available- Parameters:
type-- Returns:
- value of the maxLength facet or null
-
isElement
public static boolean isElement(commonj.sdo.Property property)
Returns whether or not the specified property is mapped to an XML element- Parameters:
property-- Returns:
- true if the property is an XML element, otherwise false.
-
getQName
public static javax.xml.namespace.QName getQName(commonj.sdo.Type type)
Return the namespace-qualified name of the specified Type- Parameters:
type-- Returns:
- QName of the type.
-
getQName
public static javax.xml.namespace.QName getQName(commonj.sdo.Property property)
Return the namespace-qualified name of the specified Property- Parameters:
property-- Returns:
- QName of the property.
-
isDataTypeWrapper
public static boolean isDataTypeWrapper(commonj.sdo.Type type)
Return true if the specified Type is a DataTypeWrapper- Parameters:
type-- Returns:
- true if the type specified is a data wrapper, otherwise false.
-
addSDOAliasName
public static void addSDOAliasName(commonj.sdo.Type type, java.lang.String aliasName)Creates an alias name for the specified type.- Parameters:
type-alias- name to add to associate with type
-
setLogging
public static void setLogging(commonj.sdo.ChangeSummary changeSummary, boolean logging)Suspend or resume logging for the specified ChangeSummary
-