org.pentaho.reporting.engine.classic.core
Interface DataFactory

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
CompoundDataFactorySupport, ContextAwareDataFactory, NamedDataFactory
All Known Implementing Classes:
CachingDataFactory, CachingDataFactory, CascadingDataFactory, CompoundDataFactory, EmptyDataFactory, ExternalDataFactory, NamedStaticDataFactory, SimpleSQLReportDataFactory, SQLReportDataFactory, StaticDataFactory, TableDataFactory

public interface DataFactory
extends Serializable, Cloneable

Creates a tablemodel on request. If the returned tablemodel is a CloseableTableModel the tablemodel must remain open until the DataFactory remains open. The TableModel should not be disposed until the data-factory has been closed.

Author:
Thomas Morgner

Field Summary
static String QUERY_LIMIT
          An internal query parameter that holds the maximum number of rows a query should return.
static String QUERY_TIMEOUT
          An internal query parameter that holds the query timeout value.
 
Method Summary
 void cancelRunningQuery()
          Attempts to cancel the query process that is generating the data for this data factory.
 Object clone()
           
 void close()
          Closes the data factory and frees all resources held by this instance.
 DataFactory derive()
          Returns a copy of the data factory that is not affected by its anchestor and holds no connection to the anchestor anymore.
 String[] getQueryNames()
          Returns all known query-names.
 void initialize(org.pentaho.reporting.libraries.base.config.Configuration configuration, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey contextKey, ResourceBundleFactory resourceBundleFactory)
          Initializes the data factory and provides new context information.
 boolean isQueryExecutable(String query, DataRow parameters)
          Checks whether the query would be executable by this datafactory.
 void open()
          Deprecated. Write your datafactories so that connections are opened on their first use. This method will go away in the next major release.
 TableModel queryData(String query, DataRow parameters)
          Queries a datasource.
 

Field Detail

QUERY_LIMIT

static final String QUERY_LIMIT
An internal query parameter that holds the maximum number of rows a query should return.

See Also:
Constant Field Values

QUERY_TIMEOUT

static final String QUERY_TIMEOUT
An internal query parameter that holds the query timeout value. This is passed to the data-source. The handling of this parameter is implementation dependent.

See Also:
Constant Field Values
Method Detail

initialize

void initialize(org.pentaho.reporting.libraries.base.config.Configuration configuration,
                org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                org.pentaho.reporting.libraries.resourceloader.ResourceKey contextKey,
                ResourceBundleFactory resourceBundleFactory)
                throws ReportDataFactoryException
Initializes the data factory and provides new context information. Initialize is always called before the datafactory has been opened by calling DataFactory#open.

Parameters:
configuration - the current report configuration.
resourceManager - the report's resource manager.
contextKey - the report's context key to access resources relative to the report location.
resourceBundleFactory - the report's resource-bundle factory to access localization information.
Throws:
ReportDataFactoryException

queryData

TableModel queryData(String query,
                     DataRow parameters)
                     throws ReportDataFactoryException
Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain more data than actually needed for the query.

The parameter-dataset may change between two calls, do not assume anything, and do not hold references to the parameter-dataset or the position of the columns in the dataset.

Parameters:
query - the query string, never null.
parameters - the parameters for the query, never null.
Returns:
the result of the query as table model.
Throws:
ReportDataFactoryException - if an error occured while performing the query.

derive

DataFactory derive()
Returns a copy of the data factory that is not affected by its anchestor and holds no connection to the anchestor anymore. A data-factory will be derived at the beginning of the report processing.

Returns:
a copy of the data factory.

open

void open()
          throws ReportDataFactoryException
Deprecated. Write your datafactories so that connections are opened on their first use. This method will go away in the next major release.

Opens the data factory. This initializes everything. Performing queries on data factories which have not yet been opened will result in exceptions.

Throws:
ReportDataFactoryException - if an error occured while opening the datafactory resources.

close

void close()
Closes the data factory and frees all resources held by this instance.


isQueryExecutable

boolean isQueryExecutable(String query,
                          DataRow parameters)
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.

Parameters:
query - the query, never null.
parameters - the parameters, never null.
Returns:
true, if the query would be executable, false if the query is not recognized.

getQueryNames

String[] getQueryNames()
Returns all known query-names. A data-factory may accept more than the query-names returned here.

Returns:
the known query names.

cancelRunningQuery

void cancelRunningQuery()
Attempts to cancel the query process that is generating the data for this data factory. If it is not possible to cancel the query, this call should be ignored.


clone

Object clone()