java.lang.Object
org.pentaho.platform.plugin.services.connections.mondrian.MDXOlap4jConnection
All Implemented Interfaces:
org.pentaho.commons.connection.IPentahoConnection

public class MDXOlap4jConnection extends Object implements org.pentaho.commons.connection.IPentahoConnection
MDXOlap4jConnection implements IPentahoConenction to support olap4j connections to any olap4j provider. Developers may subclass MDXOlap4jConnection to unwrap the olap4j connection to directly manipulate the underlying connection. An example of this is setting a DelegatingRole in the case of Mondrian.
Version:
$Id: $
Author:
Benny Chow
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.olap4j.OlapConnection
    Underlying connection to OLAP system.

    Fields inherited from interface org.pentaho.commons.connection.IPentahoConnection

    CLASSNAME_KEY, CONNECTION, CONNECTION_NAME, DRIVER_KEY, HQL_DATASOURCE, JNDI_NAME_KEY, KEYS, LOCATION_KEY, MDX_DATASOURCE, MDX_OLAP4J_DATASOURCE, NONE_DATASOURCE, PASSWORD_KEY, PROVIDER, QUERY_KEY, SQL_DATASOURCE, USERNAME_KEY, XML_DATASOURCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears any warnings cached by the connection.
    void
    Closes the connection.
    boolean
    Sets the properties to be used when the connection is made.
    org.pentaho.commons.connection.IPentahoResultSet
    Executes the specified query against the connection.
    org.olap4j.OlapConnection
    Returns the underlying connection to OLAP system.
    Returns the type of connection.
    Retrieves the string representation of the last executed query.
    org.pentaho.commons.connection.IPentahoResultSet
    Returns resultset of the last executed query.
    boolean
    Checks if the connection is initialized or not.
    boolean
    Checks if the connection is closed or not.
    boolean
    Checks if the connection is read only or not.
    org.pentaho.commons.connection.IPentahoResultSet
    Builds the query based on the pattern and parameters list and executes it against the connection.
    boolean
    Checks if the given connection supports prepared queries.
    void
    setFetchSize(int arg0)
    Sets size of the fetch buffer used when retrieving rows from the underlying database.
    void
    setMaxRows(int arg0)
    Sets maximum rows that will be returned by the next query.
    void
    Sets the properties to be used when the connection is made.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • connection

      protected org.olap4j.OlapConnection connection
      Underlying connection to OLAP system.
  • Constructor Details

    • MDXOlap4jConnection

      public MDXOlap4jConnection()
  • Method Details

    • close

      public void close()
      Closes the connection.
      Specified by:
      close in interface org.pentaho.commons.connection.IPentahoConnection
    • connect

      public boolean connect(Properties props)
      Sets the properties to be used when the connection is made. The standard keys for the properties are defined in this interface.
      Specified by:
      connect in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      props - Properties to be used for creating connection. This particular method relies on the following properties: url, driver, user, password.
    • executeQuery

      public org.pentaho.commons.connection.IPentahoResultSet executeQuery(String arg0)
      Executes the specified query against the connection.
      Specified by:
      executeQuery in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      query - SQL-like query string. May be data source specific.
      Returns:
      Returns result set of the query.
    • getResultSet

      public org.pentaho.commons.connection.IPentahoResultSet getResultSet()
      Returns resultset of the last executed query.
      Specified by:
      getResultSet in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns the resultset from the last query executed.
    • initialized

      public boolean initialized()
      Checks if the connection is initialized or not.
      Specified by:
      initialized in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns true if the connection has been properly initialized.
    • isClosed

      public boolean isClosed()
      Checks if the connection is closed or not.
      Specified by:
      isClosed in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns true if this connection has been closed.
    • isReadOnly

      public boolean isReadOnly()
      Checks if the connection is read only or not.
      Specified by:
      isReadOnly in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns true if this connection is read only. NOTE: Current implementation for all connections is read only.
    • prepareAndExecuteQuery

      public org.pentaho.commons.connection.IPentahoResultSet prepareAndExecuteQuery(String arg0, List arg1) throws Exception
      Builds the query based on the pattern and parameters list and executes it against the connection.
      Specified by:
      prepareAndExecuteQuery in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      arg0 - SQL-like query string. May be data source specific.
      arg1 - List of objects to bind into prepared query.
      Returns:
      Returns result set of the query.
      Throws:
      Exception
    • preparedQueriesSupported

      public boolean preparedQueriesSupported()
      Checks if the given connection supports prepared queries.
      Specified by:
      preparedQueriesSupported in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns true if the connection supports prepared queries.
    • setFetchSize

      public void setFetchSize(int arg0)
      Sets size of the fetch buffer used when retrieving rows from the underlying database.
      Specified by:
      setFetchSize in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      fetchSize - The buffer size.
    • setMaxRows

      public void setMaxRows(int arg0)
      Sets maximum rows that will be returned by the next query.
      Specified by:
      setMaxRows in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      maxRows - Maximum rows that are returned by the next query.
    • setProperties

      public void setProperties(Properties props)
      Sets the properties to be used when the connection is made. It connects to the OLAP system described by the properties. The standard keys for the properties are defined in IPentahoConnection interface.
      Specified by:
      setProperties in interface org.pentaho.commons.connection.IPentahoConnection
      Parameters:
      props - Properties to be used when the connection is made.
    • clearWarnings

      public void clearWarnings()
      Clears any warnings cached by the connection.
      Specified by:
      clearWarnings in interface org.pentaho.commons.connection.IPentahoConnection
    • getDatasourceType

      public String getDatasourceType()
      Returns the type of connection.
      Specified by:
      getDatasourceType in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns the type of the connection.
    • getLastQuery

      public String getLastQuery()
      Retrieves the string representation of the last executed query.
      Specified by:
      getLastQuery in interface org.pentaho.commons.connection.IPentahoConnection
      Returns:
      Returns the last query string executed.
    • getConnection

      public org.olap4j.OlapConnection getConnection()
      Returns the underlying connection to OLAP system.
      Returns:
      Returns the underlying connection.