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.AbstractDataFactory
A 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 void
cancelRunningQuery()
ScriptableDataFactory
clone()
void
close()
Closes the data factory and frees all resources held by this instance.protected org.apache.bsf.BSFManager
createInterpreter()
Creates a new interpreter instance.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.String
getLanguage()
String
getQuery(String name)
String[]
getQueryNames()
String
getScript()
String
getShutdownScript()
protected void
initializeInterpreter(org.apache.bsf.BSFManager interpreter)
Initializes the Bean-Scripting Framework manager.boolean
isQueryExecutable(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)
Checks whether the query would be executable by this datafactory.TableModel
queryData(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)
Queries a datasource.void
setLanguage(String language)
void
setQuery(String name, String value)
void
setScript(String script)
void
setShutdownScript(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.BSFException
Creates 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.BSFException
Initializes 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:
clone
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactory
- Overrides:
clone
in 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:
derive
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactory
- Overrides:
derive
in 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:
cancelRunningQuery
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactory
- Overrides:
cancelRunningQuery
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
-