public abstract class SQLBaseComponent
extends org.pentaho.platform.engine.services.solution.ComponentBase
implements org.pentaho.platform.api.data.IDataComponent, org.pentaho.platform.api.data.IPreparedComponent, org.pentaho.platform.api.engine.IParameterResolver
SQLExecute,
SQLLookupRule,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected org.pentaho.commons.connection.IPentahoConnection |
connection
reference to connection object
|
protected boolean |
connectionOwner
is set to false if using another IPreparedComponents connection vs own
|
static String |
PREPARE_PARAMETER_PREFIX |
protected List |
preparedParameters
stores the prepared parameters for later use
|
protected String |
preparedQuery
stores the prepared query for later use
|
COMPONENT_EXECUTE_FAIL, debug, MISSING_SESSION, UNKNOWN_COMPONENT_IDEMPTYLOGID, loggingLevel, LOGID_MASK1, LOGID_MASK2, LOGID_SEPARATOR| Constructor and Description |
|---|
SQLBaseComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
dispose of the resultset, and if the owner, dispose of the connection.
|
void |
done()
nothing to do in done call from runtime context.
|
org.pentaho.commons.connection.IPentahoResultSet |
doQuery(SQLConnection sqlConnection,
String query,
boolean forwardOnlyResultset) |
protected boolean |
executeAction()
determines state of component, and executes accordingly.
|
org.pentaho.commons.connection.IPentahoResultSet |
executePrepared(Map preparedParams)
executes a prepared method that returns a result set executePrepared looks up any "PREPARELATER" params in the
preparedParams map.
|
protected org.pentaho.commons.connection.IPentahoConnection |
getConnection()
pass through to getConnection(defaultConnection)
|
protected org.pentaho.commons.connection.IPentahoConnection |
getConnection(org.pentaho.commons.connection.IPentahoConnection defaultConnection)
This method retrieves a connection based on the components inputs.
|
org.pentaho.commons.connection.IPentahoConnection |
getDatasourceConnection()
attempt to aquire a connection.
|
abstract org.apache.commons.logging.Log |
getLogger() |
int |
getMaxRows() |
protected org.pentaho.commons.connection.IPentahoMetaData |
getMetadata(org.pentaho.commons.connection.IPentahoResultSet resultSet,
boolean live)
returns metadata based on the result set.
|
String |
getQuery() |
int |
getQueryTimeout() |
boolean |
getReadOnly() |
abstract String |
getResultOutputName() |
org.pentaho.commons.connection.IPentahoResultSet |
getResultSet()
returns the result set object
|
boolean |
init()
nothing is done in the init function
|
protected boolean |
prepareQuery(String rawQuery)
called when in prepared-component mode, this method populates the preparedQuery string and preparedParameters
object.
|
int |
resolveParameter(String template,
String parameter,
Matcher parameterMatcher,
int copyStart,
StringBuffer results)
This method is called when TemplateUtil.applyTemplate() encounters a parameter.
|
protected boolean |
runQuery(String rawQuery,
boolean live)
executes the specified query template.
|
void |
setMaxRows(int value) |
void |
setQueryTimeout(int timeInSec) |
void |
setReadOnly(boolean value) |
org.pentaho.commons.connection.IPentahoConnection |
shareConnection()
return this class's connection.
|
boolean |
validateAction()
validates the action.
|
abstract boolean |
validateSystemSettings() |
protected void |
waitFor(int millis)
pause the thread a certain number of milliseconds
|
addTempParameter, addTempParameterObject, applyInputsToFormat, audit, createFeedbackParameter, createFeedbackParameter, createFeedbackParameter, createFeedbackParameter, createFeedbackParameter, createFeedbackParameter, createFeedbackParameter, createNewInstance, execute, feedbackAllowed, getActionDefinition, getActionName, getActionTitle, getComponentDefinition, getComponentDefinition, getContentOutputItem, getDefaultOutputStream, getFeedbackOutputStream, getId, getInitFailMessage, getInitOk, getInputBooleanValue, getInputLongValue, getInputNames, getInputParameter, getInputStream, getInputStringValue, getInputStringValue, getInputValue, getInstanceId, getLogId, getObjectName, getOutputContentItem, getOutputContentItem, getOutputItem, getOutputItem, getOutputNames, getOutputPreference, getProcessId, getResource, getResourceAsString, getResourceDataSource, getResourceInputStream, getResourceNames, getRuntimeContext, getSession, getSetting, getSolutionName, getSolutionPath, getStringSetting, inputMissingError, isDefinedInput, isDefinedOutput, isDefinedResource, isPromptPending, outputMissingError, promptNeeded, promptNow, resourceComponentSettingError, resourceMissingError, saveSetting, setActionDefinition, setActionName, setComponentDefinition, setComponentDefinitionMap, setFeedbackMimeType, setInstanceId, setOutputMimeType, setOutputMimeType, setOutputValue, setProcessId, setRuntimeContext, setSession, validatedebug, debug, error, error, error, fatal, fatal, getMessages, getUserString, info, info, setMessages, trace, trace, warn, warngenLogIdFromInfo, genLogIdFromInfo, genLogIdFromSession, getLoggingLevel, setLoggingLevel, setLogIdclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecute, getActionDefinition, getActionName, getComponentDefinition, getInstanceId, getMessages, getProcessId, getRuntimeContext, getSession, setActionDefinition, setActionName, setComponentDefinition, setComponentDefinitionMap, setInstanceId, setMessages, setProcessId, setRuntimeContext, setSession, validatepublic static final String PREPARE_PARAMETER_PREFIX
protected String preparedQuery
protected List preparedParameters
protected boolean connectionOwner
protected org.pentaho.commons.connection.IPentahoConnection connection
public abstract boolean validateSystemSettings()
validateSystemSettings in class org.pentaho.platform.engine.services.solution.ComponentBasepublic abstract String getResultOutputName()
public abstract org.apache.commons.logging.Log getLogger()
getLogger in class org.pentaho.platform.engine.core.system.PentahoBasepublic org.pentaho.commons.connection.IPentahoResultSet getResultSet()
getResultSet in interface org.pentaho.platform.api.data.IDataComponentpublic boolean validateAction()
validateAction in class org.pentaho.platform.engine.services.solution.ComponentBasepublic void done()
done in interface org.pentaho.platform.api.engine.IComponentdone in class org.pentaho.platform.engine.services.solution.ComponentBaseprotected boolean executeAction()
executeAction in class org.pentaho.platform.engine.services.solution.ComponentBaseprotected org.pentaho.commons.connection.IPentahoMetaData getMetadata(org.pentaho.commons.connection.IPentahoResultSet resultSet,
boolean live)
resultSet - result set object to find metadatalive - if false, create an in memory versionpublic org.pentaho.commons.connection.IPentahoResultSet executePrepared(Map preparedParams)
executePrepared in interface org.pentaho.platform.api.data.IPreparedComponentpreparedParams - a map of possible parameters.protected boolean prepareQuery(String rawQuery)
rawQuery - protected boolean runQuery(String rawQuery, boolean live)
rawQuery - query templatelive - returns original result set if true, memory result set if falsepublic org.pentaho.commons.connection.IPentahoResultSet doQuery(SQLConnection sqlConnection, String query, boolean forwardOnlyResultset) throws Exception
Exceptionpublic void dispose()
dispose in interface org.pentaho.commons.connection.IDisposabledispose in interface org.pentaho.platform.api.data.IDataComponentdispose in interface org.pentaho.platform.api.data.IPreparedComponentpublic int resolveParameter(String template, String parameter, Matcher parameterMatcher, int copyStart, StringBuffer results)
resolveParameter in interface org.pentaho.platform.api.engine.IParameterResolverresolveParameter in class org.pentaho.platform.engine.services.solution.ComponentBasetemplate - the source stringparameter - the parameter valueparameterMatcher - the regex parameter matchercopyStart - the start of the copyresults - the output resultpublic org.pentaho.commons.connection.IPentahoConnection getDatasourceConnection()
protected void waitFor(int millis)
millis - time to sleeppublic org.pentaho.commons.connection.IPentahoConnection shareConnection()
shareConnection in interface org.pentaho.platform.api.data.IPreparedComponentprotected org.pentaho.commons.connection.IPentahoConnection getConnection()
protected org.pentaho.commons.connection.IPentahoConnection getConnection(org.pentaho.commons.connection.IPentahoConnection defaultConnection)
defaultConnection - a default connection to use if no other is availablepublic boolean init()
init in interface org.pentaho.platform.api.engine.IComponentinit in class org.pentaho.platform.engine.services.solution.ComponentBasepublic int getQueryTimeout()
public void setQueryTimeout(int timeInSec)
public int getMaxRows()
public void setMaxRows(int value)
public String getQuery()
public void setReadOnly(boolean value)
public boolean getReadOnly()
Copyright © 2020 Hitachi Vantara. All rights reserved.