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 interface
SessionCachingMetadataDomainRepository.CacheIteratorCallback
Simple callback interface to facilitate iterating over cache keysstatic class
SessionCachingMetadataDomainRepository.CacheKey
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
SessionCachingMetadataDomainRepository.GetDomainCallable
Callable to callIMetadataDomainRepository.getDomain(String)
with some logging statement to help in debug.static class
SessionCachingMetadataDomainRepository.PentahoAsyncThreadRunner
Asynchronously executes a collection of tasks (ieCallable
).static class
SessionCachingMetadataDomainRepository.PentahoSessionThread
Thread that sets theIPentahoSession
for the thread seePentahoSessionHolder
.
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_REGION
Public so others know where we're caching our objectsprotected SessionCachingMetadataDomainRepository.CacheIteratorCallback
REMOVE_ALL_CALLBACK
Removes 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 void
addLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite)
protected void
clearDomainIdsFromCache()
Remove domain ID cache for all sessionsprotected void
clearDomainIdsFromCache(org.pentaho.platform.api.engine.IPentahoSession session)
Remove domain ID cache for a given sessionvoid
flushDomains()
protected void
flushDomains(org.pentaho.platform.api.engine.IPentahoSession session)
protected void
forAllKeys(SessionCachingMetadataDomainRepository.CacheIteratorCallback callback)
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
.String
generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)
org.pentaho.platform.api.repository2.unified.RepositoryFileAcl
getAclFor(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.Domain
getDomain(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.boolean
hasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder)
boolean
hasAccessFor(String domainId)
String
loadAnnotationsXml(String domainId)
void
onLogout(org.pentaho.platform.api.engine.IPentahoSession session)
void
reloadDomains()
void
removeDomain(String domainId)
void
removeModel(String domainId, String modelId)
void
setAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl)
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 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:
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
public void removeDomain(String domainId)
- 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
public Set<String> getDomainIds()
- Specified by:
getDomainIds
in interfaceorg.pentaho.metadata.repository.IMetadataDomainRepository
-
getMetadataDomainIds
public Set<String> 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
public Set<String> 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
public String generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)
- 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
public Map<String,InputStream> getDomainFilesData(String domainId)
- 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
public org.pentaho.platform.api.repository2.unified.RepositoryFileAcl getAclFor(String domainId)
- Specified by:
getAclFor
in interfaceIAclAwarePentahoMetadataDomainRepositoryImporter
-
hasAccessFor
public boolean hasAccessFor(String domainId)
- 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
public String loadAnnotationsXml(String domainId)
- Specified by:
loadAnnotationsXml
in interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
storeAnnotationsXml
public void storeAnnotationsXml(String domainId, String annotationsXml)
- Specified by:
storeAnnotationsXml
in interfaceIModelAnnotationsAwareMetadataDomainRepositoryImporter
-
-