Class PentahoMetadataDomainRepository
- java.lang.Object
- 
- org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository
 
- 
- All Implemented Interfaces:
- org.pentaho.metadata.repository.IMetadataDomainRepository,- IAclAwarePentahoMetadataDomainRepositoryImporter,- IModelAnnotationsAwareMetadataDomainRepositoryImporter,- IPentahoMetadataDomainRepositoryExporter,- IPentahoMetadataDomainRepositoryImporter
 - Direct Known Subclasses:
- CachingPentahoMetadataDomainRepository,- PentahoMondrianDomainRepository,- SecurityAwarePentahoMetadataDomainRepository
 
 public class PentahoMetadataDomainRepository extends Object implements org.pentaho.metadata.repository.IMetadataDomainRepository, IModelAnnotationsAwareMetadataDomainRepositoryImporter, IAclAwarePentahoMetadataDomainRepositoryImporter, IPentahoMetadataDomainRepositoryExporter Handles the storage and retrieval of Pentaho Metada Domain objects in a repository. It does this by using a pre-defined system location (defined byPentahoMetadataDomainRepositoryInfo) as the storage location for the Domain files and associated locale files. Since Domain IDs are the unique identifier for Pentaho Metadata domains and may contain any character (including repository folder separator character(s) like '/', aUUIDwill be created to store each file. The metadata for the file will be used to store the information (such as the Domain ID).- Author:
- David M. Kincade
 
- 
- 
Field Summary- 
Fields inherited from interface org.pentaho.metadata.repository.IMetadataDomainRepositoryACCESS_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.IModelAnnotationsAwareMetadataDomainRepositoryImporterANNOTATIONS_FILE_ID_POSTFIX, PROPERTY_NAME_ANNOTATIONS
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description PentahoMetadataDomainRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)Creates an instance of this class providing theIUnifiedRepositoryrepository backend.protectedPentahoMetadataDomainRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository, org.pentaho.platform.repository2.unified.RepositoryUtils repositoryUtils, org.pentaho.metadata.util.XmiParser xmiParser, org.pentaho.metadata.util.LocalizationUtil localizationUtil)Helper constructor used for setting other objects in this class
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite)voidaddLocalizationFile(String domainId, String locale, Properties properties)Adds a set of properties as a locale properties file for the specified Domain IDvoidcreateOrUpdateAnnotationsXml(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile, org.pentaho.platform.api.repository2.unified.RepositoryFile annotationsFile, String annotationsXml)protected org.pentaho.platform.api.repository2.unified.RepositoryFilecreateUniqueFile(String domainId, String locale, org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData data)Creates a new repository file (with the supplied data) and applies the proper metadata to this file.protected StringendsWithXmi(String value)voidflushDomains()flush the domains from memoryStringgenerateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)org.pentaho.platform.api.repository2.unified.RepositoryFileAclgetAclFor(String domainId)protected org.pentaho.platform.api.repository2.unified.IAclNodeHelpergetAclHelper()org.pentaho.platform.api.repository2.unified.RepositoryFilegetAnnotationsXmlFile(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile)org.pentaho.metadata.model.DomaingetDomain(String domainId)retrieve a domain from the repo.Map<String,InputStream>getDomainFilesData(String domainId)protected StringgetDomainIdFromXmi(StringBuilder sb)Set<String>getDomainIds()return a list of all the domain ids in the repository.protected org.pentaho.metadata.util.LocalizationUtilgetLocalizationUtil()protected org.apache.commons.logging.LoggetLogger()protected org.pentaho.platform.api.repository2.unified.RepositoryFilegetMetadataDir()protected org.pentaho.platform.api.repository2.unified.RepositoryFilegetMetadataRepositoryFile(String domainId)Accesses the metadata mapping (with 1 retry) to find the metadata file for the specified domainIdprotected org.pentaho.platform.api.repository2.unified.IUnifiedRepositorygetRepository()protected org.pentaho.platform.repository2.unified.RepositoryUtilsgetRepositoryUtils()protected org.pentaho.metadata.util.XmiParsergetXmiParser()booleanhasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder)The aclHolder cannot be null unless the access type requested is ACCESS_TYPE_SCHEMA_ADMIN.booleanhasAccessFor(String domainId)protected booleanisDomainIdXmiEqualsOrNotPresent(String domainId, String domainIdXmi)StringloadAnnotationsXml(String domainId)protected voidloadLocaleStrings(String domainId, org.pentaho.metadata.model.Domain domain)protected PropertiesloadProperties(org.pentaho.platform.api.repository2.unified.RepositoryFile bundle)protected StringnoXmi(String value)voidreloadDomains()reload domains from diskvoidremoveDomain(String domainId)remove a domain from disk and memory.voidremoveModel(String domainId, String modelId)remove a model from a domain which is stored either on a disk or memory.protected StringreplaceDomainId(StringBuilder sb, String domainId)protected StringresolveAnnotationsFilePath(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile)voidsetAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl)protected voidsetLocalizationUtil(org.pentaho.metadata.util.LocalizationUtil localizationUtil)protected voidsetRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)protected voidsetRepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils repositoryUtils)protected voidsetXmiParser(org.pentaho.metadata.util.XmiParser xmiParser)voidstoreAnnotationsXml(String domainId, String annotationsXml)voidstoreDomain(InputStream inputStream, String domainId, boolean overwrite)Stores a domain to the repository directly as an Input StreamvoidstoreDomain(InputStream inputStream, String domainId, boolean overwrite, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl)voidstoreDomain(org.pentaho.metadata.model.Domain domain, boolean overwrite)Store a domain to the repository.protected StringtoString(org.pentaho.platform.api.repository2.unified.RepositoryFile file)
 
