Skip navigation links

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

B14348-04


oracle.olapi.data.cursor
Interface CursorManager

All Known Subinterfaces:
SpecifiedCursorManager
All Known Implementing Classes:
ExpressSpecifiedCursorManager

public interface CursorManager

An interface for an object that manages the buffering of data for the Cursor objects it creates. To create a CursorManager, call the createCursorManager method of the DataProvider you are using and pass it a CursorManagerSpecification. If the Source that you used to create the CursorManagerSpecification has an input, then you must add to an array of Source objects a Source that represents that input. Add one Source to the array for each input Source and pass that array as the inputSources parameter of the createCursorManager method.

For example, in the following code unitCost is the Source for an MdmMeasure, and prodHier and calHier are Source objects for the default MdmLevelHierarchy objects for the Product and Time dimensions, which are the dimensions of the measure. The dp object is the DataProvider. The unitCost Source has prodHier and calHier as inputs. The join method in the first line produces unitCostByProducts, which is a Source that has prodHier as an output and still has calHier as an input. The second line creates a Source array that has calHier has the only element. The example then creates a CursorManagerSpecification for unitCostByProducts, and creates a SpecifiedCursorManager.

 Source unitCostByProducts = unitCost.join(prodHier);
 Source[] inputSources = new Source[] {calHier};

 // Preparing and committing the current Transaction not shown.

 CursorManagerSpecification cmSpec =
                   dp.createCursorManagerSpecification(unitCostByProducts);
 SpecifiedCursorManager cursorManager =
                   dp.createCursorManager(cmSpec, inputSources);

With the methods of a CursorManager, you can create a Cursor, add or remove CursorManagerUpdateListener objects, or discover whether the CursorManagerSpecification for the CursorManager needs to be updated.

A CursorManager notifies any CursorManagerUpdateListener objects associated with it when a change occurs to the Source. The Source for a CursorManager is the Source that was passed to the createCursorManagerSpecification method of the DataProvider, the result of which was passed to the createCursorManager method of the DataProvider that created the CursorManager.

The only Source that can change is one returned by the getSource method of a DynamicDefinition for a Template. If the state of the Template changes, then the Source that the Template produces is different than the Source previously produced. If the Transaction in which the change occurred is prepared and committed, then the CursorManager becomes aware that the Source has changed. The CursorManager notifies the CursorManagerUpdateListener objects of the change. An application at any time can also call the isSpecificationUpdateNeeded method to determine if it needs to update the CursorManagerSpecification for the CursorManager in response to changes in the Source.

You can create more than one Cursor from the same CursorManager. Those Cursor objects share the same data cache. You might want to create two different Cursor objects if, for example, you want to display different views of the same data, such as a table view and a graph view.

See Also:
CursorManagerSpecification

Method Summary
 void addCursorManagerUpdateListener(CursorManagerUpdateListener l)
          Adds a CursorManagerUpdateListener to the CursorManager.
 void close()
          Closes the CursorManager and releases the resources associated with it.
 Cursor createCursor()
          Creates a Cursor whose structure is specified by the CursorManagerSpecification that was used to create the CursorManager.
 Cursor createCursor(CursorInput[] cursorInputs)
          Creates a Cursor whose structure is specified by the CursorManagerSpecification that was used to create the CursorManager.
 int getFetchSize()
          Gets the fetch size for a Cursor created by this CursorManager.
 Source getSource()
          Gets the Source for this CursorManager.
 boolean isSpecificationUpdateNeeded()
          Indicates whether the structure has changed of the Source that was used to create the CursorManagerSpecification for the CursorManager.
 void removeCursorManagerUpdateListener(CursorManagerUpdateListener l)
          Removes a CursorManagerUpdateListener from the list of listeners for the CursorManager.
 void setFetchSize(int fetchSize)
          Specifies the fetch size for Cursor objects created by this CursorManager.
 void updateSpecification(CursorInfoSpecification cursorInfoSpec)
          Replaces the CursorInfoSpecification for this CursorManager with the specified CursorInfoSpecification.

 

Method Detail

close

public void close()
Closes the CursorManager and releases the resources associated with it. Any Cursor objects created by the CursorManager become unusable.

createCursor

public Cursor createCursor()
Creates a Cursor whose structure is specified by the CursorManagerSpecification that was used to create the CursorManager.
Returns:
A Cursor.

createCursor

public Cursor createCursor(CursorInput[] cursorInputs)
Creates a Cursor whose structure is specified by the CursorManagerSpecification that was used to create the CursorManager. Use this method if the Source that you used to create the CursorManagerSpecification has an unmatched input. For each Source in the inputSources array that you used to create this CursorManager, add a CursorInput that provides a value for that Source to an array of CursorInput objects and use that array as the cursorInputs parameter.
Parameters:
cursorInputs - An array of CursorInput objects that supply values for the input Source objects specified in the creation of this CursorManager.
Returns:
A Cursor.

isSpecificationUpdateNeeded

public boolean isSpecificationUpdateNeeded()
Indicates whether the structure has changed of the Source that was used to create the CursorManagerSpecification for the CursorManager. If the structure of the Source has changed, then you need to create a new CursorManagerSpecification for the changed Source. You can use the new CursorManagerSpecification to update the specification for the existing CursorManager or use it to create a new CursorManager.
Returns:
true if the structure of the Source for the CursorManager has changed or false if it has not changed.
See Also:
SpecifiedCursorManager

addCursorManagerUpdateListener

public void addCursorManagerUpdateListener(CursorManagerUpdateListener l)
Adds a CursorManagerUpdateListener to the CursorManager.
Parameters:
l - The CursorManagerUpdateListener to add to this CursorManager.
See Also:
CursorManagerUpdateListener

removeCursorManagerUpdateListener

public void removeCursorManagerUpdateListener(CursorManagerUpdateListener l)
Removes a CursorManagerUpdateListener from the list of listeners for the CursorManager.
Parameters:
l - The CursorManagerUpdateListener to remove from the list of listeners.
See Also:
CursorManagerUpdateListener

getSource

public Source getSource()
Gets the Source for this CursorManager.
Returns:
The Source for this CursorManager.

updateSpecification

public void updateSpecification(CursorInfoSpecification cursorInfoSpec)
Replaces the CursorInfoSpecification for this CursorManager with the specified CursorInfoSpecification. When you change the structure of the Source for a CursorManager, the CursorInfoSpecification becomes outdated.

To continue to use this CursorManager, you must create a new CursorInfoSpecification, and call this method and pass in the new CursorInfoSpecification. You can then create new Cursor objects the CursorManager.

Parameters:
cursorInfoSpec - The CursorInfoSpecification with which to replace the current CursorInfoSpecification for this CursorManager.

getFetchSize

public int getFetchSize()
Gets the fetch size for a Cursor created by this CursorManager.
Returns:
An integer that is the fetch size for Cursor objects created by this CursorManager.

setFetchSize

public void setFetchSize(int fetchSize)
Specifies the fetch size for Cursor objects created by this CursorManager.
Parameters:
fetchSize - An integer that is the fetch size you want to specify for Cursor objects created by this CursorManager.

Skip navigation links

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

B14348-04


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