public class RolapConnection extends ConnectionBase
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.
RolapSchema
,
DriverManager
Modifier and Type | Class and Description |
---|---|
(package private) static class |
RolapConnection.NonEmptyResult
A
NonEmptyResult filters a result by removing empty rows
on a particular axis. |
Constructor and Description |
---|
RolapConnection(MondrianServer server,
Util.PropertyList connectInfo,
DataSource dataSource)
Creates a connection.
|
RolapConnection(MondrianServer server,
Util.PropertyList connectInfo,
RolapSchema schema,
DataSource dataSource)
Creates a RolapConnection.
|
Modifier and Type | Method and Description |
---|---|
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.
|
ScenarioImpl |
createScenario()
Helper method to allow olap4j wrappers to implement
OlapConnection.createScenario() . |
Result |
execute(Execution execution)
Executes a statement.
|
Result |
execute(Query query)
Deprecated.
Use
execute(mondrian.server.Execution) ; this method
will be removed in mondrian-4.0 |
protected void |
finalize() |
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.
|
int |
getId()
Returns the identifier of this connection.
|
Statement |
getInternalStatement() |
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.
|
Scenario |
getScenario() |
RolapSchema |
getSchema()
Get the Schema associated with this Connection.
|
SchemaReader |
getSchemaReader()
Returns a schema reader with access control appropriate to the current
role.
|
MondrianServer |
getServer()
Returns the server (mondrian instance) that this connection belongs to.
|
Exp |
parseExpression(String expr)
Parses an expresion.
|
QueryPart |
parseStatement(String query)
Parses a statement.
|
void |
setLocale(Locale locale) |
void |
setRole(Role role)
Sets the privileges for the this connection.
|
void |
setScenario(Scenario scenario) |
createParser, getFullConnectString, parseQuery, parseStatement
protected Role role
public RolapConnection(MondrianServer server, Util.PropertyList connectInfo, DataSource dataSource)
server
- Server instance this connection belongs toconnectInfo
- Connection properties; keywords are described in
RolapConnectionProperties
.dataSource
- JDBC data sourceRolapConnection(MondrianServer server, Util.PropertyList connectInfo, RolapSchema schema, DataSource dataSource)
Only RolapSchemaPool.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.
server
- Server instance this connection belongs toconnectInfo
- 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 Mondrianprotected void finalize() throws Throwable
public int getId()
protected org.apache.log4j.Logger getLogger()
getLogger
in class ConnectionBase
static DataSource createDataSource(DataSource dataSource, Util.PropertyList connectInfo, StringBuilder buf)
This method is package-level so that it can be called from the RolapConnectionTest unit test.
dataSource
- Anonymous data source from user, or nullconnectInfo
- Mondrian connection propertiesbuf
- Into which method writes a description of the JDBC credentialspublic Util.PropertyList getConnectInfo()
public void close()
Connection
Connection
. You may not use this
Connection
after closing it.public RolapSchema getSchema()
Connection
public String getConnectString()
Connection
public String getCatalogName()
Connection
public Locale getLocale()
Connection
Format
public void setLocale(Locale locale)
public SchemaReader getSchemaReader()
Connection
public Object getProperty(String name)
Connection
name
- Name of property, for example "JdbcUser".public CacheControl getCacheControl(PrintWriter pw)
Connection
pw
- Writer to which to write logging information; may be nullpublic Result execute(Query query)
execute(mondrian.server.Execution)
; this method
will be removed in mondrian-4.0query
- Query parse treeResourceLimitExceededException
- if some resource limit specified
in the property file was exceededQueryCanceledException
- if query was canceled during executionQueryTimeoutException
- if query exceeded timeout specified in
the property filepublic Result execute(Execution execution)
execution
- Execution context (includes statement, query)ResourceLimitExceededException
- if some resource limit specified
in the property file was exceededQueryCanceledException
- if query was canceled during executionQueryTimeoutException
- if query exceeded timeout specified in
the property filepublic void setRole(Role role)
Connection
public Role getRole()
Connection
public void setScenario(Scenario scenario)
public Scenario getScenario()
public MondrianServer getServer()
public QueryPart parseStatement(String query)
Connection
query
- MDX stringQuery
if it is a SELECT statement, a
DrillThrough
if it is a DRILLTHROUGH statementpublic Exp parseExpression(String expr)
Connection
public Statement getInternalStatement()
getInternalStatement
in class ConnectionBase
public DataSource getDataSource()
Connection
public ScenarioImpl createScenario()
OlapConnection.createScenario()
.