|
Oracle® OLAP Java API Reference 10g Release 2 (10.2.0.4) B14348-04 |
This documentation and Oracle OLAP Developer's Guide to the OLAP API 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 Web site at
http://www.oracle.com/technology/products/bi/olap/olap.html.
The example programs use analytic workspace metadata objects that are mapped to columns of tables in the relational database. The tables are part of the Global sample schema. You can get the SQL scripts that install the Global schema from the http://www.oracle.com/technology/products/bi/olap/olap.html Web site, also.
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 development environment such as Oracle JDeveloper.
Most of the programs are the complete code for the examples in Oracle OLAP Developer's Guide to the OLAP API, part number B14347-02, for the 10.2.0.3 release.
That documentation is unchanged in the current release.
The example program classes are in packages that indicate the chapter in which the example appears in the documentation.
Extracting the contents of the examples.zip file creates the following directory structure.
examples
src
oracle
olapi
examples
chapter2
chapter3
chapter4
chapter5
chapter6
chapter7
chapter8
chapter9
chapter10
The following table lists the Java classes that are in the examples/src/oracle/olapi/examples directory.
Classes in examples
| Description |
|---|---|
BaseExample
|
The base class for all of the example programs. This abstract class has methods that do the following:
|
BuildAWExample
|
A program that uses the Oracle OLAP Analytic Workspace Java API to define and build an analytic workspace. The OLAP Java API example programs query that analytic workspace. |
ContextExample
|
An abstract class that extends BaseExample. This class creates a Context10g object and it has methods that are commonly used by the examples.
|
Context10g
|
An instance of this class is created by a ContextExample.
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. |
MyMdmObjectVisitor
|
This class extends the MdmBaseObjectVisitor class. It is used by the SampleMetadataDiscoverer10g.java example program in the chapter4 directory.
|
RecursiveJoinAndShortcutsExamples
|
This class has the complete code for some of the examples in Oracle OLAP Java API Reference. It has the 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 subdirectories of examples/src/oracle/olapi/examples contain the source code for the examples in the chapters of Oracle OLAP Developer's Guide to the OLAP API.
The chapter2 directory has the classes that contain the complete code for the examples in Chapter 2, "Understanding OLAP API Metadata".
The following table lists the classes that are in that directory.
Classes in chapter2
| Description |
|---|---|
ElementsOfMdmAttribute
|
A program that creates a query that produces the results that appear in the table in the "MdmAttribute Class" section of Chapter 2. |
CreateCustomDimensionMember
|
Example 2-1, Creating a Custom Member of a Dimension. |
GettingDataTypeOfMdmSource
|
Example 2-2, Getting the Data Type of an MdmSource. |
GettingTypeOfMdmSource
|
Example 2-3, Getting the Type of an MdmSource. |
CreateCustomMeasureDimensionMember
|
Example 2-4, Creating a Custom Member of the MdmMeasureDimension. |
The code for most of the examples in Chapter 3, "Connecting to a Data Store", is used in the
Context10g program to create a connection to an Oracle Database instance.
The chapter3 directory contains a class that has complete code for one of the examples in the chapter . The following table lists the class that is in that directory.
Classes in chapter3
| Description |
|---|---|
GettingExistingConnection |
Example 3-5, Getting an Existing Connection. |
The code for most of the examples in Chapter 4, "Discovering the Available Metadata", appears in the SampleMetadataDiscoverer10g program, which is in the chapter4 directory.
The following table lists the class that is in that directory.
Classes in chapter4
| Description |
|---|---|
SampleMetadataDiscoverer10g |
Example 4-1, Creating an MdmMetadataProvider Example 4-2, Getting the Root MdmSchema Example 4-3, Getting MdmDimension Objects Example 4-4, Getting Subschemas Example 4-5, Getting the MdmMeasureDimension Example 4-6, Getting the Dimensions of an MdmMeasure Example 4-7, Getting the MdmHierarchy Components of an MdmPrimaryDimenison Example 4-8, Getting a Primary Source for a Metadata Object Example 4-9, Discovering the OLAP Metadata. |
The chapter5 directory has the classes that contain the complete code for the examples in Chapter 5, "Understanding Source Objects".
The following table lists the classes that are in that directory.
Classes in chapter5
| Description |
|---|---|
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. |
UsingParamSourceWithMeasDim |
Example 5-10, Using a Parameterized Source With a Measure Dimension. |
ImplementingExtractAsACustomModel |
Example 5-11, Implementing the extract Method as a CustomModel. |
CreateDependentAssignment |
Example 5-12, Creating an Assignment That Depends on Another Assignment. |
CreateCustomMemberWithAggVal |
Example 5-13, Creating a Custom Member That Assigns an Aggregated Value. |
The chapter6 directory has the classes that contain the complete code for the examples in Chapter 6, "Making Queries Using Source Objects".
The following table lists the classes that are in that directory.
Classes in chapter6
| Description |
|---|---|
MakingQueriesExamples |
The following examples are implemented as methods of this class.
Example 6-1, Controlling Input-to-Source Matching With the alias Method. |
SortingHierarchicallyByAttribute |
Example 6-6, Sorting Products Hierarchically By Attribute. |
CreatingCubeAndPivotingEdges |
Example 6-9, Creating a Cube and Pivoting Its Edges. |
DrillingInHierarchy |
Example 6-10, Drilling in a Hierarchy. |
GettingShareOfUnits |
Example 6-12, Getting the Share of Units Sold. |
UsingLagMethod |
Example 6-13, Using the Lag Method. |
UsingMovingTotalMethod |
Example 6-14, Using the movingTotal Method. |
SelectingRangeWithNumberParam |
Example 6-15, Selecting a Range With NumberParameter Objects. |
The chapter7 directory has the classes that contain the complete code for the examples in Chapter 7, "Using a TransactionProvider".
The following table lists the classes that are in that directory.
Classes in chapter7
| Description |
|---|---|
TransactionExamples |
The following examples are implemented as methods of this class.
Example 7-1, Rolling Back a Transaction. |
The chapter8 directory has the classes that contain the complete code for the examples in Chapter 8, "Understanding Cursor Classes and Objects".
The following table lists the classes that are in that directory.
Classes in chapter8
| Description |
|---|---|
CursorConceptsExamples |
The following examples, and an informal example, are implemented as methods of this class.
Example 8-1, Creating the querySource Query. |
The chapter9 directory has the classes that contain the complete code for the examples in Chapter 9, "Retrieving Query Results".
The following table lists the classes that are in that directory.
Classes in chapter9
| Description |
|---|---|
RetrievingQueryResults |
The following examples are implemented as methods of this class.
Example 9-1, Creating a Cursor. |
The chapter10 directory has the classes that contain the complete code for the examples in Chapter 10, "Creating Dynamic Queries".
The following table lists the classes that are in that directory.
Classes in chapter10
| Description |
|---|---|
TopBottomTemplate |
Example 10-1, Implementing a Template.
The following examples are implemented as inner classes of
Example 10-2, Implementing a MetadataState. |
TopBottomTest |
Example 10-4, Getting the Source Produced by the Template. |
SingleSelectionTemplate |
A Template that is used by TopBottomTest. |