|
Oracle® OLAP Java API Reference 11g Release 1 (11.1) |
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 in the examples.zip
file, which
you can get from the Oracle Technology Network (OTN) Web site at http://www.oracle.com/technology/products/bi/olap/olap.html.
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, part number B28127-01. 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. |
Before running any of the other example programs, first run the BuildAW11g
program. It creates metadata objects and builds an analytic workspace. Most of the other example programs use the objects created by this program.
Package | Class | Description |
---|---|---|
metadata |
BuildAW11g |
A program that 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 . |
The tables in this section list the classes that contain the code for the examples in Oracle OLAP Java API Developer's Guide. The tables are organized by chapter and list the examples in the order in which they appear in the documentation.
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 |
ElementsOfMdmAttribute |
Creates a query that produces the results that appear in the table in the "MdmAttribute Class" section. |
metadata |
GettingDataTypeOfMdmSource |
Example 2-1, Getting the Data Type of an MdmSource. |
metadata |
GettingTypeOfMdmSource |
Example 2-2, Getting the Type of an MdmSource. |
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, Loading the JDBC Driver for a Connection. Example 3-2, Getting a JDBC OracleConnection. Example 3-3, Creating a DataProvider. Example 3-4, Closing the Connection. Example 3-5, Creating an MdmMetadataProvider. Example 3-6, Getting the MdmSchema Objects Example 3-7, Getting a Single MdmDatabaseSchema. Example 3-8, Getting the Dimensions and Measures of an MdmDatabaseSchema. Example 3-9, Getting the Dimensions and Measures of an MdmCube. Example 3-10, Getting the Hierarchies and Levels of a Dimension. Example 3-11, Getting the MdmAttribute Objects of an MdmPrimaryDimension. Example 3-12, 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 program that contains the code for the examples.
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-5, Creating an MdmBaseAttribute. Example 4-6, Creating and Mapping an MdmCube. Example 4-7, Creating and Mapping Measures. Example 4-8, Committing Transactions. Example 4-9, Exporting to an XML Template. Example 4-10, Building an Analytic Workspace. |
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, Getting the Data Type of a Source. |
source |
UsingParamSourceWithMeasDim |
Example 5-10, Using a Parameterized Source With a Measure Dimension. |
source |
ImplementingExtractAsACustomModel |
Example 5-11, Implementing the extract Method as a CustomModel. |
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-to-Source Matching With the alias Method. |
source |
SortingHierarchicallyByAttribute |
Example 6-6, Sorting Products Hierarchically By Attribute. |
source |
CreatingCubeAndPivotingEdges |
Example 6-9, Creating a Cube and Pivoting Its 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-1, 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 | Classes in chapter10 |
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 . |