Tuesday, September 18, 2012

Programmatic roles in Mondrian

I often get asked how to use custom programmatic roles in Mondrian. It is actually very simple to get started. All you need is Mondrian and its dependencies, along with the following code.

It happens in three parts.

First you need to create a MondrianServer instance.
MondrianServer server =
        new DynamicContentFinder("path/to/datasources.xml"),
        new IdentityCatalogLocator());
The first argument must implement RepositoryContentFinder and provides a "piece of XML" to the Mondrian server. This tells it which datasources, catalogs and schemas to use. You can either take a look at some examples or refer directly to our DTD.

The second argument is used to translate the catalog URLs provided by the RepositoryContentFinder into actual paths on a file system or HTTP or whatever is required. This allows to decouple the contents of the XML, which can be shared by multiple Mondrian server instances, from the physical paths on actual machines. Notice that behind the scenes, Mondrian uses Apache VFS, so anything is possible here.
Entry roleToken =
        new RoleImpl() {
            // Override whatever here.
            // You could also implement Role directly.
This next part registers the Role implementation to use. You can either override our default implementation, or implement the API directly. Registering an object with a server gives you a token back. You will have to use this token when you create your olap4j connection, like so,
OlapConnection connection =
        "Catalog Name",
        "Schema Name",
        new Properties());
 And voilĂ .

Saturday, May 12, 2012

A Machine That Goes Bing!

Some of you might remember the famous sketch from Monthy Python's The Meaning of Life featuring the machine that goes Bing!

Although its sole purpose is to go Bing!, the concept of such a machine appealed to me for no particular reason. Besides, I had a few electronic parts that I needed to test so I figured that a machine that goes Bing! was just as good as any.

Tuesday, April 3, 2012

Oracle Essbase Sample.Basic on olap4j & Saiku Analytics

The olap4j project has had a regain in momentum lately, when community contributor Mark Semsel joined the project and offered to do some work on making olap4j compatible with Oracle Essbase. This is a very interesting milestone. We can scratch one more backend vendor from our to-do list.Who knows what's next.. too soon to whisper SAS?

Stay tuned!

Thursday, March 15, 2012

Unified DIFF from perforce changelist spec

Because this snippet is very useful when dealing with Perforce, I thought I'd share it real quick.

Ever wondered how to obtains a DIFF of a specific changelist spec? Try this.

($1 is the P4CLIENT name and $2 is the changeset spec)
P4CLIENT=$1 p4 opened -c $2 | sed -e 's/#.*$//' | P4CLIENT=$1 p4 -x - diff