Class MondrianServer
- java.lang.Object
-
- mondrian.olap.MondrianServer
-
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
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MondrianServer.MondrianVersion
Description of the version of the server.
-
Constructor Summary
Constructors Constructor Description MondrianServer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addConnection(RolapConnection connection)
Called just after a connection has been created.abstract void
addStatement(Statement statement)
Called just after a statement has been created.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 AggregationManager
getAggregationManager()
abstract CatalogLocator
getCatalogLocator()
abstract RolapConnection
getConnection(int connectionId)
Retrieves a connection.abstract org.olap4j.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 org.olap4j.OlapConnection
getConnection(String catalogName, String schemaName, String roleName, Properties props)
Extended version ofgetConnection(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 int
getId()
Returns an integer 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.abstract Monitor
getMonitor()
abstract RolapResultShepherd
getResultShepherd()
int
getSchemaVersion()
Returns the schema version of this MondrianServer.MondrianServer.MondrianVersion
getVersion()
Returns the version of this MondrianServer.abstract void
removeConnection(RolapConnection connection)
Called when a connection is closed.abstract void
removeStatement(Statement statement)
Called when a statement is closed.abstract void
shutdown()
Called when the server must terminate all background tasks and cleanup all potential memory leaks.
-
-
-
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 findercatalogLocator
- 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 int getId()
Returns an integer uniquely identifying this server within its JVM.- Returns:
- Server's unique identifier
-
getSchemaVersion
public int getSchemaVersion()
Returns the schema version of this MondrianServer.- Returns:
- Server's schema version
-
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
-
getResultShepherd
public abstract RolapResultShepherd getResultShepherd()
-
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 org.olap4j.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 nameschemaName
- Schema nameroleName
- User role name- Returns:
- Connection
- Throws:
SQLException
- If error occursSecurityException
- If security error occurs
-
getConnection
public abstract org.olap4j.OlapConnection getConnection(String catalogName, String schemaName, String roleName, Properties props) throws SQLException, SecurityException
Extended version ofgetConnection(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 nameschemaName
- Schema nameroleName
- User role nameprops
- Properties to pass down to the native driver.- Returns:
- Connection
- Throws:
SQLException
- If error occursSecurityException
- If security error occurs
-
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.
-
addConnection
public abstract void addConnection(RolapConnection connection)
Called just after a connection has been created.- Parameters:
connection
- Connection
-
removeConnection
public abstract void removeConnection(RolapConnection connection)
Called when a connection is closed.- Parameters:
connection
- Connection
-
getConnection
public abstract RolapConnection getConnection(int connectionId)
Retrieves a connection.- Parameters:
connectionId
- Connection id, perRolapConnection.getId()
- Returns:
- Connection, or null if connection is not registered
-
addStatement
public abstract void addStatement(Statement statement)
Called just after a statement has been created.- Parameters:
statement
- Statement
-
removeStatement
public abstract void removeStatement(Statement statement)
Called when a statement is closed.- Parameters:
statement
- Statement
-
getMonitor
public abstract Monitor getMonitor()
-
getAggregationManager
public abstract AggregationManager getAggregationManager()
-
-