本文整理匯總了Java中org.pentaho.di.core.variables.VariableSpace.listVariables方法的典型用法代碼示例。如果您正苦於以下問題:Java VariableSpace.listVariables方法的具體用法?Java VariableSpace.listVariables怎麽用?Java VariableSpace.listVariables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.core.variables.VariableSpace
的用法示例。
在下文中一共展示了VariableSpace.listVariables方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildFsOptions
import org.pentaho.di.core.variables.VariableSpace; //導入方法依賴的package包/類
private static FileSystemOptions buildFsOptions(VariableSpace varSpace, FileSystemOptions sourceOptions, String vfsFilename, String scheme) throws IOException {
if(varSpace == null || vfsFilename == null) {
// We cannot extract settings from a non-existant variable space
return null;
}
IKettleFileSystemConfigBuilder configBuilder = KettleFileSystemConfigBuilderFactory.getConfigBuilder(varSpace, scheme);
FileSystemOptions fsOptions = (sourceOptions == null) ? new FileSystemOptions() : sourceOptions;
String[] varList = varSpace.listVariables();
for(String var : varList) {
if(var.startsWith("vfs.")) { //$NON-NLS-1$
String param = configBuilder.parseParameterName(var, scheme);
if(param != null) {
configBuilder.setParameter(fsOptions, param, varSpace.getVariable(var), var, vfsFilename);
} else {
throw new IOException("FileSystemConfigBuilder could not parse parameter: " + var); //$NON-NLS-1$
}
}
}
return fsOptions;
}
示例2: 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);
}
}
示例3: getUsedVariables
import org.pentaho.di.core.variables.VariableSpace; //導入方法依賴的package包/類
public void getUsedVariables(JobMeta jobMeta)
{
Properties sp = new Properties();
VariableSpace space = Variables.getADefaultVariableSpace();
String keys[] = space.listVariables();
for ( int i=0; i<keys.length; i++ )
{
sp.put(keys[i], space.getVariable(keys[i]));
}
List<String> vars = jobMeta.getUsedVariables();
if (vars!=null && vars.size()>0)
{
HashMap<String, String> newVariables = new HashMap<String, String>();
for (int i=0;i<vars.size();i++)
{
String varname = (String)vars.get(i);
if (!varname.startsWith(Const.INTERNAL_VARIABLE_PREFIX))
{
newVariables.put(varname, Const.NVL(variables.get(varname), sp.getProperty(varname, "")));
}
}
// variables.clear();
variables.putAll(newVariables);
}
}
示例4: getAllVariables
import org.pentaho.di.core.variables.VariableSpace; //導入方法依賴的package包/類
public void getAllVariables(TransMeta transMeta)
{
Properties sp = new Properties();
VariableSpace space = Variables.getADefaultVariableSpace();
String keys[] = space.listVariables();
for ( int i=0; i<keys.length; i++ )
{
sp.put(keys[i], space.getVariable(keys[i]));
}
String[] vars = transMeta.listVariables();
if (vars!=null && vars.length>0)
{
HashMap<String, String> newVariables = new HashMap<String, String>();
for (int i=0;i<vars.length;i++)
{
String varname = vars[i];
newVariables.put(varname, Const.NVL(variables.get(varname), sp.getProperty(varname, "")));
}
// variables.clear();
variables.putAll(newVariables);
}
// Also add the internal job variables if these are set...
//
for (String variableName : Const.INTERNAL_JOB_VARIABLES)
{
String value = transMeta.getVariable(variableName);
if (!Const.isEmpty(value)) variables.put(variableName, value);
}
}
示例5: getUsedVariables
import org.pentaho.di.core.variables.VariableSpace; //導入方法依賴的package包/類
public void getUsedVariables(TransMeta transMeta)
{
Properties sp = new Properties();
VariableSpace space = Variables.getADefaultVariableSpace();
String keys[] = space.listVariables();
for ( int i=0; i<keys.length; i++ )
{
sp.put(keys[i], space.getVariable(keys[i]));
}
List<String> vars = transMeta.getUsedVariables();
if (vars!=null && vars.size()>0)
{
HashMap<String, String> newVariables = new HashMap<String, String>();
for (int i=0;i<vars.size();i++)
{
String varname = (String)vars.get(i);
if (!varname.startsWith(Const.INTERNAL_VARIABLE_PREFIX))
{
newVariables.put(varname, Const.NVL(variables.get(varname), sp.getProperty(varname, "")));
}
}
// variables.clear();
variables.putAll(newVariables);
}
// Also add the internal job variables if these are set...
//
for (String variableName : Const.INTERNAL_JOB_VARIABLES)
{
String value = transMeta.getVariable(variableName);
if (!Const.isEmpty(value)) variables.put(variableName, value);
}
}
示例6: 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;
}
}
示例7: getVariableNames
import org.pentaho.di.core.variables.VariableSpace; //導入方法依賴的package包/類
public static final String[] getVariableNames(VariableSpace space) {
String variableNames[] = space.listVariables();
Arrays.sort(variableNames);
// repeat a few entries at the top, for convenience...
//
String[] array = new String[variableNames.length+2];
int index=0;
array[index++]= Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY;
array[index++]= Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY;
for (String name : variableNames) array[index++] = name;
return array;
}
示例8: 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;
}
}
示例9: 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);
}
}
}
};
}
示例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);
}
}
}
};
}