- 
- 
- 
Constructor Detail- 
PentahoMetadataDomainRepositorypublic PentahoMetadataDomainRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository) Creates an instance of this class providing theIUnifiedRepositoryrepository backend.- Parameters:
- repository- the- IUnifiedRepositoryin which data will be stored / retrieved
 
 - 
PentahoMetadataDomainRepositoryprotected PentahoMetadataDomainRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository, org.pentaho.platform.repository2.unified.RepositoryUtils repositoryUtils, org.pentaho.metadata.util.XmiParser xmiParser, org.pentaho.metadata.util.LocalizationUtil localizationUtil)Helper constructor used for setting other objects in this class- Parameters:
- repository- the- IUnifiedRepositoryin which data will be stored / retrieved
- repositoryUtils- utility class for working inside the repository (NOTE:- nullis acceptable and will create a default instance)
- xmiParser- the parser class for serializing / de-serializing Domain objects (NOTE:- nullis acceptable and will create a default instance)
- localizationUtil- the object used to add locale bundles into a Pentaho Metadata Domain object (NOTE:- nullis acceptable and will create a default instance)
 
 
- 
 - 
Method Detail- 
storeDomainpublic 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.DomainStorageExceptionStore a domain to the repository. The domain should persist between JVM restarts.- Specified by:
- storeDomainin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
- Parameters:
- domain- domain object to store
- overwrite- if true, overwrite existing domain
- Throws:
- org.pentaho.metadata.repository.DomainIdNullException- if domain id is null or empty
- org.pentaho.metadata.repository.DomainAlreadyExistsException- if a domain with the same Domain ID already exists in the repository and- overwrite == false
- org.pentaho.metadata.repository.DomainStorageException- if there is a problem storing the domain
 
 - 
replaceDomainIdprotected String replaceDomainId(StringBuilder sb, String domainId) 
 - 
getDomainIdFromXmiprotected String getDomainIdFromXmi(StringBuilder sb) 
 - 
isDomainIdXmiEqualsOrNotPresentprotected boolean isDomainIdXmiEqualsOrNotPresent(String domainId, String domainIdXmi) 
 - 
storeDomainpublic void storeDomain(InputStream inputStream, String domainId, boolean overwrite) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainAlreadyExistsException, org.pentaho.metadata.repository.DomainStorageException Stores a domain to the repository directly as an Input Stream- Specified by:
- storeDomainin interface- IPentahoMetadataDomainRepositoryImporter
- Parameters:
- inputStream-
- domainId-
- overwrite-
- Throws:
- org.pentaho.metadata.repository.DomainIdNullException
- org.pentaho.metadata.repository.DomainAlreadyExistsException
- org.pentaho.metadata.repository.DomainStorageException
 
 - 
storeDomainpublic 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 interface- IAclAwarePentahoMetadataDomainRepositoryImporter
- Throws:
- org.pentaho.metadata.repository.DomainIdNullException
- org.pentaho.metadata.repository.DomainAlreadyExistsException
- org.pentaho.metadata.repository.DomainStorageException
 
 - 
getAclHelperprotected org.pentaho.platform.api.repository2.unified.IAclNodeHelper getAclHelper() 
 - 
setAclForpublic void setAclFor(String domainId, org.pentaho.platform.api.repository2.unified.RepositoryFileAcl acl) - Specified by:
- setAclForin interface- IAclAwarePentahoMetadataDomainRepositoryImporter
 
 - 
getAclForpublic org.pentaho.platform.api.repository2.unified.RepositoryFileAcl getAclFor(String domainId) - Specified by:
- getAclForin interface- IAclAwarePentahoMetadataDomainRepositoryImporter
 
 - 
hasAccessForpublic boolean hasAccessFor(String domainId) - Specified by:
- hasAccessForin interface- IAclAwarePentahoMetadataDomainRepositoryImporter
 
 - 
getDomainFilesDatapublic Map<String,InputStream> getDomainFilesData(String domainId) - Specified by:
- getDomainFilesDatain interface- IPentahoMetadataDomainRepositoryExporter
 
 - 
getDomainpublic org.pentaho.metadata.model.Domain getDomain(String domainId) retrieve a domain from the repo. This does lazy loading of the repo, so it calls reloadDomains() if not already loaded.- Specified by:
- getDomainin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
- Parameters:
- domainId- domain to get from the repository
- Returns:
- domain object
 
 - 
getDomainIdspublic Set<String> getDomainIds() return a list of all the domain ids in the repository. triggers a call to reloadDomains if necessary.- Specified by:
- getDomainIdsin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
- Returns:
- the domain Ids.
 
 - 
