KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > CacheControl


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/CacheControl.java#2 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2006-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.olap;
11
12 import javax.sql.DataSource JavaDoc;
13 import java.util.List JavaDoc;
14 import java.io.PrintWriter JavaDoc;
15
16 /**
17  * API for controlling the contents of the cache.
18  *
19  * @see mondrian.olap.Connection#getCacheControl(java.io.PrintWriter)
20  *
21  * @author jhyde
22  * @version $Id: //open/mondrian/src/main/mondrian/olap/CacheControl.java#2 $
23  * @since Sep 27, 2006
24  */

25 public interface CacheControl {
26
27     /**
28      * Creates a region consisting of a single member.
29      *
30      * @param member Member
31      * @param descendants If true, include descendants of the member in the
32      * region
33      */

34     CellRegion createMemberRegion(Member member, boolean descendants);
35
36     /**
37      * Creates a region consisting of a range between two members.
38      *
39      * <p>The members must belong to the same level of the same hierarchy.
40      * One of the bounds may be null.
41      *
42      * <p>For example, given
43      *
44      * <code><pre>Member member97Q3; // [Time].[1997].[Q3]
45      * Member member98Q2; // [Time].[1998].[Q2]
46      * </pre></code>
47      *
48      * then
49      *
50      * <table border="1">
51      * <tr>
52      * <th>Expression</th>
53      * <th>Meaning</th>
54      * </tr>
55      *
56      * <tr>
57      * <td>
58      * <code>createMemberRegion(true, member97Q3, true, member98Q2, false)</code>
59      * </td>
60      * <td>The members between 97Q3 and 98Q2, inclusive:<br/>
61      * [Time].[1997].[Q3],<br/>
62      * [Time].[1997].[Q4],<br/>
63      * [Time].[1998].[Q1],<br/>
64      * [Time].[1998].[Q2]</td>
65      * </tr>
66      *
67      * <tr>
68      * <td>
69      * <code>createMemberRegion(true, member97Q3, false, member98Q2, false)</code>
70      * </td>
71      * <td>The members between 97Q3 and 98Q2, exclusive:<br/>
72      * [Time].[1997].[Q4],<br/>
73      * [Time].[1998].[Q1]</td>
74      * </tr>
75      *
76      * <tr>
77      * <td>
78      * <code>createMemberRegion(true, member97Q3, false, member98Q2, false)</code>
79      * </td>
80      * <td>The members between 97Q3 and 98Q2, including their descendants, and
81      * including the lower bound but not the upper bound:<br/>
82      * [Time].[1997].[Q3],<br/>
83      * [Time].[1997].[Q3].[7],<br/>
84      * [Time].[1997].[Q3].[8],<br/>
85      * [Time].[1997].[Q3].[9],<br/>
86      * [Time].[1997].[Q4],<br/>
87      * [Time].[1997].[Q4].[10],<br/>
88      * [Time].[1997].[Q4].[11],<br/>
89      * [Time].[1997].[Q4].[12],<br/>
90      * [Time].[1998].[Q1],<br/>
91      * [Time].[1998].[Q1].[1],<br/>
92      * [Time].[1998].[Q1].[2],<br/>
93      * [Time].[1998].[Q1].[3]</td>
94      * </tr>
95      * </table>
96      *
97      * @param lowerInclusive Whether the the range includes the lower bound;
98      * ignored if the lower bound is not specified
99      * @param lowerMember Lower bound member.
100      * If null, takes all preceding members
101      * @param upperInclusive Whether the the range includes the upper bound;
102      * ignored if the upper bound is not specified
103      * @param upperMember upper bound member.
104      * If null, takes all preceding members
105      * @param descendants If true, include descendants of the member in the
106      * region
107      */

108     CellRegion createMemberRegion(
109         boolean lowerInclusive,
110         Member lowerMember,
111         boolean upperInclusive,
112         Member upperMember,
113         boolean descendants);
114
115     /**
116      * Creates a region consisting of the cartesian product of two or more
117      * regions.
118      */

119     CellRegion createCrossjoinRegion(CellRegion... regions);
120
121     /**
122      * Creates a region consisting of the union of two or more regions.
123      *
124      * <p>The regions must have the same dimensionality.
125      *
126      * @param regions Cell regions
127      */

128     CellRegion createUnionRegion(CellRegion... regions);
129
130     /**
131      * Creates a region consisting of all measures in a given cube.
132      */

133     CellRegion createMeasuresRegion(Cube cube);
134
135     /**
136      * Atomically all cells in the cache which correspond to measures in
137      * a cube and in a given region.
138      *
139      * @param region Region
140      */

141     void flush(CellRegion region);
142
143     /**
144      * Prints the state of the cache as it pertains to a given region.
145      */

146     void printCacheState(PrintWriter JavaDoc pw, CellRegion region);
147
148     /**
149      * Prints a debug message.
150      */

151     void trace(String JavaDoc message);
152
153     /**
154      * Flushes the cache which maps schema URLs to metadata.
155      *
156      * <p>This cache is referenced only when creating a new connection, so
157      * existing connections will continue to use the same schema definition.
158      */

159     void flushSchemaCache();
160
161     // todo: document
162
void flushSchema(
163         final String JavaDoc catalogUrl,
164         final String JavaDoc connectionKey,
165         final String JavaDoc jdbcUser,
166         String JavaDoc dataSourceStr);
167
168     // todo: document
169
void flushSchema(
170         String JavaDoc catalogUrl,
171         DataSource JavaDoc dataSource);
172
173     /**
174      * Region of cells.
175      */

176     public interface CellRegion {
177         /**
178          * Returns the dimensionality of a region.
179          * @return A list of {@link mondrian.olap.Dimension} objects.
180          */

181         List JavaDoc<Dimension> getDimensionality();
182     }
183 }
184
185 // End CacheControl.java
186
Popular Tags