diff --git a/src/org/olap4j/OlapConnection.java b/src/org/olap4j/OlapConnection.java index 0a8e244..0a21da3 100644 --- a/src/org/olap4j/OlapConnection.java +++ b/src/org/olap4j/OlapConnection.java @@ -3,7 +3,7 @@ // 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. -// Copyright (C) 2006-2008 Julian Hyde +// Copyright (C) 2006-2010 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -13,6 +13,7 @@ import org.olap4j.metadata.*; import java.sql.Connection; +import java.util.List; import java.util.Locale; /** @@ -114,6 +115,15 @@ public interface OlapConnection extends Connection, OlapWrapper { */ String getRoleName(); + /** + * Returns a list of the names of roles that are available for this user to + * execute queries. + * + * @return a list of role names, or null if the available roles are not + * known + */ + List getAvailableRoleNames(); + /** * Creates a Scenario. * diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java index 987fcc0..40643e4 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java @@ -2,7 +2,7 @@ // 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. -// Copyright (C) 2007-2009 Julian Hyde +// Copyright (C) 2007-2010 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -620,6 +620,12 @@ public String getRoleName() { return roleName; } + public List getAvailableRoleNames() { + // List of available roles is not known. Could potentially add an XMLA + // call to populate this list if useful to a client. + return null; + } + public Scenario createScenario() { throw new UnsupportedOperationException(); } diff --git a/testsrc/org/olap4j/ConnectionTest.java b/testsrc/org/olap4j/ConnectionTest.java index a138adb..3762d8a 100644 --- a/testsrc/org/olap4j/ConnectionTest.java +++ b/testsrc/org/olap4j/ConnectionTest.java @@ -3,7 +3,7 @@ // 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. -// Copyright (C) 2007-2009 Julian Hyde +// Copyright (C) 2007-2010 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -291,6 +291,20 @@ public void testConnectionUnwrap() throws SQLException { olapConnection.setLocale(Locale.getDefault()); } + // Get, set role, get available role names. + final String s = olapConnection.getRoleName(); // ok if s is null + olapConnection.setRoleName(null); + assertNull(olapConnection.getRoleName()); + olapConnection.setRoleName(s); + // ok if role names list is null + final List roleNames = olapConnection.getAvailableRoleNames(); + if (roleNames != null && s != null) { + assertTrue( + "role name " + s + " should be in available role names " + + roleNames, + roleNames.contains(s)); + } + // Unwrap the mondrian connection. switch (tester.getFlavor()) { case MONDRIAN: @@ -1389,7 +1403,7 @@ public void testBuildParseTree() { } /** - * Tests the {@link Cube#lookupMember(String[])} method. + * Tests the {@link Cube#lookupMember(String...)} method. */ public void testCubeLookupMember() throws Exception { Class.forName(tester.getDriverClassName()); @@ -1436,7 +1450,7 @@ public void testCubeLookupMember() throws Exception { } /** - * Tests the {@link Cube#lookupMembers(java.util.Set, String[])} method. + * Tests the {@link Cube#lookupMembers(java.util.Set, String...)} method. */ public void testCubeLookupMembers() throws Exception { Class.forName(tester.getDriverClassName());