Oracle® OLAP Java API Reference
10g Release 2 (10.2)

B14348-01

oracle.olapi.data.source
Class DataProvider

java.lang.Object
  |
  +--oracle.olapi.data.source.DataProvider
Direct Known Subclasses:
ExpressDataProvider

public abstract class DataProvider
extends java.lang.Object

Creates objects that an application uses in creating queries and retrieving data from a data store. ExpressDataProvider is the concrete subclass of DataProvider for an Oracle Database instance.

The DataProvider class includes methods that do the following:

For the createListSource methods, the values of the elements array must be unique. The array cannot contain duplicate values.


Method Summary
abstract void close()
Closes the DataProvider and releases resources associated with it.
BooleanSource createConstantSource(boolean element)
Creates a BooleanSource that has only one element, which has the specified boolean value.
DateSource createConstantSource(java.util.Date element)
Creates a DateSource that has only one element, which has the specified Date value.
NumberSource createConstantSource(double element)
Creates a NumberSource that has only one element, which has the specified double value.
NumberSource createConstantSource(float element)
Creates a NumberSource that has only one element, which has the specified float value.
NumberSource createConstantSource(int element)
Creates a NumberSource that has only one element, which has the specified int value.
NumberSource createConstantSource(short element)
Creates a NumberSource that has only one element, which has the specified short value.
Source createConstantSource(Source element)
Creates a Source that has only one element, which has the specified Source value.
StringSource createConstantSource(java.lang.String element)
Creates a StringSource that has only one element, which has the specified String value.
CursorInfoSpecification createCursorInfoSpecification(Source rootSource)
Creates a CursorInfoSpecification for the specified Source.
SpecifiedCursorManager createCursorManager(CursorManagerSpecification cursorManagerSpecification)
Creates a CursorManager based on a CursorManagerSpecification.
SpecifiedCursorManager createCursorManager(CursorManagerSpecification cursorManagerSpecification, Source[] inputSources)
Creates a CursorManager for a Source that has inputs.
CursorManager createCursorManager(Source rootSource)
Creates a CursorManager for the specified Source.
CursorManager createCursorManager(Source rootSource, int fetchSize, CursorInfoSpecification cursorInfoSpec)
Creates a CursorManager object with the specified CursorInfoSpecification and fetch size.
CursorManager[] createCursorManagers(Source[] rootSources)
Creates an array of CursorManager objects, one for each of the corresponding Source in the rootSources array.
CursorManager[] createCursorManagers(Source[] rootSource, int[] fetchSize, CursorInfoSpecification[] cursorInfoSpec)
Creates an array of CursorManager objects with the specified CursorInfoSpecification objects and fetch sizes.
CursorManagerSpecification createCursorManagerSpecification(Source rootSource)
Creates a CursorManagerSpecification for a Source object.
BooleanSource createListSource(boolean[] elements)
Creates a BooleanSource with elements that have the specified boolean values.
DateSource createListSource(java.util.Date[] elements)
Creates a DateSource with elements that have the specified Date values.
NumberSource createListSource(double[] elements)
Creates a NumberSource with elements that have the specified double values.
NumberSource createListSource(float[] elements)
Creates a NumberSource with elements that have the specified float values.
NumberSource createListSource(int[] elements)
Creates a NumberSource with elements that have the specified int values.
Source createListSource(java.lang.Object[][] tuples)
Creates a Source that has the arrays in the tuples array as its element values.
NumberSource createListSource(short[] elements)
Creates a NumberSource with elements that have the specified short values.
Source createListSource(Source[] elements)
Creates a Source with elements that have the specified Source objects as values.
StringSource createListSource(java.lang.String[] elements)
Creates a StringSource with elements that have the specified String values.
CustomModel createModel(Source input)
Creates a CustomModel with the specified input and a data type of Number.
CustomModel createModel(Source[] inputs)
Creates a CustomModel with the specified inputs and a data type of Number.
CustomModel createModel(Source[] inputs, Source datatype)
Creates a CustomModel with the specified inputs and data type.
CustomModel createModel(Source[] inputs, Source datatype, Model[] parentModels)
Creates a CustomModel with the specified inputs, data type, and parent models.
CustomModel createModel(Source[] inputs, Source datatype, Source[] outputs)
Creates a CustomModel with the specified inputs, data type, and outputs.
CustomModel createModel(Source[] inputs, Source datatype, Source[] outputs, Model[] parentModels)
Creates a CustomModel with the specified inputs, data type, outputs, and parent models.
CustomModel createModel(Source input, Source datatype)
Creates a CustomModel with the specified input and data type.
BooleanSource createParameterizedSource(BooleanParameter param)
Creates a parameterized BooleanSource that has the value of the specified BooleanParameter as the value of its element.
DateSource createParameterizedSource(DateParameter param)
Creates a parameterized DateSource that has the value of the specified DateParameter as the value of its element.
NumberSource createParameterizedSource(NumberParameter param)
Creates a parameterized NumberSource that has the value of the specified NumberParameter as the value of its element.
StringSource createParameterizedSource(StringParameter param)
Creates a parameterized StringSource that has the value of the specified StringParameter as the value of its element.
NumberSource createRangeSource(int bottom, int top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
NumberSource createRangeSource(int bottom, NumberSource top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
NumberSource createRangeSource(NumberSource bottom, int top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
NumberSource createRangeSource(NumberSource bottom, NumberSource top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
SQLCursorManager createSQLCursorManager(Source source)
Creates a SQLCursorManager for the specified Source.
abstract SQLCursorManager[] createSQLCursorManagers(Source[] sources)
Creates an array of SQLCursorManager objects that has one SQLCursorManager for each of the specified Source objects.
Source getEmptySource()
Gets the empty Source, which does not have any elements.
FundamentalMetadataProvider getFundamentalMetadataProvider()
Gets the FundamentalMetadataProvider for this DataProvider.
TransactionProvider getTransactionProvider()
Gets the TransactionProvider for this DataProvider.
Source getVoidSource()
Gets the void Source object, which has a single element that has null as its value.
abstract void initialize()
Initializes this DataProvider.
abstract boolean isOpen()
Indicates whether the connection to the data store is currently open.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

close

public abstract void close()
Closes the DataProvider and releases resources associated with it.

createConstantSource

public final NumberSource createConstantSource(double element)
Creates a NumberSource that has only one element, which has the specified double value.
Parameters:
element - The double value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified double value.

createConstantSource

public final NumberSource createConstantSource(float element)
Creates a NumberSource that has only one element, which has the specified float value.
Parameters:
element - The float value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified float value.

createConstantSource

public final NumberSource createConstantSource(int element)
Creates a NumberSource that has only one element, which has the specified int value.
Parameters:
element - The int value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified int value.

createConstantSource

public final StringSource createConstantSource(java.lang.String element)
Creates a StringSource that has only one element, which has the specified String value.
Parameters:
element - The String value that you want the returned StringSource to have.
Returns:
A StringSource that has the specified String value.

createConstantSource

public final DateSource createConstantSource(java.util.Date element)
Creates a DateSource that has only one element, which has the specified Date value.
Parameters:
element - The Date value that you want the returned DateSource to have.
Returns:
A DateSource that has the specified Date value.

createConstantSource

public final Source createConstantSource(Source element)
Creates a Source that has only one element, which has the specified Source value.
Parameters:
element - The Source that you want as the value of the element of the returned Source to have.
Returns:
A Source that has an element that has the specified Source as its value.

createConstantSource

public final NumberSource createConstantSource(short element)
Creates a NumberSource that has only one element, which has the specified short value.
Parameters:
element - The short value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified short value.

createConstantSource

public final BooleanSource createConstantSource(boolean element)
Creates a BooleanSource that has only one element, which has the specified boolean value.
Parameters:
element - The boolean value that you want the returned BooleanSource to have.
Returns:
A BooleanSource that has the specified boolean value.

createCursorManager

public final SpecifiedCursorManager createCursorManager(CursorManagerSpecification cursorManagerSpecification)
                                                 throws CursorManagerSpecificationExpiredException
Creates a CursorManager based on a CursorManagerSpecification. You use a CursorManager to create Cursor objects, which provide access to the results of a query.

Use this method if the Source that you used to create the CursorManagerSpecification has no inputs. If the Source has inputs, then use the createCursorManager(CursorManagerSpecification cursorManagerSpecification, Source[] inputSources) method.

Parameters:
cursorManagerSpecification - The CursorManagerSpecification for the Source for which you want to create a Cursor.
Returns:
A SpecifiedCursorManager for the Source for which you want to create a Cursor.

createCursorManager

public SpecifiedCursorManager createCursorManager(CursorManagerSpecification cursorManagerSpecification,
                                                  Source[] inputSources)
                                           throws CursorManagerSpecificationExpiredException
Creates a CursorManager for a Source that has inputs. With the inputSources argument, you specify Source objects for the inputs of the Source. A Source that you include in the inputSources array must not have any inputs itself and it must not have any outputs. When you create a Cursor from the CursorManager, you supply a CursorInput object for each Source in the inputSources array.
Parameters:
cursorManagerSpecification - A CursorManagerSpecification for the Source that has inputs.
inputSources - An array of Source objects, one for each input of the Source for the CursorManagerSpecification.
Returns:
A SpecifiedCursorManager for the Source.

createCursorManager

public final CursorManager createCursorManager(Source rootSource)
Creates a CursorManager for the specified Source.
Parameters:
rootSource - The Source for which you want a CursorManager.
Returns:
The CursorManager for the specified Source.

createCursorManagers

public final CursorManager[] createCursorManagers(Source[] rootSources)
Creates an array of CursorManager objects, one for each of the corresponding Source in the rootSources array.
Parameters:
rootSources - The Source objects for which you want CursorManager objects.
Returns:
The CursorManager objects for the specified Source objects.

createCursorManager

public final CursorManager createCursorManager(Source rootSource,
                                               int fetchSize,
                                               CursorInfoSpecification cursorInfoSpec)
Creates a CursorManager object with the specified CursorInfoSpecification and fetch size. A fetch size of -1 specifies fetching the entire result set.
Parameters:
rootSource - A Source for which you want a CursorManager.
fetchSize - An integer that specifies the fetch size for the Cursor objects created by the CursorManager.
cursorInfoSpec - A CursorInfoSpecification for the CursorManager.
Returns:
A CursorManager for the Source.

createCursorManagers

public CursorManager[] createCursorManagers(Source[] rootSource,
                                            int[] fetchSize,
                                            CursorInfoSpecification[] cursorInfoSpec)
Creates an array of CursorManager objects with the specified CursorInfoSpecification objects and fetch sizes. The array contains one CursorManager for each Source in the rootSource array. The fetchSize and cursorInfoSpec arrays supply a fetch size and a CursorInfoSpecification for the CursorManager for the corresponding Source in the rootSource array. A fetch size of -1 specifies fetching the entire result set.
Parameters:
rootSource - An array of Source objects for which you want CursorManager objects.
fetchSize - An array of integers that specify the fetch sizes for the Cursor objects created by the corresponding CursorManager objects.
cursorInfoSpec - An array of CursorInfoSpecification objects for the corresponding CursorManager objects.
Returns:
An array of CursorManager objects for the corresponding Source objects.

createCursorInfoSpecification

public final CursorInfoSpecification createCursorInfoSpecification(Source rootSource)
                                                            throws TransactionalObjectInvalidException
Creates a CursorInfoSpecification for the specified Source.
Parameters:
rootSource - The Source for which you want a CursorInfoSpecification.
Returns:
The CursorInfoSpecification for the specified Source.

createCursorManagerSpecification

public final CursorManagerSpecification createCursorManagerSpecification(Source rootSource)
                                                                  throws TransactionalObjectInvalidException
Creates a CursorManagerSpecification for a Source object. You can use the CursorManagerSpecification to create CursorManager objects. The CursorManagerSpecification specifies the behavior of Cursor objects that you create from a CursorManager.
Parameters:
rootSource - A Source that defines a query to make on the data source.
Returns:
A CursorManagerSpecification for the specified Source.

createListSource

public final NumberSource createListSource(double[] elements)
Creates a NumberSource with elements that have the specified double values.
Parameters:
elements - An array of double values.
Returns:
A NumberSource with elements that have the specified double values.

createListSource

public final NumberSource createListSource(float[] elements)
Creates a NumberSource with elements that have the specified float values.
Parameters:
elements - An array of float values.
Returns:
A NumberSource with elements that have the specified float values.

createListSource

public final NumberSource createListSource(int[] elements)
Creates a NumberSource with elements that have the specified int values.
Parameters:
elements - An array of int values.
Returns:
A NumberSource with elements that have the specified int values.

createListSource

public final StringSource createListSource(java.lang.String[] elements)
Creates a StringSource with elements that have the specified String values.
Parameters:
elements - An array of String values.
Returns:
A StringSource with elements that have the specified String values.

createListSource

public final DateSource createListSource(java.util.Date[] elements)
Creates a DateSource with elements that have the specified Date values.
Parameters:
elements - An array of Date values.
Returns:
A DateSource with elements that have the specified Date values.

createListSource

public final Source createListSource(Source[] elements)
Creates a Source with elements that have the specified Source objects as values.
Parameters:
elements - An array of Source objects.
Returns:
A Source with elements that have the specified Date values.

createListSource

public final NumberSource createListSource(short[] elements)
Creates a NumberSource with elements that have the specified short values.
Parameters:
elements - An array of short values.
Returns:
A NumberSource with elements that have the specified short values.

createListSource

public final BooleanSource createListSource(boolean[] elements)
Creates a BooleanSource with elements that have the specified boolean values.
Parameters:
elements - An array of boolean values.
Returns:
A BooleanSource with elements that have the specified boolean values.

createListSource

public final Source createListSource(java.lang.Object[][] tuples)
Creates a Source that has the arrays in the tuples array as its element values. Each array in the tuples array specifies a member for one or more MdmSubDimension objects or elements of MdmAttribute objects. MdmSubDimension member values are always String objects. An MdmAttribute can be of any data type; to specify a value of an element of an MdmAttribute, you must encapsulate the value in an appropriate java.lang class. For example, if you want to specify a value for the level depth attribute, then you must wrap the integer in the java.lang.Number class. Valid object types are Boolean, Date, Number, and String. You cannot use a Source object as a value of a component array.

You typically use the Source returned by this method as the comparison parameter in a join method, or as the parameter for the selectValues method, of a Source that has the one of the dimensions as its type and the other dimensions as the types of its outputs. If you use the Source returned by this method in either those ways, then the order of the elements of the each array in the tuples array must match the order of the elements of the Source for which the arrays are providing the values.

The data types of the corresponding elements of each component array must match. For example, if the data types of the elements of the first array are String, Number, and Date, in that order, then the data types of the elements of the other arrays must also be String, Number, and Date in the same order.

The following example creates custSel, which specifies one element of the CUSTOMER dimension, and edge, which represents dimensions for an edge of a cube. Next it creates edgeSel, which specifies values for the dimensions of edge. All of the values are String objects. The example then joins the dimension selections to a measure.

In the code, shipmentsRollup, prodRollup, calendar, and chanRollup are StringSource objects for hierarchies of the CUSTOMER, PRODUCT, TIME, and CHANNEL dimensions, respectively. The dp object is the DataProvider, and units is the Source for the UNITS measure.

 Source custSel = shipmentsRollup.selectValue(
                                  "SHIPMENTS_ROLLUP::SHIP_TO::104");

 Source edge = prodRollup.join(calendar).join(chanRollup);

 Source edgeSel = edge.selectValues(dp.createListSource(
                                    new Object [][] {
                                    {"PRODUCT_ROLLUP::ITEM::13",
                                     "CALENDAR::MONTH::21",
                                     "CHANNEL_ROLLUP::CHANNEL::3"},
                                    {"PRODUCT_ROLLUP::ITEM::13",
                                     "CALENDAR::MONTH::22",
                                     "CHANNEL_ROLLUP::CHANNEL::3"},
                                    {"PRODUCT_ROLLUP::ITEM::14",
                                     "CALENDAR::MONTH::21",
                                     "CHANNEL_ROLLUP::CHANNEL::3"}}));
 
 Source results = units.join(custSel)
                       .join(edgeSel);
Parameters:
tuples - An array of Object arrays.
Returns:
A Source with elements that have the specified arrays, and that is typically used to provide values for a set of dimensions.

createModel

public final CustomModel createModel(Source[] inputs,
                                     Source datatype,
                                     Source[] outputs,
                                     Model[] parentModels)
Creates a CustomModel with the specified inputs, data type, outputs, and parent models.
Parameters:
inputs - An array of Source objects that are the inputs of the CustomModel.
datatype - A fundamental Source that represents the data type of the CustomModel.
outputs - An array of Source objects that are the outputs of the CustomModel.
parentModels - An array of Model objects that are the parent models from which the CustomModel inherits Assignment objects.
Returns:
A CustomModel that has the specified inputs, data type, outputs, and parent models.

createModel

public final CustomModel createModel(Source[] inputs,
                                     Source datatype,
                                     Source[] outputs)
Creates a CustomModel with the specified inputs, data type, and outputs.
Parameters:
inputs - An array of Source objects that are the inputs of the CustomModel.
datatype - A fundamental Source that represents the data type of the CustomModel.
outputs - An array of Source objects that are the outputs of the CustomModel.
Returns:
A CustomModel that has the specified inputs, data type, and outputs.

createModel

public final CustomModel createModel(Source[] inputs,
                                     Source datatype,
                                     Model[] parentModels)
Creates a CustomModel with the specified inputs, data type, and parent models.
Parameters:
inputs - An array of Source objects that are the inputs of the CustomModel.
datatype - A fundamental Source that represents the data type of the CustomModel.
parentModels - An array of Model objects that are the parent models from which the CustomModel inherits Assignment objects.
Returns:
A CustomModel that has the specified inputs, data type, and parent models.

createModel

public final CustomModel createModel(Source[] inputs,
                                     Source datatype)
Creates a CustomModel with the specified inputs and data type.
Parameters:
inputs - An array of Source objects that are the inputs of the CustomModel.
datatype - A fundamental Source that represents the data type of the CustomModel.
Returns:
A CustomModel that has the specified inputs and data type.

createModel

public final CustomModel createModel(Source[] inputs)
Creates a CustomModel with the specified inputs and a data type of Number.
Parameters:
inputs - An array of Source objects that are the inputs of the CustomModel.
Returns:
A CustomModel that has the specified inputs.

createModel

public final CustomModel createModel(Source input,
                                     Source datatype)
Creates a CustomModel with the specified input and data type.
Parameters:
input - A Source that the input of the CustomModel.
datatype - A fundamental Source that represents the data type of the CustomModel.
Returns:
A CustomModel that has the specified input and data type.

createModel

public final CustomModel createModel(Source input)
Creates a CustomModel with the specified input and a data type of Number.
Parameters:
input - A Source that the input of the CustomModel.
Returns:
A CustomModel that has the specified input.

createParameterizedSource

public final StringSource createParameterizedSource(StringParameter param)
Creates a parameterized StringSource that has the value of the specified StringParameter as the value of its element.
Parameters:
param - A StringParameter that supplies the value of the element of the StringSource returned by this method.
Returns:
A StringSource whose element has the current value of the specified StringParameter.

createParameterizedSource

public final DateSource createParameterizedSource(DateParameter param)
Creates a parameterized DateSource that has the value of the specified DateParameter as the value of its element.
Parameters:
param - A DateParameter that supplies the value of the element of the DateSource returned by this method.
Returns:
A DateSource whose element has the current value of the specified DateParameter.

createParameterizedSource

public final BooleanSource createParameterizedSource(BooleanParameter param)
Creates a parameterized BooleanSource that has the value of the specified BooleanParameter as the value of its element.
Parameters:
param - A BooleanParameter that supplies the value of the element of the BooleanSource returned by this method.
Returns:
A BooleanSource whose element has the current value of the specified BooleanParameter.

createParameterizedSource

public final NumberSource createParameterizedSource(NumberParameter param)
Creates a parameterized NumberSource that has the value of the specified NumberParameter as the value of its element.
Parameters:
param - A NumberParameter that supplies the value of the element of the NumberSource returned by this method.
Returns:
A NumberSource whose element has the current value of the specified NumberParameter.

createRangeSource

public final NumberSource createRangeSource(int bottom,
                                            int top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
Parameters:
bottom - The lowest value that you want the returned NumberSource to have.
top - The highest value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified range of values.

createRangeSource

public final NumberSource createRangeSource(int bottom,
                                            NumberSource top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
Parameters:
bottom - The lowest value that you want the returned NumberSource to have.
top - A NumberSource with a single element, which has the int value that you want as the highest value of the returned NumberSource.
Returns:
A NumberSource that has the specified range of values.

createRangeSource

public final NumberSource createRangeSource(NumberSource bottom,
                                            int top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
Parameters:
bottom - A NumberSource with a single element, which has the int value that you want as the lowest value of the returned NumberSource.
top - The highest value that you want the returned NumberSource to have.
Returns:
A NumberSource that has the specified range of values.

createRangeSource

public final NumberSource createRangeSource(NumberSource bottom,
                                            NumberSource top)
Creates a NumberSource with elements that have consecutive int values that range from the specified lowest value to the specified highest value.
Parameters:
bottom - A NumberSource with a single element, which has the int value that you want as the lowest value of the returned NumberSource.
top - A NumberSource with a single element, which has the int value that you want as the highest value of the returned NumberSource.
Returns:
A NumberSource that has the specified range of values.

getEmptySource

public final Source getEmptySource()
Gets the empty Source, which does not have any elements. The empty Source represents an empty result set.
Returns:
The empty Source.

getFundamentalMetadataProvider

public final FundamentalMetadataProvider getFundamentalMetadataProvider()
Gets the FundamentalMetadataProvider for this DataProvider. The FundamentalMetadataProvider provides FundamentalMetadataObject objects that represent Oracle OLAP data types. You can use FundamentalMetadataObject objects to create derived Source objects or instances of custom MtmObject objects.
Returns:
The FundamentalMetadataProvider for this DataProvider.

getTransactionProvider

public final TransactionProvider getTransactionProvider()
Gets the TransactionProvider for this DataProvider.
Returns:
The TransactionProvider for this DataProvider.

getVoidSource

public final Source getVoidSource()
Gets the void Source object, which has a single element that has null as its value.
Returns:
The void Source.

initialize

public abstract void initialize()
                         throws java.sql.SQLException
Initializes this DataProvider. Always call this method after creating a new DataProvider.

This method throws a java.sql.SQLException if an error occurs when Oracle OLAP is preparing for its interactions with the database.


isOpen

public abstract boolean isOpen()
Indicates whether the connection to the data store is currently open.
Returns:
true when the connection to the data store is open or false when it is not.

createSQLCursorManager

public final SQLCursorManager createSQLCursorManager(Source source)
                                              throws TransactionalObjectInvalidException
Creates a SQLCursorManager for the specified Source. From the SQLCursorManager you can obtain the SQL statement that Oracle OLAP generates for the Source.
Parameters:
source - A Source that specifies a query.
Returns:
A SQLCursorManager that has the SQL statement generated for the specified Source.

createSQLCursorManagers

public abstract SQLCursorManager[] createSQLCursorManagers(Source[] sources)
Creates an array of SQLCursorManager objects that has one SQLCursorManager for each of the specified Source objects. From each SQLCursorManager you can obtain the SQL statement that Oracle OLAP generates for its Source. All of the Source objects in the sources array must be active in the same Transaction.
Parameters:
sources - An array of Source objects from the same Transaction.
Returns:
An array of SQLCursorManager objects that have the SQL statements generated for the specified Source objects. .

Oracle® OLAP Java API Reference
10g Release 2 (10.2)

B14348-01

Copyright © 2002, 2005, Oracle. All rights reserved.