org.pentaho.platform.plugin.action.sql
Class SQLBaseComponent
java.lang.Object
org.pentaho.platform.engine.core.system.PentahoBase
org.pentaho.platform.engine.services.PentahoMessenger
org.pentaho.platform.engine.services.solution.ComponentBase
org.pentaho.platform.plugin.action.sql.SQLBaseComponent
- All Implemented Interfaces:
- Serializable, IDataComponent, IPreparedComponent, IAuditable, IComponent, ILogger, IParameterResolver
- Direct Known Subclasses:
- SQLLookupRule
public abstract class SQLBaseComponent
- extends ComponentBase
- implements IDataComponent, IPreparedComponent, IParameterResolver
SQLBaseComponent is the base class for SQLExecute and SQLLookupRule. it does the majority
of work when interacting with Pentaho's BI Platform, including implementing the necessary
component features. It also implements IDataComponent and IPreparedComponent.
- See Also:
SQLExecute
,
SQLLookupRule
,
Serialized Form
Fields inherited from interface org.pentaho.platform.api.engine.ILogger |
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN |
Fields inherited from interface org.pentaho.platform.api.engine.ILogger |
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN |
Methods inherited from class org.pentaho.platform.engine.services.solution.ComponentBase |
createFeedbackParameter, createFeedbackParameter, createNewInstance, execute, getActionDefinition, getActionName, getActionTitle, getComponentDefinition, getComponentDefinition, getId, getInitFailMessage, getInitOk, getInstanceId, getLogId, getObjectName, getProcessId, getResourceAsString, getRuntimeContext, getSession, inputMissingError, outputMissingError, promptNeeded, promptNow, resourceComponentSettingError, resourceMissingError, setActionDefinition, setActionName, setComponentDefinition, setComponentDefinitionMap, setInstanceId, setProcessId, setRuntimeContext, setSession, validate |
Methods inherited from class org.pentaho.platform.engine.services.PentahoMessenger |
debug, debug, error, error, fatal, fatal, getMessages, getUserString, info, info, setMessages, trace, trace, warn, warn |
Methods inherited from interface org.pentaho.platform.api.engine.IComponent |
execute, getActionDefinition, getActionName, getComponentDefinition, getInstanceId, getMessages, getProcessId, getRuntimeContext, getSession, setActionDefinition, setActionName, setComponentDefinition, setComponentDefinitionMap, setInstanceId, setMessages, setProcessId, setRuntimeContext, setSession, validate |
Methods inherited from interface org.pentaho.platform.api.engine.ILogger |
debug, debug, error, error, fatal, fatal, getLoggingLevel, info, info, setLoggingLevel, trace, trace, warn, warn |
Methods inherited from interface org.pentaho.platform.api.engine.IComponent |
execute, getActionDefinition, getActionName, getComponentDefinition, getInstanceId, getMessages, getProcessId, getRuntimeContext, getSession, setActionDefinition, setActionName, setComponentDefinition, setComponentDefinitionMap, setInstanceId, setMessages, setProcessId, setRuntimeContext, setSession, validate |
Methods inherited from interface org.pentaho.platform.api.engine.ILogger |
debug, debug, error, error, fatal, fatal, getLoggingLevel, info, info, setLoggingLevel, trace, trace, warn, warn |
PREPARE_PARAMETER_PREFIX
public static final String PREPARE_PARAMETER_PREFIX
- See Also:
- Constant Field Values
SQLBaseComponent
public SQLBaseComponent()
validateSystemSettings
public abstract boolean validateSystemSettings()
getResultOutputName
public abstract String getResultOutputName()
getLogger
public abstract Log getLogger()
- Specified by:
getLogger
in class PentahoBase
getResultSet
public IPentahoResultSet getResultSet()
- returns the result set object
- Specified by:
getResultSet
in interface IDataComponent
- Returns:
- pentaho result set
validateAction
public boolean validateAction()
- validates the action. checks to verify inputs are available to execute
- verify query is available
- verify connection is available, via jndi, connection string, or prepared component
- verify output is specified
done
public void done()
- nothing to do in done call from runtime context.
- Specified by:
done
in interface IComponent
- Specified by:
done
in class ComponentBase
executePrepared
public IPentahoResultSet executePrepared(Map preparedParams)
- executes a prepared method that returns a result set
executePrepared looks up any "PREPARELATER" params
in the preparedParams map.
- Specified by:
executePrepared
in interface IPreparedComponent
- Parameters:
preparedParams
- a map of possible parameters.
- Returns:
- result set
doQuery
public IPentahoResultSet doQuery(SQLConnection sqlConnection,
String query,
boolean forwardOnlyResultset)
throws Exception
- Throws:
Exception
dispose
public void dispose()
- dispose of the resultset, and if the owner, dispose of the connection.
- Specified by:
dispose
in interface IDataComponent
- Specified by:
dispose
in interface IPreparedComponent
resolveParameter
public int resolveParameter(String template,
String parameter,
Matcher parameterMatcher,
int copyStart,
StringBuffer results)
- This method is called when TemplateUtil.applyTemplate() encounters a parameter.
TemplateUtil.applyTemplate is called when someone makes a call to applyInputsToFormat()
In this class it is called in the above "runQuery()" method.
- Specified by:
resolveParameter
in interface IParameterResolver
- Overrides:
resolveParameter
in class ComponentBase
- Parameters:
template
- the source stringparameter
- the parameter valueparameterMatcher
- the regex parameter matchercopyStart
- the start of the copyresults
- the output result
- Returns:
- the next copystart
getDatasourceConnection
public IPentahoConnection getDatasourceConnection()
- attempt to aquire a connection. if connection isn't available, wait a certain period of time
before trying again.
- Returns:
- connection
shareConnection
public IPentahoConnection shareConnection()
- return this class's connection. This implements the IPreparedComponent
interface, which may share its connection with others.
- Specified by:
shareConnection
in interface IPreparedComponent
- Returns:
- connection object
init
public boolean init()
- nothing is done in the init function
- Specified by:
init
in interface IComponent
- Specified by:
init
in class ComponentBase
- Returns:
- true always
getQueryTimeout
public int getQueryTimeout()
setQueryTimeout
public void setQueryTimeout(int timeInSec)
getQuery
public String getQuery()