Package mondrian.xmla
Class XmlaUtil
java.lang.Object
mondrian.xmla.XmlaUtil
- All Implemented Interfaces:
- XmlaConstants
Utility methods for XML/A implementation.
- Author:
- Gang Chen
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic classResult of a metadata query.static classWrapper which indicates that a restriction is to be treated as a SQL-style wildcard match.
- 
Field SummaryFields inherited from interface mondrian.xmla.XmlaConstantsCHH_AUTHORIZATION_CODE, CHH_AUTHORIZATION_FAULT_FS, CHH_CODE, CHH_FAULT_FS, CLIENT_FAULT_FC, CONTEXT_MIME_TYPE, CONTEXT_ROLE_NAME, CONTEXT_XMLA_PASSWORD, CONTEXT_XMLA_SESSION_ID, CONTEXT_XMLA_SESSION_STATE, CONTEXT_XMLA_SESSION_STATE_BEGIN, CONTEXT_XMLA_SESSION_STATE_END, CONTEXT_XMLA_SESSION_STATE_WITHIN, CONTEXT_XMLA_USERNAME, CPOSTA_CODE, CPOSTA_FAULT_FS, CPREA_CODE, CPREA_FAULT_FS, FAULT_ACTOR, FAULT_FC_PREFIX, FAULT_FS_PREFIX, FAULT_NS_PREFIX, HSB_ACCESS_DENIED_CODE, HSB_ACCESS_DENIED_FAULT_FS, HSB_BAD_COMMAND_CODE, HSB_BAD_COMMAND_FAULT_FS, HSB_BAD_METHOD_CODE, HSB_BAD_METHOD_FAULT_FS, HSB_BAD_METHOD_NS_CODE, HSB_BAD_METHOD_NS_FAULT_FS, HSB_BAD_NON_NULLABLE_COLUMN_CODE, HSB_BAD_NON_NULLABLE_COLUMN_FAULT_FS, HSB_BAD_PROPERTIES_CODE, HSB_BAD_PROPERTIES_FAULT_FS, HSB_BAD_PROPERTIES_LIST_CODE, HSB_BAD_PROPERTIES_LIST_FAULT_FS, HSB_BAD_REQUEST_TYPE_CODE, HSB_BAD_REQUEST_TYPE_FAULT_FS, HSB_BAD_RESTRICTION_LIST_CODE, HSB_BAD_RESTRICTION_LIST_FAULT_FS, HSB_BAD_RESTRICTIONS_CODE, HSB_BAD_RESTRICTIONS_FAULT_FS, HSB_BAD_SOAP_BODY_CODE, HSB_BAD_SOAP_BODY_FAULT_FS, HSB_BAD_STATEMENT_CODE, HSB_BAD_STATEMENT_FAULT_FS, HSB_CONNECTION_DATA_SOURCE_CODE, HSB_CONNECTION_DATA_SOURCE_FAULT_FS, HSB_DISCOVER_FORMAT_CODE, HSB_DISCOVER_FORMAT_FAULT_FS, HSB_DISCOVER_UNPARSE_CODE, HSB_DISCOVER_UNPARSE_FAULT_FS, HSB_DRILL_THROUGH_FORMAT_CODE, HSB_DRILL_THROUGH_FORMAT_FAULT_FS, HSB_DRILL_THROUGH_NOT_ALLOWED_CODE, HSB_DRILL_THROUGH_NOT_ALLOWED_FAULT_FS, HSB_DRILL_THROUGH_SQL_CODE, HSB_DRILL_THROUGH_SQL_FAULT_FS, HSB_EXECUTE_QUERY_CODE, HSB_EXECUTE_QUERY_FAULT_FS, HSB_EXECUTE_UNPARSE_CODE, HSB_EXECUTE_UNPARSE_FAULT_FS, HSB_PARSE_QUERY_CODE, HSB_PARSE_QUERY_FAULT_FS, HSB_PROCESS_CODE, HSB_PROCESS_FAULT_FS, HSB_UNKNOWN_CODE, HSB_UNKNOWN_FAULT_FS, HSH_BAD_SESSION_ID_CODE, HSH_BAD_SESSION_ID_FAULT_FS, HSH_MUST_UNDERSTAND_CODE, HSH_MUST_UNDERSTAND_FAULT_FS, HSH_UNKNOWN_CODE, HSH_UNKNOWN_FAULT_FS, MONDRIAN_NAMESPACE, MSM_UNKNOWN_CODE, MSM_UNKNOWN_FAULT_FS, MUST_UNDERSTAND_FAULT_FC, NS_SOAP_ENC_1_1, NS_SOAP_ENC_1_2, NS_SOAP_ENV_1_1, NS_SOAP_ENV_1_2, NS_SOAP_SECEXT, NS_SQL, NS_XMLA, NS_XMLA_EMPTY, NS_XMLA_EX, NS_XMLA_MDDATASET, NS_XMLA_ROWSET, NS_XSD, NS_XSI, SERVER_FAULT_FC, SIE_REQUEST_STATE_CODE, SIE_REQUEST_STATE_FAULT_FS, SOAP_MUST_UNDERSTAND_ATTR, SOAP_PREFIX, UNKNOWN_ERROR_CODE, UNKNOWN_ERROR_FAULT_FS, USM_DOM_FACTORY_CODE, USM_DOM_FACTORY_FAULT_FS, USM_DOM_PARSE_CODE, USM_DOM_PARSE_FAULT_FS, USM_DOM_PARSE_IO_CODE, USM_DOM_PARSE_IO_FAULT_FS, USM_REQUEST_INPUT_CODE, USM_REQUEST_INPUT_FAULT_FS, USM_REQUEST_STATE_CODE, USM_REQUEST_STATE_FAULT_FS, USM_UNKNOWN_CODE, USM_UNKNOWN_FAULT_FS, VERSION_MISSMATCH_FAULT_FC, XMLA_BEGIN_SESSION, XMLA_END_SESSION, XMLA_SECURITY, XMLA_SESSION, XMLA_SESSION_ID
- 
Method SummaryModifier and TypeMethodDescriptionstatic Enumeration.ResponseMimeTypechooseResponseMimeType(String accept) Chooses the appropriate response mime type given an HTTP "Accept" header.static LocaleconvertToLocale(String value) static voidelement2Text(Element elem, StringWriter writer) static Element[]filterChildElements(Element parent, String ns, String lname) static XmlaUtil.MetadataRowsetgetMetadataRowset(org.olap4j.OlapConnection connection, String methodName, Map<String, Object> restrictionMap) Returns a set of column headings and rows for a given metadata request.static StringnormalizeNumericString(String numericStr) Corrects for the differences between numeric strings arising because JDBC drivers use different representations for numbers (Doublevs.static ThrowablerootThrowable(Throwable throwable) Finds root MondrianException in exception chain if exists, otherwise the input throwable.static booleanshouldEmitInvisibleMembers(XmlaRequest request) Returns whether an XMLA request should return invisible members.static Elementstream2Element(InputStream stream) static Elementtext2Element(String text) static StringtextInElement(Element elem) 
- 
Method Details- 
element2Text- Throws:
- XmlaException
 
- 
text2Element- Throws:
- XmlaException
 
- 
stream2Element- Throws:
- XmlaException
 
- 
filterChildElements
- 
textInElement
- 
rootThrowableFinds root MondrianException in exception chain if exists, otherwise the input throwable.- Parameters:
- throwable- Exception
- Returns:
- Root exception
 
- 
normalizeNumericStringCorrects for the differences between numeric strings arising because JDBC drivers use different representations for numbers (Doublevs.BigDecimal) and these have different toString() behavior.If it contains a decimal point, then strip off trailing '0's. After stripping off the '0's, if there is nothing right of the decimal point, then strip off decimal point. - Parameters:
- numericStr- Numeric string
- Returns:
- Normalized string
 
- 
getMetadataRowsetpublic static XmlaUtil.MetadataRowset getMetadataRowset(org.olap4j.OlapConnection connection, String methodName, Map<String, Object> restrictionMap) Returns a set of column headings and rows for a given metadata request. Leverages mondrian's implementation of the XML/A specification, and is exposed here for use by mondrian's olap4j driver.- Parameters:
- connection- Connection
- methodName- Metadata method name per XMLA (e.g. "MDSCHEMA_CUBES")
- restrictionMap- Restrictions
- Returns:
- Set of rows and column headings
 
- 
chooseResponseMimeTypeChooses the appropriate response mime type given an HTTP "Accept" header.The header can contain a list of mime types and optional qualities, for example "text/html, application/xhtml+xml,application/xml;q=0.9" - Parameters:
- accept- Accept header
- Returns:
- Mime type, or null if none is acceptable
 
- 
shouldEmitInvisibleMembersReturns whether an XMLA request should return invisible members.According to the XMLA spec, it should not. But we allow the client to specify different behavior. In particular, the olap4j driver for XMLA may need to access invisible members. Returns true if the EmitInvisibleMembers property is specified and equal to "true". - Parameters:
- request- XMLA request
- Returns:
- Whether to return invisible members
 
- 
convertToLocale
 
-