Class SessionCachingMetadataDomainRepository
java.lang.Object
org.pentaho.platform.plugin.services.metadata.SessionCachingMetadataDomainRepository
- All Implemented Interfaces:
org.pentaho.metadata.repository.IMetadataDomainRepository
,org.pentaho.platform.api.engine.ILogoutListener
,IAclAwarePentahoMetadataDomainRepositoryImporter
,IDataSourceAwareMetadataDomainRepository
,IModelAnnotationsAwareMetadataDomainRepositoryImporter
,IPentahoMetadataDomainRepositoryExporter
,IPentahoMetadataDomainRepositoryImporter
public class SessionCachingMetadataDomainRepository
extends Object
implements org.pentaho.metadata.repository.IMetadataDomainRepository, IPentahoMetadataDomainRepositoryExporter, org.pentaho.platform.api.engine.ILogoutListener, IAclAwarePentahoMetadataDomainRepositoryImporter, IModelAnnotationsAwareMetadataDomainRepositoryImporter, IDataSourceAwareMetadataDomainRepository
This is the platform implementation which provides session-based caching for an existing
IMetadataDomainRepository
.- Author:
- Jordan Ganoff (jganoff@pentaho.com)
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Simple callback interface to facilitate iterating over cache keysstatic class
this as a public class so that if necessary someone can get access to a session key and clear the cache in their own way via javascript rule / etcstatic class
Callable to callIMetadataDomainRepository.getDomain(String)
with some logging statement to help in debug.static class
Asynchronously executes a collection of tasks (ieCallable
).static class
Thread that sets theIPentahoSession
for the thread seePentahoSessionHolder
. -
Field Summary
Modifier and TypeFieldDescriptionstatic String
Public so others know where we're caching our objectsprotected final SessionCachingMetadataDomainRepository.CacheIteratorCallback
Removes all keys it encounters from the known cache regionFields inherited from interface org.pentaho.metadata.repository.IMetadataDomainRepository
ACCESS_TYPE_ADMIN, ACCESS_TYPE_DELETE, ACCESS_TYPE_READ, ACCESS_TYPE_SCHEMA_ADMIN, ACCESS_TYPE_UPDATE, ACCESS_TYPE_WRITE
Fields inherited from interface org.pentaho.platform.plugin.services.metadata.IModelAnnotationsAwareMetadataDomainRepositoryImporter
ANNOTATIONS_FILE_ID_POSTFIX, PROPERTY_NAME_ANNOTATIONS
-
Constructor Summary
ConstructorDescriptionSessionCachingMetadataDomainRepository
(org.pentaho.metadata.repository.IMetadataDomainRepository delegate) Wraps the provided domain repository to provide session-based caching of domains.SessionCachingMetadataDomainRepository
(org.pentaho.metadata.repository.IMetadataDomainRepository delegate, org.pentaho.platform.api.engine.ICacheManager cacheManager, boolean domainIdsCacheEnabled, int numberOfThreads) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocalizationFile
(String domainId, String locale, InputStream inputStream, boolean overwrite) protected void
Remove domain ID cache for all sessionsprotected void
clearDomainIdsFromCache
(org.pentaho.platform.api.engine.IPentahoSession session) Remove domain ID cache for a given sessionvoid
protected void
flushDomains
(org.pentaho.platform.api.engine.IPentahoSession session) protected void
Calls the callback for every key in the cache regionprotected void
forAllKeysInSession
(org.pentaho.platform.api.engine.IPentahoSession session, SessionCachingMetadataDomainRepository.CacheIteratorCallback callback) Calls the callback for every key in the cache region whose session id matches the provided session's id.protected String
generateDomainIdCacheKeyForSession
(org.pentaho.platform.api.engine.IPentahoSession session) Create caching key String usingsession
.protected String
generateDomainIdCacheKeyForSession
(org.pentaho.platform.api.engine.IPentahoSession session, String type) Create caching key String usingsession
andtype
.generateRowLevelSecurityConstraint
(org.pentaho.metadata.model.LogicalModel model) org.pentaho.platform.api.repository2.unified.RepositoryFileAcl
Retrieve a list of all the domain ids in the repository of the data source type DataSourceWizard.org.pentaho.metadata.model.Domain
getDomainFilesData
(String domainId) Retrieve a list of all the domain ids in the repository of the data source type Metadata.boolean
hasAccess
(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder) boolean
hasAccessFor
(String domainId) loadAnnotationsXml
(String domainId) void
onLogout
(org.pentaho.platform.api.engine.IPentahoSession session) void
void
removeDomain
(String domainId) void
removeModel
(String domainId, String modelId) void
void
storeAnnotationsXml
(String domainId, String annotationsXml) void
storeDomain
(InputStream inputStream, String domainId, boolean overwrite) void
storeDomain
(InputStream inputStream, String domainId, boolean overwrite, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) void
storeDomain
(org.pentaho.metadata.model.Domain domain, boolean overwrite)
-
Field Details
-
CACHE_REGION
Public so others know where we're caching our objects -
REMOVE_ALL_CALLBACK
Removes all keys it encounters from the known cache region
-
-
Constructor Details
-
SessionCachingMetadataDomainRepository
public SessionCachingMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository delegate) Wraps the provided domain repository to provide session-based caching of domains. -
SessionCachingMetadataDomainRepository
public SessionCachingMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository delegate, org.pentaho.platform.api.engine.ICacheManager cacheManager, boolean domainIdsCacheEnabled, int numberOfThreads)
-
-
Method Details
-
forAllKeys
Calls the callback for every key in the cache region- Parameters:
callback
-
-
forAllKeysInSession
protected void forAllKeysInSession(org.pentaho.platform.api.engine.IPentahoSession session, SessionCachingMetadataDomainRepository.CacheIteratorCallback callback) Calls the callback for every key in the cache region whose session id matches the provided session's id.- Parameters:
session
- Session to use for matching keyscallback
-
-
getDomain
- Specified by:
getDomain
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
reloadDomains
public void reloadDomains()- Specified by:
reloadDomains
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
flushDomains
public void flushDomains()- Specified by:
flushDomains
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
flushDomains
protected void flushDomains(org.pentaho.platform.api.engine.IPentahoSession session) -
clearDomainIdsFromCache
protected void clearDomainIdsFromCache()Remove domain ID cache for all sessions -
clearDomainIdsFromCache
protected void clearDomainIdsFromCache(org.pentaho.platform.api.engine.IPentahoSession session) Remove domain ID cache for a given session- Parameters:
session
-
-
generateDomainIdCacheKeyForSession
protected String generateDomainIdCacheKeyForSession(org.pentaho.platform.api.engine.IPentahoSession session) Create caching key String usingsession
.DOMAIN_CACHE_KEY_PREDICATE
andIPentahoSession.getId()
are used in key creation.- Parameters:
session
-- Returns:
-
generateDomainIdCacheKeyForSession
protected String generateDomainIdCacheKeyForSession(org.pentaho.platform.api.engine.IPentahoSession session, String type) Create caching key String usingsession
andtype
.DOMAIN_CACHE_KEY_PREDICATE
,IPentahoSession.getId()
andtype
are used in key creation.- Parameters:
session
-type
-- Returns:
-
removeDomain
- Specified by:
removeDomain
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
- Specified by:
removeDomain
in interfaceIPentahoMetadataDomainRepositoryImporter
-
storeDomain
public void storeDomain(org.pentaho.metadata.model.Domain domain, boolean overwrite) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainAlreadyExistsException, org.pentaho.metadata.repository.DomainStorageException - Specified by:
storeDomain
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
- Throws:
org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainAlreadyExistsException
org.pentaho.metadata.repository.DomainStorageException
-
removeModel
public void removeModel(String domainId, String modelId) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainStorageException - Specified by:
removeModel
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
- Throws:
org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainStorageException
-
getDomainIds
- Specified by:
getDomainIds
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
getMetadataDomainIds
Description copied from interface:IDataSourceAwareMetadataDomainRepository
Retrieve a list of all the domain ids in the repository of the data source type Metadata. SeeIMetadataDomainRepository.getDomainIds()
for similar functionality.- Specified by:
getMetadataDomainIds
in interfaceIDataSourceAwareMetadataDomainRepository
- Returns:
- the metadata domain Ids.
-
getDataSourceWizardDomainIds
Description copied from interface:IDataSourceAwareMetadataDomainRepository
Retrieve a list of all the domain ids in the repository of the data source type DataSourceWizard. SeeIMetadataDomainRepository.getDomainIds()
for similar functionality.- Specified by:
getDataSourceWizardDomainIds
in interfaceIDataSourceAwareMetadataDomainRepository
- Returns:
- the data source wizard domain Ids.
-
generateRowLevelSecurityConstraint
- Specified by:
generateRowLevelSecurityConstraint
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
hasAccess
public boolean hasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder) - Specified by:
hasAccess
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
onLogout
public void onLogout(org.pentaho.platform.api.engine.IPentahoSession session) - Specified by:
onLogout
in interfaceorg.pentaho.platform.api.engine.ILogoutListener
-
getDomainFilesData
- Specified by:
getDomainFilesData
in interfaceIPentahoMetadataDomainRepositoryExporter
-
storeDomain
public void storeDomain(InputStream inputStream, String domainId, boolean overwrite, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainAlreadyExistsException, org.pentaho.metadata.repository.DomainStorageException - Specified by:
storeDomain
in interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
- Throws:
org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainAlreadyExistsException
org.pentaho.metadata.repository.DomainStorageException
-
setAclFor
public void setAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) - Specified by:
setAclFor
in interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
getAclFor
- Specified by:
getAclFor
in interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
hasAccessFor
- Specified by:
hasAccessFor
in interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
storeDomain
public void storeDomain(InputStream inputStream, String domainId, boolean overwrite) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainAlreadyExistsException, org.pentaho.metadata.repository.DomainStorageException - Specified by:
storeDomain
in interfaceIPentahoMetadataDomainRepositoryImporter
- Throws:
org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainAlreadyExistsException
org.pentaho.metadata.repository.DomainStorageException
-
addLocalizationFile
public void addLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite) throws org.pentaho.metadata.repository.DomainStorageException - Specified by:
addLocalizationFile
in interfaceIPentahoMetadataDomainRepositoryImporter
- Throws:
org.pentaho.metadata.repository.DomainStorageException
-
loadAnnotationsXml
- Specified by:
loadAnnotationsXml
in interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
storeAnnotationsXml
- Specified by:
storeAnnotationsXml
in interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-