Package mondrian.olap

Class 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
    • 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 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
      • 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 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 name
        schemaName - Schema name
        roleName - User role name
        Returns:
        Connection
        Throws:
        SQLException - If error occurs
        SecurityException - If security error occurs
      • getConnection

        public abstract org.olap4j.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 - 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, per RolapConnection.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()