⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmdrunner.html

📁 基于mondrian 开源框架进行OLAP多维分析
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><!--  == $Id: //open/mondrian-release/3.0/doc/cmdrunner.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: How to Design a Mondrian Schema</title></head><body><!-- doc2web start --><!-- page title --><div class="contentheading">Mondrian CmdRunner</div><!-- end page title --><hr noshade size="1"><h2>Contents</h2><ul>    <li><a href="#What_is_CmdRunner">What is CmdRunner?</a></li>    <li><a href="#Building">Building</a></li>    <li><a href="#Usage">Usage</a></li>    <li><a href="#Properties_file">Properties File</a></li>    <li><a href="#Command_line_arguments">Command line arguments</a></li>    <li><a href="#CmdRunner_Commands">CmdRunner Commands</a><ul>        <li><a href="#help">help</a></li>        <li><a href="#set">set</a></li>        <li><a href="#log">log</a></li>        <li><a href="#file">file</a></li>        <li><a href="#list">list</a></li>        <li><a href="#func">func</a></li>        <li><a href="#param">param</a></li>        <li><a href="#cube">cube</a></li>        <li><a href="#error">error</a></li>        <li><a href="#echo">echo</a></li>        <li><a href="#expr">expr</a></li>        <li><a href="#equals">=</a></li>        <li><a href="#tilde">~</a></li>        <li><a href="#exit">exit</a></li>        <li><a href="#run_an_MDX_query">run an MDX query</a></li>    </ul>    </li>    <li><a href="#AggGen">AggGen: Aggregate SQL Generator</a></li></ul><h2>What is CmdRunner?<a name="What_is_CmdRunner">&nbsp;</a></h2><p><code>CmdRunner</code> is a command line interpreter for Mondrian.From within the command interpreter or in a command file:properties can be set and values displayed, logginglevels changed, built-in function usages displayed,parameter values displayed and set,per-cube attributes displayed and set,results and errors from the previous MDX commanddisplayedand, of course, MDX queries evaluated.</p><p>For Mondrian developers new features can be quickly tested with <code>CmdRunner</code>. As an example, to test a new user-defined function all one need to is add it to the schema, add the location of the function's java class to the class path, point <code>CmdRunner</code> at the schema and execute a MDX query that uses the new function.</p><p>For MDX developers, <code>CmdRunner</code> lets one test a new MDX query orMondrian schema without having to run Mondrian in a Webserverusing JPivot. Rather, one can have the new MDX query in a file and point <code>CmdRunner</code> at it. Granted, the output is a list, possibly long, of row and column entries; but sometimes all one needs from <code>CmdRunner</code> is to know that the query runsand other times one can always post process the output intoexcel or gnuplot, etc.</p><h2>Building<a name="Building">&nbsp;</a></h2><p>There are two ways to run the command interpreter. The first is tohave a script create a class path with all of the needed mondrianand support jars in it and then have java execute the CmdRunner main method. The second is to build a jar that contains all of theneeded classes and simply have java reference the jar using the <code>-jar</code> argument.</p><p>To build the CmdRunner combined jar from the shell command line executethe following build command:</p><blockquote><code>    mondrian&gt; ./build.sh cmdrunner</code></blockquote><p>This will create the jar <code>cmdrunner.jar</code> in the <code><i>MONDRIAN_HOME</i>/lib</code> directory.For this build to create a jar that can actually be used it isimportant that the <i>JDBC</i> jar for your database be placed in the <code><i>MONDRIAN_HOME</i>/testlib</code> directory prior to executing the build command.</p><p>What is useful about the<code>cmdrunner.jar</code> is that it can be executed without having to have the <code><i>MONDRIAN_HOME</i></code> directory around since it bundles up everything that is needed(other than the properties and schema files).</p><h2>Usage<a name="Usage">&nbsp;</a></h2><p>There are two ways to invoke <code>CmdRunner</code>: using the <code>cmdrunner.jar</code> or using a script that builds a class path of the required jarsand then executes java with that class path. The former is an easy"canned" solution but requires building the <code>cmdrunner.jar</code> while thelater is quicker if you are in a code, compile and test cycle.</p><p>To run <code>CmdRunner</code> using the <code>cmdrunner.jar</code> from the shell prompt execute:</p><blockquote><code>    somedir&gt; java -jar cmdrunner.jar -p foodmart.properties</code></blockquote><p>In the <code><i>MONDRIAN_HOME</i>/bin</code> directory there are the shell scripts<code>cmdrunner.sh</code>and<code>cmdrunner.cmd</code>that can be used duplicating the above command:</p><blockquote><code>    mondrian&gt; ./bin/cmdrunner.sh -p foodmart.properties</code></blockquote><p>To run <code>CmdRunner</code> without first building the<code>cmdrunner.jar</code> there is the<code>run.sh</code>in the<code><i>MONDRIAN_HOME</i>/bin</code> directory.This script creates a class path and includes all jarsin the <code><i>MONDRIAN_HOME</i>/testlib</code> directorywhere the jdbc jars are located.<blockquote><code>    mondrian&gt; ./bin/run.sh -p foodmart.properties</code></blockquote></p><h2>Properties File<a name="Properties_file">&nbsp;</a></h2><p>Below is an example properties file:</p><blockquote><code>##############################################################################<br>#<br># Example properties file<br>#<br># $Id: //open/mondrian-release/3.0/doc/cmdrunner.html#2 $<br>##############################################################################<br># Environment<br>mondrian.catalogURL=file:///home/madonna/mondrian/FoodMartSchema.xml<br><br># mysql<br>mondrian.test.jdbcURL=jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart<br># to specify the jdbc username and password:<br># mondrian.test.jdbcUser=foodmart<br># mondrian.test.jdbcPassword=foodmart<br>mondrian.jdbcDrivers=com.mysql.jdbc.Driver<br><br># Use MD5 based caching for the RolapSchema instance<br>mondrian.catalog.content.cache.enabled=true<br><br># both read and use aggregate tables<br>mondrian.rolap.aggregates.Use=true<br>mondrian.rolap.aggregates.Read=true<br><br># generate aggregate sql (for every mdx query)<br>#mondrian.rolap.aggregates.generateSql=true<br><br># pretty print sql (if log level for mondrian.rolap.RolapUtil is DEBUG)<br>mondrian.rolap.generate.formatted.sql=true<br><br># by default the aggregate table with the smallest number of rows <br># (rather than rows times size of each row) is used <br>#mondrian.rolap.aggregates.ChooseByVolume=true<br><br></code></blockquote><h2>Command line arguments<a name="Command_line_arguments">&nbsp;</a></h2><p><code>CmdRunner</code> has the following command line options:</p><blockquote>    <table style="border-width:0; text-align: left" border="1" cellpadding="2" cellspacing="0">        <tbody>            <tr>                <td style="vertical-align: top; text-align: center;">                <span style="font-weight: bold;">Option</span><br></td>                <td style="vertical-align: top; text-align: center;">                <span style="font-weight: bold;">Description</span><br></td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-h</code></td>                <td style="vertical-align: top;">Print help, the list of command lineoptions.</td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-d</code></td>                <td style="vertical-align: top;">Enable CmdRunner debugging.         This does not change this log level.</td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-t</code></td>                <td style="vertical-align: top;">Time each mdx query's execution.                </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-nocache</code></td>                <td style="vertical-align: top;">Regardless of the settings in the        Schema file, set each Cube to no in-memory aggregate caching         (caching is turned off so each query goes to the database).        </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-rc</code></td>                <td style="vertical-align: top;">Do not reload the connection        after each query (the default is to reload the connection.        Its safe to just ignore this.      </td>            </tr>            <tr>                <td style="vertical-align: top;" nowrap><code>-p property-file</code></td>                <td style="vertical-align: top;">Specify the Mondrian property        file. This argument is basically required for any but the most         trivial command interpreter commands. To execute a MDX query or        request information about a function, the property file must be         supplied. On the other hand, to have the CmdRunner print out        its internal help, then the property file is not needed. </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-f filename+</code></td>                <td style="vertical-align: top;">Specify the name of one or        more files that contains CmdRunner commands. If this argument         is not supplied, then the interpreter starting in the command         entry mode. After the <code>-f</code> is seen, all subsequent        arguments are interpreted as filenames.      </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-x xmla_filename+</code></td>                <td style="vertical-align: top;">Specify the name of one or        more files that contains XMAL request that has no SOAP wrapper.        After the <code>-x</code> is seen, all subsequent        arguments are interpreted as XMLA filenames.      </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-xs soap_xmla_filename+</code></td>                <td style="vertical-align: top;">Specify the name of one or        more files that contains XMAL request with a SOAP wrapper.        After the <code>-xs</code> is seen, all subsequent        arguments are interpreted as SOAP XMLA filenames.      </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-vt</code></td>                <td style="vertical-align: top;">Validate the XMLA         response using XSLT transform. This can only be used with         the <code>-x</code> or <code>-xs</code> flags.      </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>-vx</code></td>                <td style="vertical-align: top;">Validate the XMLA         response using XPaths. This can only be used with         the <code>-x</code> or <code>-xs</code> flags.      </td>            </tr>            <tr>                <td style="vertical-align: top;"><code>mdx_command</code></td>                <td style="vertical-align: top;">A string representing         one or more CmdRunner commands. </td>            </tr>        </tbody>    </table></blockquote><h2>CmdRunner Commands<a name="CmdRunner_Commands">&nbsp;</a></h2><p>The command interpreter has a fixed set of built in commands.When a line is read, if the first word of the line matches oneof the commands, then the rest of the line is assumed to be argumentsto that command. On the other hand, if the first word does not matcha built in command, then all text until a ';' is seen or untila '=' is entered by itself on a command continuation line is seenwill be passed to the Mondrian query engine.</p><h3>help<a name="help">&nbsp;</a></h3><blockquote><code>  &gt; help &lt;cr&gt;</code><p>Prints help for all commands.</p></blockquote><h3>set<a name="set">&nbsp;</a></h3><blockquote><code>  &gt; set [ property[=value ] ] &lt;cr&gt;</code><p>With no args, prints all mondrian properties and values.</p><p>With "property" prints property's value.</p><p>With "property=value" set property to that value.</p></blockquote><h3>log<a name="log">&nbsp;</a></h3><blockquote><code>  &gt; log [ classname[=level ] ] &lt;cr&gt;</code><p>With no args, prints the current log level of all classes.</p><p>With "classname" prints the current log level of the class.</p><p>With "classname=level" set log level to new value.</p></blockquote><h3>file<a name="file">&nbsp;</a></h3><blockquote><code>  &gt; file [ filename | '=' ] &lt;cr&gt;</code><p>With no args, prints the last filename executed.</p><p>With "filename", read and execute filename.</p><p>With "=" character, re-read and re-execute previous filename.</p></blockquote><h3>list<a name="list">&nbsp;</a></h3><blockquote><code>  &gt; list [ cmd | result ] &lt;cr&gt;</code><p>With no arguments, list previous cmd and result</p><p>With "cmd" argument, list the last mdx query cmd.</p><p>With "result" argument, list the last mdx query result.</p></blockquote><h3>func<a name="func">&nbsp;</a></h3><blockquote><code>  &gt; func [ name ] &lt;cr&gt;</code><p>With no arguments, list all defined function names.</p><p>With "name" argument, display the functions:      name, description, and syntax.</p></blockquote><h3>param<a name="param">&nbsp;</a></h3><blockquote><code>  &gt; param [ name[=value ] ] &lt;cr&gt;</code><p>With no arguments, all param name/value pairs are printed.</p><p>With "name" argument, the value of the param is printed.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -