001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2003-2005 Julian Hyde
008// Copyright (C) 2005-2011 Pentaho
009// All Rights Reserved.
010*/
011package mondrian.xmla;
012
013import mondrian.olap.MondrianServer;
014
015import org.olap4j.impl.Olap4jUtil;
016import org.olap4j.metadata.XmlaConstants;
017
018import java.util.Set;
019
020/**
021 * Defines an XML for Analysis Property.
022 *
023 * @author jhyde
024 * @since May 2, 2003
025 */
026public enum PropertyDefinition {
027    AxisFormat(
028        RowsetDefinition.Type.Enumeration,
029        Olap4jUtil.enumSetAllOf(XmlaConstants.AxisFormat.class),
030        XmlaConstants.Access.Write,
031        "",
032        XmlaConstants.Method.EXECUTE,
033        "Determines the format used within an MDDataSet result set to describe the axes of the multidimensional dataset. This property can have the values listed in the following table: TupleFormat (default), ClusterFormat, CustomFormat."),
034
035    BeginRange(
036        RowsetDefinition.Type.Integer,
037        null,
038        XmlaConstants.Access.Write,
039        "-1",
040        XmlaConstants.Method.EXECUTE,
041        "Contains a zero-based integer value corresponding to a CellOrdinal attribute value. (The CellOrdinal attribute is part of the Cell element in the CellData section of MDDataSet.)\n"
042        + "Used together with the EndRange property, the client application can use this property to restrict an OLAP dataset returned by a command to a specific range of cells. If -1 is specified, all cells up to the cell specified in the EndRange property are returned.\n"
043        + "The default value for this property is -1."),
044
045    Catalog(
046        RowsetDefinition.Type.String,
047        null,
048        XmlaConstants.Access.ReadWrite,
049        "",
050        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
051        "When establishing a session with an Analysis Services instance to send an XMLA command, this property is equivalent to the OLE DB property, DBPROP_INIT_CATALOG.\n"
052        + "When you set this property during a session to change the current database for the session, this property is equivalent to the OLE DB property, DBPROP_CURRENTCATALOG.\n"
053        + "The default value for this property is an empty string."),
054
055    Content(
056        RowsetDefinition.Type.EnumString,
057        Olap4jUtil.enumSetAllOf(XmlaConstants.Content.class),
058        XmlaConstants.Access.Write,
059        XmlaConstants.Content.DEFAULT.name(),
060        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
061        "An enumerator that specifies what type of data is returned in the result set.\n"
062        + "None: Allows the structure of the command to be verified, but not executed. Analogous to using Prepare to check syntax, and so on.\n"
063        + "Schema: Contains the XML schema (which indicates column information, and so on) that relates to the requested query.\n"
064        + "Data: Contains only the data that was requested.\n"
065        + "SchemaData: Returns both the schema information as well as the data."),
066
067    Cube(
068        RowsetDefinition.Type.String,
069        null,
070        XmlaConstants.Access.ReadWrite,
071        "",
072        XmlaConstants.Method.EXECUTE,
073        "The cube context for the Command parameter. If the command contains a cube name (such as an MDX FROM clause) the setting of this property is ignored."),
074
075    DataSourceInfo(
076        RowsetDefinition.Type.String,
077        null,
078        XmlaConstants.Access.ReadWrite,
079        "",
080        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
081        "A string containing provider specific information, required to access the data source."),
082
083    // Mondrian-specific extension to XMLA.
084    Deep(
085        RowsetDefinition.Type.Boolean,
086        null,
087        XmlaConstants.Access.ReadWrite,
088        "",
089        XmlaConstants.Method.DISCOVER,
090        "In an MDSCHEMA_CUBES request, whether to include sub-elements "
091        + "(dimensions, hierarchies, levels, measures, named sets) of each "
092        + "cube."),
093
094    // Mondrian-specific extension to XMLA.
095    EmitInvisibleMembers(
096        RowsetDefinition.Type.Boolean,
097        null,
098        XmlaConstants.Access.ReadWrite,
099        "",
100        XmlaConstants.Method.DISCOVER,
101        "Whether to include members whose VISIBLE property is false, or "
102        + "measures whose MEASURE_IS_VISIBLE property is false."),
103
104    EndRange(
105        RowsetDefinition.Type.Integer,
106        null,
107        XmlaConstants.Access.Write,
108        "-1",
109        XmlaConstants.Method.EXECUTE,
110        "An integer value corresponding to a CellOrdinal used to restrict an MDDataSet returned by a command to a specific range of cells. Used in conjunction with the BeginRange property. If unspecified, all cells are returned in the rowset. The value -1 means unspecified."),
111
112    Format(
113        RowsetDefinition.Type.EnumString,
114        Olap4jUtil.enumSetAllOf(XmlaConstants.Format.class),
115        XmlaConstants.Access.Write,
116        "Native",
117        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
118        "Enumerator that determines the format of the returned result set. Values include:\n"
119        + "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.\n"
120        + "Multidimensional: Indicates that the result set will use the MDDataSet format (Execute method only).\n"
121        + "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.)"),
122
123    LocaleIdentifier(
124        RowsetDefinition.Type.UnsignedInteger,
125        null,
126        XmlaConstants.Access.ReadWrite,
127        "None",
128        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
129        "Use this to read or set the numeric locale identifier for this request. The default is provider-specific.\n"
130        + "For the complete hexadecimal list of language identifiers, search on \"Language Identifiers\" in the MSDN Library at http://www.msdn.microsoft.com.\n"
131        + "As an extension to the XMLA standard, Mondrian also allows locale codes as specified by ISO-639 and ISO-3166 and as used by Java; for example 'en-US'.\n"),
132
133    MDXSupport(
134        RowsetDefinition.Type.EnumString,
135        Olap4jUtil.enumSetAllOf(XmlaConstants.MdxSupport.class),
136        XmlaConstants.Access.Read,
137        "Core",
138        XmlaConstants.Method.DISCOVER,
139        "Enumeration that describes the degree of MDX support. At initial release Core is the only value in the enumeration. In future releases, other values will be defined for this enumeration."),
140
141    Password(
142        RowsetDefinition.Type.String,
143        null,
144        org.olap4j.metadata.XmlaConstants.Access.Read,
145        "",
146        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
147        "This property is deprecated in XMLA 1.1. To support legacy applications, the provider accepts but ignores the Password property setting when it is used with the Discover and Execute method"),
148
149    ProviderName(
150        RowsetDefinition.Type.String,
151        null,
152        XmlaConstants.Access.Read,
153        "Mondrian XML for Analysis Provider",
154        XmlaConstants.Method.DISCOVER,
155        "The XML for Analysis Provider name."),
156
157    ProviderVersion(
158        RowsetDefinition.Type.String,
159        null,
160        XmlaConstants.Access.Read,
161        MondrianServer.forId(null).getVersion().getVersionString(),
162        XmlaConstants.Method.DISCOVER,
163        "The version of the Mondrian XMLA Provider"),
164
165    // Mondrian-specific extension to XMLA.
166    /**
167     * @see Enumeration.ResponseMimeType
168     */
169    ResponseMimeType(
170        RowsetDefinition.Type.String,
171        null,
172        XmlaConstants.Access.ReadWrite,
173        "None",
174        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
175        "Accepted mime type for RPC response; accepted are 'text/xml' "
176        + "(default), 'application/xml' (equivalent to 'text/xml'), or "
177        + "'application/json'. If not specified, value in the 'Accept' header "
178        + "of the HTTP request is used."),
179
180    StateSupport(
181        RowsetDefinition.Type.EnumString,
182        Olap4jUtil.enumSetAllOf(XmlaConstants.StateSupport.class),
183        XmlaConstants.Access.Read,
184        "None",
185        XmlaConstants.Method.DISCOVER,
186        "Property that specifies the degree of support in the provider for state. For information about state in XML for Analysis, see \"Support for Statefulness in XML for Analysis.\" Minimum enumeration values are as follows:\n"
187        + "None - No support for sessions or stateful operations.\n"
188        + "Sessions - Provider supports sessions."),
189
190    Timeout(
191        RowsetDefinition.Type.UnsignedInteger,
192        null,
193        XmlaConstants.Access.ReadWrite,
194        "Undefined",
195        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
196        "A numeric time-out specifying in seconds the amount of time to wait for a request to be successful."),
197
198    UserName(
199        RowsetDefinition.Type.String,
200        null,
201        XmlaConstants.Access.Read,
202        "",
203        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
204        "Returns the UserName the server associates with the command.\n"
205        + "This property is deprecated as writeable in XMLA 1.1. To support legacy applications, servers accept but ignore the password setting when it is used with the Execute method."),
206
207    VisualMode(
208        RowsetDefinition.Type.Enumeration,
209        Olap4jUtil.enumSetAllOf(XmlaConstants.VisualMode.class),
210        XmlaConstants.Access.Write,
211        Integer.toString(XmlaConstants.VisualMode.VISUAL.ordinal()),
212        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
213        "This property is equivalent to the OLE DB property, MDPROP_VISUALMODE.\n"
214        + "The default value for this property is zero (0), equivalent to DBPROPVAL_VISUAL_MODE_DEFAULT."),
215
216    // mondrian-specific property for advanced drill-through
217    TableFields(
218        RowsetDefinition.Type.String,
219        null,
220        XmlaConstants.Access.Read,
221        "",
222        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
223        "List of fields to return for drill-through.\n"
224        + "The default value of this property is the empty string,"
225        + "in which case, all fields are returned."),
226
227    // mondrian-specific property for advanced drill-through
228    AdvancedFlag(
229        RowsetDefinition.Type.Boolean,
230        null,
231        XmlaConstants.Access.Read,
232        "false",
233        XmlaConstants.Method.DISCOVER_AND_EXECUTE,
234        "");
235
236    final RowsetDefinition.Type type;
237    final Set<? extends Enum> enumSet;
238    final XmlaConstants.Access access;
239    final XmlaConstants.Method usage;
240    final String value;
241    final String description;
242
243    PropertyDefinition(
244        RowsetDefinition.Type type,
245        Set<? extends Enum> enumSet,
246        XmlaConstants.Access access,
247        String value,
248        XmlaConstants.Method usage,
249        String description)
250    {
251        // Line endings must be UNIX style (LF) not Windows style (LF+CR).
252        // Thus the client will receive the same XML, regardless
253        // of the server O/S.
254        assert description.indexOf('\r') == -1;
255        assert value.indexOf('\r') == -1;
256        assert (enumSet != null) == type.isEnum();
257        this.type = type;
258        this.enumSet = enumSet;
259        this.access = access;
260        this.usage = usage;
261        this.value = value;
262        this.description = description;
263    }
264
265    /**
266     * Returns the description of this PropertyDefinition.
267     *
268     * @return description
269     */
270    public String getDescription() {
271        return description;
272    }
273}
274
275// End PropertyDefinition.java