Class CachingDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.core.cache.CachingDataFactory
-
- All Implemented Interfaces:
Serializable
,Cloneable
,CompoundDataFactorySupport
,DataFactory
,DataFactoryDesignTimeSupport
,DataFactoryMetaProvider
public class CachingDataFactory extends AbstractDataFactory implements CompoundDataFactorySupport
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
AbstractDataFactory.DataRowWrapper
-
-
Field Summary
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
QUERY_LIMIT, QUERY_SORT, QUERY_TIMEOUT
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
DESIGN_TIME
-
-
Constructor Summary
Constructors Constructor Description CachingDataFactory(DataFactory backend, boolean dataCacheEnabled)
CachingDataFactory(DataFactory backend, boolean noClose, boolean dataCacheEnabled)
CachingDataFactory(DataFactory backend, boolean noClose, DataCache dataCache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelRunningQuery()
Attempts to cancel the query process that is generating the data for this data factory.CachingDataFactory
clone()
void
close()
Closes the report data factory and all report data instances that have been returned by this instance.DataFactory
derive()
Derives a freshly initialized report data factory, which is independend of the original data factory.DataFactory
getDataFactoryForQuery(String queryName, boolean freeform)
String[]
getQueryNames()
Returns all known query-names.void
initialize(DataFactoryContext dataFactoryContext)
Initializes the data factory and provides new context information.boolean
isFreeFormQueryExecutable(String query, DataRow parameter)
boolean
isQueryExecutable(String query, DataRow parameters)
Checks whether the query would be executable by this datafactory.boolean
isStaticQueryExecutable(String query, DataRow parameters)
static void
printTableModelContents(TableModel mod)
Prints a table model to standard output.TableModel
queryData(String query, DataRow parameters)
Queries a datasource.TableModel
queryDesignTimeStructure(String query, DataRow parameters)
TableModel
queryDesignTimeStructureFreeForm(String query, DataRow parameters)
TableModel
queryDesignTimeStructureStatic(String query, DataRow parameters)
TableModel
queryFreeForm(String query, DataRow parameters)
TableModel
queryStatic(String query, DataRow parameters)
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getQueryHash, getReferencedFields, getResourceBundleFactory, getResourceManager
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
getMetaData
-
-
-
-
Constructor Detail
-
CachingDataFactory
public CachingDataFactory(DataFactory backend, boolean dataCacheEnabled)
-
CachingDataFactory
public CachingDataFactory(DataFactory backend, boolean noClose, boolean dataCacheEnabled)
-
CachingDataFactory
public CachingDataFactory(DataFactory backend, boolean noClose, DataCache dataCache)
-
-
Method Detail
-
initialize
public void initialize(DataFactoryContext dataFactoryContext) throws ReportDataFactoryException
Description copied from interface:DataFactory
Initializes the data factory and provides new context information. Initialize is always called before the datafactory has been opened by calling DataFactory#open.- Specified by:
initialize
in interfaceDataFactory
- Overrides:
initialize
in classAbstractDataFactory
- Parameters:
dataFactoryContext
- the current data-factory context, holding the configuration, resource-manager, context-key and resource-bundle-factory.- Throws:
ReportDataFactoryException
-
isQueryExecutable
public boolean isQueryExecutable(String query, DataRow parameters)
Description copied from interface:DataFactory
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.- Specified by:
isQueryExecutable
in interfaceDataFactory
- 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.
-
isFreeFormQueryExecutable
public boolean isFreeFormQueryExecutable(String query, DataRow parameter)
- Specified by:
isFreeFormQueryExecutable
in interfaceCompoundDataFactorySupport
-
queryStatic
public TableModel queryStatic(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
queryStatic
in interfaceCompoundDataFactorySupport
- Throws:
ReportDataFactoryException
-
queryDesignTimeStructureStatic
public TableModel queryDesignTimeStructureStatic(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
queryDesignTimeStructureStatic
in interfaceCompoundDataFactorySupport
- Throws:
ReportDataFactoryException
-
queryFreeForm
public TableModel queryFreeForm(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
queryFreeForm
in interfaceCompoundDataFactorySupport
- Throws:
ReportDataFactoryException
-
queryDesignTimeStructureFreeForm
public TableModel queryDesignTimeStructureFreeForm(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
queryDesignTimeStructureFreeForm
in interfaceCompoundDataFactorySupport
- Throws:
ReportDataFactoryException
-
isStaticQueryExecutable
public boolean isStaticQueryExecutable(String query, DataRow parameters)
- Specified by:
isStaticQueryExecutable
in interfaceCompoundDataFactorySupport
-
queryData
public 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. The dataset may change between two calls, do not assume anything!- Specified by:
queryData
in interfaceDataFactory
- Parameters:
query
-parameters
-- Returns:
- Throws:
ReportDataFactoryException
- if an error occured while performing the query.
-
queryDesignTimeStructure
public TableModel queryDesignTimeStructure(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
queryDesignTimeStructure
in interfaceDataFactoryDesignTimeSupport
- Overrides:
queryDesignTimeStructure
in classAbstractDataFactory
- Throws:
ReportDataFactoryException
-
close
public void close()
Closes the report data factory and all report data instances that have been returned by this instance.- Specified by:
close
in interfaceDataFactory
-
derive
public DataFactory derive()
Derives a freshly initialized report data factory, which is independend of the original data factory. Opening or Closing one data factory must not affect the other factories.- Specified by:
derive
in interfaceDataFactory
- Overrides:
derive
in classAbstractDataFactory
- Returns:
- nothing, the method dies instead.
- Throws:
UnsupportedOperationException
- as this class is not derivable.
-
printTableModelContents
public static void printTableModelContents(TableModel mod)
Prints a table model to standard output.- Parameters:
mod
- the model.
-
getQueryNames
public String[] getQueryNames()
Description copied from interface:DataFactory
Returns all known query-names. A data-factory may accept more than the query-names returned here.- Specified by:
getQueryNames
in interfaceDataFactory
- Returns:
- the known query names.
-
cancelRunningQuery
public void cancelRunningQuery()
Description copied from interface:DataFactory
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.- Specified by:
cancelRunningQuery
in interfaceDataFactory
- Overrides:
cancelRunningQuery
in classAbstractDataFactory
-
clone
public CachingDataFactory clone()
- Specified by:
clone
in interfaceDataFactory
- Overrides:
clone
in classAbstractDataFactory
-
getDataFactoryForQuery
public DataFactory getDataFactoryForQuery(String queryName, boolean freeform)
- Specified by:
getDataFactoryForQuery
in interfaceCompoundDataFactorySupport
-
-