diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java index 3f1f8cf..1573a13 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java @@ -167,21 +167,21 @@ abstract class XmlaOlap4jConnection implements OlapConnection { final Map map = parseConnectString(url, info); this.databaseName = - map.get(XmlaOlap4jDriver.Property.Database.name()); + map.get(XmlaOlap4jDriver.Property.DATABASE.name()); this.catalogName = - map.get(XmlaOlap4jDriver.Property.Catalog.name()); + map.get(XmlaOlap4jDriver.Property.CATALOG.name()); this.schemaName = - map.get(XmlaOlap4jDriver.Property.Schema.name()); + map.get(XmlaOlap4jDriver.Property.SCHEMA.name()); // Set URL of HTTP server. final String serverUrl = - map.get(XmlaOlap4jDriver.Property.Server.name()); + map.get(XmlaOlap4jDriver.Property.SERVER.name()); if (serverUrl == null) { throw getHelper().createException( "Connection property '" - + XmlaOlap4jDriver.Property.Server.name() + + XmlaOlap4jDriver.Property.SERVER.name() + "' must be specified"); } try { @@ -245,7 +245,7 @@ private XmlaHelper getHelper() { */ private void initSoapCache(Map map) throws OlapException { // Test if a SOAP cache class was defined - if (map.containsKey(XmlaOlap4jDriver.Property.Cache.name() + if (map.containsKey(XmlaOlap4jDriver.Property.CACHE.name() .toUpperCase())) { // Create a properties object to pass to the proxy @@ -256,11 +256,10 @@ private void initSoapCache(Map map) throws OlapException { for (Entry entry : map.entrySet()) { // Check if the current entry relates to cache config. if (entry.getKey().startsWith( - XmlaOlap4jDriver.Property.Cache.name().toUpperCase() - + ".")) + XmlaOlap4jDriver.Property.CACHE.name() + ".")) { props.put(entry.getKey().substring( - XmlaOlap4jDriver.Property.Cache.name() + XmlaOlap4jDriver.Property.CACHE.name() .length() + 1), entry.getValue()); } } diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jDriver.java b/src/org/olap4j/driver/xmla/XmlaOlap4jDriver.java index 1118422..67719a7 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jDriver.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jDriver.java @@ -1,5 +1,5 @@ /* -// $Id:$ +// $Id$ // This software is subject to the terms of the Eclipse Public License v1.0 // Agreement, available at the following URL: // http://www.eclipse.org/legal/epl-v10.html. @@ -62,7 +62,7 @@ * Schema Schema name to use. * By default, the first one returned by the * XMLA server will be used. - ** + * * Database Name of the XMLA database. * By default, the first one returned by the * XMLA server will be used. @@ -240,7 +240,7 @@ public boolean jdbcCompliant() { * @return A Proxy with which to submit XML requests */ protected XmlaOlap4jProxy createProxy(Map map) { - String cookie = map.get(Property.TestProxyCookie.name()); + String cookie = map.get(Property.TESTPROXYCOOKIE.name()); if (cookie != null) { XmlaOlap4jProxy proxy = PROXY_MAP.get(cookie); if (proxy != null) { @@ -296,14 +296,14 @@ public static synchronized String nextCookie() { * Properties supported by this driver. */ public enum Property { - TestProxyCookie( + TESTPROXYCOOKIE( "String that uniquely identifies a proxy object via which to send " + "XMLA requests for testing purposes."), - Server("URL of HTTP server"), - Catalog("Catalog name"), - Database("Name of the database"), - Schema("Name of the schema"), - Cache("Class name of the SOAP cache implementation"); + SERVER("URL of HTTP server"), + DATABASE("Name of the database"), + CATALOG("Catalog name"), + SCHEMA("Name of the schema"), + CACHE("Class name of the SOAP cache implementation"); /** * Creates a property. diff --git a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java index e8580f0..28d6111 100644 --- a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java +++ b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java @@ -195,8 +195,7 @@ public byte[] get( if (caches.containsKey(id)) { return caches.get(id).get(url, request); } else { - throw new RuntimeException( - "There are no configured caches of this name yet configured."); + throw new XmlaOlap4jInvalidStateException(); } } } @@ -217,9 +216,7 @@ public void put( if (caches.containsKey(id)) { caches.get(id).put(url, request, response); } else { - throw new RuntimeException( - "There are no configured caches of this name yet " - + "configured."); + throw new XmlaOlap4jInvalidStateException(); } } } diff --git a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java index 414df54..664a893 100644 --- a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java +++ b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java @@ -119,7 +119,7 @@ public void setCache( try { // Loads the cache class Class clazz = Class.forName(config.get( - XmlaOlap4jDriver.Property.Cache.name())); + XmlaOlap4jDriver.Property.CACHE.name())); // Instantiates it this.cache = (XmlaOlap4jCache) clazz.newInstance(); @@ -129,23 +129,23 @@ public void setCache( } catch (ClassNotFoundException e) { throw helper.createException( "The specified cache class name could not be found : " - + config.get(XmlaOlap4jDriver.Property.Cache.name()), e); + + config.get(XmlaOlap4jDriver.Property.CACHE.name()), e); } catch (InstantiationException e) { throw helper.createException( "The specified cache class name could not be instanciated : " - + config.get(XmlaOlap4jDriver.Property.Cache.name()), e); + + config.get(XmlaOlap4jDriver.Property.CACHE.name()), e); } catch (IllegalAccessException e) { throw helper.createException( "An error was encountered while instanciating the cache : " - + config.get(XmlaOlap4jDriver.Property.Cache.name()), e); + + config.get(XmlaOlap4jDriver.Property.CACHE.name()), e); } catch (IllegalArgumentException e) { throw helper.createException( "An error was encountered while instanciating the cache : " - + config.get(XmlaOlap4jDriver.Property.Cache.name()), e); + + config.get(XmlaOlap4jDriver.Property.CACHE.name()), e); } catch (SecurityException e) { throw helper.createException( "An error was encountered while instanciating the cache : " - + config.get(XmlaOlap4jDriver.Property.Cache.name()), e); + + config.get(XmlaOlap4jDriver.Property.CACHE.name()), e); } } diff --git a/testsrc/org/olap4j/ConnectionTest.java b/testsrc/org/olap4j/ConnectionTest.java index df0e7f3..7322175 100644 --- a/testsrc/org/olap4j/ConnectionTest.java +++ b/testsrc/org/olap4j/ConnectionTest.java @@ -367,7 +367,7 @@ public void testXmlaCatalogParameter() throws Exception { assertEquals(0, axesList.size()); info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); + XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMart"); connection = DriverManager.getConnection( tester.getURL().replaceFirst("\\;Catalog=FoodMart", ""), @@ -375,7 +375,7 @@ public void testXmlaCatalogParameter() throws Exception { assertEquals("FoodMart", connection.getCatalog()); info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMartError"); + XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMartError"); try { connection = DriverManager.getConnection( tester.getURL().replaceFirst("\\;Catalog=FoodMart", ""), diff --git a/testsrc/org/olap4j/XmlaConnectionTest.java b/testsrc/org/olap4j/XmlaConnectionTest.java index d8cab59..5557767 100644 --- a/testsrc/org/olap4j/XmlaConnectionTest.java +++ b/testsrc/org/olap4j/XmlaConnectionTest.java @@ -195,7 +195,7 @@ public void testNoNonTrivalCallsOnConnect() throws Exception { } Properties info = new Properties(); info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); + XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMart"); DriverManager.getConnection( "jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + cookie, diff --git a/testsrc/org/olap4j/XmlaTester.java b/testsrc/org/olap4j/XmlaTester.java index ff673dc..8b3f6c7 100644 --- a/testsrc/org/olap4j/XmlaTester.java +++ b/testsrc/org/olap4j/XmlaTester.java @@ -91,7 +91,7 @@ public Connection createConnection() throws SQLException { } Properties info = new Properties(); info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); + XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMart"); connection = DriverManager.getConnection( getURL(), @@ -107,7 +107,7 @@ public Connection createConnectionWithUserPassword() throws SQLException { } Properties info = new Properties(); info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); + XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMart"); return DriverManager.getConnection( getURL(), USER, PASSWORD); } diff --git a/testsrc/org/olap4j/driver/xmla/cache/XmlaDatabaseCache.java b/testsrc/org/olap4j/driver/xmla/cache/XmlaDatabaseCache.java index 43be0c9..27c3d01 100644 --- a/testsrc/org/olap4j/driver/xmla/cache/XmlaDatabaseCache.java +++ b/testsrc/org/olap4j/driver/xmla/cache/XmlaDatabaseCache.java @@ -9,8 +9,6 @@ import java.sql.Statement; import java.util.Map; -import org.olap4j.impl.Base64; - /** * This mock server cache is only used to save and load * runs of the XMLA driver as a database table. @@ -147,7 +145,7 @@ public void put(String id, URL url, byte[] request, byte[] response) connection.prepareStatement( Properties.QUERY_INSERT.getValueOrDefault(props)); try { - stm.setString(1,new String(request)); + stm.setString(1, new String(request)); stm.setString(2, new String(response)); stm.execute(); } finally { diff --git a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java index 6b55721..2578db9 100644 --- a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java +++ b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java @@ -38,13 +38,13 @@ public void testCacheConfig() throws Exception Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -73,13 +73,13 @@ public void testCacheModeError() throws Exception { Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -116,13 +116,13 @@ public void testCacheTimeoutError() throws Exception Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -166,13 +166,13 @@ public void testCacheSizeError() throws Exception Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -215,13 +215,13 @@ public void testCacheNameError() throws Exception Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "Class which doesn't exist"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -262,13 +262,13 @@ public void testCacheSharing() throws Exception Map cacheProperties = new HashMap(); driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(), @@ -290,13 +290,13 @@ public void testCacheSharing() throws Exception } driverParameters.put( - XmlaOlap4jDriver.Property.Server.name(), + XmlaOlap4jDriver.Property.SERVER.name(), "http://example2.com"); driverParameters.put( - XmlaOlap4jDriver.Property.Catalog.name(), + XmlaOlap4jDriver.Property.CATALOG.name(), "CatalogName2"); driverParameters.put( - XmlaOlap4jDriver.Property.Cache.name(), + XmlaOlap4jDriver.Property.CACHE.name(), "org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"); cacheProperties.put( XmlaOlap4jNamedMemoryCache.Property.NAME.name(),