mondrian.rolap
Class RolapCube

java.lang.Object
  extended by mondrian.olap.OlapElementBase
      extended by mondrian.olap.CubeBase
          extended by mondrian.rolap.RolapCube
All Implemented Interfaces:
Cube, OlapElement

public class RolapCube
extends CubeBase

RolapCube implements Cube for a ROLAP database.

Since:
10 August, 2001
Author:
jhyde
 

Nested Class Summary
static class RolapCube.CubeComparator
           
 
Field Summary
(package private)  MondrianDef.Relation fact
          For SQL generator.
 
Fields inherited from class mondrian.olap.CubeBase
CATALOG_NAME, CUBE_NAME, DIMENSION_UNIQUE_NAME, dimensions, HIERARCHY_UNIQUE_NAME, LEVEL_NUMBER, LEVEL_UNIQUE_NAME, maxNofConstraintsForAdSchemaMember, MDPROP_USERDEFINED0, MDTREEOP_CHILDREN, MDTREEOP_SELF, MEMBER_CAPTION, MEMBER_NAME, MEMBER_TYPE, MEMBER_UNIQUE_NAME, name, SCHEMA_NAME, Tree_Operator
 
Fields inherited from class mondrian.olap.OlapElementBase
caption
 
Constructor Summary
RolapCube(RolapSchema schema, MondrianDef.Schema xmlSchema, MondrianDef.Cube xmlCube, boolean load)
          Creates a RolapCube from a regular cube.
RolapCube(RolapSchema schema, MondrianDef.Schema xmlSchema, MondrianDef.VirtualCube xmlVirtualCube, boolean load)
          Creates a RolapCube from a virtual cube.
 
Method Summary
 void checkAggregateModifications()
          Check if there are modifications in the aggregations cache
 void clearCachedAggregations()
          Clear the in memory aggregate cache associated with this Cube, but only if Disabling Caching has been enabled.
 void clearCachedAggregations(boolean forced)
          Clear the in memory aggregate cache associated with this Cube.
 Member createCalculatedMember(String xml)
          Creates a calculated member in this cube.
(package private)  RolapCubeDimension createDimension(MondrianDef.CubeDimension xmlCubeDimension, MondrianDef.Schema xmlSchema)
           
(package private)  void createUsage(RolapCubeHierarchy hierarchy, MondrianDef.CubeDimension cubeDim)
           
(package private)  RolapHierarchy findBaseCubeHierarchy(RolapHierarchy hierarchy)
          Locates the base cube hierarchy for a particular virtual hierarchy.
 RolapCubeLevel findBaseCubeLevel(RolapLevel level)
          Locates the base cube level for a particular virtual level.
 ExplicitRules.Group getAggGroup()
           
(package private) static CellFormatter getCellFormatter(String cellFormatterClassName)
          Given the name of a cell formatter class, returns a cell formatter.
(package private)  MondrianDef.RelationOrJoin getFact()
          Returns this cube's fact table, null if the cube is virtual.
(package private)  HierarchyUsage getFirstUsage(Hierarchy hier)
           
protected  org.apache.log4j.Logger getLogger()
           
(package private)  List<Member> getMeasures()
           
 Hierarchy getMeasuresHierarchy()
          Returns the the measures hierarchy.
 List<RolapMember> getMeasuresMembers()
           
 Member[] getMembersForQuery(String query, List<Member> calcMembers)
          Returns Member[].
 NamedSet[] getNamedSets()
          Returns the named sets of this cube.
 RolapSchema getSchema()
           
 SchemaReader getSchemaReader()
          Returns the schema reader which enforces the appropriate access-control context.
 SchemaReader getSchemaReader(Role role)
          Returns a SchemaReader for which this cube is the context for lookup up members.
 RolapStar getStar()
          Returns this cube's underlying star schema.
 HierarchyUsage[] getUsages(Hierarchy hierarchy)
          A Hierarchy may have one or more HierarchyUsages.
 boolean hasAggGroup()
           
 boolean isCacheAggregations()
          Returns true if this Cube is either virtual or if the Cube's RolapStar is caching aggregates.
 boolean isVirtual()
          Returns whether this cube is virtual.
(package private)  void loadAggGroup(MondrianDef.Cube xmlCube)
           
(package private)  MondrianDef.CubeDimension lookup(MondrianDef.CubeDimension[] xmlDimensions, String name)
           
 OlapElement lookupChild(SchemaReader schemaReader, Id.Segment s)
          Looks up a child element, returning null if it does not exist.
 OlapElement lookupChild(SchemaReader schemaReader, Id.Segment s, MatchType matchType)
           
