|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.xmla.XmlaUtil
public class XmlaUtil
Utility methods for XML/A implementation.
Nested Class Summary | |
---|---|
static class |
XmlaUtil.MetadataRowset
Result of a metadata query. |
static class |
XmlaUtil.Wildcard
Wrapper which indicates that a restriction is to be treated as a SQL-style wildcard match. |
Field Summary |
---|
Constructor Summary | |
---|---|
XmlaUtil()
|
Method Summary | |
---|---|
static String |
element2Text(Element elem)
|
static String |
encodeElementName(String name)
Encodes an XML element name. |
static Element[] |
filterChildElements(Element parent,
String ns,
String lname)
|
static Element |
firstChildElement(Element parent,
String ns,
String lname)
Returns the first child element of an XML element, or null if there is no first child. |
static void |
generateMetamodelJavadoc()
Generates descriptions of the columns returned by each metadata query, in javadoc format, suitable for pasting into OlapDatabaseMetaData . |
static XmlaUtil.MetadataRowset |
getMetadataRowset(Connection connection,
String catalogName,
String methodName,
Map<String,Object> restrictionMap)
Returns a set of column headings and rows for a given metadata request. |
static String |
normalizeNumericString(String numericStr)
Corrects for the differences between numeric strings arising because JDBC drivers use different representations for numbers ( Double vs. |
static Throwable |
rootThrowable(Throwable throwable)
Finds root MondrianException in exception chain if exists, otherwise the input throwable. |
static Element |
stream2Element(InputStream stream)
|
static Element |
text2Element(String text)
|
static String |
textInElement(Element elem)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlaUtil()
Method Detail |
---|
public static String encodeElementName(String name)
This function is mainly for encode element names in result of Drill Through execute, because its element names come from database, we cannot make sure they are valid XML contents.
Quoth the XML/A specification, version 1.1:
XML does not allow certain characters as element and attribute names. XML for Analysis supports encoding as defined by SQL Server 2000 to address this XML constraint. For column names that contain invalid XML name characters (according to the XML 1.0 specification), the nonvalid Unicode characters are encoded using the corresponding hexadecimal values. These are escaped as _xHHHH_ where HHHH stands for the four-digit hexadecimal UCS-2 code for the character in most-significant bit first order. For example, the name "Order Details" is encoded as Order_x0020_Details, where the space character is replaced by the corresponding hexadecimal code.
name
- Name of XML element
public static String element2Text(Element elem) throws XmlaException
XmlaException
public static Element text2Element(String text) throws XmlaException
XmlaException
public static Element stream2Element(InputStream stream) throws XmlaException
XmlaException
public static Element firstChildElement(Element parent, String ns, String lname)
parent
- XML elementns
- Namespacelname
- Local name of child
public static Element[] filterChildElements(Element parent, String ns, String lname)
public static String textInElement(Element elem)
public static Throwable rootThrowable(Throwable throwable)
throwable
- Exception
public static String normalizeNumericString(String numericStr)
Double
vs. 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.
numericStr
- Numeric string
public static XmlaUtil.MetadataRowset getMetadataRowset(Connection connection, String catalogName, String methodName, Map<String,Object> restrictionMap)
connection
- ConnectioncatalogName
- Catalog namemethodName
- Metadata method name per XMLA (e.g. "MDSCHEMA_CUBES")restrictionMap
- Restrictions
public static void generateMetamodelJavadoc() throws IOException
OlapDatabaseMetaData
.
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |