KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > xmla > Enumeration


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/xmla/Enumeration.java#14 $
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) 2003-2006 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 //
10 // jhyde, May 2, 2003
11 */

12 package mondrian.xmla;
13
14 import java.util.List JavaDoc;
15 import java.util.ArrayList JavaDoc;
16
17 /**
18  * Contains inner classes which define enumerations used in XML for Analysis.
19  *
20  * @author jhyde
21  * @since May 2, 2003
22  * @version $Id: //open/mondrian/src/main/mondrian/xmla/Enumeration.java#14 $
23  */

24 class Enumeration {
25     public final String JavaDoc name;
26     public final String JavaDoc description;
27     public final RowsetDefinition.Type type;
28     private final Class JavaDoc<? extends Enum JavaDoc> clazz;
29
30     public Enumeration(
31         String JavaDoc name,
32         String JavaDoc description,
33         RowsetDefinition.Type type,
34         Class JavaDoc<? extends Enum JavaDoc> clazz)
35     {
36         this.name = name;
37         this.description = description;
38         this.type = type;
39         this.clazz = clazz;
40     }
41
42     public String JavaDoc getName() {
43         return name;
44     }
45
46     public String JavaDoc[] getNames() {
47         List JavaDoc<String JavaDoc> names = new ArrayList JavaDoc<String JavaDoc>();
48         for (Enum JavaDoc anEnum : clazz.getEnumConstants()) {
49             names.add(anEnum.name());
50         }
51         return names.toArray(new String JavaDoc[names.size()]);
52     }
53
54     public Enum JavaDoc<?> getValue(String JavaDoc valueName, boolean b) {
55         return Enum.valueOf(clazz, valueName);
56     }
57
58     public enum Methods {
59         discover,
60         execute,
61         discoverAndExecute;
62
63         public static final Enumeration enumeration = new Enumeration(
64             "Methods",
65             "Set of methods for which a property is applicable",
66             RowsetDefinition.Type.Enumeration,
67             Methods.class);
68     }
69
70     public enum Access implements EnumWithOrdinal {
71         Read(1),
72         Write(2),
73         ReadWrite(3);
74         private final int userOrdinal;
75
76         Access(int userOrdinal) {
77             this.userOrdinal = userOrdinal;
78         }
79
80         public static final Enumeration enumeration =
81             new Enumeration(
82                 "Access",
83                 "The read/write behavior of a property",
84                 RowsetDefinition.Type.Enumeration,
85                 Access.class);
86
87         public int userOrdinal() {
88             return userOrdinal;
89         }
90     }
91
92     public enum Format implements EnumWithDesc {
93         Tabular("a flat or hierarchical rowset. Similar to the XML RAW format in SQL. The Format property should be set to Tabular for OLE DB for Data Mining commands."),
94         Multidimensional("Indicates that the result set will use the MDDataSet format (Execute method only)."),
95         Native("The client does not request a specific format, so the provider may return the format appropriate to the query. (The actual result type is identified by namespace of the result.)");
96         private final String JavaDoc description;
97
98         Format(String JavaDoc description) {
99             this.description = description;
100         }
101
102         public String JavaDoc getDescription() {
103             return description;
104         }
105     }
106
107     public enum AxisFormat implements EnumWithDesc {
108         TupleFormat("The MDDataSet axis is made up of one or more CrossProduct elements."),
109         ClusterFormat("Analysis Services uses the TupleFormat format for this setting."),
110         CustomFormat("The MDDataSet axis contains one or more Tuple elements.");
111         private final String JavaDoc description;
112
113         AxisFormat(String JavaDoc description) {
114             this.description = description;
115         }
116
117         public String JavaDoc getDescription() {
118             return description;
119         }
120     }
121
122     public enum Content {
123         None,
124         Schema,
125         Data,
126         SchemaData;
127     }
128
129     enum MDXSupport {
130         Core
131     }
132
133     enum StateSupport {
134         None,
135         Sessions
136     }
137
138     enum AuthenticationMode implements EnumWithDesc {
139         Unauthenticated("no user ID or password needs to be sent."),
140         Authenticated("User ID and Password must be included in the information required for the connection."),
141         Integrated("the data source uses the underlying security to determine authorization, such as Integrated Security provided by Microsoft Internet Information Services (IIS).");
142         private final String JavaDoc description;
143
144         AuthenticationMode(String JavaDoc description) {
145             this.description = description;
146         }
147
148         public static final Enumeration enumeration = new Enumeration(
149                 "AuthenticationMode",
150                 "Specification of what type of security mode the data source uses.",
151                 RowsetDefinition.Type.EnumString,
152                 AuthenticationMode.class);
153
154         public String JavaDoc getDescription() {
155             return description;
156         }
157     }
158
159     enum ProviderType implements EnumWithDesc {
160         TDP("tabular data provider."),
161         MDP("multidimensional data provider."),
162         DMP("data mining provider. A DMP provider implements the OLE DB for Data Mining specification.");
163         private final String JavaDoc description;
164
165         private ProviderType(String JavaDoc description) {
166             this.description = description;
167         }
168
169         public static final Enumeration enumeration = new Enumeration(
170                 "ProviderType",
171                 "The types of data supported by the provider.",
172                 RowsetDefinition.Type.Array,
173                 ProviderType.class);
174
175         public String JavaDoc getDescription() {
176             return description;
177         }
178     }
179
180     enum Literal implements EnumWithDesc {
181         DBLITERAL_CATALOG_NAME(2, null, 24, ".", "0123456789", "A catalog name in a text command."),
182         DBLITERAL_CATALOG_SEPARATOR(3, ".", 0, null, null, null),
183         DBLITERAL_COLUMN_ALIAS(5, null, -1, "'\"[]", "0123456789", null),
184         DBLITERAL_COLUMN_NAME(6, null, -1, ".", "0123456789", null),
185         DBLITERAL_CORRELATION_NAME(7, null, -1, "'\"[]", "0123456789", null),
186         DBLITERAL_CUBE_NAME(21, null, -1, ".", "0123456789", null),
187         DBLITERAL_DIMENSION_NAME(22, null, -1, ".", "0123456789", null),
188         DBLITERAL_HIERARCHY_NAME(23, null, -1, ".", "0123456789", null),
189         DBLITERAL_LEVEL_NAME(24, null, -1, ".", "0123456789", null),
190         DBLITERAL_MEMBER_NAME(25, null, -1, ".", "0123456789", null),
191         DBLITERAL_PROCEDURE_NAME(14, null, -1, ".", "0123456789", null),
192         DBLITERAL_PROPERTY_NAME(26, null, -1, ".", "0123456789", null),
193         DBLITERAL_QUOTE(15, "[", -1, null, null, "The character used in a text command as the opening quote for quoting identifiers that contain special characters."),
194         DBLITERAL_QUOTE_SUFFIX(28, "]", -1, null, null, "The character used in a text command as the closing quote for quoting identifiers that contain special characters. 1.x providers that use the same character as the prefix and suffix may not return this literal value and can set the lt member of the DBLITERAL structure to DBLITERAL_INVALID if requested."),
195         DBLITERAL_TABLE_NAME(17, null, -1, ".", "0123456789", null),
196         DBLITERAL_TEXT_COMMAND(18, null, -1, null, null, "A text command, such as an SQL statement."),
197         DBLITERAL_USER_NAME(19, null, 0, null, null, null);
198         private final String JavaDoc literalValue;
199         private final int literalMaxLength;
200         private final String JavaDoc literalInvalidChars;
201         private final String JavaDoc literalInvalidStartingChars;
202         private final String JavaDoc description;
203
204         /*
205         // Enum DBLITERALENUM and DBLITERALENUM20, OLEDB.H.
206         public static final int DBLITERAL_INVALID = 0,
207         DBLITERAL_BINARY_LITERAL = 1,
208         DBLITERAL_CATALOG_NAME = 2,
209         DBLITERAL_CATALOG_SEPARATOR = 3,
210         DBLITERAL_CHAR_LITERAL = 4,
211         DBLITERAL_COLUMN_ALIAS = 5,
212         DBLITERAL_COLUMN_NAME = 6,
213         DBLITERAL_CORRELATION_NAME = 7,
214         DBLITERAL_CURSOR_NAME = 8,
215         DBLITERAL_ESCAPE_PERCENT = 9,
216         DBLITERAL_ESCAPE_UNDERSCORE = 10,
217         DBLITERAL_INDEX_NAME = 11,
218         DBLITERAL_LIKE_PERCENT = 12,
219         DBLITERAL_LIKE_UNDERSCORE = 13,
220         DBLITERAL_PROCEDURE_NAME = 14,
221         DBLITERAL_QUOTE = 15,
222         DBLITERAL_QUOTE_PREFIX = DBLITERAL_QUOTE,
223         DBLITERAL_SCHEMA_NAME = 16,
224         DBLITERAL_TABLE_NAME = 17,
225         DBLITERAL_TEXT_COMMAND = 18,
226         DBLITERAL_USER_NAME = 19,
227         DBLITERAL_VIEW_NAME = 20,
228         DBLITERAL_CUBE_NAME = 21,
229         DBLITERAL_DIMENSION_NAME = 22,
230         DBLITERAL_HIERARCHY_NAME = 23,
231         DBLITERAL_LEVEL_NAME = 24,
232         DBLITERAL_MEMBER_NAME = 25,
233         DBLITERAL_PROPERTY_NAME = 26,
234         DBLITERAL_SCHEMA_SEPARATOR = 27,
235         DBLITERAL_QUOTE_SUFFIX = 28;
236 */

237
238         Literal(int ordinal, String JavaDoc literalValue, int literalMaxLength, String JavaDoc literalInvalidChars, String JavaDoc literalInvalidStartingChars, String JavaDoc description) {
239             this.literalValue = literalValue;
240             this.literalMaxLength = literalMaxLength;
241             this.literalInvalidChars = literalInvalidChars;
242             this.literalInvalidStartingChars = literalInvalidStartingChars;
243             this.description = description;
244         }
245
246         public String JavaDoc getLiteralName() {
247             return name();
248         }
249
250         public String JavaDoc getLiteralValue() {
251             return literalValue;
252         }
253
254         public String JavaDoc getLiteralInvalidChars() {
255             return literalInvalidChars;
256         }
257
258         public String JavaDoc getLiteralInvalidStartingChars() {
259             return literalInvalidStartingChars;
260         }
261
262         public int getLiteralMaxLength() {
263             return literalMaxLength;
264         }
265
266         public String JavaDoc getDescription() {
267             return description;
268         }
269     }
270
271     enum TreeOp implements EnumWithDesc, EnumWithOrdinal, EnumWithName {
272         Children("MDTREEOP_CHILDREN", 1, "Returns only the immediate children"),
273         Siblings("MDTREEOP_SIBLINGS", 2, "Returns members on the same level"),
274         Parent("MDTREEOP_PARENT", 4, "Returns only the immediate parent"),
275         Self("MDTREEOP_SELF", 8, "Returns the immediate member in the list of returned rows"),
276         Descendants("MDTREEOP_DESCENDANTS", 16, "Returns all descendants"),
277         Ancestors("MDTREEOP_ANCESTORS", 32, "Returns all ancestors");
278         private final String JavaDoc userName;
279         private final int userOrdinal;
280         private final String JavaDoc description;
281
282         TreeOp(String JavaDoc userName, int userOrdinal, String JavaDoc description) {
283             this.userName = userName;
284             this.userOrdinal = userOrdinal;
285             this.description = description;
286         }
287
288         static final Enumeration enumeration =
289             new Enumeration(
290                 "TREE_OP",
291                 "Bitmap which controls which relatives of a member are returned",
292                 RowsetDefinition.Type.Integer,
293                 TreeOp.class);
294
295         public int userOrdinal() {
296             return userOrdinal;
297         }
298
299         public String JavaDoc userName() {
300             return userName;
301         }
302
303         public String JavaDoc getDescription() {
304             return description;
305         }
306     }
307
308     enum VisualMode {
309         Default("DBPROPVAL_VISUAL_MODE_DEFAULT", 0, "Provider-dependent. In Microsoft SQL Server 2000 Analysis Services, this is equivalent to DBPROPVAL_VISUAL_MODE_ORIGINAL."),
310         Visual("DBPROPVAL_VISUAL_MODE_VISUAL", 1, "Visual totals are enabled."),
311         Original("DBPROPVAL_VISUAL_MODE_ORIGINAL", 2, "Visual totals are not enabled.");
312
313         VisualMode(String JavaDoc name2, int ordinal2, String JavaDoc description) {}
314
315         static final Enumeration enumeration =
316             new Enumeration(
317                 "VisualMode",
318                 "This property determines the default behavior for visual totals.",
319                 RowsetDefinition.Type.Integer,
320                 VisualMode.class);
321     }
322
323     interface EnumWithDesc {
324         String JavaDoc getDescription();
325     }
326
327     interface EnumWithOrdinal {
328         int userOrdinal();
329     }
330
331     interface EnumWithName {
332         String JavaDoc userName();
333     }
334 }
335
336 // End Enumeration.java
337
Popular Tags