Class Rowset
- java.lang.Object
-
- mondrian.xmla.Rowset
-
- All Implemented Interfaces:
XmlaConstants
- Direct Known Subclasses:
RowsetDefinition.DbschemaCatalogsRowset
,RowsetDefinition.DbschemaColumnsRowset
,RowsetDefinition.DbschemaProviderTypesRowset
,RowsetDefinition.DbschemaSchemataRowset
,RowsetDefinition.DbschemaTablesInfoRowset
,RowsetDefinition.DbschemaTablesRowset
,RowsetDefinition.DiscoverDatasourcesRowset
,RowsetDefinition.DiscoverEnumeratorsRowset
,RowsetDefinition.DiscoverKeywordsRowset
,RowsetDefinition.DiscoverLiteralsRowset
,RowsetDefinition.DiscoverPropertiesRowset
,RowsetDefinition.DiscoverSchemaRowsetsRowset
,RowsetDefinition.MdschemaActionsRowset
,RowsetDefinition.MdschemaCubesRowset
,RowsetDefinition.MdschemaDimensionsRowset
,RowsetDefinition.MdschemaFunctionsRowset
,RowsetDefinition.MdschemaHierarchiesRowset
,RowsetDefinition.MdschemaLevelsRowset
,RowsetDefinition.MdschemaMeasuresRowset
,RowsetDefinition.MdschemaMembersRowset
,RowsetDefinition.MdschemaPropertiesRowset
,RowsetDefinition.MdschemaSetsRowset
abstract class Rowset extends java.lang.Object implements XmlaConstants
Base class for an XML for Analysis schema rowset. A concrete derived class should implementpopulateImpl(mondrian.xmla.XmlaResponse, org.olap4j.OlapConnection, java.util.List<mondrian.xmla.Rowset.Row>)
, callingaddRow(mondrian.xmla.Rowset.Row, java.util.List<mondrian.xmla.Rowset.Row>)
for each row.- Since:
- May 2, 2003
- Author:
- jhyde
- See Also:
RowsetDefinition
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Rowset.Row
A set of name/value pairs, which can be output usingaddRow(mondrian.xmla.Rowset.Row, java.util.List<mondrian.xmla.Rowset.Row>)
.protected static class
Rowset.XmlElement
Holder for non-scalar column values of aRowset.Row
.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
deep
protected java.util.Map<java.lang.String,java.lang.String>
extraProperties
protected XmlaHandler
handler
protected static org.apache.log4j.Logger
LOGGER
protected java.util.Map<java.lang.String,java.lang.String>
properties
protected XmlaRequest
request
protected java.util.Map<java.lang.String,java.lang.Object>
restrictions
protected RowsetDefinition
rowsetDefinition
-
Fields inherited from interface mondrian.xmla.XmlaConstants
CHH_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, 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
-
-
Constructor Summary
Constructors Constructor Description Rowset(RowsetDefinition definition, XmlaRequest request, XmlaHandler handler)
Creates a Rowset.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
addRow(Rowset.Row row, java.util.List<Rowset.Row> rows)
Adds aRowset.Row
to a result, provided that it meets the necessary criteria.protected Util.Functor1<java.lang.Boolean,Catalog>
catNameCond()
protected void
emit(Rowset.Row row, XmlaResponse response)
Emits a row for this rowset, reading fields from aRowset.Row
object.(package private) int
getRestrictionValueAsInt(RowsetDefinition.Column column)
Returns a column's restriction as anint
if it exists, -1 otherwise.(package private) java.lang.String
getRestrictionValueAsString(RowsetDefinition.Column column)
Returns the restriction if it is a String, or null otherwise.protected boolean
isRestricted(RowsetDefinition.Column column)
Returns true if there is a restriction for the given column definition.(package private) <E,V>
Util.Functor1<java.lang.Boolean,E>makeCondition(Util.Functor1<V,? super E> getter, RowsetDefinition.Column column)
Creates a condition functor using an accessor.(package private) <E> Util.Functor1<java.lang.Boolean,E>
makeCondition(RowsetDefinition.Column column)
Creates a condition functor based on the restrictions on a given metadata column specified in an XMLA request.protected boolean
needConnection()
protected <E> void
populate(java.lang.Class<E> clazz, java.util.List<Rowset.Row> rows, java.util.Comparator<E> comparator)
Populates all of the values in an enumeration into a list of rows.void
populate(XmlaResponse response, OlapConnection connection, java.util.List<Rowset.Row> rows)
Gathers the set of rows which match a given set of the criteria.protected abstract void
populateImpl(XmlaResponse response, OlapConnection connection, java.util.List<Rowset.Row> rows)
Gathers the set of rows which match a given set of the criteria.protected java.util.ArrayList<RowsetDefinition.Column>
pruneRestrictions(java.util.ArrayList<RowsetDefinition.Column> list)
protected void
setProperty(PropertyDefinition propertyDef, java.lang.String value)
Sets a property for this rowset.void
unparse(XmlaResponse response)
Writes the contents of this rowset as a series of SAX events.
-
-
-
Field Detail
-
LOGGER
protected static final org.apache.log4j.Logger LOGGER
-
rowsetDefinition
protected final RowsetDefinition rowsetDefinition
-
restrictions
protected final java.util.Map<java.lang.String,java.lang.Object> restrictions
-
properties
protected final java.util.Map<java.lang.String,java.lang.String> properties
-
extraProperties
protected final java.util.Map<java.lang.String,java.lang.String> extraProperties
-
request
protected final XmlaRequest request
-
handler
protected final XmlaHandler handler
-
deep
protected final boolean deep
-
-
Constructor Detail
-
Rowset
Rowset(RowsetDefinition definition, XmlaRequest request, XmlaHandler handler)
Creates a Rowset.The exceptions thrown in this constructor are not produced during the execution of an XMLA request and so can be ordinary exceptions and not XmlaException (which are specifically for generating SOAP Fault xml).
-
-
Method Detail
-
pruneRestrictions
protected java.util.ArrayList<RowsetDefinition.Column> pruneRestrictions(java.util.ArrayList<RowsetDefinition.Column> list)
-
setProperty
protected void setProperty(PropertyDefinition propertyDef, java.lang.String value)
Sets a property for this rowset. Called by the constructor for each supplied property. A derived class should override this method and intercept each property it supports. Any property it does not support, it should forward to the base class method, which will probably throw an error.
-
unparse
public final void unparse(XmlaResponse response) throws XmlaException, java.sql.SQLException
Writes the contents of this rowset as a series of SAX events.- Throws:
XmlaException
java.sql.SQLException
-
populate
public final void populate(XmlaResponse response, OlapConnection connection, java.util.List<Rowset.Row> rows) throws XmlaException
Gathers the set of rows which match a given set of the criteria.- Throws:
XmlaException
-
needConnection
protected boolean needConnection()
-
populateImpl
protected abstract void populateImpl(XmlaResponse response, OlapConnection connection, java.util.List<Rowset.Row> rows) throws XmlaException, java.sql.SQLException
Gathers the set of rows which match a given set of the criteria.- Throws:
XmlaException
java.sql.SQLException
-
addRow
protected final boolean addRow(Rowset.Row row, java.util.List<Rowset.Row> rows) throws XmlaException
Adds aRowset.Row
to a result, provided that it meets the necessary criteria. Returns whether the row was added.- Parameters:
row
- Rowrows
- List of result rows- Throws:
XmlaException
-
emit
protected void emit(Rowset.Row row, XmlaResponse response) throws XmlaException, java.sql.SQLException
Emits a row for this rowset, reading fields from aRowset.Row
object.- Parameters:
row
- Rowresponse
- XMLA response writer- Throws:
XmlaException
java.sql.SQLException
-
populate
protected <E> void populate(java.lang.Class<E> clazz, java.util.List<Rowset.Row> rows, java.util.Comparator<E> comparator) throws XmlaException
Populates all of the values in an enumeration into a list of rows.- Throws:
XmlaException
-
makeCondition
<E> Util.Functor1<java.lang.Boolean,E> makeCondition(RowsetDefinition.Column column)
Creates a condition functor based on the restrictions on a given metadata column specified in an XMLA request.A condition is a
Util.Functor1
whose return type is boolean. Restrictions are used in each Rowset's discovery request. If there is no restriction then the passes method always returns true.It is known at the beginning of a
populate(XmlaResponse, org.olap4j.OlapConnection, java.util.List)
method whether the restriction is not specified (null), a single value (String) or an array of values (String[]). So, creating the conditions just once at the beginning is faster than having to determine the restriction status each time it is needed.
-
makeCondition
<E,V> Util.Functor1<java.lang.Boolean,E> makeCondition(Util.Functor1<V,? super E> getter, RowsetDefinition.Column column)
Creates a condition functor using an accessor.The accessor gets a particular property of the element in question for the column restrictions to act upon.
-
getRestrictionValueAsString
java.lang.String getRestrictionValueAsString(RowsetDefinition.Column column)
Returns the restriction if it is a String, or null otherwise. Does not attempt two determine if the restriction is an array of Strings if all members of the array have the same value (in which case one could return, again, simply a single String).
-
getRestrictionValueAsInt
int getRestrictionValueAsInt(RowsetDefinition.Column column)
Returns a column's restriction as anint
if it exists, -1 otherwise.
-
isRestricted
protected boolean isRestricted(RowsetDefinition.Column column)
Returns true if there is a restriction for the given column definition.
-
catNameCond
protected Util.Functor1<java.lang.Boolean,Catalog> catNameCond()
-
-