From b456d3899dd539206ca978124fb9e5272098dec5 Mon Sep 17 00:00:00 2001 From: Julian Hyde Date: Tue, 24 Oct 2006 22:48:56 +0000 Subject: [PATCH] Add NamedSet and Database; clean up schema result set defns in spec; switch some uses of SQLException to OlapException git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@16 c6a108a4-781c-0410-a6c6-c2d559e19af0 --- build.xml | 2 + doc/olap4j_fs.html | 766 ++++++++++--------- lib/spring.jar | Bin 0 -> 1932690 bytes src/org/olap4j/OlapConnection.java | 17 +- src/org/olap4j/OlapDatabaseMetaData.java | 31 +- src/org/olap4j/OlapParameterMetaData.java | 5 +- src/org/olap4j/OlapResultSet.java | 5 - src/org/olap4j/OlapStatement.java | 7 +- src/org/olap4j/PreparedOlapStatement.java | 21 +- src/org/olap4j/metadata/Cube.java | 7 + src/org/olap4j/metadata/Database.java | 46 +- src/org/olap4j/metadata/Hierarchy.java | 12 +- src/org/olap4j/metadata/Level.java | 10 +- src/org/olap4j/metadata/Member.java | 7 +- src/org/olap4j/metadata/NamedSet.java | 26 + src/org/olap4j/metadata/Property.java | 3 +- src/org/olap4j/sample/SimpleQuerySample.java | 21 +- src/org/olap4j/sample/SpringSample.java | 3 - 18 files changed, 538 insertions(+), 451 deletions(-) create mode 100755 lib/spring.jar create mode 100644 src/org/olap4j/metadata/NamedSet.java diff --git a/build.xml b/build.xml index 9223094..6e9873a 100644 --- a/build.xml +++ b/build.xml @@ -47,6 +47,8 @@ + + diff --git a/doc/olap4j_fs.html b/doc/olap4j_fs.html index 41f7953..fcf12de 100644 --- a/doc/olap4j_fs.html +++ b/doc/olap4j_fs.html @@ -123,7 +123,7 @@

