001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2007-2011 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.olap4j; 011 012import mondrian.rolap.RolapConnection; 013 014import org.olap4j.OlapException; 015 016import java.sql.*; 017import java.util.List; 018import java.util.Properties; 019 020/** 021 * Instantiates classes to implement the olap4j API against the 022 * Mondrian OLAP engine. 023 * 024 * <p>There are implementations for JDBC 3.0 (which occurs in JDK 1.5) 025 * and JDBC 4.0 (which occurs in JDK 1.6). 026 * 027 * @author jhyde 028 * @since Jun 14, 2007 029 */ 030interface Factory { 031 /** 032 * Creates a connection. 033 * 034 * @param driver Driver 035 * @param url URL of server 036 * @param info Properties defining the connection 037 * @return Connection 038 * @throws SQLException on error 039 */ 040 Connection newConnection( 041 MondrianOlap4jDriver driver, 042 String url, 043 Properties info) throws SQLException; 044 045 /** 046 * Creates an empty result set. 047 * 048 * @param olap4jConnection Connection 049 * @return Result set 050 */ 051 EmptyResultSet newEmptyResultSet( 052 MondrianOlap4jConnection olap4jConnection); 053 054 /** 055 * Creates a result set with a fixed set of rows. 056 * 057 * @param olap4jConnection Connection 058 * @param headerList Column headers 059 * @param rowList Row values 060 * @return Result set 061 */ 062 ResultSet newFixedResultSet( 063 MondrianOlap4jConnection olap4jConnection, 064 List<String> headerList, 065 List<List<Object>> rowList); 066 067 /** 068 * Creates a cell set. 069 * 070 * 071 * @param olap4jStatement Statement 072 * @return Cell set 073 */ 074 MondrianOlap4jCellSet newCellSet( 075 MondrianOlap4jStatement olap4jStatement); 076 077 /** 078 * Creates a statement. 079 * 080 * @param olap4jConnection Connection 081 * @return Statement 082 */ 083 MondrianOlap4jStatement newStatement( 084 MondrianOlap4jConnection olap4jConnection); 085 086 /** 087 * Creates a prepared statement. 088 * 089 * @param mdx MDX query text 090 * @param olap4jConnection Connection 091 * @return Prepared statement 092 * @throws org.olap4j.OlapException on database error 093 */ 094 MondrianOlap4jPreparedStatement newPreparedStatement( 095 String mdx, 096 MondrianOlap4jConnection olap4jConnection) 097 throws OlapException; 098 099 /** 100 * Creates a metadata object. 101 * 102 * @param olap4jConnection Connection 103 * @param mondrianConnection Mondrian connection 104 * @return Metadata object 105 */ 106 MondrianOlap4jDatabaseMetaData newDatabaseMetaData( 107 MondrianOlap4jConnection olap4jConnection, 108 RolapConnection mondrianConnection); 109} 110 111// End Factory.java