当前位置: 首页>>代码示例>>Java>>正文


Java Variables类代码示例

本文整理汇总了Java中org.pentaho.di.core.variables.Variables的典型用法代码示例。如果您正苦于以下问题:Java Variables类的具体用法?Java Variables怎么用?Java Variables使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Variables类属于org.pentaho.di.core.variables包,在下文中一共展示了Variables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetUrl

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test
public void testGetUrl() {
  VariableSpace space = new Variables();
  space.setVariable("SERVER", "hcpdemo.com");
  space.setVariable("PORT", "8000");
  space.setVariable("NAMESPACE", "hcp-demo");
  space.setVariable("TENANT", "pentaho");
  
  HCPConnection connection = new HCPConnection();
  connection.setServer("${SERVER}");
  connection.setPort("${PORT}");
  connection.setNamespace("${NAMESPACE}");
  connection.setTenant("${TENANT}");
  
  String restUrl = connection.getRestUrl(space);
  assertEquals("http://pentaho.hcp-demo.hcpdemo.com:8000/rest", restUrl);    
}
 
开发者ID:mattcasters,项目名称:pdi-hcp-plugin,代码行数:18,代码来源:HCPConnectionTest.java

示例2: createFilename

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
public static final String createFilename(String sharedObjectsFile)
{
    String filename;
    if (Const.isEmpty(sharedObjectsFile))
    {
        // First fallback is the environment/kettle variable ${KETTLE_SHARED_OBJECTS}
        // This points to the file
        filename = Variables.getADefaultVariableSpace().getVariable("KETTLE_SHARED_OBJECTS");
        
        // Last line of defence...
        if (Const.isEmpty(filename))
        {
            filename = Const.getSharedObjectsFile();
        }
    }
    else
    {
        filename = sharedObjectsFile;
    }
    return filename;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:SharedObjects.java

示例3: show

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
private void show()
{
	if (rowDatas.size()==0) return;
	
	int nr = wStepList.getSelectionIndex();

	java.util.List<Object[]> buffer = (java.util.List<Object[]>)rowDatas.get(nr);
       RowMetaInterface rowMeta = (RowMetaInterface)rowMetas.get(nr);
	String    name   = (String)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(Messages.getString("EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title"));
       	mb.setMessage(Messages.getString("EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Message"));
       	mb.open();
       }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:26,代码来源:EnterPreviewRowsDialog.java

示例4: testRegexEval1

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
public void testRegexEval1() throws Exception
{
    String regexStepName = "regexeval";
    RegexEvalMeta regexEvalMeta = new RegexEvalMeta();

    regexEvalMeta.setScript("[abc]*");
    regexEvalMeta.setMatcher("field1");
    regexEvalMeta.setResultFieldName("res");

    TransMeta transMeta = TransTestFactory.generateTestTransformation(new Variables(), regexEvalMeta, regexStepName);
    
    // Now execute the transformation and get the result from the dummy step.
    //
    List<RowMetaAndData> result = TransTestFactory.executeTestTransformation
            (
                transMeta, 
                TransTestFactory.INJECTOR_STEPNAME, 
                regexStepName, 
                TransTestFactory.DUMMY_STEPNAME, 
                createSourceData()
            );
    
    checkRows(createResultData1(), result);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:25,代码来源:RegexEvalTest.java

示例5: createFilename

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
public static final String createFilename(String sharedObjectsFile)
{
    String filename;
    if (Const.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 (Const.isEmpty(filename))
        {
            filename = Const.getSharedObjectsFile();
        }
    }
    else
    {
        filename = sharedObjectsFile;
    }
    return filename;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:SharedObjects.java

示例6: show

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
private void show()
{
	if (rowDatas.size()==0) return;
	
	int nr = wStepList.getSelectionIndex();

	java.util.List<Object[]> buffer = (java.util.List<Object[]>)rowDatas.get(nr);
       RowMetaInterface rowMeta = (RowMetaInterface)rowMetas.get(nr);
	String    name   = (String)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();
       }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:26,代码来源:EnterPreviewRowsDialog.java

示例7: testGetFieldsNoProbsClassification

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test
public void testGetFieldsNoProbsClassification() throws Exception {
  WekaScoringModel model = WekaScoringData.loadSerializedModel(
      CLASSIFICATION_MODEL, null, new Variables());

  assertTrue(model != null);

  WekaScoringMeta meta = new WekaScoringMeta();

  meta.setModel(model);
  RowMetaInterface rmi = new RowMeta();

  meta.getFields(rmi, null, null, null, new Variables());

  assertTrue(rmi.size() == 1);
  assertEquals(rmi.getValueMeta(0).getName(), "class_predicted");
}
 
开发者ID:pentaho,项目名称:pdi-weka-scoring-plugin,代码行数:18,代码来源:WekaScoringTest.java

示例8: testGetFields

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test
public void testGetFields() throws Exception {
  XMLOutputMeta xmlOutputMeta = new XMLOutputMeta();
  xmlOutputMeta.setDefault();
  XMLField xmlField = new XMLField();
  xmlField.setFieldName( "aField" );
  xmlField.setLength( 10 );
  xmlField.setPrecision( 3 );
  xmlOutputMeta.setOutputFields( new XMLField[] { xmlField } );
  RowMetaInterface row = mock( RowMetaInterface.class );
  RowMetaInterface rmi = mock( RowMetaInterface.class );
  StepMeta nextStep = mock( StepMeta.class );
  Repository repo = mock( Repository.class );
  IMetaStore metastore = mock( IMetaStore.class );
  ValueMetaInterface vmi = mock( ValueMetaInterface.class );
  when( row.searchValueMeta( "aField" ) ).thenReturn( vmi );
  xmlOutputMeta.getFields( row, "", new RowMetaInterface[] { rmi }, nextStep, new Variables(), repo, metastore );
  verify( vmi ).setLength( 10, 3 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:20,代码来源:XMLOutputMetaTest.java

示例9: cancel

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
public synchronized void cancel() throws SQLException {
  
  // Kill the service transformation on the server...
  // Only ever try once.
  //
  if (!stopped.get()) {
    stopped.set(true);
    try {
      String reply = HttpUtil.execService(new Variables(), 
          connection.getHostname(), connection.getPort(), connection.getWebAppName(), 
          connection.getService()+"/stopTrans"+"/?name="+URLEncoder.encode(serviceTransName, "UTF-8")+"&id="+Const.NVL(serviceObjectId, "")+"&xml=Y",
          connection.getUsername(), connection.getPassword(), 
          connection.getProxyHostname(), connection.getProxyPort(), connection.getNonProxyHosts());
      
      WebResult webResult = new WebResult(XMLHandler.loadXMLString(reply, WebResult.XML_TAG));
      if (!"OK".equals(webResult.getResult())) {
        throw new SQLException("Cancel on remote server failed: "+webResult.getMessage());
      }
      
    } catch(Exception e) {
      throw new SQLException("Couldn't cancel SQL query on slave server", e);
    }
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:25,代码来源:ThinResultSet.java

示例10: generateTimeTransformation

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
  // We actually load the transformation from a template and then slightly modify it.
  //
  String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
  InputStream inputStream = getClass().getResourceAsStream(filename);
  TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
  
  // Find the table output step and inject the target table name and database...
  //
  StepMeta stepMeta = transMeta.findStep("TARGET");
  if (stepMeta!=null) {
    TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
    meta.setDatabaseMeta(databaseMeta);
    String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
    meta.setTableName(phTable);
  }
  
  return transMeta;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:JobGenerator.java

示例11: testPropertiesBuilderForPassword

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
private void testPropertiesBuilderForPassword( boolean isEncrypted, String password ) throws KettleException {
  MongoDbMeta input = new MongoDbInputMeta();
  setPassword( input, "${" + PASSWORD + "}" );

  MongoDbMeta output = new MongoDbOutputMeta();
  setPassword( output, "${" + PASSWORD + "}" );

  VariableSpace vars = new Variables();

  initEncryptor();

  String value;
  if ( isEncrypted ) {
    value = Encr.encryptPasswordIfNotUsingVariables( password );
  } else {
    value = password;
  }
  vars.setVariable( PASSWORD, value );

  MongoProperties inProps = MongoWrapperUtil.createPropertiesBuilder( input, vars ).build();
  MongoProperties outProps = MongoWrapperUtil.createPropertiesBuilder( output, vars ).build();

  checkPass( inProps, password );
  checkPass( outProps, password );
}
 
开发者ID:pentaho,项目名称:pentaho-mongodb-plugin,代码行数:26,代码来源:MongoWrapperUtilTest.java

示例12: testCheck

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test
public void testCheck() throws Exception {
  WebServiceMeta webServiceMeta = new WebServiceMeta();
  TransMeta transMeta = mock( TransMeta.class );
  StepMeta stepMeta = mock( StepMeta.class );
  RowMetaInterface prev = mock( RowMetaInterface.class );
  RowMetaInterface info = mock( RowMetaInterface.class );
  Repository rep = mock( Repository.class );
  IMetaStore metastore = mock( IMetaStore.class );
  String[] input = { "one" };
  ArrayList<CheckResultInterface> remarks = new ArrayList<>();
  webServiceMeta.check(
    remarks, transMeta, stepMeta, null, input, null, info, new Variables(), rep, metastore );
  assertEquals( 2, remarks.size() );
  assertEquals( "Not receiving any fields from previous steps!", remarks.get( 0 ).getText() );
  assertEquals( "Step is receiving info from other steps.", remarks.get( 1 ).getText() );

  remarks.clear();
  webServiceMeta.setInFieldArgumentName( "ifan" );
  when( prev.size() ).thenReturn( 2 );
  webServiceMeta.check(
    remarks, transMeta, stepMeta, prev, new String[]{}, null, info, new Variables(), rep, metastore );
  assertEquals( 2, remarks.size() );
  assertEquals( "Step is connected to previous one, receiving 2 fields", remarks.get( 0 ).getText() );
  assertEquals( "No input received from other steps!", remarks.get( 1 ).getText() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:WebServiceMetaTest.java

示例13: createDataObject

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
private TextFileInputData createDataObject( String file,
                                            String separator,
                                            String... outputFields ) throws Exception {
  TextFileInputData data = new TextFileInputData();
  data.files = new FileInputList();
  data.files.addFile( KettleVFS.getFileObject( file ) );

  data.separator = separator;

  data.outputRowMeta = new RowMeta();
  if ( outputFields != null ) {
    for ( String field : outputFields ) {
      data.outputRowMeta.addValueMeta( new ValueMetaString( field ) );
    }
  }

  data.dataErrorLineHandler = mock( FileErrorHandler.class );
  data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
  data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ], new Variables() );
  data.filePlayList = new FilePlayListAll();
  return data;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:TextFileInputTest.java

示例14: testTopLevelObjectStructureNoNestedDocs

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test public void testTopLevelObjectStructureNoNestedDocs() throws Exception {
  List<MongoDbOutputMeta.MongoField> paths = asList( mf( "field1", true, "" ), mf( "field2", true, "" ) );

  RowMetaInterface rmi = new RowMeta();
  rmi.addValueMeta( new ValueMetaString( "field1" ) );
  rmi.addValueMeta( new ValueMetaInteger( "field2" ) );

  Object[] row = new Object[ 2 ];
  row[ 0 ] = "value1";
  row[ 1 ] = 12L;
  VariableSpace vs = new Variables();

  for ( MongoDbOutputMeta.MongoField f : paths ) {
    f.init( vs );
  }

  DBObject result = kettleRowToMongo( paths, rmi, row, vs, MongoDbOutputData.MongoTopLevel.RECORD, false );

  assertEquals( result.toString(), "{ \"field1\" : \"value1\" , \"field2\" : 12}" );

}
 
开发者ID:pentaho,项目名称:pentaho-mongodb-plugin,代码行数:22,代码来源:MongoDbOutputTest.java

示例15: testTopLevelArrayStructureWithPrimitives

import org.pentaho.di.core.variables.Variables; //导入依赖的package包/类
@Test public void testTopLevelArrayStructureWithPrimitives() throws Exception {
  List<MongoDbOutputMeta.MongoField> paths = asList( mf( "field1", false, "[0]" ), mf( "field2", false, "[1]" ) );

  RowMetaInterface rmi = new RowMeta();
  rmi.addValueMeta( new ValueMetaString( "field1" ) );
  rmi.addValueMeta( new ValueMetaInteger( "field2" ) );

  Object[] row = new Object[ 2 ];
  row[ 0 ] = "value1";
  row[ 1 ] = 12L;
  VariableSpace vs = new Variables();

  for ( MongoDbOutputMeta.MongoField f : paths ) {
    f.init( vs );
  }

  DBObject result = kettleRowToMongo( paths, rmi, row, vs, MongoDbOutputData.MongoTopLevel.ARRAY, false );

  assertEquals( result.toString(), "[ \"value1\" , 12]" );
}
 
开发者ID:pentaho,项目名称:pentaho-mongodb-plugin,代码行数:21,代码来源:MongoDbOutputTest.java


注:本文中的org.pentaho.di.core.variables.Variables类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。