mondrian.rolap.agg
Class SegmentHeader

java.lang.Object
  extended by mondrian.rolap.agg.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()

Version:
$Id: //open/mondrian/src/main/mondrian/rolap/agg/SegmentHeader.java#11 $
Author:
LBoudreau
See Also:
Serialized Form

Nested Class Summary
static class SegmentHeader.ConstrainedColumn
          Constrained columns are part of the SegmentHeader and SegmentCache.
 
Constructor Summary
SegmentHeader(String schemaName, String schemaChecksum, String cubeName, String measureName, SegmentHeader.ConstrainedColumn[] constrainedColumns, String[] compoundPredicates, String rolapStarFactTableName, BitKey constrainedColsBitKey)
          Base constructor for segment headers.
SegmentHeader(String schemaName, String schemaChecksum, String cubeName, String measureName, SegmentHeader.ConstrainedColumn[] constrainedColumns, String rolapStarFactTableName, BitKey constrainedColsBitKey)
          Base constructor for segment headers.
 
Method Summary
 SegmentHeader clone(SegmentHeader.ConstrainedColumn[] overrideValues)
          Creates a clone of this header by replacing some of the constrained columns in the process.
 boolean equals(Object obj)
           
static SegmentHeader.ConstrainedColumn[] forCacheRegion(RolapCacheRegion region)
           
static SegmentHeader forSegment(Segment segment, List<StarPredicate> compoundPredicates)
          Creates a SegmentHeader object describing the supplied Segment object.
 int getArity()
          Returns the arity of this SegmentHeader.
 SegmentHeader.ConstrainedColumn getConstrainedColumn(String columnExpression)
          Returns the constrained column object, if any, corresponding to a column name and a table name.
 SegmentHeader.ConstrainedColumn[] getConstrainedColumns()
          Returns an array of constrained columns which define this segment header.
 BitKey getConstrainedColumnsBitKey()
           
 String getDescription()
          Returns a human readable description of this segment header.
 String getUniqueID()
          Returns a unique identifier for this header.
 int hashCode()
           
 boolean isSubset(Segment segment)
          Tells if the passed segment is a subset of this segment and could be used for a rollup in cache operation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SegmentHeader

public SegmentHeader(String schemaName,
                     String schemaChecksum,
                     String cubeName,
                     String measureName,
                     SegmentHeader.ConstrainedColumn[] constrainedColumns,
                     String rolapStarFactTableName,
                     BitKey constrainedColsBitKey)
Base constructor for segment headers.

Parameters:
schemaName - The name of the schema which this header belongs to.
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.

SegmentHeader

public SegmentHeader(String schemaName,
                     String schemaChecksum,
                     String cubeName,
                     String measureName,
                     SegmentHeader.ConstrainedColumn[] constrainedColumns,
                     String[] compoundPredicates,
                     String rolapStarFactTableName,
                     BitKey constrainedColsBitKey)
Base constructor for segment headers.

Parameters:
schemaName - The name of the schema which this header belongs to.
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.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

forCacheRegion

public static SegmentHeader.ConstrainedColumn[] forCacheRegion(RolapCacheRegion region)

forSegment

public static SegmentHeader forSegment(Segment segment,
                                       List<StarPredicate> compoundPredicates)
Creates a SegmentHeader object describing the supplied Segment object.

Parameters:
segment - A segment object for which we want to generate a SegmentHeader.
Returns:
A SegmentHeader describing the supplied Segment object.

clone

public SegmentHeader clone(SegmentHeader.ConstrainedColumn[] 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.

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.

getConstrainedColumns

public SegmentHeader.ConstrainedColumn[] getConstrainedColumns()
Returns an array of constrained columns which define this segment header. The caller should consider this list immutable.

Returns:
An array of ConstrainedColumns

getConstrainedColumn

public SegmentHeader.ConstrainedColumn 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.

getConstrainedColumnsBitKey

public BitKey getConstrainedColumnsBitKey()

isSubset

public boolean isSubset(Segment segment)
Tells if the passed segment is a subset of this segment and could be used for a rollup in cache operation.

Parameters:
segment - A segment which might be a subset of the current segment.
Returns:
True or false.

getUniqueID

public String 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