protected  RolapStar.Column makeColumns(RolapStar.Table table, RolapCubeLevel level, RolapStar.Column parentColumn, String usagePrefix)
          Adds a column to the appropriate table in the RolapStar.
 Set<Dimension> nonJoiningDimensions(Member[] tuple)
          Finds out non joining dimensions for this cube.
 Set<Dimension> nonJoiningDimensions(Set<Dimension> otherDims)
          Finds out non joining dimensions for this cube.
(package private)  void processFormatStringAttribute(MondrianDef.CalculatedMember xmlCalcMember, StringBuilder buf)
           
 void pushAggregateModificationsToGlobalCache()
          Push all modifications of the aggregations to global cache, so other queries can start using the new cache
(package private)  void registerDimension(RolapCubeDimension dimension)
          Understand this and you are no longer a novice.
 void setCacheAggregations(boolean cache)
          Set if this (non-virtual) Cube's RolapStar should cache aggregations.
 boolean shouldIgnoreUnrelatedDimensions(String baseCubeName)
          This method tells us if unrelated dimensions to measures from the input base cube should be pushed to default member or not during aggregation.
 
Methods inherited from class mondrian.olap.CubeBase
getDescription, getDimension, getDimensions, getHierarchy, getMonthLevel, getName, getQualifiedName, getQuarterLevel, getTimeDimension, getUniqueName, getWeekLevel, getYearLevel, lookupDimension, lookupHierarchy
 
Methods inherited from class mondrian.olap.OlapElementBase
clone, computeHashCode, equals, equals, getCaption, hashCode, setCaption, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mondrian.olap.OlapElement
getCaption
 

Field Detail

fact

final MondrianDef.Relation fact
For SQL generator. Fact table.

Constructor Detail

RolapCube

RolapCube(RolapSchema schema,
          MondrianDef.Schema xmlSchema,
          MondrianDef.Cube xmlCube,
          boolean load)
Creates a RolapCube from a regular cube.


RolapCube

RolapCube(RolapSchema schema,
          MondrianDef.Schema xmlSchema,
          MondrianDef.VirtualCube xmlVirtualCube,
          boolean load)
Creates a RolapCube from a virtual cube.

Method Detail

getCellFormatter

static CellFormatter getCellFormatter(String cellFormatterClassName)
                               throws Exception
Given the name of a cell formatter class, returns a cell formatter. If class name is null, returns null.

Throws:
Exception - if class cannot be instantiated
Parameters:
cellFormatterClassName - Name of cell formatter class
Returns:
Cell formatter or null

getLogger

protected org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class OlapElementBase

hasAggGroup

public boolean hasAggGroup()

getAggGroup

public ExplicitRules.Group getAggGroup()

loadAggGroup

void loadAggGroup(MondrianDef.Cube xmlCube)

processFormatStringAttribute

void processFormatStringAttribute(MondrianDef.CalculatedMember xmlCalcMember,
                                  StringBuilder buf)

getSchema

public RolapSchema getSchema()

getNamedSets

public NamedSet[] getNamedSets()
Returns the named sets of this cube.


getSchemaReader

public SchemaReader getSchemaReader()
Returns the schema reader which enforces the appropriate access-control context. schemaReader is cached, and needs to stay in sync with any changes to the cube.

Post-condition:
return != null
See Also:
getSchemaReader(Role)

getSchemaReader

public SchemaReader getSchemaReader(Role role)
Description copied from interface: Cube
Returns a SchemaReader for which this cube is the context for lookup up members. If role is null, the returned schema reader also obeys the access-control profile of role.


lookup

MondrianDef.CubeDimension lookup(MondrianDef.CubeDimension[] xmlDimensions,
                                 String name)

isCacheAggregations

public boolean isCacheAggregations()
Returns true if this Cube is either virtual or if the Cube's RolapStar is caching aggregates.

Returns:
Whether this Cube's RolapStar should cache aggregations

setCacheAggregations

public void setCacheAggregations(boolean cache)
Set if this (non-virtual) Cube's RolapStar should cache aggregations.

Parameters:
cache - Whether this Cube's RolapStar should cache aggregations

clearCachedAggregations

public void clearCachedAggregations()
Clear the in memory aggregate cache associated with this Cube, but only if Disabling Caching has been enabled.


clearCachedAggregations

public void clearCachedAggregations(boolean forced)
Clear the in memory aggregate cache associated with this Cube.


checkAggregateModifications

public void checkAggregateModifications()
Check if there are modifications in the aggregations cache


pushAggregateModificationsToGlobalCache

public void pushAggregateModificationsToGlobalCache()
Push all modifications of the aggregations to global cache, so other queries can start using the new cache


getStar

