mondrian.rolap
Class RolapConnection

java.lang.Object
  extended by mondrian.olap.ConnectionBase
      extended by mondrian.rolap.RolapConnection
All Implemented Interfaces:
Connection

public class RolapConnection
extends ConnectionBase

A RolapConnection is a connection to a Mondrian OLAP Server.

Typically, you create a connection via DriverManager.getConnection(String, mondrian.spi.CatalogLocator). RolapConnectionProperties describes allowable keywords.

Since:
2 October, 2002
Author:
jhyde
See Also:
RolapSchema, DriverManager
 

Nested Class Summary
(package private) static class RolapConnection.NonEmptyResult
          A NonEmptyResult filters a result by removing empty rows on a particular axis.
 
Field Summary
protected  Role role
           
 
Constructor Summary
RolapConnection(Util.PropertyList connectInfo)
          Creates a connection.
RolapConnection(Util.PropertyList connectInfo, DataSource dataSource)
          Creates a connection.
RolapConnection(Util.PropertyList connectInfo, RolapSchema schema)
          Creates a RolapConnection.
RolapConnection(Util.PropertyList connectInfo, RolapSchema schema, DataSource dataSource)
          Creates a RolapConnection.
 
Method Summary
 void close()
          Closes this Connection.
(package private) static DataSource createDataSource(DataSource dataSource, Util.PropertyList connectInfo, StringBuilder buf)
          Creates a JDBC data source from the JDBC credentials contained within a set of mondrian connection properties.
 Result execute(Query query)
          Executes a Query.
 CacheControl getCacheControl(PrintWriter pw)
          Returns an object with which to explicitly control the contents of the cache.
 String getCatalogName()
          Get the name of the Catalog associated with this Connection.
 Util.PropertyList getConnectInfo()
           
 String getConnectString()
          Get the Connect String associated with this Connection.
 DataSource getDataSource()
          Returns the data source this connection uses to create connections to the underlying JDBC database.
 Locale getLocale()
          Returns the locale this connection belongs to.
protected  org.apache.log4j.Logger getLogger()
           
 Object getProperty(String name)
          Returns the value of a connection property.
 Role getRole()
          Returns the access-control profile for this connection.
 Schema getSchema()
          Get the Schema associated with this Connection.
 SchemaReader getSchemaReader()
          Returns a schema reader with access control appropriate to the current role.
 void setLocale(Locale locale)
           
 void setRole(Role role)
          Sets the privileges for the this connection.
 
Methods inherited from class mondrian.olap.ConnectionBase
getFullConnectString, memoryUsageNotification, parseExpression, parseQuery, parseQuery, parseQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

role

protected Role role
Constructor Detail

RolapConnection

public RolapConnection(Util.PropertyList connectInfo)
Creates a connection.

Parameters:
connectInfo - Connection properties; keywords are described in RolapConnectionProperties.

RolapConnection

public RolapConnection(Util.PropertyList connectInfo,
                       DataSource dataSource)
Creates a connection.

Parameters:
connectInfo - Connection properties; keywords are described in RolapConnectionProperties.

RolapConnection

RolapConnection(Util.PropertyList connectInfo,
                RolapSchema schema)
Creates a RolapConnection.

Only RolapSchema.Pool.get(java.lang.String, java.lang.String, java.lang.String, java.lang.String, mondrian.olap.Util.PropertyList) calls this with schema != null (to create a schema's internal connection). Other uses retrieve a schema from the cache based upon the Catalog property.

Pre-condition:
connectInfo != null
Parameters:
connectInfo - Connection properties; keywords are described in RolapConnectionProperties.
schema - Schema for the connection. Must be null unless this is to be an internal connection.

RolapConnection

RolapConnection(Util.PropertyList connectInfo,
                RolapSchema schema,
                DataSource dataSource)
Creates a RolapConnection.

Only RolapSchema.Pool.get(java.lang.String, java.lang.String, java.lang.String, java.lang.String, mondrian.olap.Util.PropertyList) calls this with schema != null (to create a schema's internal connection). Other uses retrieve a schema from the cache based upon the Catalog property.

Pre-condition:
connectInfo != null
Parameters:
connectInfo - Connection properties; keywords are described in RolapConnectionProperties.
schema - Schema for the connection. Must be null unless this is to be an internal connection.
dataSource - If not null an external DataSource to be used by Mondrian
Method Detail

getLogger

protected org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class ConnectionBase

createDataSource

static DataSource createDataSource(DataSource dataSource,
                                   Util.PropertyList connectInfo,
                                   StringBuilder buf)
Creates a JDBC data source from the JDBC credentials contained within a set of mondrian connection properties.

This method is package-level so that it can be called from the RolapConnectionTest unit test.

Parameters:
dataSource - Anonymous data source from user, or null
connectInfo - Mondrian connection properties
buf - Into which method writes a description of the JDBC credentials
Returns:
Data source

getConnectInfo

public Util.PropertyList getConnectInfo()

close

public void close()
Description copied from interface: Connection
Closes this Connection. You may not use this Connection after closing it.


getSchema

public Schema getSchema()
Description copied from interface: Connection
Get the Schema associated with this Connection.

Returns:
the Schema (never null).

getConnectString

public String getConnectString()
Description copied from interface: Connection
Get the Connect String associated with this Connection.

Returns:
the Connect String (never null).

getCatalogName

public String getCatalogName()
Description copied from interface: Connection
Get the name of the Catalog associated with this Connection.

Returns:
the Catalog name (never null).

getLocale

public Locale getLocale()
Description copied from interface: Connection
Returns the locale this connection belongs to. Determines, for example, the currency string used in formatting cell values.

See Also:
Format

setLocale

public void setLocale(Locale locale)

getSchemaReader

public SchemaReader getSchemaReader()
Description copied from interface: Connection
Returns a schema reader with access control appropriate to the current role.


getProperty

public Object getProperty(String name)
Description copied from interface: Connection
Returns the value of a connection property.

Parameters:
name - Name of property, for example "JdbcUser".
Returns:
Value of property, or null if property is not defined.

getCacheControl

public CacheControl getCacheControl(PrintWriter pw)
Description copied from interface: Connection
Returns an object with which to explicitly control the contents of the cache.

Parameters:
pw - Writer to which to write logging information; may be null

execute

public Result execute(Query query)
Executes a Query.

Throws:
ResourceLimitExceededException - if some resource limit specified in the property file was exceeded
QueryCanceledException - if query was canceled during execution
QueryTimeoutException - if query exceeded timeout specified in the property file

setRole

public void setRole(Role role)
Description copied from interface: Connection
Sets the privileges for the this connection.


getRole

public Role getRole()
Description copied from interface: Connection
Returns the access-control profile for this connection.


getDataSource

public DataSource getDataSource()
Description copied from interface: Connection
Returns the data source this connection uses to create connections to the underlying JDBC database.

Returns:
Data source

SourceForge.net_Logo