Interface DataFactory
-
- All Superinterfaces:
Cloneable
,Serializable
- All Known Subinterfaces:
CompoundDataFactorySupport
,DataFactoryDesignTimeSupport
- All Known Implementing Classes:
AbstractDataFactory
,AbstractNamedDataFactory
,AbstractScriptableDataFactory
,CachingDataFactory
,CascadingDataFactory
,CompoundDataFactory
,DesignTimeDataFactory
,EmptyDataFactory
,ExternalDataFactory
,NamedStaticDataFactory
,SequenceDataFactory
,SimpleSQLReportDataFactory
,SortingDataFactory
,SQLReportDataFactory
,StaticDataFactory
,TableDataFactory
public interface DataFactory extends Serializable, Cloneable
Creates a tablemodel on request. If the returned tablemodel is a.util.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
Fields Modifier and Type Field Description static String
QUERY_LIMIT
An internal query parameter that holds the maximum number of rows a query should return.static String
QUERY_SORT
static String
QUERY_TIMEOUT
An internal query parameter that holds the query timeout value.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.DataFactoryMetaData
getMetaData()
String[]
getQueryNames()
Returns all known query-names.void
initialize(DataFactoryContext dataFactoryContext)
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.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
-
QUERY_SORT
static final String QUERY_SORT
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
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.
-
initialize
void initialize(DataFactoryContext dataFactoryContext) 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:
dataFactoryContext
- the current data-factory context, holding the configuration, resource-manager, context-key and resource-bundle-factory.- Throws:
ReportDataFactoryException
-
clone
Object clone()
-
getMetaData
DataFactoryMetaData getMetaData()
- Returns:
- the metadata object for this dataFactory
-
-