001 /* 002 // $Id: //open/mondrian/src/main/mondrian/olap/MondrianServer.java#6 $ 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) 2006-2007 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.olap; 011 012 import java.util.List; 013 014 /** 015 * Interface by which to control an instance of Mondrian. 016 * 017 * <p>Typically, there is only one instance of Mondrian per JVM. However, you 018 * access a MondrianServer via the {@link #forConnection} method for future 019 * expansion. 020 * 021 * @author jhyde 022 * @version $Id: //open/mondrian/src/main/mondrian/olap/MondrianServer.java#6 $ 023 * @since Jun 25, 2006 024 */ 025 public abstract class MondrianServer { 026 private static MondrianServer instance = new MondrianServerImpl(); 027 028 /** 029 * Returns the MondrianServer which hosts a given connection. 030 * @param connection Connection 031 */ 032 public static MondrianServer forConnection(Connection connection) { 033 // Mondrian server is currently a singleton, so the connection is 034 // irrelevant. 035 Util.discard(connection); 036 return instance; 037 } 038 039 /** 040 * Returns the version of this MondrianServer. 041 */ 042 public abstract MondrianVersion getVersion(); 043 044 /** 045 * Returns a list of MDX keywords. 046 * @return list of MDX keywords 047 */ 048 public abstract List<String> getKeywords(); 049 050 /** 051 * Description of the version of the server. 052 */ 053 public interface MondrianVersion { 054 /** 055 * Returns the version string, for example "2.3.0". 056 * 057 * @see java.sql.DatabaseMetaData#getDatabaseProductVersion() 058 */ 059 String getVersionString(); 060 061 /** 062 * Returns the major part of the version number. 063 * 064 * <p>For example, if the full version string is "2.3.0", the major 065 * version is 2. 066 * 067 * @return major part of the version number 068 * @see java.sql.DatabaseMetaData#getDatabaseMajorVersion() 069 */ 070 int getMajorVersion(); 071 072 /** 073 * Returns the minor part of the version number. 074 * 075 * <p>For example, if the full version string is "2.3.0", the minor 076 * version is 3. 077 * 078 * @return minor part of the version number 079 * 080 * @see java.sql.DatabaseMetaData#getDatabaseProductVersion() 081 */ 082 int getMinorVersion(); 083 084 /** 085 * Retrieves the name of this database product. 086 * 087 * @return database product name 088 * @see java.sql.DatabaseMetaData#getDatabaseProductName() 089 */ 090 String getProductName(); 091 } 092 } 093 094 // End MondrianServer.java