public RolapStar getStar()
Returns this cube's underlying star schema.


createUsage

void createUsage(RolapCubeHierarchy hierarchy,
                 MondrianDef.CubeDimension cubeDim)

getUsages

public HierarchyUsage[] getUsages(Hierarchy hierarchy)
A Hierarchy may have one or more HierarchyUsages. This method returns an array holding the one or more usages associated with a Hierarchy. The HierarchyUsages hierarchyName attribute always equals the name attribute of the Hierarchy.

Parameters:
hierarchy - Hierarchy
Returns:
an HierarchyUsages array with 0 or more members.

getFirstUsage

HierarchyUsage getFirstUsage(Hierarchy hier)

registerDimension

void registerDimension(RolapCubeDimension dimension)
Understand this and you are no longer a novice.

Parameters:
dimension - Dimension

makeColumns

protected RolapStar.Column makeColumns(RolapStar.Table table,
                                       RolapCubeLevel level,
                                       RolapStar.Column parentColumn,
                                       String usagePrefix)
Adds a column to the appropriate table in the RolapStar. Note that if the RolapLevel has a table attribute, then the associated column needs to be associated with that table.


shouldIgnoreUnrelatedDimensions

public boolean shouldIgnoreUnrelatedDimensions(String baseCubeName)
This method tells us if unrelated dimensions to measures from the input base cube should be pushed to default member or not during aggregation.

Parameters:
baseCubeName - name of the base cube for which we want to check this property
Returns:
boolean

getMembersForQuery

public Member[] getMembersForQuery(String query,
                                   List<Member> calcMembers)
Description copied from interface: Cube
Returns Member[]. It builds Member[] by analyzing cellset, which gets created by running mdx sQuery. query has to be in the format of something like "[with calculated members] select *members* on columns from this".


nonJoiningDimensions

public Set<Dimension> nonJoiningDimensions(Member[] tuple)
Finds out non joining dimensions for this cube. Useful for finding out non joining dimensions for a stored measure from a base cube.

Parameters:
tuple - array of members
Returns:
Set of dimensions that do not exist (non joining) in this cube

nonJoiningDimensions

public Set<Dimension> nonJoiningDimensions(Set<Dimension> otherDims)
Finds out non joining dimensions for this cube. Equality test for dimensions is done based on the unique name. Object equality can't be used.

Parameters:
otherDims - Set of dimensions to be tested for existance in this cube
Returns:
Set of dimensions that do not exist (non joining) in this cube

getMeasures

List<Member> getMeasures()

getFact

MondrianDef.RelationOrJoin getFact()
Returns this cube's fact table, null if the cube is virtual.


isVirtual

public boolean isVirtual()
Returns whether this cube is virtual. We use the fact that virtual cubes do not have fact tables.


findBaseCubeHierarchy

RolapHierarchy findBaseCubeHierarchy(RolapHierarchy hierarchy)
Locates the base cube hierarchy for a particular virtual hierarchy. If not found, return null. This may be converted to a map lookup or cached in some way in the future to increase performance with cubes that have large numbers of hierarchies

Parameters:
hierarchy - virtual hierarchy
Returns:
base cube hierarchy if found

findBaseCubeLevel

public RolapCubeLevel findBaseCubeLevel(RolapLevel level)
Locates the base cube level for a particular virtual level. If not found, return null. This may be converted to a map lookup or cached in some way in the future to increase performance with cubes that have large numbers of hierarchies and levels

Parameters:
level - virtual level
Returns:
base cube level if found

createDimension

RolapCubeDimension createDimension(MondrianDef.CubeDimension xmlCubeDimension,
                                   MondrianDef.Schema xmlSchema)

lookupChild

public OlapElement lookupChild(SchemaReader schemaReader,
                               Id.Segment s)
Description copied from interface: OlapElement
Looks up a child element, returning null if it does not exist.

Specified by:
lookupChild in interface OlapElement
Overrides:
lookupChild in class CubeBase

lookupChild

public OlapElement lookupChild(SchemaReader schemaReader,
                               Id.Segment s,
                               MatchType matchType)
Specified by:
lookupChild in interface OlapElement
Overrides:
lookupChild in class CubeBase

getMeasuresHierarchy

public Hierarchy getMeasuresHierarchy()
Returns the the measures hierarchy.


getMeasuresMembers

public List<RolapMember> getMeasuresMembers()

createCalculatedMember

public Member createCalculatedMember(String xml)
Description copied from interface: Cube
Creates a calculated member in this cube.

The XML string must be a <CalculatedMember/> element, as defined in Mondrian.xml.

Parameters:
xml - XML string

SourceForge.net_Logo