OlapException provides some additional information to help an OLAP client
-identify the location of the error. The context is the ResultCell
-or ResultPosition object where the error occurred. The region is an
+identify the location of the error. The context is the Cell
+or Position object where the error occurred. The region is an
object representing the textual region in the MDX statement.
that any statements or prepared statements created from that connection also
work with the connection pool.
The problem does not just affect connections: some connection pools also wrap
-Statement, PreparedStatement, ResultSet
+Statement, PreparedStatement, CellSet
and
DatabaseMetaData objects, so there are convert()
@@ -585,13 +593,13 @@
It extends ResultSet, but since most of these methods are concerned with rows
-and columns, few of ResultSet's methods are applicable. The following methods
+and columns, only a few of the base class's methods are applicable. The following methods
are applicable:
An OlapStatement can have no more than one CellSet open. Closing an
+OlapStatement, or preparing or executing a new query, implicitly closes any
+previous CellSet.
is to support an object model (hence easy programming model) without increasing
memory. No specific change to the specification, but decided to add memory
efficiency as a design goal.]
-
[Is an OlapResultSet still accessible when its OlapStatement is closed?]
D.2. Design notes
JDK. We are targeting JDK 1.5, and running retroweaver for
@@ -3317,11 +3343,11 @@
Accessing cells
It would be possible to access cells in a result set (a) by ordinal; (b) by
coordinates; (c) by the 'etchasketch' model determined by the position of the
iterator along each axis, as used by JOLAP. We decided to support (a) and (b)
-but not (c). There are methods on ResultSet to convert from ordinal to
+but not (c). There are methods on CellSet to convert from ordinal to
coordinates and vice versa.
If there is a huge number of cells, the client has limited memory, and
bandwidth to the server is limited, random access to cells is costly. Michael
-suggested that we add a method List<ResultCell> getCells(int startOrdinal, int
+suggested that we add a method List<Cell> getCells(int startOrdinal, int
endOrdinal), which matches XML/A behavior, but we declined to add it to the spec
for now. John drew the analogy of a modern file system, implementing a serial
access interface (streams) on top of random-access primitives. For now, we
@@ -3332,6 +3358,12 @@
Rename OlapResultSet to CellSet, OlapResultSetMetaData to
+ CellSetMetaData, OlapResultAxis to CellSetAxis, ResultCell to Cell,
+ ResultSetPosition to Position.
+
diff --git a/src/mondrian/olap4j/AbstractNamedList.java b/src/mondrian/olap4j/AbstractNamedList.java
new file mode 100644
index 0000000..cb90afd
--- /dev/null
+++ b/src/mondrian/olap4j/AbstractNamedList.java
@@ -0,0 +1,53 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.metadata.NamedList;
+
+import java.util.AbstractList;
+
+/**
+ * Partial implementation of {@link org.olap4j.metadata.NamedList}.
+ *
+ *
Derived class must implement {@link #get(int)} and {@link #size()}, as
+ * per {@link java.util.AbstractList}.
+ *
+ * @see mondrian.olap4j.NamedListImpl
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 25, 2007
+ */
+abstract class AbstractNamedList
+ extends AbstractList
+ implements NamedList
+{
+ public T get(String name) {
+ for (T t : this) {
+ if (t.getName().equals(name)) {
+ return t;
+ }
+ }
+ return null;
+ }
+
+ public int indexOfName(String name) {
+ for (int i = 0; i < size(); ++i) {
+ T t = get(i);
+ if (t.getName().equals(name)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+}
+
+// End AbstractNamedList.java
diff --git a/src/mondrian/olap4j/EmptyResultSet.java b/src/mondrian/olap4j/EmptyResultSet.java
new file mode 100644
index 0000000..f848b6b
--- /dev/null
+++ b/src/mondrian/olap4j/EmptyResultSet.java
@@ -0,0 +1,854 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import java.sql.*;
+import java.math.BigDecimal;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+import java.util.Calendar;
+import java.net.URL;
+
+/**
+ * EmptyResultSet ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class EmptyResultSet implements ResultSet {
+ final MondrianOlap4jConnection olap4jConnection;
+
+ EmptyResultSet(MondrianOlap4jConnection olap4jConnection) {
+ this.olap4jConnection = olap4jConnection;
+ }
+
+ public boolean next() throws SQLException {
+ return false;
+ }
+
+ public void close() throws SQLException {
+ }
+
+ public boolean wasNull() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getString(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte getByte(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getShort(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getInt(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getLong(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public float getFloat(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public double getDouble(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(
+ int columnIndex, int scale) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ if (false) {
+ return new byte[0];
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getBinaryStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getString(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getBoolean(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte getByte(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getShort(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getInt(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getLong(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public float getFloat(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public double getDouble(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(
+ String columnLabel, int scale) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte[] getBytes(String columnLabel) throws SQLException {
+ if (false) {
+ return new byte[0];
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getAsciiStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getBinaryStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLWarning getWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clearWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCursorName() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSetMetaData getMetaData() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int findColumn(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getCharacterStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getCharacterStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isBeforeFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAfterLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void beforeFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void afterLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean first() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean last() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean absolute(int row) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean relative(int rows) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean previous() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setFetchDirection(int direction) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getFetchDirection() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setFetchSize(int rows) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getFetchSize() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getType() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getConcurrency() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowUpdated() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowInserted() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowDeleted() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNull(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateByte(int columnIndex, byte x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateShort(int columnIndex, short x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateInt(int columnIndex, int x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateLong(int columnIndex, long x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateFloat(int columnIndex, float x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDouble(int columnIndex, double x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBigDecimal(
+ int columnIndex, BigDecimal x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateString(int columnIndex, String x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBytes(int columnIndex, byte x[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDate(int columnIndex, Date x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTime(int columnIndex, Time x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTimestamp(
+ int columnIndex, Timestamp x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(
+ int columnIndex, Object x, int scaleOrLength) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(int columnIndex, Object x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNull(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBoolean(
+ String columnLabel, boolean x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateByte(String columnLabel, byte x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateShort(String columnLabel, short x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateInt(String columnLabel, int x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateLong(String columnLabel, long x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateFloat(String columnLabel, float x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDouble(String columnLabel, double x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBigDecimal(
+ String columnLabel, BigDecimal x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateString(String columnLabel, String x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBytes(String columnLabel, byte x[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDate(String columnLabel, Date x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTime(String columnLabel, Time x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTimestamp(
+ String columnLabel, Timestamp x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(
+ String columnLabel, Object x, int scaleOrLength) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(String columnLabel, Object x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void insertRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void deleteRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void refreshRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void cancelRowUpdates() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveToInsertRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveToCurrentRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Statement getStatement() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(
+ int columnIndex, Map> map) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Ref getRef(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Blob getBlob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Clob getClob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Array getArray(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(
+ String columnLabel, Map> map) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Ref getRef(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Blob getBlob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Clob getClob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Array getArray(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(
+ int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(
+ String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public URL getURL(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public URL getURL(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRef(int columnIndex, Ref x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRef(String columnLabel, Ref x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(int columnIndex, Blob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(int columnIndex, Clob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateArray(String columnLabel, Array x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public RowId getRowId(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public RowId getRowId(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getHoldability() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isClosed() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNString(
+ int columnIndex, String nString) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNString(
+ String columnLabel, String nString) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, NClob nClob) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NClob getNClob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NClob getNClob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateSQLXML(
+ int columnIndex, SQLXML xmlObject) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateSQLXML(
+ String columnLabel, SQLXML xmlObject) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNString(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNString(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ int columnIndex, Reader x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ int columnIndex,
+ InputStream inputStream,
+ long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ String columnLabel,
+ InputStream inputStream,
+ long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ int columnIndex, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ int columnIndex, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ int columnIndex, Reader x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ int columnIndex, InputStream inputStream) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ String columnLabel, InputStream inputStream) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ int columnIndex, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public T unwrap(Class iface) throws SQLException {
+ if (iface.isInstance(this)) {
+ return iface.cast(this);
+ }
+ throw olap4jConnection.helper.createException("cannot cast");
+ }
+
+ public boolean isWrapperFor(Class> iface) throws SQLException {
+ return iface.isInstance(this);
+ }
+}
+
+// End EmptyResultSet.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jCatalog.java b/src/mondrian/olap4j/MondrianOlap4jCatalog.java
new file mode 100644
index 0000000..2648217
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jCatalog.java
@@ -0,0 +1,55 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.metadata.Catalog;
+import org.olap4j.metadata.NamedList;
+import org.olap4j.metadata.Schema;
+import org.olap4j.metadata.Database;
+import org.olap4j.OlapException;
+
+/**
+ * MondrianOlap4jCatalog ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 23, 2007
+ */
+class MondrianOlap4jCatalog implements Catalog, Named {
+ final MondrianOlap4jDatabase olap4jDatabase;
+
+ MondrianOlap4jCatalog(
+ MondrianOlap4jDatabase olap4jDatabase) {
+ this.olap4jDatabase = olap4jDatabase;
+ }
+
+ public NamedList getSchemas() throws OlapException {
+ // A mondrian catalog contains one schema, so implicitly it contains
+ // one catalog
+ NamedList list =
+ new NamedListImpl();
+ list.add(
+ new MondrianOlap4jSchema(
+ this,
+ olap4jDatabase.metaData.connection.getSchemaReader(),
+ olap4jDatabase.metaData.connection.getSchema()));
+ return (NamedList) list;
+ }
+
+ public Database getDatabase() {
+ return olap4jDatabase;
+ }
+
+ public String getName() {
+ return "LOCALDB";
+ }
+}
+
+// End MondrianOlap4jCatalog.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jCell.java b/src/mondrian/olap4j/MondrianOlap4jCell.java
new file mode 100644
index 0000000..2fb9648
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jCell.java
@@ -0,0 +1,114 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.Cell;
+import org.olap4j.CellSet;
+import org.olap4j.OlapException;
+import org.olap4j.metadata.Property;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.sql.ResultSet;
+
+/**
+ * MondrianOlap4jCell ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class MondrianOlap4jCell implements Cell {
+ private final int[] coordinates;
+ private final MondrianOlap4jCellSet olap4jCellSet;
+ private final mondrian.olap.Cell cell;
+
+ MondrianOlap4jCell(
+ int[] coordinates,
+ MondrianOlap4jCellSet olap4jCellSet,
+ mondrian.olap.Cell cell)
+ {
+ assert coordinates != null;
+ assert olap4jCellSet != null;
+ assert cell != null;
+ this.coordinates = coordinates;
+ this.olap4jCellSet = olap4jCellSet;
+ this.cell = cell;
+ }
+
+ public CellSet getCellSet() {
+ return olap4jCellSet;
+ }
+
+ public int getOrdinal() {
+ return (Integer) cell.getPropertyValue(
+ mondrian.olap.Property.CELL_ORDINAL.name);
+ }
+
+ public List getCoordinateList() {
+ ArrayList list = new ArrayList(coordinates.length);
+ for (int i = 0; i < coordinates.length; i++) {
+ list.add(coordinates[i]);
+ }
+ return list;
+ }
+
+ public Object getPropertyValue(Property property) {
+ // We assume that mondrian properties have the same name as olap4j
+ // properties.
+ return cell.getPropertyValue(property.getName());
+ }
+
+ public boolean isEmpty() {
+ // FIXME
+ return cell.isNull();
+ }
+
+ public boolean isError() {
+ return cell.isError();
+ }
+
+ public boolean isNull() {
+ return cell.isNull();
+ }
+
+ public double getDoubleValue() throws OlapException {
+ Object o = cell.getValue();
+ if (o instanceof Number) {
+ Number number = (Number) o;
+ return number.doubleValue();
+ }
+ throw olap4jCellSet.olap4jStatement.olap4jConnection.helper
+ .createException(this, "not a number");
+ }
+
+ public String getErrorText() {
+ Object o = cell.getValue();
+ if (o instanceof Throwable) {
+ return ((Throwable) o).getMessage();
+ } else {
+ return null;
+ }
+ }
+
+ public Object getValue() {
+ return cell.getValue();
+ }
+
+ public String getFormattedValue() {
+ return cell.getFormattedValue();
+ }
+
+ public ResultSet drillThrough() {
+ throw new UnsupportedOperationException();
+ }
+}
+
+// End MondrianOlap4jCell.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jCellSet.java b/src/mondrian/olap4j/MondrianOlap4jCellSet.java
new file mode 100644
index 0000000..ff769df
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jCellSet.java
@@ -0,0 +1,1004 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.*;
+import org.olap4j.Cell;
+import org.olap4j.metadata.Property;
+import org.olap4j.metadata.Cube;
+import mondrian.olap.*;
+import mondrian.olap.Axis;
+
+import java.util.*;
+import java.sql.*;
+import java.sql.Date;
+import java.math.BigDecimal;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+
+/**
+ * MondrianOlap4jCellSet ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class MondrianOlap4jCellSet implements CellSet, CellSetMetaData {
+ final MondrianOlap4jStatement olap4jStatement;
+ private final Result result;
+ private boolean closed;
+
+ public MondrianOlap4jCellSet(
+ MondrianOlap4jStatement olap4jStatement,
+ Result result)
+ {
+ assert olap4jStatement != null;
+ assert result != null;
+ this.olap4jStatement = olap4jStatement;
+ this.result = result;
+ this.closed = false;
+ }
+
+ public CellSetMetaData getMetaData() throws OlapException {
+ return this;
+ }
+
+ public List getAxes() {
+ mondrian.olap.Axis[] axes = result.getAxes();
+ QueryAxis[] queryAxes = result.getQuery().getAxes();
+ assert axes.length == queryAxes.length;
+ ArrayList list = new ArrayList(axes.length);
+
+ for (int i = 0; i < axes.length; i++) {
+ Axis axis = axes[i];
+ QueryAxis queryAxis = queryAxes[i];
+ list.add(new MondrianOlap4jCellSetAxis(this, queryAxis, axis));
+ }
+ return list;
+ }
+
+ public CellSetAxis getFilterAxis() {
+ final Axis axis = result.getSlicerAxis();
+ final QueryAxis queryAxis = result.getQuery().getSlicerAxis();
+ return new MondrianOlap4jCellSetAxis(this, queryAxis, axis);
+ }
+
+ public Cell getCell(List coordinates) {
+ int[] coords = new int[coordinates.size()];
+ for (int i = 0; i < coords.length; i++) {
+ coords[i] = coordinates.get(i);
+ }
+ mondrian.olap.Cell cell = result.getCell(coords);
+ return new MondrianOlap4jCell(coords, this, cell);
+ }
+
+ public Cell getCell(int ordinal) {
+ throw new UnsupportedOperationException();
+ }
+
+ public List ordinalToCoordinates(int ordinal) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int coordinatesToOrdinal(List coordinates) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean next() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void close() throws SQLException {
+ this.closed = true;
+ }
+
+ public boolean wasNull() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getString(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte getByte(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getShort(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getInt(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getLong(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public float getFloat(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public double getDouble(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(
+ int columnIndex, int scale) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getBinaryStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getString(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getBoolean(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte getByte(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getShort(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getInt(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getLong(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public float getFloat(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public double getDouble(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(
+ String columnLabel, int scale) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public byte[] getBytes(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getAsciiStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getBinaryStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLWarning getWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clearWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCursorName() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int findColumn(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getCharacterStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getCharacterStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isBeforeFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAfterLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void beforeFirst() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void afterLast() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean first() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean last() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean absolute(int row) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean relative(int rows) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean previous() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setFetchDirection(int direction) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getFetchDirection() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setFetchSize(int rows) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getFetchSize() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getType() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getConcurrency() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowUpdated() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowInserted() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean rowDeleted() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNull(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateByte(int columnIndex, byte x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateShort(int columnIndex, short x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateInt(int columnIndex, int x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateLong(int columnIndex, long x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateFloat(int columnIndex, float x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDouble(int columnIndex, double x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBigDecimal(
+ int columnIndex, BigDecimal x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateString(int columnIndex, String x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBytes(int columnIndex, byte x[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDate(int columnIndex, Date x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTime(int columnIndex, Time x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTimestamp(
+ int columnIndex, Timestamp x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(
+ int columnIndex, Object x, int scaleOrLength) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(int columnIndex, Object x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNull(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBoolean(
+ String columnLabel, boolean x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateByte(String columnLabel, byte x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateShort(String columnLabel, short x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateInt(String columnLabel, int x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateLong(String columnLabel, long x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateFloat(String columnLabel, float x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDouble(String columnLabel, double x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBigDecimal(
+ String columnLabel, BigDecimal x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateString(String columnLabel, String x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBytes(String columnLabel, byte x[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateDate(String columnLabel, Date x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTime(String columnLabel, Time x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateTimestamp(
+ String columnLabel, Timestamp x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader, int length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(
+ String columnLabel, Object x, int scaleOrLength) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateObject(String columnLabel, Object x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void insertRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void deleteRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void refreshRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void cancelRowUpdates() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveToInsertRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveToCurrentRow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Statement getStatement() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(
+ int columnIndex, Map> map) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Ref getRef(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Blob getBlob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Clob getClob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Array getArray(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getObject(
+ String columnLabel, Map> map) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Ref getRef(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Blob getBlob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Clob getClob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Array getArray(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(
+ int columnIndex, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Timestamp getTimestamp(
+ String columnLabel, Calendar cal) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public URL getURL(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public URL getURL(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRef(int columnIndex, Ref x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRef(String columnLabel, Ref x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(int columnIndex, Blob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(int columnIndex, Clob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateArray(String columnLabel, Array x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public RowId getRowId(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public RowId getRowId(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getHoldability() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isClosed() throws SQLException {
+ return closed;
+ }
+
+ public void updateNString(
+ int columnIndex, String nString) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNString(
+ String columnLabel, String nString) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, NClob nClob) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NClob getNClob(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NClob getNClob(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateSQLXML(
+ int columnIndex, SQLXML xmlObject) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateSQLXML(
+ String columnLabel, SQLXML xmlObject) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNString(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNString(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ int columnIndex, Reader x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ int columnIndex,
+ InputStream inputStream,
+ long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ String columnLabel,
+ InputStream inputStream,
+ long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ int columnIndex, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ int columnIndex, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, Reader reader, long length) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ int columnIndex, Reader x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNCharacterStream(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ int columnIndex, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ int columnIndex, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ int columnIndex, Reader x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateAsciiStream(
+ String columnLabel, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBinaryStream(
+ String columnLabel, InputStream x) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateCharacterStream(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ int columnIndex, InputStream inputStream) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateBlob(
+ String columnLabel, InputStream inputStream) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateClob(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ int columnIndex, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateNClob(
+ String columnLabel, Reader reader) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ // implement Wrapper
+
+ public T unwrap(Class iface) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isWrapperFor(Class> iface) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ // implement CellSetMetaData
+
+
+ public List getCellProperties() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Cube getCube() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List getAxesMetaData() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getColumnCount() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAutoIncrement(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isCaseSensitive(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSearchable(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isCurrency(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int isNullable(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSigned(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getColumnDisplaySize(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getColumnLabel(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getColumnName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getSchemaName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getPrecision(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getScale(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getTableName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCatalogName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getColumnType(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getColumnTypeName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isReadOnly(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isWritable(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefinitelyWritable(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getColumnClassName(int column) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+}
+
+// End MondrianOlap4jCellSet.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jCellSetAxis.java b/src/mondrian/olap4j/MondrianOlap4jCellSetAxis.java
new file mode 100644
index 0000000..0ebc035
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jCellSetAxis.java
@@ -0,0 +1,126 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.*;
+import org.olap4j.Position;
+import org.olap4j.metadata.Hierarchy;
+import org.olap4j.metadata.Member;
+import org.olap4j.metadata.Property;
+
+import java.util.*;
+
+/**
+ * MondrianOlap4jCellSetAxis ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class MondrianOlap4jCellSetAxis implements CellSetAxis, CellSetAxisMetaData {
+ private final MondrianOlap4jCellSet olap4jCellSet;
+ private final mondrian.olap.QueryAxis queryAxis;
+ private final mondrian.olap.Axis axis;
+
+ MondrianOlap4jCellSetAxis(
+ MondrianOlap4jCellSet olap4jCellSet,
+ mondrian.olap.QueryAxis queryAxis,
+ mondrian.olap.Axis axis)
+ {
+ assert olap4jCellSet != null;
+ assert queryAxis != null;
+ assert axis != null;
+ this.olap4jCellSet = olap4jCellSet;
+ this.queryAxis = queryAxis;
+ this.axis = axis;
+ }
+
+ public int getOrdinal() {
+ return queryAxis.getAxisOrdinal().logicalOrdinal();
+ }
+
+ public CellSet getCellSet() {
+ return olap4jCellSet;
+ }
+
+ public CellSetAxisMetaData getAxisMetaData() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List getPositions() {
+ return new AbstractList() {
+ public Position get(final int index) {
+ final mondrian.olap.Position mondrianPosition =
+ axis.getPositions().get(index);
+ return new MondrianOlap4jPosition(mondrianPosition, index);
+ }
+
+ public int size() {
+ return axis.getPositions().size();
+ }
+ };
+ }
+
+ public int getPositionCount() {
+ throw new UnsupportedOperationException();
+ }
+
+ public ListIterator iterate() {
+ throw new UnsupportedOperationException();
+ }
+
+ // implement CellSetAxisMetaData
+
+ public org.olap4j.Axis getAxis() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List getHierarchies() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List getProperties() {
+ throw new UnsupportedOperationException();
+ }
+
+ private class MondrianOlap4jPosition implements Position {
+ private final mondrian.olap.Position mondrianPosition;
+ private final int index;
+
+ public MondrianOlap4jPosition(
+ mondrian.olap.Position mondrianPosition, int index) {
+ this.mondrianPosition = mondrianPosition;
+ this.index = index;
+ }
+
+ public List getMembers() {
+ return new AbstractList() {
+
+ public Member get(int index) {
+ final mondrian.olap.Member mondrianMember =
+ mondrianPosition.get(index);
+ return new MondrianOlap4jMember(
+ olap4jCellSet.olap4jStatement.olap4jConnection.olap4jSchema,
+ mondrianMember);
+ }
+
+ public int size() {
+ return mondrianPosition.size();
+ }
+ };
+ }
+
+ public int getOrdinal() {
+ return index;
+ }
+ }
+}
+
+// End MondrianOlap4jCellSetAxis.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jConnection.java b/src/mondrian/olap4j/MondrianOlap4jConnection.java
new file mode 100644
index 0000000..5d28430
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jConnection.java
@@ -0,0 +1,365 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import mondrian.olap.Util;
+
+import java.sql.*;
+import java.util.Properties;
+import java.util.Map;
+
+import org.olap4j.*;
+import org.olap4j.metadata.Schema;
+import org.olap4j.metadata.Database;
+import org.olap4j.metadata.Catalog;
+import org.olap4j.mdx.parser.MdxParserFactory;
+
+/**
+ * MondrianOlap4jConnection ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 23, 2007
+ */
+class MondrianOlap4jConnection implements OlapConnection {
+ /**
+ * Handler for errors.
+ */
+ final Helper helper = new Helper();
+
+ /**
+ * Underlying mondrian connection. Set on creation, cleared on close.
+ */
+ mondrian.olap.Connection connection;
+
+ /**
+ * Current schema.
+ */
+ MondrianOlap4jSchema olap4jSchema;
+
+ /**
+ * The name of the sole catalog.
+ */
+ private static final String LOCALDB_CATALOG_NAME = "LOCALDB";
+ private static final String CONNECT_STRING_PREFIX = "jdbc:mondrian:";
+
+ /**
+ * Creates an Olap4j connection to Mondrian.
+ *
+ *
This method is intentionally package-protected. The public API
+ * uses the traditional JDBC {@link java.sql.DriverManager}.
+ * See {@link mondrian.olap4j.MondrianOlap4jDriver} for more details.
+ *
+ * @param url Connect-string URL
+ * @param info Additional properties
+ */
+ MondrianOlap4jConnection(String url, Properties info) throws SQLException {
+ if (!url.startsWith(CONNECT_STRING_PREFIX)) {
+ throw new AssertionError(
+ "does not start with '" + CONNECT_STRING_PREFIX + "'");
+ }
+ String x = url.substring(CONNECT_STRING_PREFIX.length());
+ Util.PropertyList list = Util.parseConnectString(x);
+ for (Map.Entry entry : Util.toMap(info).entrySet()) {
+ list.put(entry.getKey(), entry.getValue());
+ }
+ this.connection =
+ mondrian.olap.DriverManager.getConnection(list, null);
+ final OlapDatabaseMetaData olapDatabaseMetaData = getMetaData();
+ final Database database = olapDatabaseMetaData.getDatabase();
+ final Catalog catalog = database.getCatalogs().get(getCatalog());
+ this.olap4jSchema =
+ new MondrianOlap4jSchema(
+ (MondrianOlap4jCatalog) catalog,
+ connection.getSchemaReader(),
+ connection.getSchema());
+ }
+
+ public OlapStatement createStatement() {
+ return new MondrianOlap4jStatement(this);
+ }
+
+ public PreparedStatement prepareStatement(String sql) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public CallableStatement prepareCall(String sql) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String nativeSQL(String sql) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setAutoCommit(boolean autoCommit) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getAutoCommit() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void commit() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void rollback() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void close() throws SQLException {
+ if (connection != null) {
+ mondrian.olap.Connection c = connection;
+ connection = null;
+ c.close();
+ }
+ }
+
+ public boolean isClosed() throws SQLException {
+ return connection == null;
+ }
+
+ public OlapDatabaseMetaData getMetaData() {
+ return new MondrianOlap4jDatabaseMetaData(this, connection);
+ }
+
+ public void setReadOnly(boolean readOnly) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isReadOnly() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setCatalog(String catalog) throws SQLException {
+ if (!catalog.equals(LOCALDB_CATALOG_NAME)) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public String getCatalog() throws SQLException {
+ return LOCALDB_CATALOG_NAME;
+ }
+
+ public void setTransactionIsolation(int level) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getTransactionIsolation() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLWarning getWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clearWarnings() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Statement createStatement(
+ int resultSetType, int resultSetConcurrency) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public PreparedStatement prepareStatement(
+ String sql,
+ int resultSetType,
+ int resultSetConcurrency) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public CallableStatement prepareCall(
+ String sql,
+ int resultSetType,
+ int resultSetConcurrency) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map> getTypeMap() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setTypeMap(Map> map) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setHoldability(int holdability) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getHoldability() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Savepoint setSavepoint() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Savepoint setSavepoint(String name) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void rollback(Savepoint savepoint) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Statement createStatement(
+ int resultSetType,
+ int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public PreparedStatement prepareStatement(
+ String sql,
+ int resultSetType,
+ int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public CallableStatement prepareCall(
+ String sql,
+ int resultSetType,
+ int resultSetConcurrency,
+ int resultSetHoldability) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public PreparedStatement prepareStatement(
+ String sql, int autoGeneratedKeys) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public PreparedStatement prepareStatement(
+ String sql, int columnIndexes[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public PreparedStatement prepareStatement(
+ String sql, String columnNames[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Clob createClob() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Blob createBlob() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NClob createNClob() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SQLXML createSQLXML() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isValid(int timeout) throws SQLException {
+ return !isClosed();
+ }
+
+ public void setClientInfo(
+ String name, String value) throws SQLClientInfoException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setClientInfo(Properties properties) throws SQLClientInfoException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getClientInfo(String name) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Properties getClientInfo() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Array createArrayOf(
+ String typeName, Object[] elements) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Struct createStruct(
+ String typeName, Object[] attributes) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ // implement Wrapper
+
+ public T unwrap(Class iface) throws SQLException {
+ if (iface.isInstance(this)) {
+ return iface.cast(this);
+ } else if (iface.isInstance(connection)) {
+ return iface.cast(connection);
+ }
+ throw helper.createException("does not implement '" + iface + "'");
+ }
+
+ public boolean isWrapperFor(Class> iface) throws SQLException {
+ return iface.isInstance(this) ||
+ iface.isInstance(connection);
+ }
+
+ // implement OlapConnection
+
+ public PreparedOlapStatement prepareOlapStatement(
+ String mdx)
+ throws OlapException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public MdxParserFactory getParserFactory() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Schema getSchema() throws OlapException {
+ return olap4jSchema;
+ }
+
+ // inner classes
+
+ static class Helper {
+ SQLException createException(String msg) {
+ return new SQLException(msg);
+ }
+
+ OlapException createException(Cell context, String msg) {
+ OlapException exception = new OlapException(msg);
+ exception.setContext(context);
+ return exception;
+ }
+
+ OlapException createException(Cell context, String msg, Throwable cause) {
+ OlapException exception = new OlapException(msg, cause);
+ exception.setContext(context);
+ return exception;
+ }
+
+ public OlapException toOlapException(SQLException e) {
+ if (e instanceof OlapException) {
+ return (OlapException) e;
+ } else {
+ return new OlapException(null, e);
+ }
+ }
+ }
+}
+
+// End MondrianOlap4jConnection.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jCube.java b/src/mondrian/olap4j/MondrianOlap4jCube.java
new file mode 100644
index 0000000..e0cee13
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jCube.java
@@ -0,0 +1,87 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.metadata.*;
+import org.olap4j.metadata.Cube;
+import org.olap4j.metadata.Dimension;
+import org.olap4j.metadata.NamedSet;
+import org.olap4j.metadata.Schema;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Collection;
+
+import mondrian.olap.*;
+
+/**
+ * MondrianOlap4jCube ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class MondrianOlap4jCube implements Cube, Named {
+ private final mondrian.olap.Cube cube;
+ private final MondrianOlap4jSchema olap4jSchema;
+
+ MondrianOlap4jCube(
+ mondrian.olap.Cube cube,
+ MondrianOlap4jSchema olap4jSchema)
+ {
+ this.cube = cube;
+ this.olap4jSchema = olap4jSchema;
+ }
+
+ public Schema getSchema() {
+ return olap4jSchema;
+ }
+
+ public NamedList getDimensions() {
+ List list =
+ new NamedListImpl();
+ for (mondrian.olap.Dimension dimension : cube.getDimensions()) {
+ list.add(
+ new MondrianOlap4jDimension(
+ olap4jSchema, dimension));
+ }
+ return (NamedList) list;
+ }
+
+ public List getMeasures() {
+ throw new UnsupportedOperationException();
+ }
+
+ public NamedList getSets() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection getSupportedLocales() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getUniqueName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCaption(Locale locale) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDescription(Locale locale) {
+ throw new UnsupportedOperationException();
+ }
+}
+
+// End MondrianOlap4jCube.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jDatabase.java b/src/mondrian/olap4j/MondrianOlap4jDatabase.java
new file mode 100644
index 0000000..777cdf8
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jDatabase.java
@@ -0,0 +1,50 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.metadata.Database;
+import org.olap4j.metadata.Catalog;
+import org.olap4j.metadata.NamedList;
+import org.olap4j.OlapDatabaseMetaData;
+import mondrian.olap.MondrianServer;
+
+/**
+ * MondrianOlap4jDatabase ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 23, 2007
+ */
+class MondrianOlap4jDatabase implements Database {
+ final MondrianServer mondrianServer;
+ final MondrianOlap4jDatabaseMetaData metaData;
+
+ MondrianOlap4jDatabase(
+ MondrianServer mondrianServer,
+ MondrianOlap4jDatabaseMetaData metaData)
+ {
+ this.mondrianServer = mondrianServer;
+ this.metaData = metaData;
+ }
+
+ public NamedList getCatalogs() {
+ // A mondrian instance contains only one catalog.
+ NamedListImpl list =
+ new NamedListImpl();
+ list.add(new MondrianOlap4jCatalog(this));
+ return (NamedList) list;
+ }
+
+ public OlapDatabaseMetaData getMetaData() {
+ return metaData;
+ }
+}
+
+// End MondrianOlap4jDatabase.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jDatabaseMetaData.java b/src/mondrian/olap4j/MondrianOlap4jDatabaseMetaData.java
new file mode 100644
index 0000000..3854750
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jDatabaseMetaData.java
@@ -0,0 +1,894 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import mondrian.olap.Connection;
+import mondrian.olap.MondrianServer;
+
+import org.olap4j.OlapDatabaseMetaData;
+import org.olap4j.OlapException;
+import org.olap4j.metadata.Database;
+
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+
+/**
+ * Implementation of {@link org.olap4j.OlapDatabaseMetaData} for Mondrian.
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 23, 2007
+ */
+class MondrianOlap4jDatabaseMetaData implements OlapDatabaseMetaData {
+ private final MondrianOlap4jConnection olap4jConnection;
+ final Connection connection;
+ final MondrianServer mondrianServer;
+
+ MondrianOlap4jDatabaseMetaData(
+ MondrianOlap4jConnection olap4jConnection,
+ Connection connection)
+ {
+ this.olap4jConnection = olap4jConnection;
+ this.connection = connection;
+ mondrianServer = MondrianServer.forConnection(connection);
+ }
+
+ public boolean allProceduresAreCallable() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean allTablesAreSelectable() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getURL() throws SQLException {
+ return connection.getConnectString();
+ }
+
+ public String getUserName() throws SQLException {
+ // mondrian does not support a user name property
+ return null;
+ }
+
+ public boolean isReadOnly() throws SQLException {
+ // all mondrian databases are read-only
+ return true;
+ }
+
+ public boolean nullsAreSortedHigh() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nullsAreSortedLow() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nullsAreSortedAtStart() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nullsAreSortedAtEnd() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDatabaseProductName() throws SQLException {
+ return mondrianServer.getVersion().getProductName();
+ }
+
+ public String getDatabaseProductVersion() throws SQLException {
+ return mondrianServer.getVersion().getVersionString();
+ }
+
+ public String getDriverName() throws SQLException {
+ return MondrianOlap4jDriver.NAME;
+ }
+
+ public String getDriverVersion() throws SQLException {
+ return MondrianOlap4jDriver.VERSION;
+ }
+
+ public int getDriverMajorVersion() {
+ return MondrianOlap4jDriver.MAJOR_VERSION;
+ }
+
+ public int getDriverMinorVersion() {
+ return MondrianOlap4jDriver.MINOR_VERSION;
+ }
+
+ public boolean usesLocalFiles() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean usesLocalFilePerTable() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMixedCaseIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesUpperCaseIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesLowerCaseIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesMixedCaseIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getIdentifierQuoteString() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getSQLKeywords() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNumericFunctions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getStringFunctions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getSystemFunctions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getTimeDateFunctions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getSearchStringEscape() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getExtraNameCharacters() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsAlterTableWithAddColumn() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsAlterTableWithDropColumn() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsColumnAliasing() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nullPlusNonNullIsNull() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsConvert() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsConvert(
+ int fromType, int toType) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsTableCorrelationNames() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsExpressionsInOrderBy() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOrderByUnrelated() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsGroupBy() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsGroupByUnrelated() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsGroupByBeyondSelect() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsLikeEscapeClause() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMultipleResultSets() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMultipleTransactions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsNonNullableColumns() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMinimumSQLGrammar() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCoreSQLGrammar() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsExtendedSQLGrammar() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsANSI92IntermediateSQL() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsANSI92FullSQL() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOuterJoins() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsFullOuterJoins() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsLimitedOuterJoins() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getSchemaTerm() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getProcedureTerm() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCatalogTerm() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isCatalogAtStart() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCatalogSeparator() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSchemasInDataManipulation() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSchemasInProcedureCalls() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSchemasInTableDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCatalogsInDataManipulation() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsPositionedDelete() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsPositionedUpdate() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSelectForUpdate() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsStoredProcedures() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSubqueriesInComparisons() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSubqueriesInExists() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSubqueriesInIns() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsCorrelatedSubqueries() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsUnion() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsUnionAll() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxBinaryLiteralLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxCharLiteralLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnsInGroupBy() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnsInIndex() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnsInOrderBy() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnsInSelect() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxColumnsInTable() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxConnections() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxCursorNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxIndexLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxSchemaNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxProcedureNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxCatalogNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxRowSize() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxStatementLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxStatements() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxTableNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxTablesInSelect() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getMaxUserNameLength() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getDefaultTransactionIsolation() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsTransactions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getProcedures(
+ String catalog,
+ String schemaPattern,
+ String procedureNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getProcedureColumns(
+ String catalog,
+ String schemaPattern,
+ String procedureNamePattern,
+ String columnNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getTables(
+ String catalog,
+ String schemaPattern,
+ String tableNamePattern,
+ String types[]) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getSchemas() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getCatalogs() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getTableTypes() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getColumns(
+ String catalog,
+ String schemaPattern,
+ String tableNamePattern,
+ String columnNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getColumnPrivileges(
+ String catalog,
+ String schema,
+ String table,
+ String columnNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getTablePrivileges(
+ String catalog,
+ String schemaPattern,
+ String tableNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getBestRowIdentifier(
+ String catalog,
+ String schema,
+ String table,
+ int scope,
+ boolean nullable) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getVersionColumns(
+ String catalog, String schema, String table) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getPrimaryKeys(
+ String catalog, String schema, String table) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getImportedKeys(
+ String catalog, String schema, String table) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getExportedKeys(
+ String catalog, String schema, String table) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getCrossReference(
+ String parentCatalog,
+ String parentSchema,
+ String parentTable,
+ String foreignCatalog,
+ String foreignSchema,
+ String foreignTable) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getTypeInfo() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getIndexInfo(
+ String catalog,
+ String schema,
+ String table,
+ boolean unique,
+ boolean approximate) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsResultSetType(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsResultSetConcurrency(
+ int type, int concurrency) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean ownUpdatesAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean ownDeletesAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean ownInsertsAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean othersUpdatesAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean othersDeletesAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean othersInsertsAreVisible(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean updatesAreDetected(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean deletesAreDetected(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean insertsAreDetected(int type) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsBatchUpdates() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getUDTs(
+ String catalog,
+ String schemaPattern,
+ String typeNamePattern,
+ int[] types) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public java.sql.Connection getConnection() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsSavepoints() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsNamedParameters() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsMultipleOpenResults() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsGetGeneratedKeys() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getSuperTypes(
+ String catalog,
+ String schemaPattern,
+ String typeNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getSuperTables(
+ String catalog,
+ String schemaPattern,
+ String tableNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getAttributes(
+ String catalog,
+ String schemaPattern,
+ String typeNamePattern,
+ String attributeNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsResultSetHoldability(int holdability) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getResultSetHoldability() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getDatabaseMajorVersion() throws SQLException {
+ return mondrianServer.getVersion().getMajorVersion();
+ }
+
+ public int getDatabaseMinorVersion() throws SQLException {
+ return mondrianServer.getVersion().getMajorVersion();
+ }
+
+ public int getJDBCMajorVersion() throws SQLException {
+ // mondrian olap4j supports jdbc 4.0
+ return 4;
+ }
+
+ public int getJDBCMinorVersion() throws SQLException {
+ // mondrian olap4j supports jdbc 4.0
+ return 0;
+ }
+
+ public int getSQLStateType() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean locatorsUpdateCopy() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsStatementPooling() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public RowIdLifetime getRowIdLifetime() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getSchemas(
+ String catalog, String schemaPattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getClientInfoProperties() throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getFunctions(
+ String catalog,
+ String schemaPattern,
+ String functionNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ResultSet getFunctionColumns(
+ String catalog,
+ String schemaPattern,
+ String functionNamePattern,
+ String columnNamePattern) throws SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ // straightforward implementation of unwrap and isWrapperFor, since this
+ // class already implements the interface they most likely require:
+ // DatabaseMetaData and OlapDatabaseMetaData
+
+ public T unwrap(Class iface) throws SQLException {
+ if (iface.isInstance(this)) {
+ return iface.cast(this);
+ }
+ throw olap4jConnection.helper.createException(
+ "does not implement '" + iface + "'");
+ }
+
+ public boolean isWrapperFor(Class> iface) throws SQLException {
+ return iface.isInstance(this);
+ }
+
+ // implement OlapDatabaseMetaData
+
+ public Database getDatabase() {
+ return new MondrianOlap4jDatabase(
+ mondrianServer, this);
+ }
+
+ public ResultSet getActions() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getDatasources(
+ String dataSourceName) throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getLiterals() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getDatabaseProperties(
+ String dataSourceName) throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getProperties() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public String getMdxKeywords() throws OlapException {
+ StringBuilder buf = new StringBuilder();
+ for (String keyword : mondrianServer.getKeywords()) {
+ if (buf.length() > 0) {
+ buf.append(',');
+ }
+ buf.append(keyword);
+ }
+ return buf.toString();
+ }
+
+ public ResultSet getCubes(
+ String catalog,
+ String schemaPattern,
+ String cubeNamePattern) throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getDimensions() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getFunctions() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getHierarchies() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getMeasures() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getMembers() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getLevels() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+
+ public ResultSet getSets() throws OlapException {
+ return new EmptyResultSet(olap4jConnection);
+ }
+}
+
+// End MondrianOlap4jDatabaseMetaData.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jDimension.java b/src/mondrian/olap4j/MondrianOlap4jDimension.java
new file mode 100644
index 0000000..be3cad7
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jDimension.java
@@ -0,0 +1,68 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import org.olap4j.metadata.Dimension;
+import org.olap4j.metadata.Hierarchy;
+import org.olap4j.metadata.NamedList;
+import org.olap4j.metadata.Member;
+import org.olap4j.OlapException;
+
+import java.util.Locale;
+
+/**
+ * MondrianOlap4jDimension ...
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 24, 2007
+ */
+class MondrianOlap4jDimension implements Dimension, Named {
+ private final MondrianOlap4jSchema olap4jSchema;
+ private final mondrian.olap.Dimension dimension;
+
+ MondrianOlap4jDimension(
+ MondrianOlap4jSchema olap4jSchema,
+ mondrian.olap.Dimension dimension)
+ {
+ this.olap4jSchema = olap4jSchema;
+ this.dimension = dimension;
+ }
+
+ public NamedList getHierarchies() throws OlapException {
+ throw new UnsupportedOperationException();
+ }
+
+ public NamedList getRootMembers() throws OlapException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getDimensionType() throws OlapException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getUniqueName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCaption(Locale locale) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDescription(Locale locale) {
+ throw new UnsupportedOperationException();
+ }
+}
+
+// End MondrianOlap4jDimension.java
diff --git a/src/mondrian/olap4j/MondrianOlap4jDriver.java b/src/mondrian/olap4j/MondrianOlap4jDriver.java
new file mode 100644
index 0000000..ddf741b
--- /dev/null
+++ b/src/mondrian/olap4j/MondrianOlap4jDriver.java
@@ -0,0 +1,128 @@
+/*
+// $Id: $
+// 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) 2007-2007 Julian Hyde
+// All Rights Reserved.
+// You must accept the terms of that agreement to use this software.
+*/
+package mondrian.olap4j;
+
+import mondrian.rolap.RolapConnectionProperties;
+
+import java.sql.*;
+import java.util.Properties;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * Olap4j driver for Mondrian.
+ *
+ *
Since olap4j is a superset of JDBC, you register this driver as you would
+ * any JDBC driver:
+ *
+ *
Note how we use the {@link Connection#unwrap(Class)} method to down-cast
+ * the JDBC connection object to the extension {@link org.olap4j.OlapConnection}
+ * object. This method is only available in the JDBC 4.0 (JDK 1.6 onwards).
+ *
+ *
Connection properties
+ *
+ *
The driver supports the same set of properties as a traditional mondrian
+ * connection. See {@link mondrian.rolap.RolapConnectionProperties}.
+ *
+ *
Catalogs and schemas
+ *
+ *
Mondrian has a sole catalog, called "LOCALDB". You will get an error
+ * if you attempt to use {@link java.sql.Connection#setCatalog(String)} to set
+ * it to anything else.
+ *
+ * @author jhyde
+ * @version $Id: $
+ * @since May 22, 2007
+ */
+public class MondrianOlap4jDriver implements Driver {
+ public static final String NAME = "Mondrian olap4j driver";
+ public static final String VERSION = "2.4";
+ public static final int MAJOR_VERSION = 2;
+ public static final int MINOR_VERSION = 4;
+
+ static {
+ try {
+ register();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void register() throws SQLException {
+ DriverManager.registerDriver(new MondrianOlap4jDriver());
+ }
+
+ public Connection connect(String url, Properties info) throws SQLException {
+ return new MondrianOlap4jConnection(url, info);
+ }
+
+ public boolean acceptsURL(String url) throws SQLException {
+ return url.startsWith("jdbc:mondrian:");
+ }
+
+ public DriverPropertyInfo[] getPropertyInfo(
+ String url, Properties info) throws SQLException
+ {
+ List list = new ArrayList();
+
+ // First, add the contents of info
+ for (Map.Entry