1 12 package mondrian.xmla; 13 14 import java.util.List ; 15 import java.util.ArrayList ; 16 17 24 class Enumeration { 25 public final String name; 26 public final String description; 27 public final RowsetDefinition.Type type; 28 private final Class <? extends Enum > clazz; 29 30 public Enumeration( 31 String name, 32 String description, 33 RowsetDefinition.Type type, 34 Class <? extends Enum > clazz) 35 { 36 this.name = name; 37 this.description = description; 38 this.type = type; 39 this.clazz = clazz; 40 } 41 42 public String getName() { 43 return name; 44 } 45 46 public String [] getNames() { 47 List <String > names = new ArrayList <String >(); 48 for (Enum anEnum : clazz.getEnumConstants()) { 49 names.add(anEnum.name()); 50 } 51 return names.toArray(new String [names.size()]); 52 } 53 54 public Enum <?> getValue(String 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 description; 97 98 Format(String description) { 99 this.description = description; 100 } 101 102 public String 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 description; 112 113 AxisFormat(String description) { 114 this.description = description; 115 } 116 117 public String 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 description; 143 144 AuthenticationMode(String 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 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 description; 164 165 private ProviderType(String 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 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 literalValue; 199 private final int literalMaxLength; 200 private final String literalInvalidChars; 201 private final String literalInvalidStartingChars; 202 private final String description; 203 204 237 238 Literal(int ordinal, String literalValue, int literalMaxLength, String literalInvalidChars, String literalInvalidStartingChars, String 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 getLiteralName() { 247 return name(); 248 } 249 250 public String getLiteralValue() { 251 return literalValue; 252 } 253 254 public String getLiteralInvalidChars() { 255 return literalInvalidChars; 256 } 257 258 public String getLiteralInvalidStartingChars() { 259 return literalInvalidStartingChars; 260 } 261 262 public int getLiteralMaxLength() { 263 return literalMaxLength; 264 } 265 266 public String 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 userName; 279 private final int userOrdinal; 280 private final String description; 281 282 TreeOp(String userName, int userOrdinal, String 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 userName() { 300 return userName; 301 } 302 303 public String 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 name2, int ordinal2, String 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 getDescription(); 325 } 326 327 interface EnumWithOrdinal { 328 int userOrdinal(); 329 } 330 331 interface EnumWithName { 332 String userName(); 333 } 334 } 335 336 | Popular Tags |