public class OlapServiceImpl extends Object implements IOlapService
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.
IOlapService.Catalog, IOlapService.Cube, IOlapService.Schema
Modifier and Type | Field and Description |
---|---|
static String |
CATALOG_CACHE_REGION |
Constructor and Description |
---|
OlapServiceImpl()
Empty constructor.
|
OlapServiceImpl(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repo,
mondrian.olap.MondrianServer server)
Constructor for testing purposes.
|
Modifier and Type | Method and Description |
---|---|
void |
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 |
flush(org.pentaho.platform.api.engine.IPentahoSession session,
String name)
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.
|
List<String> |
getCatalogNames(org.pentaho.platform.api.engine.IPentahoSession pentahoSession)
Provides a list of catalog names known to this server,
whether local or remote.
|
List<IOlapService.Catalog> |
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.
|
List<IOlapService.Cube> |
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.
|
List<IOlapService.Schema> |
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 |
setConnectionFilters(Collection<IOlapConnectionFilter> filters) |
void |
setHelper(MondrianCatalogRepositoryHelper helper) |
void |
setMondrianRole(mondrian.olap.Role role) |
public static String CATALOG_CACHE_REGION
public OlapServiceImpl()
PentahoSystem
to fetch the IUnifiedRepository
at runtime.public OlapServiceImpl(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repo, mondrian.olap.MondrianServer server)
public void setHelper(MondrianCatalogRepositoryHelper helper)
protected List<IOlapService.Catalog> getCache(org.pentaho.platform.api.engine.IPentahoSession 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.
protected void resetCache(org.pentaho.platform.api.engine.IPentahoSession session)
protected void initCache(org.pentaho.platform.api.engine.IPentahoSession session)
public void addHostedCatalog(String name, String dataSourceInfo, InputStream inputStream, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session)
IOlapService
addHostedCatalog
in interface IOlapService
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.protected boolean hasAccess(String catalogName, EnumSet<org.pentaho.platform.api.repository2.unified.RepositoryFilePermission> perms, org.pentaho.platform.api.engine.IPentahoSession session)
public void addOlap4jCatalog(String name, String className, String URL, String user, String password, Properties props, boolean overwrite, org.pentaho.platform.api.engine.IPentahoSession session)
IOlapService
addOlap4jCatalog
in interface IOlapService
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.public void removeCatalog(String name, org.pentaho.platform.api.engine.IPentahoSession session)
IOlapService
removeCatalog
in interface IOlapService
name
- Name of the catalog to delete.session
- Session to use when deleting.public void flush(org.pentaho.platform.api.engine.IPentahoSession session, String name)
flush
in interface IOlapService
public void flushAll(org.pentaho.platform.api.engine.IPentahoSession session)
IOlapService
flushAll
in interface IOlapService
protected mondrian.xmla.XmlaHandler.XmlaExtra getXmlaExtra(org.olap4j.OlapConnection connection) throws SQLException
SQLException
public List<String> getCatalogNames(org.pentaho.platform.api.engine.IPentahoSession pentahoSession) throws IOlapServiceException
IOlapService
This method is much cheaper to invoke than
IOlapService.getCatalogs(IPentahoSession)
since it doesn't
require the connection to be opened.
getCatalogNames
in interface IOlapService
pentahoSession
- The session asking for catalogs.IOlapServiceException
public List<IOlapService.Catalog> getCatalogs(org.pentaho.platform.api.engine.IPentahoSession session) throws IOlapServiceException
IOlapService
getCatalogs
in interface IOlapService
session
- The session asking for catalogs.IOlapServiceException
public List<IOlapService.Schema> getSchemas(String parentCatalog, org.pentaho.platform.api.engine.IPentahoSession session)
IOlapService
getSchemas
in interface IOlapService
parentCatalog
- The catalog to constrain the list of schemas, or null
to return the whole list.session
- The session asking for schemas.public List<IOlapService.Cube> getCubes(String parentCatalog, String parentSchema, org.pentaho.platform.api.engine.IPentahoSession pentahoSession)
IOlapService
getCubes
in interface IOlapService
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.public org.olap4j.OlapConnection getConnection(String catalogName, org.pentaho.platform.api.engine.IPentahoSession session) throws IOlapServiceException
IOlapService
IOlapService.getCatalogs(IPentahoSession)
.getConnection
in interface IOlapService
IOlapServiceException
public void setConnectionFilters(Collection<IOlapConnectionFilter> filters)
public void setMondrianRole(mondrian.olap.Role role)
Copyright © 2021 Hitachi Vantara. All rights reserved.