Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.olap.mdx
Class MDXDataSource

java.lang.Object
  extended by com.citra.pivot.olap.mdx.MDXDataSource
All Implemented Interfaces:
DataSource
Direct Known Subclasses:
Olap4jDataSource

public abstract class MDXDataSource
extends Object
implements DataSource

MDXDataSource is a DataSource that connects to a database that uses the MDX query language. When executing an OlapSelection, this is first converted to the MDX statement, which is then passed to the database, and the result from the query is returned. MDXResolver is used for that purpose.


Field Summary
protected  MDXResolver resolver
           
protected  OlapSchema schema
           
 
Constructor Summary
MDXDataSource()
          Constructs a MDXDataSource.
 
Method Summary
 void closeConnection(Connection connection)
          Closes and releases a connection.
 Connection createConnection()
          Returns a new connection to the datasource.
protected abstract  MDXResolver createResolver()
          Creates and returns an instance of the class responsible for resolving selections.
protected abstract  OlapSchema createSchema()
          Creates and returns the schema.
 Object executeSelection(OlapSelection selection, Connection connection)
          Executes the selection using the supplied connection object.
 boolean getLogging()
          Sets debugging on/off.
 MDXResolver getResolver()
          Returns the class responsible for resolving selections.
 OlapSchema getSchema()
          Retrieves the schema of the datasource.
 void setLogging(boolean logging)
          Sets logging on/off.
 void setResolver(MDXResolver resolver)
          Assigns the class responsible for resolving selections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resolver

protected MDXResolver resolver

schema

protected OlapSchema schema
Constructor Detail

MDXDataSource

public MDXDataSource()
Constructs a MDXDataSource.

Method Detail

closeConnection

public void closeConnection(Connection connection)
                     throws DataSourceException
Closes and releases a connection.

Parameters:
connection - the connection to close
Throws:
DataSourceException

createConnection

public Connection createConnection()
Returns a new connection to the datasource.

Specified by:
createConnection in interface DataSource
Returns:
a new connection to the datasource

createResolver

protected abstract MDXResolver createResolver()
Creates and returns an instance of the class responsible for resolving selections.

Returns:
the resolver

createSchema

protected abstract OlapSchema createSchema()
Creates and returns the schema.

Returns:
the schema

executeSelection

public Object executeSelection(OlapSelection selection,
                               Connection connection)
                        throws DataSourceException
Executes the selection using the supplied connection object.

Parameters:
selection - the selection to execute
connection - the connection to use
Returns:
the object returned from the query
Throws:
DataSourceException

getLogging

public boolean getLogging()
Sets debugging on/off. In debug mode, all MDX statements are logged in the system console, together with the time it took to evaluate them.

Returns:
true, if logging is enabled, false otherwise

getResolver

public MDXResolver getResolver()
Returns the class responsible for resolving selections.

Returns:
the resolver

getSchema

public OlapSchema getSchema()
Retrieves the schema of the datasource. The schema serves as a starting point for getting members and making queries.

Specified by:
getSchema in interface DataSource
Returns:
the datasource's schema

setLogging

public void setLogging(boolean logging)
Sets logging on/off. In logging mode, all MDX statements are logged in the system console, together with the time it took to evaluate them.

Parameters:
logging - true, if logging is enabled, false otherwise

setResolver

public void setResolver(MDXResolver resolver)
Assigns the class responsible for resolving selections.

Parameters:
resolver - the resolver to assign

Copyright © 2011 Citra Technologies. All Rights Reserved.