📄 developer_notes.html
字号:
<html><!-- == $Id: //open/mondrian-release/3.0/doc/developer_notes.html#2 $ == This software is subject to the terms of the Common Public License == Agreement, available at the following URL: == http://www.opensource.org/licenses/cpl.html. == Copyright (C) 2005-2007 Julian Hyde and others. == All Rights Reserved. == You must accept the terms of that agreement to use this software. --><head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <title>Pentaho Analysis Services: Developer Notes</title></head><body><!-- doc2web start --><!-- page title --><div class="contentheading">Mondrian Developer Notes</div><!-- end page title --><hr noshade size="1"><h2>Contents</h2><ol> <li><a href="#Log_Levels">Logging Levels and Information</a></li> <li><a href="#Agg_default_rules">Default aggregate table recognition rules</a></li> <li><a href="#Snowflakes">Snowflakes and the DimensionUsage level attribute</a></li> <li><a href="#Memory_monitoring">Memory Monitoring</a></li> <li><a href="#Role_implementation">Implementing Roles</a></li></ol><h2>Logging Levels and Information<a name="Log_Levels"> </a></h2><p>Some of the Mondrian classes are instrumented with Apache Log4J Loggers.For some of these classes there are certain logging setting that provideinformation for not just the code developer but also for someonesetting up a Mondrian installation. The following is a list of someof those log setting and the associated information.</p><table style="text-align: left; " border="1" cellpadding="2" cellspacing="0"> <tbody> <tr> <td style="vertical-align: top; text-align: center;"> <span style="font-weight: bold;">Category</span><br> </td> <td style="vertical-align: top; text-align: center;"> <span style="font-weight: bold;">Level</span><br> </td> <td style="vertical-align: top; text-align: center;"> <span style="font-weight: bold;">Description</span><br> </td> </tr> <tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.aggmatcher.AggTableManager </code></td> <td style="vertical-align: top;"><code>INFO</code></td> <td style="vertical-align: top;"> A list of the RolapStar fact table names (aliases) and for each fact table, a list of all of its associated aggregate tables. </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.aggmatcher.AggTableManager </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> A verbose output of all RolapStar fact tables, their measures columns, and dimension tables and columnns, along with all of each fact table's aggregate tables, columns and dimension tables. </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.aggmatcher.DefaultDef </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> For each candidate aggregate table, the Matcher regular expressions for matching: table name and the fact count, foreign key, level and measure columns. Helpful in finding out why an aggregate table was not recognized. </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.agg.AggregationManager </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> For each aggregate Sql query, if an aggregate table can be used to fulfill the query, which aggregate it was along with bitKeys and column names. </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.RolapUtil </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> Prints out all Sql statements and their execution time. If one set the Mondrian property, <code>mondrian.rolap.generate.formatted.sql</code> to true, then the Sql is pretty printed (very nice). </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.RolapConnection </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> Prints out each MDX query prior to its execution. (No pretty printing, sigh.) </td> </tr> <tr> <td style="vertical-align: top;"><code> mondrian.rolap.RolapSchema </code></td> <td style="vertical-align: top;"><code>DEBUG</code></td> <td style="vertical-align: top;"> Prints out each Rolap Schema as it is being loaded. </td> </tr> </tbody></table><p>There are more classes with logging, but their logging is at a lower, moredetailed level of more use to code developers.</p><p>Log levels can be set in either a log4j.properties file or log4j.xml file.You have to make sure you tell Mondrian which one to use.For the log4j.properties, entries might look like:</p><blockquote> log4j.category.mondrian.rolap.RolapConnection=DEBUG<br> log4j.category.mondrian.rolap.RolapUtil=DEBUG<br></blockquote><p>while for the log4.xml:</p><blockquote> <category name="mondrian.rolap.RolapConnection"><br> <priority value="DEBUG"/><br> </category><br> <category name="mondrian.rolap.RolapUtil"><br> <priority value="DEBUG"/><br> </category><br></blockquote><h2>Default aggregate table recognition rules<a name="Agg_default_rules"> </a></h2><p>The default Mondrian rules for recognizing aggregate tablesare specified by creating an instance of the rule schemafound in the file:<code>MONDRIAN_HOME/src/main/rolap/aggmatcher/DefaultRulesSchema.xml.</code>The instance of this schema that is built into the <code>mondrian.jar</code>after a build is in the same directory,<code>MONDRIAN_HOME/src/main/rolap/aggmatcher/DefaultRules.xml.</code></p><p>There are six different default rules that are used to match and map a candidateaggregate table: table name, ignore column, fact count column, foreign key column, level column and measure column. All of these rules are defined by creating an instance of the DefaultRulesSchema.xml grammar.The DefaultRulesSchema.xml instance, the DefaultRules.xml file mentionedabove, that by default is built as part of the mondrian.jar does notcontain an ignore column rule.This grammar has base/supporting classes that are common to the aboverules. In <code>XOM</code>terms, these are classes and super classes of the rule elements.</p><p>The first <code>XOM</code>class dealing with matching is the <code>CaseMatcher</code>class.This has an attribute "charcase" that takes the legal values of</p><blockquote> "ignore" (default)<br> "exact"<br> "upper"<br> "lower"<br></blockquote><p>When the value of the attribute is "ignore", then the regular expression formed by an element extending the <code>CaseMatcher</code>class will be case independent for both any parameters usedto instantiate the regular expression template as well as forthe text in the post-instantiated regular expression.On the other hand, when the "charcase" attribute take any ofthe other three values, it is only the parameter values themselvesthat are "exact", unchanged, "lower", converted to lower case, or"upper", converted to upper case.</p><p>The class <code>NameMatcher</code>extends the <code>CaseMatcher</code>class. This classhas pre-template and post-template attributes whose default valuesis the empty string. These attributes are prepended/appended to a parameter to generate a regular expression.As an example, the <code>TableMatcher </code>element extends <code>NameMatcher</code>class.The parameter in this case is the fact table name and the regularexpression would be: </p><blockquote> pre-template-attribute${fact_table_name}post-template-attribute</blockquote><p>For Mondrian, the builtin rule has the pre template value "agg_.+_" and the post template attribute value is the defaultso the regular expression becomes:</p><blockquote> agg_.+_${fact_table_name}</blockquote><p>Also, the<code>NameMatcher</code>has an attribute called<code>basename</code>which is optional. If set, then its value must be a regular expressionwith a single capture group. A capture group is an regular expressioncomponent surrounded by "(" and ")". As an example, "(.*)" isa capture group and if this was the total regular expression, thenit would match anything and the single capture would match the same.On the other hand if the total regular expression was "RF_(.*)_TBL", thena name such as "RF_SHIPPMENTS_TBL" would match the regular expression whilethe capture group would be "SHIPPMENTS". Now, if the<code>basename</code>attribute is defined, then it is applied to each fact table name allowingone to strip away information and get to the "base" name. This mightbe needed because a DBA might prepend or append a tag to all of your fact table names and the DBA might wish to have a different tagprepend or append to all of your aggregate table names (RF_SHIPPMENTS_TBLas the fact table and RA_SHIPPMENTS_AGG_14 as an example aggregatename (the DBA prepended the "RA_" and you appended the "_AGG_14")).</p><p>Both the<code>FactCountMatch</code>and<code>ForeignKeyMatch</code>elements also extend the<code>NameMatcher</code>class. In these cases, the builtin Mondrian rule has nopre or post template attribute values, no regular expression,The<code>FactCountMatch</code>takes no other parameter from the fact table (the fact table does nothave a fact count column) rather it takes a fact count attributewith default value "fact_count", and this is used tocreate the regular expression.For the <code>ForeignKeyMatch</code>matcher, its the fact table's foreign key that is used as the regular expression.</p><p>The ignore, asdf level and measure column matching elements have one or more<code>Regex</code>child elements. These allow for specifying multiple possible matches(if any match, then its a match).The<code>IgnoreMap,</code><code>LevelMap</code>and <code>MeasureMap</code>elements extend the <code>RegexMapper</code>which holds an array of<code>Regex</code>elements.The<code>Regex</code>element extends <code>CaseMatcher</code>It has two attributes, <code>space</code>with default value '_' which says how space characters should be mapped,and<code>dot</code>with default value '_' which says how '.' characters should be mapped.If a name were the string "Unit Sales.Case" then (with the default
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -