org.pentaho.di.core.variables
Interface VariableSpace

All Known Subinterfaces:
ScriptInterface, StepInterface
All Known Implementing Classes:
Abort, AbstractStep, AccessInput, AccessOutput, AddSequence, AddXML, AggregateRows, AnalyticQuery, Append, AutoDoc, BaseStep, BlockingStep, BlockUntilStepsFinish, Calculator, ChangeFileEncoding, CheckSum, CloneRow, ClosureGenerator, ClusterSchema, ColumnExists, CombinationLookup, ConcatFields, Constant, CreditCardValidator, CsvInput, CubeInput, CubeOutput, Database, DatabaseJoin, DatabaseLookup, DatabaseMeta, DataGrid, DBProc, Delay, Delete, Denormaliser, DetectEmptyStream, DetectLastRow, DimensionLookup, DummyTrans, DynamicSQLRow, Edi2Xml, ElasticSearchBulk, ExcelInput, ExcelOutput, ExcelWriterStep, ExecProcess, ExecSQL, ExecSQLRow, FieldsChangeSequence, FieldSplitter, FileExists, FileLocked, FilesFromResult, FilesToResult, FilterRows, FixedInput, Flattener, Formula, FuzzyMatch, GaInputStep, GetFileNames, GetFilesRowsCount, GetPreviousRowField, GetRepositoryNames, GetSlaveSequence, GetSubFolders, GetTableNames, GetVariable, GetXMLData, GPBulkLoader, GroupBy, HTTP, HTTPPOST, IfNull, InfobrightLoader, IngresVectorwiseLoader, Injector, InsertUpdate, Janino, JavaFilter, Job, JobEntryAbort, JobEntryAddResultFilenames, JobEntryBase, JobEntryCheckDbConnections, JobEntryCheckFilesLocked, JobEntryColumnsExist, JobEntryConnectedToRepository, JobEntryCopyFiles, JobEntryCopyMoveResultFilenames, JobEntryCreateFile, JobEntryCreateFolder, JobEntryDelay, JobEntryDeleteFile, JobEntryDeleteFiles, JobEntryDeleteFolders, JobEntryDeleteResultFilenames, JobEntryDosToUnix, JobEntryDTDValidator, JobEntryEmpty, JobEntryEval, JobEntryEvalFilesMetrics, JobEntryEvalTableContent, JobEntryExportRepository, JobEntryFileCompare, JobEntryFileExists, JobEntryFilesExist, JobEntryFolderIsEmpty, JobEntryFoldersCompare, JobEntryFTP, JobEntryFTPDelete, JobEntryFTPPUT, JobEntryFTPSGet, JobEntryFTPSPUT, JobEntryGetPOP, JobEntryHTTP, JobEntryJob, JobEntryMail, JobEntryMailValidator, JobEntryMoveFiles, JobEntryMSAccessBulkLoad, JobEntryMsgBoxInfo, JobEntryMssqlBulkLoad, JobEntryMysqlBulkFile, JobEntryMysqlBulkLoad, JobEntryPGPDecryptFiles, JobEntryPGPEncryptFiles, JobEntryPGPVerify, JobEntryPing, JobEntrySetVariables, JobEntrySFTP, JobEntrySFTPPUT, JobEntryShell, JobEntrySimpleEval, JobEntrySNMPTrap, JobEntrySpecial, JobEntrySQL, JobEntrySSH2GET, JobEntrySSH2PUT, JobEntrySuccess, JobEntrySyslog, JobEntryTableExists, JobEntryTalendJobExec, JobEntryTrans, JobEntryTruncateTables, JobEntryUnZip, JobEntryWaitForFile, JobEntryWaitForSQL, JobEntryWebServiceAvailable, JobEntryWriteToFile, JobEntryWriteToLog, JobEntryXMLWellFormed, JobEntryXSDValidator, JobEntryXSLT, JobEntryZipFile, JobMeta, JoinRows, JsonInput, JsonOutput, LDAPInput, LDAPOutput, LDIFInput, LoadFileInput, LucidDBBulkLoader, LucidDBStreamingLoader, Mail, MailInput, MailValidator, Mapping, MappingInput, MappingOutput, MemoryGroupBy, MergeJoin, MergeRows, MetaInject, MondrianInput, MonetDBAgileMart, MonetDBBulkLoader, MultiMergeJoin, MySQLBulkLoader, Normaliser, NullIf, NumberRange, OlapInput, OraBulkLoader, ParGzipCsvInput, PentahoReportingOutput, PGBulkLoader, PrioritizeStreams, ProcessFiles, PropertyInput, PropertyOutput, RandomCCNumberGenerator, RandomValue, RegexEval, ReplaceString, ReservoirSampling, Rest, RowGenerator, RowsFromResult, RowsToResult, RssInput, RssOutput, Rules, SalesforceDelete, SalesforceInput, SalesforceInsert, SalesforceUpdate, SalesforceUpsert, SampleRows, SapInput, SasInput, Script, ScriptDummy, ScriptValuesMod, ScriptValuesModDummy, SecretKeyGenerator, SelectValues, SetValueConstant, SetValueField, SetVariable, SingleThreader, SlaveServer, SocketReader, SocketWriter, SortedMerge, SortRows, SplitFieldToRows, SQLFileOutput, SSH, StepMetastructure, StepsMetrics, StreamLookup, StringCut, StringOperations, SwitchCase, SymmetricCryptoTrans, SynchronizeAfterMerge, SyslogMessage, SystemData, TableAgileMart, TableExists, TableInput, TableOutput, TeraFast, TextFileInput, TextFileOutput, Trans, TransMeta, UniqueRows, UniqueRowsByHashSet, UnivariateStats, Update, UserDefinedJavaClass, Validator, ValueMapper, Variables, WebService, WebServiceAvailable, WriteToLog, XBaseInput, XMLInput, XMLInputSax, XMLInputStream, XMLJoin, XMLOutput, XsdValidator, Xslt, YamlInput

