mondrian.olap
Class MondrianServer

java.lang.Object
  extended by mondrian.olap.MondrianServer
Direct Known Subclasses:
MondrianServerImpl

public abstract class MondrianServer
extends Object

Interface by which to control an instance of Mondrian.

Typically, there is only one instance of Mondrian per JVM. However, you access a MondrianServer via the forConnection(mondrian.olap.Connection) method for future expansion.

Since:
Jun 25, 2006
Version:
$Id: //open/mondrian/src/main/mondrian/olap/MondrianServer.java#10 $
Author:
jhyde

Nested Class Summary
static interface MondrianServer.MondrianVersion
          Description of the version of the server.
 
Constructor Summary
MondrianServer()
           
 
Method Summary
static MondrianServer createWithRepository(RepositoryContentFinder contentFinder, CatalogLocator catalogLocator)
          Creates a server.
static void dispose(String instanceId)
          Disposes of a server and cleans up everything.
static MondrianServer forConnection(Connection connection)
          Returns the MondrianServer that hosts a given connection.
static MondrianServer forId(String instanceId)
          Returns the server with the given id.
abstract  CatalogLocator getCatalogLocator()
           
abstract  OlapConnection getConnection(String catalogName, String schemaName, String roleName)
          Gets a Connection given a catalog (and implicitly the catalog's data source) and the name of a user role.
abstract  OlapConnection getConnection(String catalogName, String schemaName, String roleName, Properties props)
          Extended version of getConnection(String, String, String) taking a list of properties to pass down to the native connection.
abstract  List<Map<String,Object>> getDatabases(RolapConnection connection)
          Returns a list of the databases in this server.
abstract  String getId()
          Returns a string uniquely identifying this server within its JVM.
abstract  List<String> getKeywords()
          Returns a list of MDX keywords.
abstract  LockBox getLockBox()
          Returns the lock box that can be used to pass objects via their string key.
 MondrianServer.MondrianVersion getVersion()
          Returns the version of this MondrianServer.
abstract  void shutdown()
          Called when the server must terminate all background tasks and cleanup all potential memory leaks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MondrianServer

public MondrianServer()
Method Detail

forConnection

public static MondrianServer forConnection(Connection connection)
Returns the MondrianServer that hosts a given connection.

Parameters:
connection - Connection (not null)
Returns:
server this connection belongs to (not null)

createWithRepository

public static MondrianServer createWithRepository(RepositoryContentFinder contentFinder,
                                                  CatalogLocator catalogLocator)
Creates a server.

When creating a server, the calling code must call the shutdown() method to dispose of it.

Parameters:
contentFinder - Repository content finder
catalogLocator - Catalog locator
Returns:
Server that reads from the given repository

forId

public static MondrianServer forId(String instanceId)
Returns the server with the given id.

If id is null, returns the catalog-less server. (The catalog-less server can also be acquired using its id.) If server is not found, returns null.

Parameters:
instanceId - Server instance id
Returns:
Server, or null if no server with this id

dispose

public static void dispose(String instanceId)
Disposes of a server and cleans up everything.

Parameters:
instanceId - The instance ID of the server to shutdown gracefully.

getId

public abstract String getId()
Returns a string uniquely identifying this server within its JVM.

Returns:
Server's unique identifier

getVersion

public MondrianServer.MondrianVersion getVersion()
Returns the version of this MondrianServer.

Returns:
Server's version

getKeywords

public abstract List<String> getKeywords()
Returns a list of MDX keywords.

Returns:
list of MDX keywords

getLockBox

public abstract LockBox getLockBox()
Returns the lock box that can be used to pass objects via their string key.

Returns:
Lock box for this server

getConnection

public abstract OlapConnection getConnection(String catalogName,
                                             String schemaName,
                                             String roleName)
                                      throws SQLException,
                                             SecurityException
Gets a Connection given a catalog (and implicitly the catalog's data source) and the name of a user role.

If you want to pass in a role object, and you are making the call within the same JVM (i.e. not RPC), register the role using getLockBox() and pass in the moniker for the generated lock box entry. The server will retrieve the role from the moniker.

Parameters:
catalogName - Catalog name
schemaName - Schema name
roleName - User role name
Returns:
Connection
Throws:
SQLException - If error occurs
SecurityException

getConnection

public abstract OlapConnection getConnection(String catalogName,
                                             String schemaName,
                                             String roleName,
                                             Properties props)
                                      throws SQLException,
                                             SecurityException
Extended version of getConnection(String, String, String) taking a list of properties to pass down to the native connection.

Gets a Connection given a catalog (and implicitly the catalog's data source) and the name of a user role.

If you want to pass in a role object, and you are making the call within the same JVM (i.e. not RPC), register the role using getLockBox() and pass in the moniker for the generated lock box entry. The server will retrieve the role from the moniker.

Parameters:
catalogName - Catalog name
schemaName - Schema name
roleName - User role name
props - Properties to pass down to the native driver.
Returns:
Connection
Throws:
SQLException - If error occurs
SecurityException

getDatabases

public abstract List<Map<String,Object>> getDatabases(RolapConnection connection)
Returns a list of the databases in this server. One element per database, each element a map whose keys are the XMLA fields describing a data source: "DataSourceName", "DataSourceDescription", "URL", etc. Unrecognized fields are ignored.

Parameters:
connection - Connection
Returns:
List of data source definitions

getCatalogLocator

public abstract CatalogLocator getCatalogLocator()

shutdown

public abstract void shutdown()
Called when the server must terminate all background tasks and cleanup all potential memory leaks.


Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads