Class OlapServiceImpl
java.lang.Object
org.pentaho.platform.plugin.action.olap.impl.OlapServiceImpl
- All Implemented Interfaces:
IOlapService
Implementation of the IOlapService which uses the
MondrianCatalogRepositoryHelper
as a backend to
store the connection informations and uses DriverManager
to create the connections.
It will also check for the presence of a IConnectionUserRoleMapper
and change the roles accordingly before creating a connection.
This implementation is thread safe. It will use a ReadWriteLock
to manage the access to its metadata.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pentaho.platform.plugin.action.olap.IOlapService
IOlapService.Catalog, IOlapService.Cube, IOlapService.Schema
-
Field Summary
-
Constructor Summary
ConstructorDescriptionEmpty constructor.OlapServiceImpl
(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repo, mondrian.olap.MondrianServer server) Constructor for testing purposes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHostedCatalog
(String name, String dataSourceInfo, InputStream inputStream, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session) Adds a hosted catalog on this server.void
addOlap4jCatalog
(String name, String className, String URL, String user, String password, Properties props, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session) Adds a generic olap4j catalog to this server.void
Flushes a single schema from the cache.void
flushAll
(org.pentaho.platform.api.engine.IPentahoSession session) Flushes all schema caches.protected List<IOlapService.Catalog>
getCache
(org.pentaho.platform.api.engine.IPentahoSession session) Returns a list of catalogs for the current session.getCatalogNames
(org.pentaho.platform.api.engine.IPentahoSession pentahoSession) Provides a list of catalog names known to this server, whether local or remote.getCatalogs
(org.pentaho.platform.api.engine.IPentahoSession session) Provides a list of catalogs known to this server, whether local or remote.org.olap4j.OlapConnection
getConnection
(String catalogName, org.pentaho.platform.api.engine.IPentahoSession session) Provides olap connections to a named catalog.getCubes
(String parentCatalog, String parentSchema, org.pentaho.platform.api.engine.IPentahoSession pentahoSession) Provides a list of the available cubes, whether constrained to a particular catalog and/or schema or not.getSchemas
(String parentCatalog, org.pentaho.platform.api.engine.IPentahoSession session) Provides a list of the available schemas, whether constrained to a particular catalog or not, represented as a tree of the schema and all of its cubes.protected mondrian.xmla.XmlaHandler.XmlaExtra
getXmlaExtra
(org.olap4j.OlapConnection connection) protected boolean
hasAccess
(String catalogName, EnumSet<org.pentaho.platform.api.repository2.unified.RepositoryFilePermission> perms, org.pentaho.platform.api.engine.IPentahoSession session) protected void
initCache
(org.pentaho.platform.api.engine.IPentahoSession session) Initializes the cache.protected Object
makeCacheSubRegionKey
(Locale locale) void
removeCatalog
(String name, org.pentaho.platform.api.engine.IPentahoSession session) Removes a catalog from this server, whether hosted or remote.protected void
resetCache
(org.pentaho.platform.api.engine.IPentahoSession session) Clears all caches for all locales.void
void
void
setMondrianRole
(mondrian.olap.Role role)
-
Field Details
-
CATALOG_CACHE_REGION
-
-
Constructor Details
-
OlapServiceImpl
public OlapServiceImpl()Empty constructor. Creating an instance from here will use thePentahoSystem
to fetch theIUnifiedRepository
at runtime. -
OlapServiceImpl
public OlapServiceImpl(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repo, mondrian.olap.MondrianServer server) Constructor for testing purposes. Takes a repository as a parameter.
-
-
Method Details
-
setHelper
-
getCache
protected List<IOlapService.Catalog> getCache(org.pentaho.platform.api.engine.IPentahoSession session) Returns a list of catalogs for the current session.The cache is stored in the platform's caches in the region
CATALOG_CACHE_REGION
. It is also segmented by locale, but we only return the correct sub-region according to the session passed as a parameter. -
resetCache
protected void resetCache(org.pentaho.platform.api.engine.IPentahoSession session) Clears all caches for all locales. -
makeCacheSubRegionKey
-
initCache
protected void initCache(org.pentaho.platform.api.engine.IPentahoSession session) Initializes the cache. Only the cache specific to the sesison's locale will be populated. -
addHostedCatalog
public void addHostedCatalog(String name, String dataSourceInfo, InputStream inputStream, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session) Description copied from interface:IOlapService
Adds a hosted catalog on this server.- Specified by:
addHostedCatalog
in interfaceIOlapService
- Parameters:
name
- NAme of the catalog to createdataSourceInfo
- Connection properties. ie: Provider=mondrian;DataSource=SampleData.inputStream
- Stream of the mondrian schema's XMLoverwrite
- Whether to overwrite a catalog of the same name.session
- Pentaho session to perform this task.
-
hasAccess
-
addOlap4jCatalog
public void addOlap4jCatalog(String name, String className, String URL, String user, String password, Properties props, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session) Description copied from interface:IOlapService
Adds a generic olap4j catalog to this server.- Specified by:
addOlap4jCatalog
in interfaceIOlapService
- Parameters:
name
- Name of the catalog to useclassName
- The class of the driver to use. Must be an implementation of java.sql.Driver.URL
- The URL to use.user
- Username to use when connecting.password
- Password to use when connecting.props
- Extra connection parameters to pass.overwrite
- Whether to overwrite the catalog if it exists.session
- The session to use when creating the connection.
-
removeCatalog
Description copied from interface:IOlapService
Removes a catalog from this server, whether hosted or remote.- Specified by:
removeCatalog
in interfaceIOlapService
- Parameters:
name
- Name of the catalog to delete.session
- Session to use when deleting.
-
flush
Flushes a single schema from the cache.- Specified by:
flush
in interfaceIOlapService
-
flushAll
public void flushAll(org.pentaho.platform.api.engine.IPentahoSession session) Description copied from interface:IOlapService
Flushes all schema caches.- Specified by:
flushAll
in interfaceIOlapService
-
getXmlaExtra
protected mondrian.xmla.XmlaHandler.XmlaExtra getXmlaExtra(org.olap4j.OlapConnection connection) throws SQLException - Throws:
SQLException
-
getCatalogNames
public List<String> getCatalogNames(org.pentaho.platform.api.engine.IPentahoSession pentahoSession) throws IOlapServiceException Description copied from interface:IOlapService
Provides a list of catalog names known to this server, whether local or remote.This method is much cheaper to invoke than
IOlapService.getCatalogs(IPentahoSession)
since it doesn't require the connection to be opened.- Specified by:
getCatalogNames
in interfaceIOlapService
- Parameters:
pentahoSession
- The session asking for catalogs.- Throws:
IOlapServiceException
-
getCatalogs
public List<IOlapService.Catalog> getCatalogs(org.pentaho.platform.api.engine.IPentahoSession session) throws IOlapServiceException Description copied from interface:IOlapService
Provides a list of catalogs known to this server, whether local or remote. Returns a tree, rooted at the catalog, representing all of the schemas and cubes included in this catalog.- Specified by:
getCatalogs
in interfaceIOlapService
- Parameters:
session
- The session asking for catalogs.- Throws:
IOlapServiceException
-
getSchemas
public List<IOlapService.Schema> getSchemas(String parentCatalog, org.pentaho.platform.api.engine.IPentahoSession session) Description copied from interface:IOlapService
Provides a list of the available schemas, whether constrained to a particular catalog or not, represented as a tree of the schema and all of its cubes.- Specified by:
getSchemas
in interfaceIOlapService
- Parameters:
parentCatalog
- The catalog to constrain the list of schemas, or null to return the whole list.session
- The session asking for schemas.- Returns:
- A list of schemas.
-
getCubes
public List<IOlapService.Cube> getCubes(String parentCatalog, String parentSchema, org.pentaho.platform.api.engine.IPentahoSession pentahoSession) Description copied from interface:IOlapService
Provides a list of the available cubes, whether constrained to a particular catalog and/or schema or not.- Specified by:
getCubes
in interfaceIOlapService
- Parameters:
parentCatalog
- The catalog to constrain the list of cubes, or null to return the whole list.parentSchema
- The schema to constrain the list of cubes, or null to return the whole list.pentahoSession
- The session asking for cubes.- Returns:
- A list of cubes.
-
getConnection
public org.olap4j.OlapConnection getConnection(String catalogName, org.pentaho.platform.api.engine.IPentahoSession session) throws IOlapServiceException Description copied from interface:IOlapService
Provides olap connections to a named catalog. For a list of available catalogs, seeIOlapService.getCatalogs(IPentahoSession)
.- Specified by:
getConnection
in interfaceIOlapService
- Throws:
IOlapServiceException
-
setConnectionFilters
-
setMondrianRole
public void setMondrianRole(mondrian.olap.Role role)
-