public interface VariableSpace

Interface to implement variable sensitive objects.

Author:
Sven Boden

Method Summary
 void copyVariablesFrom(VariableSpace space)
          Copy the variables from another space, without initializing with the defaults.
 String environmentSubstitute(String aString)
          Substitute the string using the current variable space.
 String[] environmentSubstitute(String[] string)
          Replaces environment variables in an array of strings.
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
          This method returns a boolean for the new variable check boxes.
 VariableSpace getParentVariableSpace()
          Get the parent of the variable space.
 String getVariable(String variableName)
          Get the value of a variable.
 String getVariable(String variableName, String defaultValue)
          Get the value of a variable with a default in case the variable is not found.
 void initializeVariablesFrom(VariableSpace parent)
          Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()).
 void injectVariables(Map<String,String> prop)
          Inject variables.
 String[] listVariables()
          List the variables (not the values) that are currently in the variable space.
 void setParentVariableSpace(VariableSpace parent)
          Set the parent variable space
 void setVariable(String variableName, String variableValue)
          Sets a variable in the Kettle Variables list.
 void shareVariablesWith(VariableSpace space)
          Share a variable space from another variable space.
 

Method Detail

initializeVariablesFrom

void initializeVariablesFrom(VariableSpace parent)
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). The parent is set as parent variable space.

Parameters:
parent - the parent to start from, or null if root.

copyVariablesFrom

void copyVariablesFrom(VariableSpace space)
Copy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.

Parameters:
space - the space to copy the variables from.

shareVariablesWith

void shareVariablesWith(VariableSpace space)
Share a variable space from another variable space. This means that the object should take over the space used as argument.

Parameters:
space - Variable space to be shared.

getParentVariableSpace

VariableSpace getParentVariableSpace()
Get the parent of the variable space.

Returns:
the parent.

setParentVariableSpace

void setParentVariableSpace(VariableSpace parent)
Set the parent variable space

Parameters:
parent - The parent variable space to set

setVariable

void setVariable(String variableName,
                 String variableValue)
Sets a variable in the Kettle Variables list.

Parameters:
variableName - The name of the variable to set
variableValue - The value of the variable to set. If the variableValue is null, the variable is cleared from the list.

getVariable

String getVariable(String variableName,
                   String defaultValue)
Get the value of a variable with a default in case the variable is not found.

Parameters:
variableName - The name of the variable
defaultValue - The default value in case the variable could not be found
Returns:
the String value of a variable

getVariable

String getVariable(String variableName)
Get the value of a variable.

Parameters:
variableName - The name of the variable
Returns:
the String value of a variable or null in case the variable could not be found.

getBooleanValueOfVariable

boolean getBooleanValueOfVariable(String variableName,
                                  boolean defaultValue)
This method returns a boolean for the new variable check boxes. If the variable name is not set or the variable name is not specified, this method simply returns the default value. If not, it convert the variable value to a boolean. "Y", "YES" and "TRUE" all convert to true. (case insensitive)

Parameters:
variableName - The variable to look up.
defaultValue - The default value to return.
Returns:
See Also:
static method ValueMeta.convertStringToBoolean()

listVariables

String[] listVariables()
List the variables (not the values) that are currently in the variable space.

Returns:
Array of String variable names.

environmentSubstitute

String environmentSubstitute(String aString)
Substitute the string using the current variable space.

Parameters:
aString - The string to substitute.
Returns:
The substituted string.

environmentSubstitute

String[] environmentSubstitute(String[] string)
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)

Parameters:
string - The array of strings that wants its variables to be replaced.
Returns:
the array with the environment variables replaced.

injectVariables

void injectVariables(Map<String,String> prop)
Inject variables. The behaviour should be that the properties object will be stored and at the time the VariableSpace is initialized (or upon calling this method if the space is already initialized). After injecting the link of the properties object should be removed.

Parameters:
prop - Properties object containing key-value pairs.