Class RolapSchema

    • Field Detail

      • LOGGER

        static final org.apache.log4j.Logger LOGGER
      • key

        final SchemaKey key
        This is basically a unique identifier for this RolapSchema instance used it its equals and hashCode methods.
    • Constructor Detail

      • RolapSchema

        RolapSchema​(SchemaKey key,
                    ByteString md5Bytes,
                    java.lang.String catalogUrl,
                    java.lang.String catalogStr,
                    Util.PropertyList connectInfo,
                    javax.sql.DataSource dataSource)
        Create RolapSchema given the MD5 hash, catalog name and string (content) and the connectInfo object.
        Parameters:
        md5Bytes - may be null
        catalogUrl - URL of catalog
        catalogStr - may be null
        connectInfo - Connection properties
    • Method Detail

      • getCellFormatter

        static CellFormatter getCellFormatter​(java.lang.String className,
                                              Scripts.ScriptDefinition script)
                                       throws java.lang.Exception
        Given the name of a cell formatter class and/or a cell formatter script, returns a cell formatter.
        Parameters:
        className - Name of cell formatter class
        script - Script
        Returns:
        Cell formatter
        Throws:
        java.lang.Exception - if class cannot be instantiated
      • getMemberFormatter

        static MemberFormatter getMemberFormatter​(java.lang.String className,
                                                  Scripts.ScriptDefinition script)
                                           throws java.lang.Exception
        Given the name of a member formatter class, returns a member formatter.
        Parameters:
        className - Name of cell formatter class
        script - Script
        Returns:
        Member formatter
        Throws:
        java.lang.Exception - if class cannot be instantiated
      • createPropertyFormatter

        static PropertyFormatter createPropertyFormatter​(java.lang.String className,
                                                         Scripts.ScriptDefinition script)
                                                  throws java.lang.Exception
        Given the name of a property formatter class, returns a propert formatter.
        Parameters:
        className - Name of property formatter class
        script - Script
        Returns:
        Property formatter
        Throws:
        java.lang.Exception - if class cannot be instantiated
      • flushSegments

        protected void flushSegments()
      • flushJdbcSchema

        protected void flushJdbcSchema()
        Clears the cache of JDBC tables for the aggs.
      • finalCleanUp

        protected void finalCleanUp()
        Performs a sweep of the JDBC tables caches and the segment data. Only called internally when a schema and it's data must be refreshed.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getLogger

        protected org.apache.log4j.Logger getLogger()
      • load

        protected void load​(java.lang.String catalogUrl,
                            java.lang.String catalogStr)
        Method called by all constructors to load the catalog into DOM and build application mdx and sql objects.
        Parameters:
        catalogUrl - URL of catalog
        catalogStr - Text of catalog, or null
      • getSchemaLoadDate

        public java.util.Date getSchemaLoadDate()
        Description copied from interface: Schema
        Returns when this schema was last loaded.
        Specified by:
        getSchemaLoadDate in interface Schema
        Returns:
        Date and time when this schema was last loaded
      • getWarnings

        public java.util.List<java.lang.Exception> getWarnings()
        Description copied from interface: Schema
        Returns a list of warnings and errors that occurred while loading this schema.
        Specified by:
        getWarnings in interface Schema
        Returns:
        list of warnings
      • getDefaultRole

        public Role getDefaultRole()
      • getName

        public java.lang.String getName()
        Description copied from interface: Schema
        Returns the name of this schema.
        Specified by:
        getName in interface Schema
      • getId

        public java.lang.String getId()
        Returns this schema instance unique ID.
        Specified by:
        getId in interface Schema
        Returns:
        A string representing the schema ID.
      • getAnnotationMap

        public java.util.Map<java.lang.String,​Annotation> getAnnotationMap()
        Description copied from interface: Annotated
        Returns a list of annotations.

        The map may be empty, never null.

        Specified by:
        getAnnotationMap in interface Annotated
        Returns:
        Map from annotation name to annotations.
      • getDialect

        public Dialect getDialect()
        Returns this schema's SQL dialect.

        NOTE: This method is not cheap. The implementation gets a connection from the connection pool.

        Returns:
        dialect
      • locate

        mondrian.rolap.RolapSchema.XmlLocation locate​(ElementDef node,
                                                      java.lang.String attributeName)
        Returns the location of an element or attribute in an XML document.

        TODO: modify eigenbase-xom parser to return position info

        Parameters:
        node - Node
        attributeName - Attribute name, or null
        Returns:
        Location of node or attribute in an XML document
      • error

        void error​(java.lang.String message,
                   mondrian.rolap.RolapSchema.XmlLocation xmlLocation)
        Reports an error. If we are tolerant of errors (see RolapConnectionProperties.Ignore), adds it to the stack, overwise throws. A thrown exception will typically abort the attempt to create the exception.
        Parameters:
        message - Message
        xmlLocation - Location of XML element or attribute that caused the error, or null
      • createDimension

        public Dimension createDimension​(Cube cube,
                                         java.lang.String xml)
        Description copied from interface: Schema
        Creates a dimension in the given cube by parsing an XML string. The XML string must be either a <Dimension> or a <DimensionUsage>. Returns the dimension created.
        Specified by:
        createDimension in interface Schema
      • createCube

        public Cube createCube​(java.lang.String xml)
        Description copied from interface: Schema
        Creates a cube by parsing an XML string. Returns the cube created.
        Specified by:
        createCube in interface Schema
      • getRolapSchemas

        public static java.util.List<RolapSchema> getRolapSchemas()
      • cacheContains

        public static boolean cacheContains​(RolapSchema rolapSchema)
      • lookupCube

        public Cube lookupCube​(java.lang.String cube,
                               boolean failIfNotFound)
        Description copied from interface: Schema
        Finds a cube called cube in this schema; if no cube exists, failIfNotFound controls whether to raise an error or return null.
        Specified by:
        lookupCube in interface Schema
      • lookupCube

        protected RolapCube lookupCube​(java.lang.String cubeName)
        Finds a cube called 'cube' in the current catalog, or return null if no cube exists.
      • lookupXmlCalculatedMember

        protected MondrianDef.CalculatedMember lookupXmlCalculatedMember​(java.lang.String calcMemberName,
                                                                         java.lang.String cubeName)
        Returns an xmlCalculatedMember called 'calcMemberName' in the cube called 'cubeName' or return null if no calculatedMember or xmlCube by those name exists.
      • getCubesWithStar

        public java.util.List<RolapCube> getCubesWithStar​(RolapStar star)
      • removeCube

        public boolean removeCube​(java.lang.String cubeName)
        Description copied from interface: Schema
        Removes a cube.
        Specified by:
        removeCube in interface Schema
        Returns:
        Whether cube was removed
      • getCubes

        public Cube[] getCubes()
        Description copied from interface: Schema
        Returns a list of all cubes in this schema.
        Specified by:
        getCubes in interface Schema
      • getCubeList

        public java.util.List<RolapCube> getCubeList()
      • getSharedHierarchies

        public Hierarchy[] getSharedHierarchies()
        Description copied from interface: Schema
        Returns a list of shared dimensions in this schema.
        Specified by:
        getSharedHierarchies in interface Schema
      • getSharedHierarchy

        RolapHierarchy getSharedHierarchy​(java.lang.String name)
      • getNamedSet

        public NamedSet getNamedSet​(java.lang.String name)
      • lookupRole

        public Role lookupRole​(java.lang.String role)
        Description copied from interface: Schema
        Finds a role with a given name in the current catalog, or returns null if no such role exists.
        Specified by:
        lookupRole in interface Schema
      • roleNames

        public java.util.Set<java.lang.String> roleNames()
      • getFunTable

        public FunTable getFunTable()
        Description copied from interface: Schema
        Returns this schema's function table.
        Specified by:
        getFunTable in interface Schema
      • getParameters

        public Parameter[] getParameters()
        Description copied from interface: Schema
        Returns this schema's parameters.
        Specified by:
        getParameters in interface Schema
      • createMemberReader

        MemberReader createMemberReader​(java.lang.String sharedName,
                                        RolapHierarchy hierarchy,
                                        java.lang.String memberReaderClass)
        Gets a MemberReader with which to read a hierarchy. If the hierarchy is shared (sharedName is not null), looks up a reader from a cache, or creates one if necessary.

        Synchronization: thread safe

      • getInternalConnection

        public RolapConnection getInternalConnection()
        Connection for purposes of parsing and validation. Careful! It won't have the correct locale or access-control profile.
      • getStar

        public RolapStar getStar​(java.lang.String factTableName)
      • getStars

        public java.util.Collection<RolapStar> getStars()
      • getDataSourceChangeListener

        public DataSourceChangeListener getDataSourceChangeListener()
        Returns:
        Returns the dataSourceChangeListener.
      • setDataSourceChangeListener

        public void setDataSourceChangeListener​(DataSourceChangeListener dataSourceChangeListener)
        Parameters:
        dataSourceChangeListener - The dataSourceChangeListener to set.