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-2012 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.olap4j; 011 012import mondrian.olap.OlapElement; 013 014import org.olap4j.OlapConnection; 015import org.olap4j.OlapException; 016import org.olap4j.impl.Named; 017import org.olap4j.impl.Olap4jUtil; 018import org.olap4j.metadata.*; 019 020import java.util.Collections; 021import java.util.List; 022 023/** 024 * Implementation of {@link org.olap4j.metadata.Database} 025 * for the Mondrian OLAP engine. 026 * 027 * @author LBoudreau 028 */ 029class MondrianOlap4jDatabase 030 extends MondrianOlap4jMetadataElement 031 implements Database, Named 032{ 033 private final NamedList<MondrianOlap4jCatalog> catalogs; 034 private final MondrianOlap4jConnection olap4jConnection; 035 private final String name; 036 private final String description; 037 private final String providerName; 038 private final String url; 039 private final String dataSourceInfo; 040 private final List<ProviderType> providerType; 041 private final List<AuthenticationMode> authenticationMode; 042 043 /** 044 * Creates a MondrianOlap4jDatabase. 045 * 046 * @param olap4jConnection Connection 047 * @param catalogs List of catalogs 048 * @param name Name of database 049 * @param description Description of database 050 * @param providerName Provider name 051 * @param url URL of provider 052 * @param dataSourceInfo Data source info 053 * @param providerType List of provider types supported by this database 054 * @param authenticationMode Authentication modes 055 */ 056 MondrianOlap4jDatabase( 057 MondrianOlap4jConnection olap4jConnection, 058 NamedList<MondrianOlap4jCatalog> catalogs, 059 String name, 060 String description, 061 String providerName, 062 String url, 063 String dataSourceInfo, 064 List<ProviderType> providerType, 065 List<AuthenticationMode> authenticationMode) 066 { 067 this.olap4jConnection = olap4jConnection; 068 this.name = name; 069 this.description = description; 070 this.providerName = providerName; 071 this.url = url; 072 this.dataSourceInfo = dataSourceInfo; 073 this.providerType = 074 Collections.unmodifiableList(providerType); 075 this.authenticationMode = 076 Collections.unmodifiableList(authenticationMode); 077 this.catalogs = Olap4jUtil.unmodifiableNamedList(catalogs); 078 } 079 080 public List<AuthenticationMode> getAuthenticationModes() 081 throws OlapException 082 { 083 return authenticationMode; 084 } 085 086 public NamedList<Catalog> getCatalogs() throws OlapException { 087 return Olap4jUtil.cast(catalogs); 088 } 089 090 public String getDescription() throws OlapException { 091 return this.description; 092 } 093 094 public String getName() { 095 return this.name; 096 } 097 098 public OlapConnection getOlapConnection() { 099 return this.olap4jConnection; 100 } 101 102 public String getProviderName() throws OlapException { 103 return this.providerName; 104 } 105 106 public List<ProviderType> getProviderTypes() throws OlapException { 107 return this.providerType; 108 } 109 110 public String getURL() throws OlapException { 111 return this.url; 112 } 113 114 public String getDataSourceInfo() throws OlapException { 115 return this.dataSourceInfo; 116 } 117 118 protected OlapElement getOlapElement() { 119 return null; 120 } 121} 122 123// End MondrianOlap4jDatabase.java