Package mondrian.rolap.aggmatcher
Class DefaultRules
- java.lang.Object
-
- mondrian.rolap.aggmatcher.DefaultRules
-
public class DefaultRules extends Object
Container for the default aggregate recognition rules. It is generated by parsing the default rule xml information found in theMondrianProperties.AggregateRules
value which normally is a resource in the jar file (but can be a url).It is a singleton since it is used to recognize tables independent of database connection (each
RolapSchema
uses the same instance).- Author:
- Richard M. Emberson
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
columnsOK(RolapStar star, JdbcSchema.Table dbFactTable, JdbcSchema.Table aggTable, MessageRecorder msgRecorder)
Uses theDefaultRecognizer
Recognizer to determine if the given aggTable's columns all match upto the dbFactTable's columns (where present) making the column usages as a result.DefaultDef.AggRule
getAggRule()
Returns theDefaultDef.AggRule
whose tag equals this rule's tag.DefaultDef.AggRule
getAggRule(String tag)
Returns theDefaultDef.AggRule
whose tag equals the parameter tag, or null if not found.mondrian.rolap.aggmatcher.Recognizer.Matcher
getFactCountMatcher()
Gets theRecognizer.Matcher
for columns that should be ignored.mondrian.rolap.aggmatcher.Recognizer.Matcher
getForeignKeyMatcher(String foreignKeyName)
Gets theRecognizer.Matcher
for this foreign key column name.mondrian.rolap.aggmatcher.Recognizer.Matcher
getIgnoreMatcher()
Gets theRecognizer.Matcher
for the fact count column.static DefaultRules
getInstance()
There is a single instance of theDefaultRecognizer
and theDefaultRules
class is a container of that instance.mondrian.rolap.aggmatcher.Recognizer.Matcher
getLevelMatcher(String usagePrefix, String hierarchyName, String levelName, String levelColumnName)
Gets aRecognizer.Matcher
for a given level's hierarchy's name, level name and column name.mondrian.rolap.aggmatcher.Recognizer.Matcher
getMeasureMatcher(String measureName, String measureColumnName, String aggregateName)
Creates aRecognizer.Matcher
for the given measure name (symbolic name), column name and aggregate name (sum, count, etc.).mondrian.rolap.aggmatcher.Recognizer.Matcher
getTableMatcher(String tableName)
Gets theRecognizer.Matcher
for this tableName.String
getTag()
Gets the tag of this rule (this is the value of theMondrianProperties.AggregateRuleTag
property).protected static DefaultDef.AggRules
makeAggRules(File file)
protected static DefaultDef.AggRules
makeAggRules(InputStream inStream)
protected static DefaultDef.AggRules
makeAggRules(String text, String name)
protected static DefaultDef.AggRules
makeAggRules(URL url)
protected static org.eigenbase.xom.DOMWrapper
makeDOMWrapper(File file)
protected static org.eigenbase.xom.DOMWrapper
makeDOMWrapper(InputStream inStream)
protected static org.eigenbase.xom.DOMWrapper
makeDOMWrapper(String text, String name)
protected static org.eigenbase.xom.DOMWrapper
makeDOMWrapper(URL url)
boolean
matchesTableName(String factTableName, String name)
Returns true if this candidate aggregate table name "matches" the factTableName.void
validate(MessageRecorder msgRecorder)
-
-
-
Method Detail
-
getInstance
public static DefaultRules getInstance()
There is a single instance of theDefaultRecognizer
and theDefaultRules
class is a container of that instance.
-
makeAggRules
protected static DefaultDef.AggRules makeAggRules(File file)
-
makeAggRules
protected static DefaultDef.AggRules makeAggRules(URL url)
-
makeAggRules
protected static DefaultDef.AggRules makeAggRules(InputStream inStream)
-
makeAggRules
protected static DefaultDef.AggRules makeAggRules(String text, String name)
-
makeDOMWrapper
protected static org.eigenbase.xom.DOMWrapper makeDOMWrapper(File file)
-
makeDOMWrapper
protected static org.eigenbase.xom.DOMWrapper makeDOMWrapper(URL url)
-
makeDOMWrapper
protected static org.eigenbase.xom.DOMWrapper makeDOMWrapper(InputStream inStream)
-
makeDOMWrapper
protected static org.eigenbase.xom.DOMWrapper makeDOMWrapper(String text, String name)
-
validate
public void validate(MessageRecorder msgRecorder)
-
getTag
public String getTag()
Gets the tag of this rule (this is the value of theMondrianProperties.AggregateRuleTag
property).
-
getAggRule
public DefaultDef.AggRule getAggRule()
Returns theDefaultDef.AggRule
whose tag equals this rule's tag.
-
getAggRule
public DefaultDef.AggRule getAggRule(String tag)
Returns theDefaultDef.AggRule
whose tag equals the parameter tag, or null if not found.- Parameters:
tag
-- Returns:
- the AggRule with tag value equal to tag parameter, or null.
-
getTableMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getTableMatcher(String tableName)
Gets theRecognizer.Matcher
for this tableName.- Parameters:
tableName
-
-
getIgnoreMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getIgnoreMatcher()
Gets theRecognizer.Matcher
for the fact count column.
-
getFactCountMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getFactCountMatcher()
Gets theRecognizer.Matcher
for columns that should be ignored.- Returns:
- the
Recognizer.Matcher
for columns that should be ignored.
-
getForeignKeyMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getForeignKeyMatcher(String foreignKeyName)
Gets theRecognizer.Matcher
for this foreign key column name.- Parameters:
foreignKeyName
- Name of a foreign key column
-
matchesTableName
public boolean matchesTableName(String factTableName, String name)
Returns true if this candidate aggregate table name "matches" the factTableName.- Parameters:
factTableName
- Name of the fact tablename
- candidate aggregate table name
-
getMeasureMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getMeasureMatcher(String measureName, String measureColumnName, String aggregateName)
Creates aRecognizer.Matcher
for the given measure name (symbolic name), column name and aggregate name (sum, count, etc.).
-
getLevelMatcher
public mondrian.rolap.aggmatcher.Recognizer.Matcher getLevelMatcher(String usagePrefix, String hierarchyName, String levelName, String levelColumnName)
Gets aRecognizer.Matcher
for a given level's hierarchy's name, level name and column name.
-
columnsOK
public boolean columnsOK(RolapStar star, JdbcSchema.Table dbFactTable, JdbcSchema.Table aggTable, MessageRecorder msgRecorder)
Uses theDefaultRecognizer
Recognizer to determine if the given aggTable's columns all match upto the dbFactTable's columns (where present) making the column usages as a result.
-
-