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
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceSimple callback interface to facilitate iterating over cache keysstatic classthis 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 classCallable to callIMetadataDomainRepository.getDomain(String)with some logging statement to help in debug.static classAsynchronously executes a collection of tasks (ieCallable).static classThread that sets theIPentahoSessionfor the thread seePentahoSessionHolder. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringPublic so others know where we're caching our objectsprotected final SessionCachingMetadataDomainRepository.CacheIteratorCallbackRemoves 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_WRITEFields inherited from interface org.pentaho.platform.plugin.services.metadata.IModelAnnotationsAwareMetadataDomainRepositoryImporter
ANNOTATIONS_FILE_ID_POSTFIX, PROPERTY_NAME_ANNOTATIONS -
Constructor Summary
ConstructorsConstructorDescriptionSessionCachingMetadataDomainRepository(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 TypeMethodDescriptionvoidaddLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite) protected voidRemove domain ID cache for all sessionsprotected voidclearDomainIdsFromCache(org.pentaho.platform.api.engine.IPentahoSession session) Remove domain ID cache for a given sessionvoidprotected voidflushDomains(org.pentaho.platform.api.engine.IPentahoSession session) protected voidCalls the callback for every key in the cache regionprotected voidforAllKeysInSession(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 StringgenerateDomainIdCacheKeyForSession(org.pentaho.platform.api.engine.IPentahoSession session) Create caching key String usingsession.protected StringgenerateDomainIdCacheKeyForSession(org.pentaho.platform.api.engine.IPentahoSession session, String type) Create caching key String usingsessionandtype.generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model) org.pentaho.platform.api.repository2.unified.RepositoryFileAclRetrieve a list of all the domain ids in the repository of the data source type DataSourceWizard.org.pentaho.metadata.model.DomaingetDomainFilesData(String domainId) Retrieve a list of all the domain ids in the repository of the data source type Metadata.booleanhasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder) booleanhasAccessFor(String domainId) loadAnnotationsXml(String domainId) voidonLogout(org.pentaho.platform.api.engine.IPentahoSession session) voidvoidremoveDomain(String domainId) voidremoveModel(String domainId, String modelId) voidvoidstoreAnnotationsXml(String domainId, String annotationsXml) voidstoreDomain(InputStream inputStream, String domainId, boolean overwrite) voidstoreDomain(InputStream inputStream, String domainId, boolean overwrite, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) voidstoreDomain(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:
getDomainin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
reloadDomains
public void reloadDomains()- Specified by:
reloadDomainsin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
flushDomains
public void flushDomains()- Specified by:
flushDomainsin 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_PREDICATEandIPentahoSession.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 usingsessionandtype.DOMAIN_CACHE_KEY_PREDICATE,IPentahoSession.getId()andtypeare used in key creation.- Parameters:
session-type-- Returns:
-
removeDomain
- Specified by:
removeDomainin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository- Specified by:
removeDomainin 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:
storeDomainin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository- Throws:
org.pentaho.metadata.repository.DomainIdNullExceptionorg.pentaho.metadata.repository.DomainAlreadyExistsExceptionorg.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:
removeModelin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository- Throws:
org.pentaho.metadata.repository.DomainIdNullExceptionorg.pentaho.metadata.repository.DomainStorageException
-
getDomainIds
- Specified by:
getDomainIdsin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
getMetadataDomainIds
Description copied from interface:IDataSourceAwareMetadataDomainRepositoryRetrieve a list of all the domain ids in the repository of the data source type Metadata. SeeIMetadataDomainRepository.getDomainIds()for similar functionality.- Specified by:
getMetadataDomainIdsin interfaceIDataSourceAwareMetadataDomainRepository- Returns:
- the metadata domain Ids.
-
getDataSourceWizardDomainIds
Description copied from interface:IDataSourceAwareMetadataDomainRepositoryRetrieve a list of all the domain ids in the repository of the data source type DataSourceWizard. SeeIMetadataDomainRepository.getDomainIds()for similar functionality.- Specified by:
getDataSourceWizardDomainIdsin interfaceIDataSourceAwareMetadataDomainRepository- Returns:
- the data source wizard domain Ids.
-
generateRowLevelSecurityConstraint
- Specified by:
generateRowLevelSecurityConstraintin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
hasAccess
public boolean hasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder) - Specified by:
hasAccessin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
onLogout
public void onLogout(org.pentaho.platform.api.engine.IPentahoSession session) - Specified by:
onLogoutin interfaceorg.pentaho.platform.api.engine.ILogoutListener
-
getDomainFilesData
- Specified by:
getDomainFilesDatain 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:
storeDomainin interfaceIAclAwarePentahoMetadataDomainRepositoryImporter- Throws:
org.pentaho.metadata.repository.DomainIdNullExceptionorg.pentaho.metadata.repository.DomainAlreadyExistsExceptionorg.pentaho.metadata.repository.DomainStorageException
-
setAclFor
public void setAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) - Specified by:
setAclForin interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
getAclFor
- Specified by:
getAclForin interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
hasAccessFor
- Specified by:
hasAccessForin 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:
storeDomainin interfaceIPentahoMetadataDomainRepositoryImporter- Throws:
org.pentaho.metadata.repository.DomainIdNullExceptionorg.pentaho.metadata.repository.DomainAlreadyExistsExceptionorg.pentaho.metadata.repository.DomainStorageException
-
addLocalizationFile
public void addLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite) throws org.pentaho.metadata.repository.DomainStorageException - Specified by:
addLocalizationFilein interfaceIPentahoMetadataDomainRepositoryImporter- Throws:
org.pentaho.metadata.repository.DomainStorageException
-
loadAnnotationsXml
- Specified by:
loadAnnotationsXmlin interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
storeAnnotationsXml
- Specified by:
storeAnnotationsXmlin interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-