2
2
// This software is subject to the terms of the Eclipse Public License v1.0
3
3
// Agreement, available at the following URL:
4
4
// http://www.eclipse.org/legal/epl-v10.html.
5
- // Copyright (C) 2007-2010 Julian Hyde
5
+ // Copyright (C) 2007-2011 Julian Hyde
6
6
// All Rights Reserved.
7
7
// You must accept the terms of that agreement to use this software.
8
8
*/
@@ -26,10 +26,12 @@ class XmlaOlap4jSchema implements Schema, Named {
26
26
final XmlaOlap4jCatalog olap4jCatalog ;
27
27
private final String name ;
28
28
final NamedList <XmlaOlap4jCube > cubes ;
29
+ private final NamedList <XmlaOlap4jDimension > sharedDimensions ;
29
30
30
31
XmlaOlap4jSchema (
31
32
XmlaOlap4jCatalog olap4jCatalog ,
32
33
String name )
34
+ throws OlapException
33
35
{
34
36
if (olap4jCatalog == null ) {
35
37
throw new NullPointerException ("Catalog cannot be null." );
@@ -40,16 +42,36 @@ class XmlaOlap4jSchema implements Schema, Named {
40
42
41
43
this .olap4jCatalog = olap4jCatalog ;
42
44
this .name = name ;
43
- this .cubes = new DeferredNamedListImpl <XmlaOlap4jCube >(
44
- XmlaOlap4jConnection .MetadataRequest .MDSCHEMA_CUBES ,
45
+
46
+ // Dummy cube to own shared dimensions.
47
+ final XmlaOlap4jCube sharedCube =
48
+ new XmlaOlap4jCube (this , "" , "" , "" );
49
+
50
+ final XmlaOlap4jConnection .Context context =
45
51
new XmlaOlap4jConnection .Context (
46
52
olap4jCatalog .olap4jDatabaseMetaData .olap4jConnection ,
47
53
olap4jCatalog .olap4jDatabaseMetaData ,
48
54
olap4jCatalog ,
49
55
this ,
50
- null , null , null , null ),
56
+ sharedCube , null , null , null );
57
+
58
+ this .cubes = new DeferredNamedListImpl <XmlaOlap4jCube >(
59
+ XmlaOlap4jConnection .MetadataRequest .MDSCHEMA_CUBES ,
60
+ context ,
51
61
new XmlaOlap4jConnection .CubeHandler (),
52
62
null );
63
+
64
+ String [] restrictions = {
65
+ "CATALOG_NAME" , olap4jCatalog .getName (),
66
+ "SCHEMA_NAME" , getName (),
67
+ "CUBE_NAME" , ""
68
+ };
69
+
70
+ this .sharedDimensions = new DeferredNamedListImpl <XmlaOlap4jDimension >(
71
+ XmlaOlap4jConnection .MetadataRequest .MDSCHEMA_DIMENSIONS ,
72
+ context ,
73
+ new XmlaOlap4jConnection .DimensionHandler (null ),
74
+ restrictions );
53
75
}
54
76
55
77
public int hashCode () {
@@ -78,8 +100,7 @@ public NamedList<Cube> getCubes() throws OlapException {
78
100
}
79
101
80
102
public NamedList <Dimension > getSharedDimensions () throws OlapException {
81
- // No shared dimensions
82
- return Olap4jUtil .cast (new NamedListImpl <XmlaOlap4jDimension >());
103
+ return Olap4jUtil .cast (sharedDimensions );
83
104
}
84
105
85
106
public Collection <Locale > getSupportedLocales () throws OlapException {
0 commit comments