001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap4j/FactoryJdbc3Impl.java#1 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2007-2007 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap4j;
011    
012    import mondrian.olap.Query;
013    
014    import java.sql.*;
015    import java.util.*;
016    
017    /**
018     * Implementation of {@link mondrian.olap4j.Factory} for JDBC 3.0.
019     *
020     * @author jhyde
021     * @version $Id: //open/mondrian/src/main/mondrian/olap4j/FactoryJdbc3Impl.java#1 $
022     * @since Jun 14, 2007
023     */
024    class FactoryJdbc3Impl implements Factory {
025        public Connection newConnection(
026            String url,
027            Properties info)
028            throws SQLException
029        {
030            return new MondrianOlap4jConnectionJdbc3(url, info);
031        }
032    
033        public EmptyResultSet newEmptyResultSet(
034            MondrianOlap4jConnection olap4jConnection)
035        {
036            List<String> headerList = Collections.emptyList();
037            List<List<Object>> rowList = Collections.emptyList();
038            return new EmptyResultSetJdbc3(
039                olap4jConnection, headerList, rowList);
040        }
041    
042        public ResultSet newFixedResultSet(
043            MondrianOlap4jConnection olap4jConnection,
044            List<String> headerList,
045            List<List<Object>> rowList)
046        {
047            return new EmptyResultSetJdbc3(
048                olap4jConnection, headerList, rowList);
049        }
050    
051        public MondrianOlap4jCellSet newCellSet(
052            MondrianOlap4jStatement olap4jStatement,
053            Query query)
054        {
055            return new MondrianOlap4jCellSetJdbc3(olap4jStatement, query);
056        }
057    
058        public MondrianOlap4jPreparedStatement newPreparedStatement(
059            String mdx,
060            MondrianOlap4jConnection olap4jConnection)
061        {
062            return new MondrianOlap4jPreparedStatementJdbc3(olap4jConnection, mdx);
063        }
064    
065        public MondrianOlap4jDatabaseMetaData newDatabaseMetaData(
066            MondrianOlap4jConnection olap4jConnection)
067        {
068            return new MondrianOlap4jDatabaseMetaDataJdbc3(olap4jConnection);
069        }
070    
071        // Inner classes
072    
073        private static class MondrianOlap4jPreparedStatementJdbc3
074            extends MondrianOlap4jPreparedStatement
075        {
076            public MondrianOlap4jPreparedStatementJdbc3(
077                MondrianOlap4jConnection olap4jConnection,
078                String mdx) {
079                super(olap4jConnection, mdx);
080            }
081        }
082    
083        private static class MondrianOlap4jCellSetJdbc3
084            extends MondrianOlap4jCellSet
085        {
086            public MondrianOlap4jCellSetJdbc3(
087                MondrianOlap4jStatement olap4jStatement, Query query)
088            {
089                super(olap4jStatement, query);
090            }
091        }
092    
093        private static class EmptyResultSetJdbc3 extends EmptyResultSet {
094            public EmptyResultSetJdbc3(
095                MondrianOlap4jConnection olap4jConnection,
096                List<String> headerList,
097                List<List<Object>> rowList)
098            {
099                super(olap4jConnection, headerList, rowList);
100            }
101        }
102    
103        private class MondrianOlap4jConnectionJdbc3
104            extends MondrianOlap4jConnection
105        {
106            public MondrianOlap4jConnectionJdbc3(
107                String url,
108                Properties info) throws SQLException
109            {
110                super(FactoryJdbc3Impl.this, url, info);
111            }
112        }
113    
114        private static class MondrianOlap4jDatabaseMetaDataJdbc3
115            extends MondrianOlap4jDatabaseMetaData
116        {
117            public MondrianOlap4jDatabaseMetaDataJdbc3(
118                MondrianOlap4jConnection olap4jConnection)
119            {
120                super(olap4jConnection);
121            }
122        }
123    }
124    
125    // End FactoryJdbc3Impl.java