|
Home
JPivot is a JSP custom tag library that renders an OLAP table and let users
perform typical OLAP navigations like slice and dice, drill down and roll up.
It uses Mondrian as its OLAP Server.
JPivot also supports XMLA datasource access.
How to run?
Download the jpivot-[version].zip and extract the jpivot.war file.
Place the war file into tomcats webapp directory.
Make sure, Mondrian gets some memory for caching - this will improve speed
significantly. For example, set the environment variable
JAVA_OPTS=-Xms256m -Xmx512m
to have 256 megs for caching and 512 megs for temporary peaks.
Start Tomcat and point your browser to http://localhost:8080/jpivot.
You'll need JDK 1.4 and Tomcat 4.1.30, JPivot does not work with earlier versions (sorry).
There are some simple examples that run without a database, but you probably want to
run the DB examples too.
Download the MondrianFoodMart-Access.zip
and set up an ODBC datasource called MondrianFoodMart that uses MS Access
Database and points to MondrianFoodMart.mdb from the above download.
JPivot examples are configured to use this setup.
Using JDBC driver
JPivot reads the connection parameters from JSPs
containing the <jp:mondrianQuery ...> tag which contains the MDX query. This allows to
run queries against different databases. The example JSPs live in /WEB-INF/queries
and are configured for MS Access, the MySQL version is commented out. You will have
to change these to run other databases.
Using J2EE DataSource
You may use a predefined JDBC DataSource to run your MDX queries.
<jp:mondrianQuery
id="query01"
dataSource="jdbc/JPivotDS"
catalogUri="/WEB-INF/demo/FoodMart.xml">
MDX goes here
</jp:mondrianQuery>
Look at the tomcat documentation to see how to set up a datasource. Example follows:
<Context path="/jpivot" docBase="C:\dev\jpivot\build\web" debug="0"
reloadable="true" crossContext="true">
<Resource auth="Container" name="jdbc/JPivotDS"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/JPivotDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>400</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>tarzan</value>
</parameter>
<parameter>
<name>password</name>
<value>jane</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/foodmart?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
In web.xml you have to reference the data source as follows:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/JPivotDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
How to compile?
The distribution contains binary and source. The jpivot.war file contains in its /WEB-INF/lib
directory all *.jar files that are needed to build. The simplest way to set up a build environment
is to
- extract the jpivot.war file to some temp directory by renaming it to jpivot.zip
- from /WEB-INF/lib copy all *.jar files except jpivot.jar to the lib/ directory
of the jpivot distribution (which already contains mondrian-src.jar
Now you should be able to build JPivot using ant. You will have to
define the following ant properties in your build.properties (e.g. in your home directory):
catalina.home=c:/java/jakarta-tomcat-4.1.30
mysql.home=c:/java/mysql-connector-java-3.0.8-stable
xalan.home=c:/java/xalan-j_2_6_0
Then ant should work. For running the tests you will have to set up the
MondrianFoodMart database, either MS Access or MySQL (see build.xml).
How to use in another web application?
Unzip the war file. You will need the following files
- /wcf/**
- /jpivot/**
- /WEB-INF/wcf/**
- /WEB-INF/jpivot/**
- /WEB-INF/lib/**
- You will have to merge the entries from /WEB-INF/web.xml into your applications web.xml
|