Class PentahoMetadataDomainRepository

    • Constructor Detail

      • PentahoMetadataDomainRepository

        public PentahoMetadataDomainRepository​(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
        Creates an instance of this class providing the IUnifiedRepository repository backend.
        Parameters:
        repository - the IUnifiedRepository in which data will be stored / retrieved
      • PentahoMetadataDomainRepository

        protected 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 IUnifiedRepository in which data will be stored / retrieved
        repositoryUtils - 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)
    • Method Detail

      • 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
        Store a domain to the repository. The domain should persist between JVM restarts.
        Specified by:
        storeDomain in 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
      • endsWithXmi

        protected String endsWithXmi​(String value)
      • isDomainIdXmiEqualsOrNotPresent

        protected boolean isDomainIdXmiEqualsOrNotPresent​(String domainId,
                                                          String domainIdXmi)
      • 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
        Stores a domain to the repository directly as an Input Stream
        Specified by:
        storeDomain in interface IPentahoMetadataDomainRepositoryImporter
        Parameters:
        inputStream -
        domainId -
        overwrite -
        Throws:
        org.pentaho.metadata.repository.DomainIdNullException
        org.pentaho.metadata.repository.DomainAlreadyExistsException
        org.pentaho.metadata.repository.DomainStorageException
      • 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 interface IAclAwarePentahoMetadataDomainRepositoryImporter
        Throws:
        org.pentaho.metadata.repository.DomainIdNullException
        org.pentaho.metadata.repository.DomainAlreadyExistsException
        org.pentaho.metadata.repository.DomainStorageException
      • getAclHelper

        protected org.pentaho.platform.api.repository2.unified.IAclNodeHelper getAclHelper()
      • getDomain

        public 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:
        getDomain in interface org.pentaho.metadata.repository.IMetadataDomainRepository
        Parameters:
        domainId - domain to get from the repository
        Returns:
        domain object
      • getDomainIds

        public Set<String> getDomainIds()
        return a list of all the domain ids in the repository. triggers a call to reloadDomains if necessary.
        Specified by:
        getDomainIds in interface org.pentaho.metadata.repository.IMetadataDomainRepository
        Returns:
        the domain Ids.
      • removeDomain

        public void removeDomain​(String domainId)
        remove a domain from disk and memory.
        Specified by:
        removeDomain in interface org.pentaho.metadata.repository.IMetadataDomainRepository
        Specified by:
        removeDomain in interface IPentahoMetadataDomainRepositoryImporter
        Parameters:
        domainId -
      • removeModel

        public 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:
        removeModel in interface org.pentaho.metadata.repository.IMetadataDomainRepository
        Parameters:
        domainId -
        modelId -
        Throws:
        org.pentaho.metadata.repository.DomainIdNullException
        org.pentaho.metadata.repository.DomainStorageException
      • reloadDomains

        public void reloadDomains()
        reload domains from disk
        Specified by:
        reloadDomains in interface org.pentaho.metadata.repository.IMetadataDomainRepository
      • flushDomains

        public void flushDomains()
        flush the domains from memory
        Specified by:
        flushDomains in interface org.pentaho.metadata.repository.IMetadataDomainRepository
      • generateRowLevelSecurityConstraint

        public String generateRowLevelSecurityConstraint​(org.pentaho.metadata.model.LogicalModel model)
        Specified by:
        generateRowLevelSecurityConstraint in interface org.pentaho.metadata.repository.IMetadataDomainRepository
      • hasAccess

        public 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:
        hasAccess in interface org.pentaho.metadata.repository.IMetadataDomainRepository
      • addLocalizationFile

        public 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
      • getMetadataDir

        protected org.pentaho.platform.api.repository2.unified.RepositoryFile getMetadataDir()
      • loadLocaleStrings

        protected void loadLocaleStrings​(String domainId,
                                         org.pentaho.metadata.model.Domain domain)
      • loadProperties

        protected Properties loadProperties​(org.pentaho.platform.api.repository2.unified.RepositoryFile bundle)
      • createUniqueFile

        protected 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
      • getRepository

        protected org.pentaho.platform.api.repository2.unified.IUnifiedRepository getRepository()
      • getXmiParser

        protected org.pentaho.metadata.util.XmiParser getXmiParser()
      • getRepositoryUtils

        protected org.pentaho.platform.repository2.unified.RepositoryUtils getRepositoryUtils()
      • getLocalizationUtil

        protected org.pentaho.metadata.util.LocalizationUtil getLocalizationUtil()
      • setRepository

        protected void setRepository​(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
      • setXmiParser

        protected void setXmiParser​(org.pentaho.metadata.util.XmiParser xmiParser)
      • setRepositoryUtils

        protected void setRepositoryUtils​(org.pentaho.platform.repository2.unified.RepositoryUtils repositoryUtils)
      • setLocalizationUtil

        protected void setLocalizationUtil​(org.pentaho.metadata.util.LocalizationUtil localizationUtil)
      • toString

        protected String toString​(org.pentaho.platform.api.repository2.unified.RepositoryFile file)
      • getMetadataRepositoryFile

        protected 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
      • getAnnotationsXmlFile

        public org.pentaho.platform.api.repository2.unified.RepositoryFile getAnnotationsXmlFile​(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile)
      • createOrUpdateAnnotationsXml

        public void createOrUpdateAnnotationsXml​(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile,
                                                 org.pentaho.platform.api.repository2.unified.RepositoryFile annotationsFile,
                                                 String annotationsXml)
      • resolveAnnotationsFilePath

        protected String resolveAnnotationsFilePath​(org.pentaho.platform.api.repository2.unified.RepositoryFile domainFile)
      • getLogger

        protected org.apache.commons.logging.Log getLogger()