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 existingIMetadataDomainRepository.- Author:
- Jordan Ganoff (jganoff@pentaho.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceSessionCachingMetadataDomainRepository.CacheIteratorCallbackSimple callback interface to facilitate iterating over cache keysstatic classSessionCachingMetadataDomainRepository.CacheKeythis 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 classSessionCachingMetadataDomainRepository.GetDomainCallableCallable to callIMetadataDomainRepository.getDomain(String)with some logging statement to help in debug.static classSessionCachingMetadataDomainRepository.PentahoAsyncThreadRunnerAsynchronously executes a collection of tasks (ieCallable).static classSessionCachingMetadataDomainRepository.PentahoSessionThreadThread that sets theIPentahoSessionfor the thread seePentahoSessionHolder.
-
Field Summary
Fields Modifier and Type Field Description static StringCACHE_REGIONPublic so others know where we're caching our objectsprotected SessionCachingMetadataDomainRepository.CacheIteratorCallbackREMOVE_ALL_CALLBACKRemoves all keys it encounters from the known cache region-
Fields 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
Constructors Constructor Description SessionCachingMetadataDomainRepository(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite)protected voidclearDomainIdsFromCache()Remove domain ID cache for all sessionsprotected voidclearDomainIdsFromCache(org.pentaho.platform.api.engine.IPentahoSession session)Remove domain ID cache for a given sessionvoidflushDomains()protected voidflushDomains(org.pentaho.platform.api.engine.IPentahoSession session)protected voidforAllKeys(SessionCachingMetadataDomainRepository.CacheIteratorCallback callback)Calls 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.StringgenerateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)org.pentaho.platform.api.repository2.unified.RepositoryFileAclgetAclFor(String domainId)Set<String>getDataSourceWizardDomainIds()Retrieve a list of all the domain ids in the repository of the data source type DataSourceWizard.org.pentaho.metadata.model.DomaingetDomain(String id)Map<String,InputStream>getDomainFilesData(String domainId)Set<String>getDomainIds()Set<String>getMetadataDomainIds()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)StringloadAnnotationsXml(String domainId)voidonLogout(org.pentaho.platform.api.engine.IPentahoSession session)voidreloadDomains()voidremoveDomain(String domainId)voidremoveModel(String domainId, String modelId)voidsetAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl)voidstoreAnnotationsXml(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 Detail
-
CACHE_REGION
public static String CACHE_REGION
Public so others know where we're caching our objects
-
REMOVE_ALL_CALLBACK
protected final SessionCachingMetadataDomainRepository.CacheIteratorCallback REMOVE_ALL_CALLBACK
Removes all keys it encounters from the known cache region
-
-
Constructor Detail
-
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 Detail
-
forAllKeys
protected void forAllKeys(SessionCachingMetadataDomainRepository.CacheIteratorCallback callback)
Calls the callback for every key in the cache region- Parameters:
callback- {@see CacheCallback}
-
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- {@see CacheCallback}
-
getDomain
public org.pentaho.metadata.model.Domain getDomain(String id)
- 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
public void removeDomain(String domainId)
- 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
public Set<String> getDomainIds()
- Specified by:
getDomainIdsin interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
getMetadataDomainIds
public Set<String> 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
public Set<String> 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
public String generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)
- 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
public Map<String,InputStream> getDomainFilesData(String domainId)
- 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
public org.pentaho.platform.api.repository2.unified.RepositoryFileAcl getAclFor(String domainId)
- Specified by:
getAclForin interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
hasAccessFor
public boolean hasAccessFor(String domainId)
- 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
public String loadAnnotationsXml(String domainId)
- Specified by:
loadAnnotationsXmlin interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
storeAnnotationsXml
public void storeAnnotationsXml(String domainId, String annotationsXml)
- Specified by:
storeAnnotationsXmlin interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
-