|
Oracle® OLAP Java API Reference 11g Release 2 (11.2) E10794-06 |
This documentation and Oracle OLAP Java API Developer's Guide contain examples that demonstrate the use of OLAP Java API classes. The complete code for many of the examples is available from the Oracle Technology Network (OTN) Web site, as described in the Examples of Using the Oracle OLAP Java API section of the Overview.
The example programs use metadata objects that are based on tables of a schema in the relational database. The schema is owned by the GLOBAL user. From the OTN Web site, you can also download the SQL scripts that create the GLOBAL user and install the Global schema.
You can add the example program classes to your Java development environment and compile and run them if the programs can connect to an Oracle Database instance with the OLAP option that has the Global schema installed.
The example programs are in a package organization that you can import into an integrated developement environment such as Oracle JDeveloper. Most of the programs are the complete code for the examples in Oracle OLAP Java API Developer's Guide. The example program classes are in a structure that indicates the package of API classes that they exemplify. Extracting the contents of the examples.zip
file creates the following directory structure.
examples src oracle olapi examples cursor metadata source template transaction
In the remainder of this document, the references to the directory structure begin with the examples.src.oracle.olapi.examples
directory.
The following table lists the classes that are in the examples
directory. These classes are used by all of the example programs.
Class | Description |
---|---|
BaseExample11g |
The base class for all of the example programs. Some of the methods of this class do the following:
|
Context11g |
An instance of this class is created by a BaseExample11g . This class has methods that do the following:
This class also has convenience methods for getting metadata objects from the |
CursorPrintWriter |
A PrintWriter that has methods for displaying the values of a Cursor in various formats. |
Logger |
This class encapsulates the logging of output generated by an example program. |
SQLResultSetPrinter |
This class displays the result set of a SQL query. |
Before running any of the other example programs, first run the SpecifyAWValues
program. It passes values to the CreateAndBuildAW
class, which creates metadata objects and builds an analytic workspace. Most of the other example programs use the objects created by these classes.
Package | Class | Description |
---|---|---|
metadata |
SpecifyAWValues |
A program that passes values to the CreateAndBuildAW class. That class defines metadata objects, maps them to the Global schema, deploys them to an analytic workspace, writes the metadata object definitions to an XML file, and builds the analytic workspace. Most of the other OLAP Java API example programs query that analytic workspace. |
The following table lists the classes that have the code for examples that appear in Oracle OLAP Java API Reference.
Package | Class | Description |
---|---|---|
source |
RecursiveJoinAndShortcutsExamples |
This class has the complete code for the examples in the descriptions of the full signature of the Source.recursiveJoin method, of other signatures of recursiveJoin , and of some related Source methods such as selectDescendants and sortDescendingHierarchically . |
source |
SourceExamplesInRef |
This class has the complete code for examples in some of the classes in the oracle.olapi.data.source package. |
The tables in this section list the classes that contain the code for the examples in Oracle OLAP Java API Developer's Guide. Each table lists the examples in a chapter.
The following table lists the examples that appear in Chapter 2, "Understanding OLAP Java API Metadata", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
metadata |
AssociateDescriptions |
Example 2-1, Associating a Description with an MdmObject. |
metadata |
ElementsOfMdmAttribute |
Creates a query that produces the results that appear in Table 2-3 in the "Representing Dimension Attributes" topic. |
metadata |
BasicCubeViewQuery |
Example 2-4, Basic Cube View Query. Example 2-5, Basic Cube Query Using Source Objects. |
The following table lists the examples that appear in Chapter 3, "Discovering Metadata", and the example program that contains the code for the examples.
Package | Class | Description |
---|---|---|
metadata |
ConnectAndDiscover |
Example 3-1, Getting a JDBC OracleConnection. Example 3-2, Creating a DataProvider. Example 3-3, Closing the Connection. Example 3-4, Creating an MdmMetadataProvider. Example 3-5, Getting the MdmSchema Objects Example 3-6, Getting a Single MdmDatabaseSchema. Example 3-7, Getting the Dimensions and Measures of an MdmDatabaseSchema. Example 3-8, Getting the Dimensions and Measures of an MdmCube. Example 3-9, Getting the Hierarchies and Levels of a Dimension. Example 3-10, Getting the MdmAttribute Objects of an MdmPrimaryDimension. Example 3-11, Getting a Primary Source for a Metadata Object. |
The following table lists the examples that appear in Chapter 4, "Creating Metadata and Analytic Workspaces", and the example programs that contain the code for the examples. The CreateMetadataAndAW
program, which contains the code for most of the examples, creates a subset of the objects specified by SpecifyAWValues
and created by the CreateAndBuildAW
program. In CreateMetadataAndAW
the values, such as the names for the OLAP objects and the names of relational tables and columns, are hard-coded. The methods are simplified for use as examples in the documentation. The CreateMetadataAndAW
and SpecifyAWValues
both first delete the GLOBAL_AWJ analytic workspace if it exists and then define and build the analytic workspace.
Note: All of the examples from the other chapters use the analytic workspace created by the SpecifyAWValues
program. If you run the CreateMetadataAndAW
program, be sure to run the SpecifyAWValues
program before running any of the other example programs.
Package | Class | Description |
---|---|---|
metadata |
CreateMetadataAndAW |
Example 4-1, Creating an AW. Example 4-2, Creating and Deploying an MdmStandardDimension. Example 4-3, Creating and Mapping an MdmDimensionLevel. Example 4-4, Creating and Mapping MdmLevelHierarchy and MdmHierarchyLevel Objects. Example 4-6, Creating an MdmBaseAttribute. Example 4-7, Creating and Mapping an MdmCube. Example 4-8, Creating and Mapping Measures. Example 4-9, Committing Transactions. Example 4-10, Exporting to an XML Template. Example 4-11, Building an Analytic Workspace. |
metadata |
CreateValueHierarchy |
Example 4-5, Creating an MdmValueHierarchy. |
The following table lists the examples that appear in Chapter 5, "Understanding Source Objects", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
source |
UnderstandingSourceObjects |
The following examples, and two informal untitled examples, are implemented as methods of this class.
Example 5-1, Using the isSubtypeOf Method. |
The following table lists the examples that appear in Chapter 6, "Making Queries Using Source Methods", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
source |
MakingQueriesExamples |
The following examples are implemented as methods of this class.
Example 6-1, Controlling Input-with-Source Matching With the alias Method. |
source |
SortingHierarchicallyByAttribute |
Example 6-5, Sorting Products Hierarchically By Attribute. |
source |
CreatingCubeAndPivotingEdges |
Example 6-9, Creating a Cube and Pivoting the Edges. |
source |
DrillingInHierarchy |
Example 6-10, Drilling in a Hierarchy. |
source |
GettingShareOfUnits |
Example 6-12, Getting the Share of Units Sold. |
source |
UsingLagMethod |
Example 6-13, Using the Lag Method. |
source |
UsingMovingTotalMethod |
Example 6-14, Using the movingTotal Method. |
source |
SelectingRangeWithNumberParam |
Example 6-15, Selecting a Range With NumberParameter Objects. |
The following table lists the examples that appear in Chapter 7, "Using a TransactionProvider", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
transaction |
TransactionExamples |
The following examples are implemented as methods of this class.
Example 7-2, Rolling Back a Transaction. |
The following table lists the examples that appear in Chapter 8, "Understanding Cursor Classes and Objects", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
cursor |
CursorConceptsExamples |
The following examples, and an informal example, are implemented as methods of this class.
Example 8-1, Creating the querySource Query. |
The following table lists the examples that appear in Chapter 9, "Retrieving Query Results", and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
cursor |
RetrievingQueryResults |
The following examples are implemented as methods of this class.
Example 9-1, Creating a Cursor. |
The following table lists the examples that appear in Chapter 10, "Creating Dynamic Queries, and the example programs that contain the code for the examples.
Package | Class | Description |
---|---|---|
template |
TopBottomTemplate |
Example 10-1, Implementing a Template.
The following examples are implemented as inner classes of Example 10-2, Implementing a MetadataState. |
template |
TopBottomTest |
Example 10-4, Getting the Source Produced by the Template. |
template |
SingleSelectionTemplate |
A Template that is used by TopBottomTest . |