org.pentaho.di.core.variables.Variables.getADefaultVariableSpace()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.pentaho.di.core.variables.Variables.getADefaultVariableSpace()方法的一些代码示例,展示了Variables.getADefaultVariableSpace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables.getADefaultVariableSpace()方法的具体详情如下:
包路径:org.pentaho.di.core.variables.Variables
类名称:Variables
方法名:getADefaultVariableSpace

Variables.getADefaultVariableSpace介绍

[英]Get a default variable space as a placeholder. Everytime you will get a new instance.
[中]获取默认变量空间作为占位符。每次你都会得到一个新的实例。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

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 = vars.get( i );
   if ( !varname.startsWith( Const.INTERNAL_VARIABLE_PREFIX ) ) {
    // add all new non-internal variables to newVariablesMap
    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 = jobMeta.getVariable( variableName );
  if ( !Utils.isEmpty( value ) ) {
   variables.put( variableName, value );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 = 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 ( !Utils.isEmpty( value ) ) {
   variables.put( variableName, value );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 ( !Utils.isEmpty( value ) ) {
   variables.put( variableName, value );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void show() {
  if ( rowDatas.size() == 0 ) {
   return;
  }

  int nr = wStepList.getSelectionIndex();

  java.util.List<Object[]> buffer = rowDatas.get( nr );
  RowMetaInterface rowMeta = rowMetas.get( nr );
  String name = stepNames.get( nr );

  if ( rowMeta != null && buffer != null && buffer.size() > 0 ) {
   PreviewRowsDialog prd =
    new PreviewRowsDialog( shell, Variables.getADefaultVariableSpace(), SWT.NONE, name, rowMeta, buffer );
   prd.open();
  } else {
   MessageBox mb = new MessageBox( shell, SWT.ICON_INFORMATION | SWT.OK );
   mb.setText( BaseMessages.getString( PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title" ) );
   mb.setMessage( BaseMessages.getString( PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Message" ) );
   mb.open();
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public static final String createFilename( String sharedObjectsFile ) {
 String filename;
 if ( Utils.isEmpty( sharedObjectsFile ) ) {
  // First fallback is the environment/kettle variable ${KETTLE_SHARED_OBJECTS}
  // This points to the file
  filename = Variables.getADefaultVariableSpace().getVariable( Const.KETTLE_SHARED_OBJECTS );
  // Last line of defence...
  if ( Utils.isEmpty( filename ) ) {
   filename = Const.getSharedObjectsFile();
  }
 } else {
  filename = sharedObjectsFile;
 }
 return filename;
}

代码示例来源:origin: pentaho/pentaho-kettle

new TableView( Variables.getADefaultVariableSpace(), composite, SWT.BORDER
 | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, PropsUI.getInstance() );

代码示例来源:origin: pentaho/pentaho-kettle

sp.putAll( System.getProperties() );
VariableSpace space = Variables.getADefaultVariableSpace();
String[] keys = space.listVariables();
for ( String key : keys ) {

代码示例来源:origin: pentaho/pentaho-kettle

new PreviewRowsDialog( shell, Variables.getADefaultVariableSpace(), SWT.NONE, BaseMessages.getString(
  PKG, "Spoon.StringSearchResult.Subtitle" ), StringSearchResult.getResultRowMeta(), rows );
String title = BaseMessages.getString( PKG, "Spoon.StringSearchResult.Title" );

代码示例来源:origin: pentaho/pentaho-kettle

new PreviewRowsDialog( shell, Variables.getADefaultVariableSpace(), SWT.NONE, "-", rowMeta, rows );
prd.setTitleMessage(

代码示例来源:origin: pentaho/pentaho-kettle

Variables.getADefaultVariableSpace(), shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf,
  FieldsRows, null, props );
wFields.setReadonly( readOnly );

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get & show the SQL required to run the loaded transformation...
 *
 */
public void getTransSQL( TransMeta transMeta ) {
 GetSQLProgressDialog pspd = new GetSQLProgressDialog( spoon.getShell(), transMeta );
 List<SQLStatement> stats = pspd.open();
 if ( stats != null ) {
  // null means error, but we already displayed the error
  if ( stats.size() > 0 ) {
   SQLStatementsDialog ssd =
    new SQLStatementsDialog( spoon.getShell(), Variables.getADefaultVariableSpace(), SWT.NONE, stats );
   String sn = ssd.open();
   if ( sn != null ) {
    StepMeta esi = transMeta.findStep( sn );
    if ( esi != null ) {
     spoon.delegates.steps.editStep( transMeta, esi );
    }
   }
  } else {
   MessageBox mb = new MessageBox( spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION );
   mb.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Message" ) );
   mb.setText( BaseMessages.getString( PKG, "Spoon.Dialog.NoSQLNeedEexecuted.Title" ) ); // "SQL"
   mb.open();
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

BaseMessages.getString( PKG, "PartitionSchemaDialog.PartitionID.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
  false, false ), };
wPartitions = new TableView( Variables.getADefaultVariableSpace(), // probably better push this up. TODO
 shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, partitionColumns, 1, lsMod, props );
props.setLook( wPartitions );

代码示例来源:origin: pentaho/pentaho-kettle

Variables.getADefaultVariableSpace(), shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf,
FieldsRows, null, props );

相关文章