mondrian.spi
Class SegmentHeader

java.lang.Object
  extended by mondrian.spi.SegmentHeader
All Implemented Interfaces:
Serializable

public class SegmentHeader
extends Object
implements Serializable

SegmentHeaders are the key objects used to retrieve the segments from the segment cache.

The segment header objects are immutable and fully serializable.

The headers have each an ID which is a SHA-256 checksum of the following properties, concatenated. See getUniqueID()

Author:
LBoudreau
See Also:
Serialized Form

Field Summary
 List<String> compoundPredicates
           
 BitKey constrainedColsBitKey
           
 String cubeName
           
 String measureName
           
 String rolapStarFactTableName
           
 ByteString schemaChecksum
           
 String schemaName
           
 
Constructor Summary
SegmentHeader(String schemaName, ByteString schemaChecksum, String cubeName, String measureName, List<SegmentColumn> constrainedColumns, List<String> compoundPredicates, String rolapStarFactTableName, BitKey constrainedColsBitKey, List<SegmentColumn> excludedRegions)
          Creates a segment header.
 
Method Summary
 boolean canConstrain(SegmentColumn[] region)
          Checks if this header can be constrained by a given region.
 SegmentHeader clone(SegmentColumn[] overrideValues)
          Creates a clone of this header by replacing some of the constrained columns in the process.
 SegmentHeader constrain(SegmentColumn[] region)
          Applies a set of exclusions to this segment header and returns a new segment header representing the original one to which a region has been excluded.
 boolean equals(Object obj)
           
 int getArity()
          Returns the arity of this SegmentHeader.
 SegmentColumn getConstrainedColumn(String columnExpression)
          Returns the constrained column object, if any, corresponding to a column name and a table name.
 List<SegmentColumn> getConstrainedColumns()
          Returns a list of constrained columns which define this segment header.
 BitKey getConstrainedColumnsBitKey()
           
 String getDescription()
          Returns a human readable description of this segment header.
 SegmentColumn getExcludedRegion(String columnExpression)
           
 List<SegmentColumn> getExcludedRegions()
           
 ByteString getUniqueID()
          Returns a unique identifier for this header.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

compoundPredicates

public final List<String> compoundPredicates

measureName

public final String measureName

cubeName

public final String cubeName

schemaName

public final String schemaName

rolapStarFactTableName

public final String rolapStarFactTableName

constrainedColsBitKey

public final BitKey constrainedColsBitKey

schemaChecksum

public final ByteString schemaChecksum
Constructor Detail

SegmentHeader

public SegmentHeader(String schemaName,
                     ByteString schemaChecksum,
                     String cubeName,
                     String measureName,
                     List<SegmentColumn> constrainedColumns,
                     List<String> compoundPredicates,
                     String rolapStarFactTableName,
                     BitKey constrainedColsBitKey,
                     List<SegmentColumn> excludedRegions)
Creates a segment header.

Parameters:
schemaName - The name of the schema which this header belongs to.
schemaChecksum - Schema checksum
cubeName - The name of the cube this segment belongs to.
measureName - The name of the measure which defines this header.
constrainedColumns - An array of constrained columns objects which define the predicated of this segment header.
compoundPredicates - Compound predicates (Must not be null, but typically empty.)
rolapStarFactTableName - Star fact table name
constrainedColsBitKey - Constrained columns bit key
excludedRegions - Excluded regions. (Must not be null, but typically
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

clone

public SegmentHeader clone(SegmentColumn[] overrideValues)
Creates a clone of this header by replacing some of the constrained columns in the process.

Parameters:
overrideValues - A list of constrained columns to either replace or add to the original header.
Returns:
A clone of the header with the columns replaced.

canConstrain

public boolean canConstrain(SegmentColumn[] region)
Checks if this header can be constrained by a given region.

It will return false if the region covers one of the axis in its entirety.

It will return false if the region sits outside of the bounds of this header. This means that when performing a flush operation, the header must be scrapped altogether.


constrain

public SegmentHeader constrain(SegmentColumn[] region)
Applies a set of exclusions to this segment header and returns a new segment header representing the original one to which a region has been excluded.

Parameters:
region - Region
Returns:
Header with constraint applied

toString

public String toString()
Overrides:
toString in class Object

getArity

public int getArity()
Returns the arity of this SegmentHeader.

Returns:
The arity as an integer number.

getExcludedRegions

public List<SegmentColumn> getExcludedRegions()

getConstrainedColumns

public List<SegmentColumn> getConstrainedColumns()
Returns a list of constrained columns which define this segment header. The caller should consider this list immutable.

Returns:
List of ConstrainedColumns

getConstrainedColumn

public SegmentColumn getConstrainedColumn(String columnExpression)
Returns the constrained column object, if any, corresponding to a column name and a table name.

Parameters:
columnExpression - The column name we want.
Returns:
A Constrained column, or null.

getExcludedRegion

public SegmentColumn getExcludedRegion(String columnExpression)

getConstrainedColumnsBitKey

public BitKey getConstrainedColumnsBitKey()

getUniqueID

public ByteString getUniqueID()
Returns a unique identifier for this header. The identifier can be used for storage and will be the same across segments which have the same schema name, cube name, measure name, and for each constrained column, the same column name, table name, and predicate values.

Returns:
A unique identification string.

getDescription

public String getDescription()
Returns a human readable description of this segment header.

Returns:
A string describing the header.

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads