public class PentahoMetadataDomainRepository extends Object implements org.pentaho.metadata.repository.IMetadataDomainRepository, IModelAnnotationsAwareMetadataDomainRepositoryImporter, IAclAwarePentahoMetadataDomainRepositoryImporter, IPentahoMetadataDomainRepositoryExporter
PentahoMetadataDomainRepositoryInfo
) 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 '/', a UUID
will be created to store each file. The metadata for the file will be used to store the information (such as the
Domain ID). ACCESS_TYPE_ADMIN, ACCESS_TYPE_DELETE, ACCESS_TYPE_READ, ACCESS_TYPE_SCHEMA_ADMIN, ACCESS_TYPE_UPDATE, ACCESS_TYPE_WRITE
ANNOTATIONS_FILE_ID_POSTFIX, PROPERTY_NAME_ANNOTATIONS
Modifier | Constructor and Description |
---|---|
|
PentahoMetadataDomainRepository(IUnifiedRepository repository)
Creates an instance of this class providing the
IUnifiedRepository repository backend. |
protected |
PentahoMetadataDomainRepository(IUnifiedRepository repository,
RepositoryUtils repositoryUtils,
org.pentaho.metadata.util.XmiParser xmiParser,
org.pentaho.metadata.util.LocalizationUtil localizationUtil)
Helper constructor used for setting other objects in this class
|
Modifier and Type | Method and Description |
---|---|
void |
addLocalizationFile(String domainId,
String locale,
InputStream inputStream,
boolean overwrite) |
void |
addLocalizationFile(String domainId,
String locale,
Properties properties)
Adds a set of properties as a locale properties file for the specified Domain ID
|
void |
createOrUpdateAnnotationsXml(RepositoryFile domainFile,
RepositoryFile annotationsFile,
String annotationsXml) |
protected RepositoryFile |
createUniqueFile(String domainId,
String locale,
SimpleRepositoryFileData data)
Creates a new repository file (with the supplied data) and applies the proper metadata to this file.
|
protected String |
endsWithXmi(String value) |
void |
flushDomains()
flush the domains from memory
|
String |
generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model) |
RepositoryFileAcl |
getAclFor(String domainId) |
protected IAclNodeHelper |
getAclHelper() |
RepositoryFile |
getAnnotationsXmlFile(RepositoryFile domainFile) |
org.pentaho.metadata.model.Domain |
getDomain(String domainId)
retrieve a domain from the repo.
|
Map<String,InputStream> |
getDomainFilesData(String domainId) |
protected String |
getDomainIdFromXmi(StringBuilder sb) |
Set<String> |
getDomainIds()
return a list of all the domain ids in the repository.
|
protected org.pentaho.metadata.util.LocalizationUtil |
getLocalizationUtil() |
protected org.apache.commons.logging.Log |
getLogger() |
protected RepositoryFile |
getMetadataDir() |
protected RepositoryFile |
getMetadataRepositoryFile(String domainId)
Accesses the metadata mapping (with 1 retry) to find the metadata file for the specified domainId
|
protected IUnifiedRepository |
getRepository() |
protected RepositoryUtils |
getRepositoryUtils() |
protected org.pentaho.metadata.util.XmiParser |
getXmiParser() |
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.
|
boolean |
hasAccessFor(String domainId) |
protected boolean |
isDomainIdXmiEqualsOrNotPresent(String domainId,
String domainIdXmi) |
String |
loadAnnotationsXml(String domainId) |
protected void |
loadLocaleStrings(String domainId,
org.pentaho.metadata.model.Domain domain) |
protected Properties |
loadProperties(RepositoryFile bundle) |
protected String |
noXmi(String value) |
void |
reloadDomains()
reload domains from disk
|
void |
removeDomain(String domainId)
remove a domain from disk and memory.
|
void |
removeModel(String domainId,
String modelId)
remove a model from a domain which is stored either on a disk or memory.
|
protected String |
replaceDomainId(StringBuilder sb,
String domainId) |
protected String |
resolveAnnotationsFilePath(RepositoryFile domainFile) |
void |
setAclFor(String domainId,
RepositoryFileAcl acl) |
protected void |
setLocalizationUtil(org.pentaho.metadata.util.LocalizationUtil localizationUtil) |
protected void |
setRepository(IUnifiedRepository repository) |
protected void |
setRepositoryUtils(RepositoryUtils repositoryUtils) |
protected void |
setXmiParser(org.pentaho.metadata.util.XmiParser xmiParser) |
void |
storeAnnotationsXml(String domainId,
String annotationsXml) |
void |
storeDomain(org.pentaho.metadata.model.Domain domain,
boolean overwrite)
Store a domain to the repository.
|
void |
storeDomain(InputStream inputStream,
String domainId,
boolean overwrite)
Stores a domain to the repository directly as an Input Stream
|
void |
storeDomain(InputStream inputStream,
String domainId,
boolean overwrite,
RepositoryFileAcl acl) |
protected String |
toString(RepositoryFile file) |
public PentahoMetadataDomainRepository(IUnifiedRepository repository)
IUnifiedRepository
repository backend.repository
- the IUnifiedRepository
in which data will be stored / retrievedprotected PentahoMetadataDomainRepository(IUnifiedRepository repository, RepositoryUtils repositoryUtils, org.pentaho.metadata.util.XmiParser xmiParser, org.pentaho.metadata.util.LocalizationUtil localizationUtil)
repository
- the IUnifiedRepository
in which data will be stored / retrievedrepositoryUtils
- utility class for working inside the repository (NOTE: null
is acceptable and
will create a default instance)xmiParser
- the parser class for serializing / de-serializing Domain objects (NOTE: null
is acceptable and will create a default instance)localizationUtil
- the object used to add locale bundles into a Pentaho Metadata Domain object (NOTE:
null
is acceptable and will create a default instance)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
storeDomain
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
domain
- domain object to storeoverwrite
- if true, overwrite existing domainorg.pentaho.metadata.repository.DomainIdNullException
- if domain id is null or emptyorg.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 domainprotected String replaceDomainId(StringBuilder sb, String domainId)
protected String getDomainIdFromXmi(StringBuilder sb)
protected boolean isDomainIdXmiEqualsOrNotPresent(String domainId, String domainIdXmi)
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
storeDomain
in interface IPentahoMetadataDomainRepositoryImporter
inputStream
- domainId
- overwrite
- org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainAlreadyExistsException
org.pentaho.metadata.repository.DomainStorageException
public void storeDomain(InputStream inputStream, String domainId, boolean overwrite, RepositoryFileAcl acl) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainAlreadyExistsException, org.pentaho.metadata.repository.DomainStorageException
storeDomain
in interface IAclAwarePentahoMetadataDomainRepositoryImporter
org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainAlreadyExistsException
org.pentaho.metadata.repository.DomainStorageException
protected IAclNodeHelper getAclHelper()
public void setAclFor(String domainId, RepositoryFileAcl acl)
setAclFor
in interface IAclAwarePentahoMetadataDomainRepositoryImporter
public RepositoryFileAcl getAclFor(String domainId)
getAclFor
in interface IAclAwarePentahoMetadataDomainRepositoryImporter
public boolean hasAccessFor(String domainId)
hasAccessFor
in interface IAclAwarePentahoMetadataDomainRepositoryImporter
public Map<String,InputStream> getDomainFilesData(String domainId)
getDomainFilesData
in interface IPentahoMetadataDomainRepositoryExporter
public org.pentaho.metadata.model.Domain getDomain(String domainId)
getDomain
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
domainId
- domain to get from the repositorypublic Set<String> getDomainIds()
getDomainIds
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
public void removeDomain(String domainId)
removeDomain
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
removeDomain
in interface IPentahoMetadataDomainRepositoryImporter
domainId
- public void removeModel(String domainId, String modelId) throws org.pentaho.metadata.repository.DomainIdNullException, org.pentaho.metadata.repository.DomainStorageException
removeModel
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
domainId
- modelId
- org.pentaho.metadata.repository.DomainIdNullException
org.pentaho.metadata.repository.DomainStorageException
public void reloadDomains()
reloadDomains
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
public void flushDomains()
flushDomains
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
public String generateRowLevelSecurityConstraint(org.pentaho.metadata.model.LogicalModel model)
generateRowLevelSecurityConstraint
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
public boolean hasAccess(int accessType, org.pentaho.metadata.model.concept.IConcept aclHolder)
hasAccess
in interface org.pentaho.metadata.repository.IMetadataDomainRepository
public void addLocalizationFile(String domainId, String locale, Properties properties) throws org.pentaho.metadata.repository.DomainStorageException
domainId
- the domain ID for which this properties file will be addedlocale
- the locale for which this properties file will be addedproperties
- the properties to be addedorg.pentaho.metadata.repository.DomainStorageException
public void addLocalizationFile(String domainId, String locale, InputStream inputStream, boolean overwrite) throws org.pentaho.metadata.repository.DomainStorageException
addLocalizationFile
in interface IPentahoMetadataDomainRepositoryImporter
org.pentaho.metadata.repository.DomainStorageException
protected RepositoryFile getMetadataDir()
protected void loadLocaleStrings(String domainId, org.pentaho.metadata.model.Domain domain)
protected Properties loadProperties(RepositoryFile bundle)
protected RepositoryFile createUniqueFile(String domainId, String locale, SimpleRepositoryFileData data)
domainId
- the Domain id associated with this filelocale
- the locale associated with this file (or null for a domain file)data
- the data to put in the fileprotected IUnifiedRepository getRepository()
protected org.pentaho.metadata.util.XmiParser getXmiParser()
protected RepositoryUtils getRepositoryUtils()
protected org.pentaho.metadata.util.LocalizationUtil getLocalizationUtil()
protected void setRepository(IUnifiedRepository repository)
protected void setXmiParser(org.pentaho.metadata.util.XmiParser xmiParser)
protected void setRepositoryUtils(RepositoryUtils repositoryUtils)
protected void setLocalizationUtil(org.pentaho.metadata.util.LocalizationUtil localizationUtil)
protected String toString(RepositoryFile file)
protected RepositoryFile getMetadataRepositoryFile(String domainId)
public String loadAnnotationsXml(String domainId)
loadAnnotationsXml
in interface IModelAnnotationsAwareMetadataDomainRepositoryImporter
public void storeAnnotationsXml(String domainId, String annotationsXml)
storeAnnotationsXml
in interface IModelAnnotationsAwareMetadataDomainRepositoryImporter
public RepositoryFile getAnnotationsXmlFile(RepositoryFile domainFile)
public void createOrUpdateAnnotationsXml(RepositoryFile domainFile, RepositoryFile annotationsFile, String annotationsXml)
protected String resolveAnnotationsFilePath(RepositoryFile domainFile)
protected org.apache.commons.logging.Log getLogger()
Copyright © 2017 Hitachi Vantara. All rights reserved.