1 13 14 package mondrian.olap; 15 import mondrian.rolap.RolapConnection; 16 import mondrian.rolap.RolapConnectionProperties; 17 import mondrian.spi.CatalogLocator; 18 import mondrian.spi.impl.CatalogLocatorImpl; 19 20 import javax.sql.DataSource ; 21 22 29 public class DriverManager { 30 31 public DriverManager() { 32 } 33 34 50 public static Connection getConnection( 51 String connectString, 52 CatalogLocator locator, 53 boolean fresh) { 54 Util.PropertyList properties = Util.parseConnectString(connectString); 55 return getConnection(properties, locator, fresh); 56 } 57 58 63 public static Connection getConnection( 64 Util.PropertyList properties, 65 boolean fresh) { 66 return getConnection(properties, CatalogLocatorImpl.INSTANCE, fresh); 67 } 68 69 83 public static Connection getConnection( 84 Util.PropertyList properties, 85 CatalogLocator locator, 86 boolean fresh) { 87 return getConnection(properties, locator, null, fresh); 88 } 89 90 106 public static Connection getConnection( 107 Util.PropertyList properties, 108 CatalogLocator locator, 109 DataSource dataSource, 110 boolean fresh) { 111 String provider = properties.get("PROVIDER", "mondrian"); 112 if (!provider.equalsIgnoreCase("mondrian")) { 113 throw Util.newError("Provider not recognized: " + provider); 114 } 115 if (locator != null) { 116 String catalog = properties.get( 117 RolapConnectionProperties.Catalog.name()); 118 properties.put( 119 RolapConnectionProperties.Catalog.name(), 120 locator.locate(catalog)); 121 } 122 return new RolapConnection(properties, dataSource); 123 } 124 } 125 126 127
| Popular Tags
|