Contents

  • The OlapParameterMetaData interface
  • The OlapResultSet interface
  • The ResultAxis interface
  • -
  • The Position interface
  • +
  • The ResultPosition interface
  • The ResultCell interface
  • @@ -133,6 +133,7 @@

    Contents

  • Access control
  • Metadata objects
    1. The MetadataElement interface
    2. +
    3. The Database interface
    4. The Catalog interface
    5. The Schema interface
    6. The Cube interface
    7. @@ -381,7 +382,7 @@

      We now describe the olap4j API in more detail, by breaking it down into a set of functional areas.

      -olap4j components +olap4j components

      2.1. Driver management

      @@ -537,7 +538,9 @@

      2.2.2. Connection pooling

      work with the connection pool.

      The problem does not just affect connections: some connection pools also wrap Statement, PreparedStatement, ResultSet -and DatabaseMetaData objects, so there are convert() +and + +DatabaseMetaData objects, so there are convert() methods for these too.

      Hopefully this problem will only be temporary. As olap4j gains popularity, we expect connection pools to add support for the extended interfaces, and it will @@ -606,7 +609,7 @@

      2.3.4. The OlapResultSet interface

      2.3.5. The ResultAxis interface

      A ResultAxis is -a

      +a ...

      [tbd]

      [access positions by index (i.e. a list) and by scrolling (i.e. an iterator)]

      2.3.6. The ResultPosition interface

      @@ -886,13 +889,21 @@
      2.6.2.1. The MetadataElement interfacee
    8. String getCaption(Locale locale)
    9. String getDescription(Locale locale)
    10. -
      2.6.2.2. The Catalog interface
      -

      Catalog ...

      +
      2.6.2.2. The Database interface
      +

      Database +is the root element in a hierarchy of metadata elements.

      +

      Methods:

      +
        +
      • NamedList<Catalog> getCatalogs()
      • +
      +
      2.6.2.3. The Catalog interface
      +

      Catalog +...

      • String getName()
      • NamedList<Schema> getSchemas()
      -
      2.6.2.3. The Schema interface
      +
      2.6.2.4. The Schema interface

      Schema ...

      -
      2.6.2.4. The Cube interface
      +
      2.6.2.5. The Cube interface

      Cube ...

      -
      2.6.2.5. The Dimension interface
      +
      2.6.2.6. The Dimension interface

      Dimension -...

      +(extends +MetadataElement)

      • String getName()
      • List<Hierarchy> getHierarchies()
      • List<Member> getRootMembers()
      • Dimension.Type getDimensionType()
      -
      2.6.2.6. The Hierarchy interface
      -

      Hierarchy +

      2.6.2.7. The Hierarchy interface
      +

      Hierarchy  +(extends +MetadataElement) ...

      • Dimension getDimension()
      • @@ -928,16 +942,20 @@
        2.6.2.6. The Hierarchy interface
      • List<Level> getLevels()
      • boolean hasAll()
      -
      2.6.2.7. The Level interface
      -

      Level ...

      +
      2.6.2.8. The Level interface
      +

      Level  +(extends +MetadataElement) ...

      • int getDepth()
      • Hierarchy getHierarchy()
      • Level.Type getLevelType()
      • List<Property> getProperties()
      -
      2.6.2.8. The Member interface
      -

      Member ...

      +
      2.6.2.9. The Member interface
      +

      Member  +(extends +MetadataElement) ...

      • String getName()
      • List<Member> getChildMembers()
      • @@ -957,13 +975,17 @@
        2.6.2.8. The Member interface
      • boolean isHidden()
      • Member getDataMember()
      -
      2.6.2.9. The Measure interface
      -

      Measure ...

      +
      2.6.2.10. The Measure interface
      +

      Measure  +(extends +MetadataElement) ...

      • extends Member
      -
      2.6.2.10. The Property interface
      -

      Property +

      2.6.2.11. The Property interface
      +

      Property  +(extends +MetadataElement) ...

      • Datatype getType()
      • @@ -976,6 +998,14 @@
        2.6.2.10. The Property interface
        }
      • enum StandardCellProperty { BACK_COLOR, CELL_EVALUATION_LIST, ... }
      +
      2.6.2.12. The NamedSet interface
      +

      NamedSet +(extends +MetadataElement) +...

      +
        +
      • Cube getCube()
      • +

      2.6.3. The OlapDatabaseMetaData interface, and methods which return schema rowsets

      @@ -984,114 +1014,170 @@

      2.6.3. java.sql.DatabaseMetaData) contains methods which return schema result sets.

      Schema result sets are specified as in [XML for Analysis -specification]. Here is a table of the XML/A methods and the corresponding -olap4j method.

      +specification]. Here is a table of the XML/A methods and the corresponding +olap4j method and element type.

      - + + + + + + + + + + + + + + + + + + OlapDatabaseMetaData.getDatasources + + + OlapDatabaseMetaData.getMdxKeywords + + OlapDatabaseMetaData.getLiterals + + OlapDatabaseMetaData.getDatabaseProperties + + + OlapDatabaseMetaData.getActions + + OlapDatabaseMetaData.getCubes + + OlapDatabaseMetaData.getDimensions + + OlapDatabaseMetaData.getFunctions + + OlapDatabaseMetaData.getHierarchies + + + + OlapDatabaseMetaData.getLevels + + OlapDatabaseMetaData.getMeasures + + OlapDatabaseMetaData.getMembers + + OlapDatabaseMetaData.getProperties + + OlapDatabaseMetaData.getSets +
      XML for Analysis schema rowsetOlapDatabaseMetaData methodSchema result set methodMetadata element
      not supported + not supported + Database
      not supported + + DatabaseMetaData.getCatalogs + Catalog
      not supported + + DatabaseMetaData.getSchemas + Schema
      DISCOVER_DATASOURCES - getDatasources + not supported
      DISCOVER_ENUMERATORS not supportednot supported
      DISCOVER_KEYWORDS - getMdxKeywords + not supported
      DISCOVER_LITERALS - getLiterals + not supported
      DISCOVER_PROPERTIES - getDatabaseProperties + not supported
      DISCOVER_SCHEMA_ROWSETS not supportednot supported
      MDSCHEMA_ACTIONS - getActions + not supported
      MDSCHEMA_CUBES - getCubes + Cube
      MDSCHEMA_DIMENSIONS - getDimensions + Dimension
      MDSCHEMA_FUNCTIONS - getFunctions + not supported
      MDSCHEMA_HIERARCHIES - getHierarchies + Hierarchy
      MDSCHEMA_INPUT_DATASOURCES not supportednot supported
      MDSCHEMA_KPIS not supportednot supported
      MDSCHEMA_LEVELS - getLevels + Level
      MDSCHEMA_MEASURES - getMeasures + Measure
      MDSCHEMA_MEMBERS - getMembers + Member
      MDSCHEMA_PROPERTIES - getProperties + Property
      MDSCHEMA_SETS - getSets + NamedSet
      @@ -1119,32 +1205,13 @@

      2.6.3. Type - A description of the data type for the column. + A description of the data type for the column, and whether the + column may be NULL. Description A brief description of the purpose of the column. - - - Restriction - - Indicates whether the column can be used to restrict the - returned rowset by inclusion in the Restrictions - parameter of the Discover method. - Yes means that the column is available to - use as a Restrictions item to filter results - by this field. - - - - Nullable - - Indicates whether the data must be returned or if a null - string is allowed if the column does not apply. Yes - means nulls are allowed, and the data is optional. - No means that the data is required. -

      [Need to clean up data types in the following tables. Types should all be JDBC types.]

      @@ -1154,6 +1221,10 @@

      2.6.3. the ProviderType and AuthenticationMode attributes of getDatasources, and the DIMENSION_TYPE attribute of getDimensions. In some cases those enums already exist, but need to be extended.]

      +

      [Mapping from OLE DB- and XML/A-style column sets to JDBC-style. Types: +DBTYPE_WSTR to String, DBTYPE_GUID to String, DBTYPE_DBTIMESTAMP to Timestamp, +DBTYPE_BOOL to boolean; DBTYPE_I4, DBTYPE_UI4, DBTYPE_I2 and DBTYPE_UI2 all map +to int. Column names: mapped CamelCase to UPPER_CASE.]

      2.6.3.1. getDatasources

      Specified by the DISCOVER_DATASOURCES XML for Analysis method.

      @@ -1161,66 +1232,60 @@
      2.6.3.1. getDatasources
      - - + + - - - + + - - + - + - - + - + - - - + + - - - + + - - + - + - - + - + -
      Column nameTypeColumn nameType DescriptionNullable
      DataSourceNamestringDATA_SOURCE_NAMEString not null The name of the data source, such as FoodMart 2000.No
      DataSourceDescriptionDATA_SOURCE_DESCRIPTIONstringString A description of the data source, as entered by the publisher.Yes
      URLURLstringString The unique path that shows where to invoke the XML for Analysis methods for that data source.Yes
      DataSourceInfostringDATA_SOURCE_INFOString

      A string containing any additional information required to connect to the data source. This can include the Initial Catalog property or other information for the provider.

      Example: "Provider=MSOLAP;Data Source=Local;"

      Yes
      ProviderNamestringPROVIDER_NAMEString

      The name of the provider behind the data source.

      Example: "MSDASQL"

      Yes
      ProviderTypePROVIDER_TYPEarrayarray [todo] not null

      The types of data supported by the @@ -1233,13 +1298,12 @@

      2.6.3.1. getDatasources
      implements the OLE DB for Data Mining specification.
      No
      AuthenticationModeAUTHENTICATION_MODEEnumStringEnumString [todo] not null Specification of what type of @@ -1255,7 +1319,6 @@
      2.6.3.1. getDatasources
      No
      @@ -1270,46 +1333,41 @@
      2.6.3.2. getDatabaseProperties
      - - + + - - + - - + - - + - - + - @@ -1320,22 +1378,19 @@
      2.6.3.2. getDatabaseProperties
      - - + -
      Column nameTypeColumn nameType DescriptionNullable
      PROPERTY_NAMEstringString not null The name of the property. No
      PROPERTY_DESCRIPTIONstringString A localizable text description of the property.Yes
      PROPERTY_TYPEstringString The XML data type of the property.Yes
      PROPERTY_ACCESS_TYPEEnumStringEnumString [todo] not null Access for the property. The value can be Read, Write, or ReadWrite.No
      True if a property is required, false if it is not required.Yes
      VALUEstringString The current value of the property.Yes

      [Is VALUE a JDBC reserved word? If so, change it.]

      -
      2.6.3.3 getLiterals

      Retrieves a list of information on supported literals, including data types and values.

      @@ -1344,23 +1399,19 @@
      2.6.3.3 getLiterals
      - - + + - - - - + + - - - - + + - - - - + - + - - - - + - + - - - - + - + - - -
      Column nameTypeColumn nameType DescriptionRestrictionNullable
      LiteralNamestringLITERAL_NAMEString not null

      The name of the literal described in the row.

      Example: DBLITERAL_LIKE_PERCENT

      Yes, as an arrayNo
      LiteralValuestringLITERAL_VALUEString

      Contains the actual literal value.

      Example, if LiteralName is @@ -1369,50 +1420,39 @@

      2.6.3.3 getLiterals
      "%".

      NoYes
      LiteralInvalidCharsLITERAL_INVALID_CHARSstringString

      The characters, in the literal, that are not valid.

      For example, if table names can contain anything other than a numeric character, this string would be "0123456789".

      NoYes
      LiteralInvalidStartingCharsLITERAL_INVALID_
      + STARTING_CHARS
      stringString The characters that are not valid as the first character of the literal. If the literal can start with any valid character, this is null.NoYes
      LiteralMaxLengthLITERAL_MAX_LENGTHintegerint The maximum number of characters in the literal. If there is no maximum or the maximum is unknown, the value is –1.NoYes
      @@ -1424,29 +1464,29 @@
      2.6.3.4. getCubes
      - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
      Column nameType indicatorColumn nameType Description
      CATALOG_NAMEDBTYPE_WSTRString The name of the database.
      SCHEMA_NAMEDBTYPE_WSTRString Not supported.
      CUBE_NAMEDBTYPE_WSTRString The name of the cube or dimension. Dimension names are prefaced by a dollar sign ($) symbol.
      CUBE_TYPEDBTYPE_WSTRString The type of the cube. Valid values are:
      • CUBE
      • DIMENSION
      • @@ -1455,76 +1495,76 @@
        2.6.3.4. getCubes
      CUBE_GUIDDBTYPE_GUIDString Not supported.
      CREATED_ONDBTYPE_DBTIMESTAMPTimestamp Not supported.
      LAST_SCHEMA_UPDATEDBTYPE_DBTIMESTAMPTimestamp The time that the cube was last processed.
      SCHEMA_UPDATED_BYDBTYPE_WSTRString Not supported.
      LAST_DATA_UPDATEDBTYPE_DBTIMESTAMPTimestamp The time that the cube was last processed.
      DATA_UPDATED_BYDBTYPE_WSTRString Not supported.
      DESCRIPTIONDBTYPE_WSTRString A user-friendly description of the cube.
      IS_DRILLTHROUGH_ENABLEDDBTYPE_BOOLboolean A Boolean that always returns true.
      IS_LINKABLEDBTYPE_BOOLboolean A Boolean that indicates whether a cube can be used in a linked cube.
      IS_WRITE_ENABLEDDBTYPE_BOOLboolean A Boolean that indicates whether a cube is write-enabled.
      IS_SQL_ENABLEDDBTYPE_BOOLboolean A Boolean that indicates whether SQL can be used on the cube.
      CUBE_CAPTIONDBTYPE_WSTRString The caption of the cube.
      BASE_CUBE_NAMEDBTYPE_WSTRString The name of the source cube if this cube is a perspective cube.
      ANNOTATIONSDBTYPE_WSTRString (Optional) A set of notes, in XML format.
      @@ -1540,28 +1580,28 @@
      2.6.3.5. getDimensions
      - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - +
      Column nameType indicatorColumn nameType Description
      CATALOG_NAMEDBTYPE_WSTRString The name of the database.
      SCHEMA_NAMEDBTYPE_WSTRString Not supported.
      CUBE_NAMEDBTYPE_WSTRString The name of the cube.
      DIMENSION_NAMEDBTYPE_WSTRString The name of the dimension. If a dimension is part of more than one cube or measure group, then there is one row for each unique combination of @@ -1569,29 +1609,29 @@
      2.6.3.5. getDimensions
      DIMENSION_UNIQUE_NAMEDBTYPE_WSTRString The unique name of the dimension.
      DIMENSION_GUIDDBTYPE_GUIDString Not supported.
      DIMENSION_CAPTIONDBTYPE_WSTRString The caption of the dimension. This should be used when displaying the name of the dimension to the user, such as in the user interface or reports.
      DIMENSION_ORDINALDBTYPE_UI4int The position of the dimension within the cube.
      DIMENSION_TYPEDBTYPE_I2int The type of the dimension. Valid values include:
      • MD_DIMTYPE_UNKNOWN (0)
      • MD_DIMTYPE_TIME (1)
      • @@ -1615,28 +1655,28 @@
        2.6.3.5. getDimensions
      DIMENSION_CARDINALITYDBTYPE_UI4int The number of members in the key attribute.
      DEFAULT_HIERARCHYDBTYPE_WSTRString A hierarchy from the dimension. Preserved for backwards compatibility.
      DESCRIPTIONDBTYPE_WSTRString A user-friendly description of the dimension.
      IS_VIRTUALDBTYPE_BOOLboolean Always FALSE.
      IS_READWRITEDBTYPE_BOOLboolean A Boolean that indicates whether the dimension is write-enabled. @@ -1645,7 +1685,7 @@
      2.6.3.5. getDimensions
      DIMENSION_UNIQUE_SETTINGSDBTYPE_I4int A bitmap that specifies which columns contain unique values if the dimension contains only members with unique names. The following bit value constants @@ -1656,13 +1696,14 @@
      2.6.3.5. getDimensions
      DIMENSION_MASTER_UNIQUE_NAMEDBTYPE_WSTRDIMENSION_MASTER_
      + UNIQUE_NAME
      String Always NULL.
      DIMENSION_IS_VISIBLEDBTYPE_BOOLboolean Always TRUE.
      @@ -1679,36 +1720,36 @@
      2.6.3.6. getFunctions
      - - + + - + - + - + - + - + - + - + - + - + - + - + - +
      Column nameType indicatorColumn nameType Description
      FUNCTION_NAMEDBTYPE_WSTRString The name of the function.
      DESCRIPTIONDBTYPE_WSTRString A description of the function.
      PARAMETER_LISTDBTYPE_WSTRString A comma delimited list of parameters formatted as in Microsoft Visual Basic. For example, a parameter might be Name as String.
      RETURN_TYPEDBTYPE_I4int The VARTYPE of the return data type of the function.
      ORIGINDBTYPE_I4int The origin of the function:
      • 1 for MDX functions.
      • 2 for user-defined functions.
      • @@ -1717,27 +1758,27 @@
        2.6.3.6. getFunctions
      INTERFACE_NAMEDBTYPE_WSTRString The name of the interface for user-defined functions

      The group name for Multidimensional Expressions (MDX) functions.

      LIBRARY_NAMEDBTYPE_WSTRString The name of the type library for user-defined functions. NULL for MDX functions.
      DLL_NAMEDBTYPE_WSTRString (Optional) The name of the assembly that implements the user-defined function.

      Returns VT_NULL for MDX functions.

      HELP_FILEDBTYPE_WSTRString (Optional) The name of the file that contains the help documentation for the user-defined function.

      Returns VT_NULL for MDX @@ -1745,13 +1786,13 @@

      2.6.3.6. getFunctions
      HELP_CONTEXTDBTYPE_I4int (Optional) Returns the Help context ID for this function.
      OBJECTDBTYPE_WSTRString (Optional) The generic name of the object class to which a property applies. For example, the rowset corresponding to the <level_name>.Members function @@ -1761,7 +1802,7 @@
      2.6.3.6. getFunctions
      CAPTIONDBTYPE_WSTRString The display caption for the function.
      @@ -1777,31 +1818,31 @@
      2.6.3.7. getHierarchies
      - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - +
      Column nameType indicatorColumn nameType Description
      CATALOG_NAMEDBTYPE_WSTRString The name of the catalog to which this hierarchy belongs. NULL if the provider does not support catalogs.
      SCHEMA_NAMEDBTYPE_WSTRString Not supported
      CUBE_NAMEDBTYPE_WSTRString (Required) The name of the cube to which this hierarchy belongs.
      DIMENSION_UNIQUE_NAMEDBTYPE_WSTRString The unique name of the dimension to which this hierarchy belongs. For providers that generate unique names by qualification, each component of @@ -1809,7 +1850,7 @@
      2.6.3.7. getHierarchies
      HIERARCHY_NAMEDBTYPE_WSTRString The name of the hierarchy. Blank if there is only a single hierarchy in the dimension. This will always have a value in Microsoft SQL Server 2005 @@ -1817,17 +1858,17 @@
      2.6.3.7. getHierarchies
      HIERARCHY_UNIQUE_NAMEDBTYPE_WSTRString The unique name of the hierarchy.
      HIERARCHY_GUIDDBTYPE_GUIDString Not supported
      HIERARCHY_CAPTIONDBTYPE_WSTRString A label or a caption associated with the hierarchy. Used primarily for display purposes. If a caption does not exist, HIERARCHY_NAME is @@ -1837,7 +1878,7 @@
      2.6.3.7. getHierarchies
      DIMENSION_TYPEDBTYPE_I2int [define enum] The type of the dimension. Valid values include the following values:
      • MD_DIMTYPE_UNKNOWN (0)
      • @@ -1862,30 +1903,30 @@
        2.6.3.7. getHierarchies
      HIERARCHY_CARDINALITYDBTYPE_UI4int The number of members in the hierarchy.
      DEFAULT_MEMBERDBTYPE_WSTRString The default member for this hierarchy. This is a unique name. Every hierarchy must have a default member.
      ALL_MEMBERDBTYPE_WSTRString The member at the highest level of the rollup.
      DESCRIPTIONDBTYPE_WSTRString A human-readable description of the hierarchy. NULL if no description exists.
      STRUCTUREDBTYPE_I2int The structure of the hierarchy. Valid values include the following values:
      • MD_STRUCTURE_FULLYBALANCED (0)
      • @@ -1897,12 +1938,12 @@
        2.6.3.7. getHierarchies
      IS_VIRTUALDBTYPE_BOOLboolean Always returns False.
      IS_READWRITEDBTYPE_BOOLboolean A Boolean that indicates whether the Write Back to dimension column is enabled.

      Returns TRUE if the Write Back to dimension column that @@ -1910,43 +1951,44 @@

      2.6.3.7. getHierarchies
      DIMENSION_UNIQUE_SETTINGSDBTYPE_I4int Always returns MDDIMENSIONS_MEMBER_KEY_UNIQUE (1).
      DIMENSION_MASTER_UNIQUE_NAMEDBTYPE_WSTRDIMENSION_MASTER_
      + UNIQUE_NAME
      String Always returns NULL.
      DIMENSION_IS_VISIBLEDBTYPE_BOOLboolean Always returns true. If the dimension is not visible, it will not appear in the schema rowset.
      HIERARCHY_ORDINALDBTYPE_UI4int The ordinal number of the hierarchy across all hierarchies of the cube.
      DIMENSION_IS_SHAREDDBTYPE_BOOLboolean Always returns TRUE.
      HIERARCHY_IS_VISIBLEDBTYPE_BOOLboolean A Boolean that indicates whether the hieararchy is visible.

      Returns TRUE if the hierarchy is visible; otherwise, FALSE.

      HIERARCHY_ORIGINDBTYPE_UI2int A bit mask that determines the source of the hierarchy:
      • MD_USER_DEFINED identifies user @@ -1964,7 +2006,7 @@
        2.6.3.7. getHierarchies
      HIERARCHY_DISPLAY_FOLDERDBTYPE_WSTRString The path to be used when displaying the hierarchy in the user interface. Folder names will be separated by a semicolon (;). Nested folders are @@ -1972,7 +2014,7 @@
      2.6.3.7. getHierarchies
      INSTANCE_SELECTIONDBTYPE_UI2int A hint to the client application on how to show the hierarchy. Valid values include the following values: