Class ScriptableDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.extensions.datasources.scriptable.ScriptableDataFactory
-
- All Implemented Interfaces:
Serializable,Cloneable,org.pentaho.reporting.engine.classic.core.DataFactory,org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport,org.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
public class ScriptableDataFactory extends org.pentaho.reporting.engine.classic.core.AbstractDataFactoryA datafactory that uses a bean-scripting framework script to produce a tablemodel.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ScriptableDataFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelRunningQuery()ScriptableDataFactoryclone()voidclose()Closes the data factory and frees all resources held by this instance.protected org.apache.bsf.BSFManagercreateInterpreter()Creates a new interpreter instance.org.pentaho.reporting.engine.classic.core.DataFactoryderive()Returns a copy of the data factory that is not affected by its ancestor and holds no connection to the ancestor anymore.StringgetLanguage()StringgetQuery(String name)String[]getQueryNames()StringgetScript()StringgetShutdownScript()protected voidinitializeInterpreter(org.apache.bsf.BSFManager interpreter)Initializes the Bean-Scripting Framework manager.booleanisQueryExecutable(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)Checks whether the query would be executable by this datafactory.TableModelqueryData(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)Queries a datasource.voidsetLanguage(String language)voidsetQuery(String name, String value)voidsetScript(String script)voidsetShutdownScript(String shutdownScript)-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getQueryHash, getReferencedFields, getResourceBundleFactory, getResourceManager, initialize, queryDesignTimeStructure
-
-
-
-
Method Detail
-
getLanguage
public String getLanguage()
-
setLanguage
public void setLanguage(String language)
-
getScript
public String getScript()
-
setScript
public void setScript(String script)
-
getShutdownScript
public String getShutdownScript()
-
setShutdownScript
public void setShutdownScript(String shutdownScript)
-
getQueryNames
public String[] getQueryNames()
-
createInterpreter
protected org.apache.bsf.BSFManager createInterpreter() throws org.apache.bsf.BSFExceptionCreates a new interpreter instance.- Returns:
- the interpreter or null, if there was an error.
- Throws:
org.apache.bsf.BSFException
-
initializeInterpreter
protected void initializeInterpreter(org.apache.bsf.BSFManager interpreter) throws org.apache.bsf.BSFExceptionInitializes the Bean-Scripting Framework manager.- Parameters:
interpreter- the BSF-Manager that should be initialized.- Throws:
org.apache.bsf.BSFException- if an error occurred.
-
queryData
public TableModel queryData(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters) throws org.pentaho.reporting.engine.classic.core.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 stringparameters- the parameters for the query- Returns:
- the result of the query as table model.
- Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException- if an error occurred while performing the query.
-
clone
public ScriptableDataFactory clone()
- Specified by:
clonein interfaceorg.pentaho.reporting.engine.classic.core.DataFactory- Overrides:
clonein classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
derive
public org.pentaho.reporting.engine.classic.core.DataFactory derive()
Returns a copy of the data factory that is not affected by its ancestor and holds no connection to the ancestor anymore. A data-factory will be derived at the beginning of the report processing.- Specified by:
derivein interfaceorg.pentaho.reporting.engine.classic.core.DataFactory- Overrides:
derivein classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory- Returns:
- a copy of the data factory.
-
close
public void close()
Closes the data factory and frees all resources held by this instance.
-
isQueryExecutable
public boolean isQueryExecutable(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.- Parameters:
query-parameters-- Returns:
-
cancelRunningQuery
public void cancelRunningQuery()
- Specified by:
cancelRunningQueryin interfaceorg.pentaho.reporting.engine.classic.core.DataFactory- Overrides:
cancelRunningQueryin classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
-