Package org.olap4j

Interface OlapWrapper

  • All Known Subinterfaces:
    CellSet, CellSetMetaData, OlapConnection, OlapDatabaseMetaData, OlapStatement, PreparedOlapStatement

    public interface OlapWrapper
    Interface for olap4j classes which provide the ability to retrieve the delegate instance when the instance in question is in fact a proxy class.

    OlapWrapper duplicates the functionality of the java.sql.Wrapper interface (introduced in JDBC 4.0), making this functionality available to olap4j clients running in a JDBC 3.0 environment. For code which will run only on JDBC 4.0 and later, Wrapper can be used, and OlapWrapper can be ignored.

    In JDBC 3.0 (JDK 1.5) and earlier, the OlapWrapper interface is used to convert a JDBC class to the corresponding olap4j class. For instance, write

     import java.sql.Connection;
     import java.sql.DriverManager;
     import org.olap4j.OlapConnection;
     import org.olap4j.OlapWrapper;
    
     Connection connection = DriverManager.getConnection("jdbc: ...");
     OlapWrapper wrapper = (OlapWrapper) connection;
     OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
     
    to create a JDBC 3.0 connection and convert it to an olap4j connection.

    In JDBC 4.0 (JDK 1.6) and later, you don't need to use this class. All of the key JDBC classes implement java.sql.Wrapper interface, so you can use its isWrapper and unwrap methods without casting. For instance, write

     import java.sql.Connection;
     import java.sql.DriverManager;
     import org.olap4j.OlapConnection;
    
     Connection connection = DriverManager.getConnection("jdbc: ...");
     OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
     
    to create a JDBC 4.0 connection and convert it to an olap4j connection.
    Since:
    Jun 14, 2007
    Author:
    jhyde
    • Method Detail

      • unwrap

        <T> T unwrap​(java.lang.Class<T> iface)
              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • isWrapperFor

        boolean isWrapperFor​(java.lang.Class<?> iface)
                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException