developer.html
来自「基于mondrian 开源框架进行OLAP多维分析」· HTML 代码 · 共 489 行 · 第 1/2 页
HTML
489 行
<html><!-- == $Id: //open/mondrian-release/3.0/doc/developer.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 == 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's guide</title></head><body><!-- doc2web start --><!-- page title --><div class="contentheading">Developer's Guide</div><!-- end page title --><hr noshade size="1"><p>There are several ways to get Mondrian running. The easiest is to download a binary release, as described in the <a href="install.html">installation guide</a>. But you can also build Mondrian from its source code. This document describes how to do that, how to learn about Mondrian's inner workings, and the guidelines you'll need to follow if you want to contribute to the Mondrian project.</p><h2>Getting the source code<a name="Getting_the_source_code"> </a></h2><p>First, you need to get a copy of the source code. You can get the source code from SourceForge or from the project's Perforce source server.</p><h3>Download the latest release<a name="3_3_Download_the_latest_source_release"> </a></h3><p>Download the latest <code>mondrian-<i>version</i>.zip</code> from <a href="http://sourceforge.net/projects/mondrian">SourceForge</a>, and unzip. Now find the <code>mondrian-<i>version</i>-src.zip</code> inside this distribution, and unzip it. The directory you unzip this source code to — typically something like <code>C:\open\mondrian</code>or <code>/usr/local/mondrian-<i>x.y.z</i></code> — will be denoted <code><i>${project.location}</i></code> later in this document.</p><h3>Connect to the Perforce source-code server<a name="3_4_Connect_to_the_Perforce_source_code_server"> </a></h3><p>If you are a mondrian developer, and need to access the latest source code and check in changes, you should connect to the Perforce source-code server. If you are not a developer, but are interested in getting the latest code, you can connect as the 'guest' user.</p><ol> <li>Download the perforce client from <a target="_parent" href="http://www.perforce.com/perforce/loadprog.html">http://www.perforce.com/perforce/loadprog.html</a></li> <li>If you have Windows, start the perforce UI (P4Win). (If you are not running windows, you will have to use the command-line interface to do the following; 'p4 help' should get you started.)</li> <li>Choose <code>Settings</code> > <code>Switch Port Client User...</code>; the following dialog appears.<blockquote> <img border="0" alt="Perforce setup" src="images/perforce_setup.png" width="425" height="258"/> </blockquote> </li> <li>Set <code>Server</code> to <code>perforce.eigenbase.org</code>; <code>Port</code> to <code>1666</code>; set <code>User</code> toyour SourceForge username (usually <code>guest</code>, unless you are a commiter to the project); set <code>Client</code> to your username plus the name of your machine (forexample, <code>guest.jhyde.stilton</code>).</li> <li>Choose <code>ClientSpec</code> > <code>New...</code> andcreate a client with the same name. Set its root to something like'C:\' or 'D:\work', and view specification of <blockquote> <pre>//open/mondrian/... //<<clientname>>/mondrian/...</pre> </blockquote> </li> <li>Sync to head revision.</li></ol><h3>Checking in code<a name="Checking_in_code"> </a></h3><p>If you are a regular contributor to the Mondrian project, we will give you privileges to commit to the source code server. As a commiter, you will be able to add, edit, and delete files in the source system, and commit changelists. Usually we ask you to prove your worth with a few tasks before welcoming you to the team; contact Julian Hyde for more information on how to join the team.</p><p>When you check in:</p><ul> <li><b>Write a unit test for your change</b>. (Or unit tests: the number of unit tests you write should be appropriate for the scale of your change.) The test should fail before you make the change, and succeed after it. We recommend a test-driven development process, where you write the test before you change the code. Unit tests are particularly important if you are fixing a bug.</li> <li><b>Run the regression suite, and make sure all tests pass</b>. We don't expect you to run the suite in all configurations (DBMSes, operating systems, JDK versions, and parameter settings) but if your change affects something configuration-specific, be smart and test more than one configuration. For example, SQL generation is DBMS-specific, and file handling is OS-specific, but MDX function implementations are typically generic.</li> <li><b>Make sure your change adheres to the <a href="#Coding_guidelines"> coding guidelines</a></b>.</li> <li><b>If the change affects mondrian's user-visible behavior, update the documentation</b>. For example, if you make a schema change, update <a href="schema.html">schema.html</a>.</li> <li><b>If your change affects a public API, discuss the change with mondrian developers first</b>. We want to preserve backwards compatibility if possible, or at least clearly document the change in the release notes.</li> <li><b>Check in your changes in a single perforce changelist</b>. The changelist must have a helpful description, prefixed by 'MONDRIAN: ' to distinguish it from changes to other projects on the same server. If your changes fixes a bug, reference the bug number in your changelist description, and reference the changelist number and expected release number in the bug comments when closing the bug.</li></ul><h2>Building the code</h2><p>Next, install a build environment. Install the <a href="#JDK">JDK</a>, <a href="#Ant">Ant</a>, <a href="#Tomcat">Tomcat</a>, <a href="#Xalan">Xalan</a>,and <a href="#JUnit">JUnit</a>, and set <code>JAVA_HOME</code>, <code>ANT_HOME</code>, <code>TOMCAT_HOME</code>, <code>XALAN_HOME</code>, <code>JUNIT_HOME</code> in your environment.</p><p>Download the latest <code>jpivot-<i>version</i>.war</code> fromthe <a target="_parent" href="http://sourceforge.net/projects/jpivot">JPivot project at SourceForge</a> andsave it as <code><i>${project.location}</i>/lib/jpivot.war</code>.</p><p>Now build the code, as follows:</p><blockquote><code>C:\mondrian> <b>ant</b><br/>Buildfile: build.xml<br/><br/>sniff:<br/><br/>prepare:<br/><br/>parser:<br/>[javacup] Opening files...<br/>[javacup] Parsing specification from C:\mondrian\src\main\mondrian\olap\Parser.cup...<br/>[javacup] Checking specification...<br/>[javacup] Warning: Terminal "UNKNOWN" was declared but never used<br/>[javacup] Warning: Non terminal "unsigned_integer" was declared but never used<br/>[javacup] Building parse tables...<br/>[javacup] Computing non-terminal nullability...<br/>[javacup] Computing first sets...<br/>[javacup] Building state machine...<br/>[javacup] Filling in tables...<br/>[javacup] Checking for non-reduced productions...<br/>[javacup] Writing parser...<br/>[javacup] Closing files...<br/>[javacup] ------- CUP v0.10k Parser Generation Summary -------<br/>[javacup] 0 errors and 2 warnings<br/>[javacup] 47 terminals, 49 non-terminals, and 100 productions declared,<br/>[javacup] producing 153 unique parse states.<br/>[javacup] 2 terminals declared but not used.<br/>[javacup] 0 non-terminals declared but not used.<br/>[javacup] 0 productions never reduced.<br/>[javacup] 0 conflicts detected (0 expected).<br/>[javacup] Code written to "Parser.java", and "ParserSym.java".<br/>[javacup] ---------------------------------------------------- (v0.10k)<br/><br/>generate.resources:<br/>[javac] Compiling 2 source files to D:\open\mondrian\classes<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource.java<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource.properties<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource_en_US.java<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource_en_US.properties<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource_de_DE.java<br/>[resgen] Generating D:\open\mondrian\src\main\mondrian\olap\MondrianResource_de_DE.properties<br/><br/>def:<br/>[xomgen] Writing src\main\mondrian\olap\mondrian.dtd<br/>[xomgen] Writing src\main\mondrian\olap\MondrianDef.java<br/>[xomgen] Done<br/>[copy] Copying 1 file to D:\open\mondrian\lib<br/><br/>compile.java:<br/>[javac] Compiling 791 source files to D:\open\mondrian\classes<br/>[javac] Note: Some input files use or override a deprecated API.<br/>[javac] Note: Recompile with -deprecation for details.<br/><br/>compile.jsp.maybe:<br/><br/>copy.properties:<br/>[copy] Copying 4 files to D:\open\mondrian\classes<br/><br/>compile:<br/><br/>BUILD SUCCESSFUL<br/>Total time: 46 seconds</code></blockquote><h2>Installing the database</h2><p>Before you run the regression test suite or the web application, you must install the standard FoodMart dataset. This is described in the<a href="install.html#2_Set_up_test_data">installation guide</a>.</p><p> If you got your files from the Perforce server, you can skip the step where you download the data sets: you should already have the files <code>demo/access/MondrianFoodMart.mdb</code>and <code>demo/FoodMartCreateData.zip</code>.</p><h2>Running the test suite<a name="6_Run_the_test_suite"> </a></h2><p>At the command line:</p><blockquote><code>cd <i>${project.location}</i><br/>ant test</code></blockquote><p>Running the test via the Mondrian Ant build in Eclipse works, too.</p><p>Example output:</p><blockquote><code>Buildfile: build.xml<br>Overriding previous definition of reference to jdk<br/><br>prepare:<br>[mkdir] Created dir: C:\open\mondrian\build<br><br>parser:<br>[javacup] Opening files...<br>[javacup] Parsing specification from C:\open\mondrian\src\main\mondrian\olap\Parser.cup...<br>[javacup] Checking specification...<br>[javacup] Warning: Terminal "UNKNOWN" was declared but never used<br>[javacup] Warning: Non terminal "unsigned_integer" was declared but never used<br>[javacup] Building parse tables...<br>[javacup] Computing non-terminal nullability...<br>[javacup] Computing first sets...<br>[javacup] Building state machine...<br>[javacup] Filling in tables...<br>[javacup] *** Reduce/Reduce conflict found in state #99<br>[javacup] between value_expression_primary ::= NULL (*)<br>[javacup] and term3 ::= term3 IS NULL (*)<br>[javacup] under symbols: {EOF, AND, AS, CELL, DIMENSION, ELSE, END, IN, IS, MATCHES, MEMBER, NOT, ON, OR, PROPERTIES, SELECT, SE<br>T, THEN, WHEN, XOR, COLON, COMMA, EQ, GE, GT, LE, LT, NE, RBRACE, RPAREN}<br>[javacup] Resolved in favor of the second production.<br><br>[javacup] *** Shift/Reduce conflict found in state #99<br>[javacup] between value_expression_primary ::= NULL (*)<br>[javacup] under symbol EOF<br>[javacup] Resolved in favor of shifting.<br>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?