本文整理汇总了Java中org.pentaho.di.core.variables.VariableSpace.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java VariableSpace.getVariable方法的具体用法?Java VariableSpace.getVariable怎么用?Java VariableSpace.getVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.variables.VariableSpace
的用法示例。
在下文中一共展示了VariableSpace.getVariable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setVariables(VariableSpace space)
{
this.variables = new HashMap<String, String>();
for (String name : space.listVariables())
{
String value = space.getVariable(name);
this.variables.put(name, value);
}
}
示例2: getVariableName
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public static final String getVariableName(Shell shell, VariableSpace space)
{
String keys[] = space.listVariables();
Arrays.sort(keys);
int size = keys.length;
String key[] = new String[size];
String val[] = new String[size];
String str[] = new String[size];
for (int i=0;i<keys.length;i++)
{
key[i] = keys[i];
val[i] = space.getVariable(key[i]);
str[i] = key[i]+" ["+val[i]+"]";
}
EnterSelectionDialog esd = new EnterSelectionDialog(shell, str, Messages.getString("System.Dialog.SelectEnvironmentVar.Title"), Messages.getString("System.Dialog.SelectEnvironmentVar.Message"));
esd.clearModal();
if (esd.open()!=null)
{
int nr = esd.getSelectionNr();
String var = key[nr];
return var;
}
else
{
return null;
}
}
示例3: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
setInternalFilenameKettleVariables(var);
setInternalNameKettleVariable(var);
// The name of the directory in the repository
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, directory!=null?directory.getPath():"");
// Here we don't remove the job specific parameters, as they may come in handy.
//
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "Parent Job File Directory"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "Parent Job Filename"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, "Parent Job Name"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "Parent Job Repository Directory"); //$NON-NLS-1$
}
}
示例4: getVariableName
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public static final String getVariableName(Shell shell, VariableSpace space)
{
String keys[] = space.listVariables();
Arrays.sort(keys);
int size = keys.length;
String key[] = new String[size];
String val[] = new String[size];
String str[] = new String[size];
for (int i=0;i<keys.length;i++)
{
key[i] = keys[i];
val[i] = space.getVariable(key[i]);
str[i] = key[i]+" ["+val[i]+"]";
}
EnterSelectionDialog esd = new EnterSelectionDialog(shell, str, BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Title"), BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Message"));
esd.clearModal();
if (esd.open()!=null)
{
int nr = esd.getSelectionNr();
String var = key[nr];
return var;
}
else
{
return null;
}
}
示例5: getLogBuffer
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
protected String getLogBuffer(VariableSpace space, String logChannelId, LogStatus status, String limit) {
StringBuffer buffer = CentralLogStore.getAppender().getBuffer(logChannelId, true);
if (Const.isEmpty(limit)) {
String defaultLimit = space.getVariable(Const.KETTLE_LOG_SIZE_LIMIT, null);
if (!Const.isEmpty(defaultLimit)) {
limit = defaultLimit;
}
}
// See if we need to limit the amount of rows
//
int nrLines = Const.isEmpty(limit) ? -1 : Const.toInt(space.environmentSubstitute(limit), -1);
if (nrLines>0) {
int start = buffer.length()-1;
for (int i=0;i<nrLines && start>0;i++) {
start = buffer.lastIndexOf(Const.CR, start-1);
}
if (start>0) {
buffer.delete(0, start+Const.CR.length());
}
}
return buffer.append(Const.CR + status.getStatus().toUpperCase() + Const.CR).toString();
}
示例6: getConfigBuilder
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
* This factory returns a FileSystemConfigBuilder.
* Custom FileSystemConfigBuilders can be created by implementing the {@link IKettleFileSystemConfigBuilder}
* or overriding the {@link KettleGenericFileSystemConfigBuilder}
*
* @see FileSystemConfigBuilder
*
* @param varSpace A Kettle variable space for resolving VFS config parameters
* @param scheme The VFS scheme (FILE, HTTP, SFTP, etc...)
* @return A FileSystemConfigBuilder that can translate Kettle variables into VFS config parameters
* @throws IOException
*/
public static IKettleFileSystemConfigBuilder getConfigBuilder(VariableSpace varSpace, String scheme) throws IOException {
IKettleFileSystemConfigBuilder result = null;
// Attempt to load the Config Builder from a variable: vfs.config.parser = class
String parserClass = varSpace.getVariable("vfs." + scheme + ".config.parser"); //$NON-NLS-1$ //$NON-NLS-2$
if(parserClass != null) {
try {
Class<?> configBuilderClass = KettleFileSystemConfigBuilderFactory.class.getClassLoader().loadClass(parserClass);
Method mGetInstance = configBuilderClass.getMethod("getInstance"); //$NON-NLS-1$
if((mGetInstance != null) && (IKettleFileSystemConfigBuilder.class.isAssignableFrom(mGetInstance.getReturnType()))) {
result = (IKettleFileSystemConfigBuilder)mGetInstance.invoke(null);
} else {
result = (IKettleFileSystemConfigBuilder)configBuilderClass.newInstance();
}
} catch (Exception e) {
// Failed to load custom parser. Throw exception.
throw new IOException(BaseMessages.getString(PKG, "CustomVfsSettingsParser.Log.FailedToLoad")); //$NON-NLS-1$
}
} else {
// No custom parser requested, load default
if(scheme.equalsIgnoreCase("sftp")) { //$NON-NLS-1$
result = KettleSftpFileSystemConfigBuilder.getInstance();
} else {
result = KettleGenericFileSystemConfigBuilder.getInstance();
}
}
return result;
}
示例7: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
if (!Const.isEmpty(filename)) // we have a finename that's defined.
{
try
{
FileObject fileObject = KettleVFS.getFileObject(filename);
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, fileDir.getURI());
}
catch(IOException e)
{
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
}
else
{
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
// The name of the transformation
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, Const.NVL(name, ""));
// The name of the directory in the repository
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, directory!=null?directory.getPath():"");
// Here we don't remove the job specific parameters, as they may come in handy.
//
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "Parent Job File Directory"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "Parent Job Filename"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, "Parent Job Name"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "Parent Job Repository Directory"); //$NON-NLS-1$
}
}
示例8: getSelectionAdapter
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public static final SelectionAdapter getSelectionAdapter(final Composite composite, final Text destination, final GetCaretPositionInterface getCaretPositionInterface, final InsertTextInterface insertTextInterface, final VariableSpace space)
{
return new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
String keys[] = space.listVariables();
Arrays.sort(keys);
int size = keys.length;
String key[] = new String[size];
String val[] = new String[size];
String str[] = new String[size];
for (int i=0;i<keys.length;i++)
{
key[i] = keys[i];
val[i] = space.getVariable(key[i]);
str[i] = key[i]+" ["+val[i]+"]";
}
// Before focus is lost, we get the position of where the selected variable needs to be inserted.
int position=0;
if (getCaretPositionInterface!=null)
{
position = getCaretPositionInterface.getCaretPosition();
}
EnterSelectionDialog esd = new EnterSelectionDialog(composite.getShell(), str, Messages.getString("System.Dialog.SelectEnvironmentVar.Title"), Messages.getString("System.Dialog.SelectEnvironmentVar.Message"));
if (esd.open()!=null)
{
int nr = esd.getSelectionNr();
String var = "${"+key[nr]+"}";
if (insertTextInterface==null)
{
destination.insert(var);
//destination.setToolTipText(StringUtil.environmentSubstitute( destination.getText() ) );
e.doit=false;
}
else
{
insertTextInterface.insertText(var, position);
}
}
}
};
}
示例9: hookInOtherParsers
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
* Hook in known parsers, and then those that have been specified in the variable
* ftp.file.parser.class.names
* @param ftpClient
* @throws FTPException
* @throws IOException
*/
protected void hookInOtherParsers(FTPClient ftpClient) throws FTPException, IOException {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Hooking.Parsers"));}
String system = ftpClient.system();
MVSFileParser parser = new MVSFileParser();
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.MVS.Parser"));}
FTPFileFactory factory = new FTPFileFactory(system);
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.Factory"));}
factory.addParser(parser);
ftpClient.setFTPFileFactory(factory);
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Get.Variable.Space"));}
VariableSpace vs = this.getVariables();
if (vs != null) {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Getting.Other.Parsers"));}
String otherParserNames = vs.getVariable("ftp.file.parser.class.names");
if (otherParserNames != null) {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Creating.Parsers"));}
String[] parserClasses = otherParserNames.split("|");
String cName = null;
Class<?> clazz = null;
Object parserInstance = null;
for (int i=0; i<parserClasses.length; i++) {
cName = parserClasses[i].trim();
if (cName.length() > 0) {
try {
clazz = Class.forName(cName);
parserInstance = clazz.newInstance();
if (parserInstance instanceof FTPFileParser) {
if (log.isDetailed()) {logDetailed(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.Other.Parser", cName));}
factory.addParser((FTPFileParser)parserInstance);
}
} catch (Exception ignored) {
if (log.isDebug()) {
ignored.printStackTrace();
logError(BaseMessages.getString(PKG, "JobEntryFTP.ERROR.Creating.Parser", cName));
}
}
}
}
}
}
}
示例10: getSelectionAdapter
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public static final SelectionAdapter getSelectionAdapter(final Composite composite, final Text destination, final GetCaretPositionInterface getCaretPositionInterface, final InsertTextInterface insertTextInterface, final VariableSpace space)
{
return new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
String keys[] = space.listVariables();
Arrays.sort(keys);
int size = keys.length;
String key[] = new String[size];
String val[] = new String[size];
String str[] = new String[size];
for (int i=0;i<keys.length;i++)
{
key[i] = keys[i];
val[i] = space.getVariable(key[i]);
str[i] = key[i]+" ["+val[i]+"]";
}
// Before focus is lost, we get the position of where the selected variable needs to be inserted.
int position=0;
if (getCaretPositionInterface!=null)
{
position = getCaretPositionInterface.getCaretPosition();
}
EnterSelectionDialog esd = new EnterSelectionDialog(composite.getShell(), str, BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Title"), BaseMessages.getString(PKG, "System.Dialog.SelectEnvironmentVar.Message"));
if (esd.open()!=null)
{
int nr = esd.getSelectionNr();
String var = "${"+key[nr]+"}";
if (insertTextInterface==null)
{
destination.insert(var);
//destination.setToolTipText(StringUtil.environmentSubstitute( destination.getText() ) );
e.doit=false;
}
else
{
insertTextInterface.insertText(var, position);
}
}
}
};
}