Skip to content

Commit

Permalink
MONDRIAN Oops, missed a file. olap4j.jar is now tagged revision 0.9.4…
Browse files Browse the repository at this point in the history
…-svn0059 and built against JDK1.5 (previously 1.6).

[git-p4: depot-paths = "//open/mondrian/": change = 10417]
  • Loading branch information
julianhyde committed Jan 10, 2008
1 parent 81b79f8 commit 9632926
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
Binary file modified lib/olap4j.jar
Binary file not shown.
87 changes: 87 additions & 0 deletions testsrc/main/mondrian/olap4j/MondrianInprocProxy.java
@@ -0,0 +1,87 @@
/*
// 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) 2008-2008 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
package mondrian.olap4j;

import org.xml.sax.SAXException;
import org.olap4j.driver.xmla.XmlaOlap4jDriver;

import javax.servlet.ServletException;
import java.util.concurrent.*;
import java.util.*;
import java.net.URL;
import java.io.IOException;

import mondrian.tui.XmlaSupport;

/**
* Proxy which implements XMLA requests by talking to mondrian
* in-process. This is more convenient to debug than an inter-process
* request using HTTP.
*
* @version $Id$
* @author jhyde
*/
public class MondrianInprocProxy
implements XmlaOlap4jDriver.Proxy
{
private final Map<String, String> catalogNameUrls;
private final String urlString;

/**
* Creates and initializes a MondrianInprocProxy.
*
* @param catalogNameUrls Collection of catalog names and the URL where
* their catalog is to be found. For testing purposes, this should contain
* a catalog called "FoodMart".
*
* @param urlString JDBC connect string; must begin with "jdbc:mondrian:"
*/
public MondrianInprocProxy(
Map<String, String> catalogNameUrls,
String urlString)
{
this.catalogNameUrls = catalogNameUrls;
if (!urlString.startsWith("jdbc:mondrian:")) {
throw new IllegalArgumentException();
}
this.urlString = urlString.substring("jdbc:mondrian:".length());
}

// Use single-threaded executor for ease of debugging.
private static final ExecutorService singleThreadExecutor =
Executors.newSingleThreadExecutor();

public byte[] get(URL url, String request) throws IOException {
try {
return XmlaSupport.processSoapXmla(
request, urlString, catalogNameUrls, null);
} catch (ServletException e) {
throw new RuntimeException(
"Error while reading '" + url + "'", e);
} catch (SAXException e) {
throw new RuntimeException(
"Error while reading '" + url + "'", e);
}
}

public Future<byte[]> submit(
final URL url,
final String request)
{
return singleThreadExecutor.submit(
new Callable<byte[] >() {
public byte[] call() throws Exception {
return get(url, request);
}
}
);
}
}

// End MondrianInprocProxy.java

0 comments on commit 9632926

Please sign in to comment.