removeDomainpublic void removeDomain(String domainId) remove a domain from disk and memory.- Specified by:
- removeDomainin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
- Specified by:
- removeDomainin interface- IPentahoMetadataDomainRepositoryImporter
- Parameters:
- domainId-
 
 - 
removeModelpublic void removeModel(String domainId, String modelId) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainStorageException remove a model from a domain which is stored either on a disk or memory.- Specified by:
- removeModelin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
- Parameters:
- domainId-
- modelId-
- Throws:
- org.pentaho.metadata.repository.DomainIdNullException
- org.pentaho.metadata.repository.DomainStorageException
 
 - 
reloadDomainspublic void reloadDomains() reload domains from disk- Specified by:
- reloadDomainsin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
 
 - 
flushDomainspublic void flushDomains() flush the domains from memory- Specified by:
- flushDomainsin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
 
 - 
generateRowLevelSecurityConstraintpublic String generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model) - Specified by:
- generateRowLevelSecurityConstraintin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
 
 - 
hasAccesspublic boolean hasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder)The aclHolder cannot be null unless the access type requested is ACCESS_TYPE_SCHEMA_ADMIN.- Specified by:
- hasAccessin interface- org.pentaho.metadata.repository.IMetadataDomainRepository
 
 - 
addLocalizationFilepublic void addLocalizationFile(String domainId, String locale, Properties properties) throws org.pentaho.metadata.repository.DomainStorageException Adds a set of properties as a locale properties file for the specified Domain ID- Parameters:
- domainId- the domain ID for which this properties file will be added
- locale- the locale for which this properties file will be added
- properties- the properties to be added
- Throws:
- org.pentaho.metadata.repository.DomainStorageException
 
 - 
addLocalizationFilepublic void addLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite) throws org.pentaho.metadata.repository.DomainStorageException - Specified by:
- addLocalizationFilein interface- IPentahoMetadataDomainRepositoryImporter
- Throws:
- org.pentaho.metadata.repository.DomainStorageException
 
 - 
getMetadataDirprotected org.pentaho.platform.api.repository2.unified.RepositoryFile getMetadataDir() 
 - 
loadLocaleStringsprotected void loadLocaleStrings(String domainId, org.pentaho.metadata.model.Domain domain) 
 - 
loadPropertiesprotected Properties loadProperties(org.pentaho.platform.api.repository2.unified.RepositoryFile bundle) 
 - 
createUniqueFileprotected org.pentaho.platform.api.repository2.unified.RepositoryFile createUniqueFile(String domainId, String locale, org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData data) Creates a new repository file (with the supplied data) and applies the proper metadata to this file.- Parameters:
- domainId- the Domain id associated with this file
- locale- the locale associated with this file (or null for a domain file)
- data- the data to put in the file
- Returns:
- the repository file created
 
 - 
getRepositoryprotected org.pentaho.platform.api.repository2.unified.IUnifiedRepository getRepository() 
 - 
getXmiParserprotected org.pentaho.metadata.util.XmiParser getXmiParser() 
 - 
getRepositoryUtilsprotected org.pentaho.platform.repository2.unified.RepositoryUtils getRepositoryUtils() 
 - 
getLocalizationUtilprotected org.pentaho.metadata.util.LocalizationUtil getLocalizationUtil() 
 - 
setRepositoryprotected void setRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository) 
 - 
setXmiParserprotected void setXmiParser(org.pentaho.metadata.util.XmiParser xmiParser) 
 - 
setRepositoryUtilsprotected void setRepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils repositoryUtils) 
 - 
setLocalizationUtilprotected void setLocalizationUtil(org.pentaho.metadata.util.LocalizationUtil localizationUtil) 
 - 
toStringprotected String toString(org.pentaho.platform.api.repository2.unified.RepositoryFile file) 
 - 
getMetadataRepositoryFileprotected org.pentaho.platform.api.repository2.unified.RepositoryFile getMetadataRepositoryFile(String domainId) Accesses the metadata mapping (with 1 retry) to find the metadata file for the specified domainId
 - 
loadAnnotationsXmlpublic String loadAnnotationsXml(String domainId) - Specified by:
- loadAnnotationsXmlin interface- IModelAnnotationsAwareMetadataDomainRepositoryImporter
 
 - 
storeAnnotationsXmlpublic void storeAnnotationsXml(String domainId, String annotationsXml) - Specified by:
- storeAnnotationsXmlin interface- IModelAnnotationsAwareMetadataDomainRepositoryImporter
 
 - 
getAnnotationsXmlFilepublic org.pentaho.platform.api.repository2.unified.RepositoryFile getAnnotationsXmlFile(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile) 
 - 
createOrUpdateAnnotationsXmlpublic void createOrUpdateAnnotationsXml(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile, org.pentaho.platform.api.repository2.unified.RepositoryFile annotationsFile, String annotationsXml)
 - 
resolveAnnotationsFilePathprotected String resolveAnnotationsFilePath(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile) 
 - 
getLoggerprotected org.apache.commons.logging.Log getLogger() 
 
- 
 
-