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


Java Trans.execute方法代码示例

本文整理汇总了Java中org.pentaho.di.trans.Trans.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Trans.execute方法的具体用法?Java Trans.execute怎么用?Java Trans.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.trans.Trans的用法示例。


在下文中一共展示了Trans.execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.pentaho.di.trans.Trans; //导入方法依赖的package包/类
/**
 * 1) create a new transformation <br>
 * 2) Express the transformation as XML file <br>
 * 3) Execute the transformation <br>
 * <br>
 * @param args
 */
public static void main(String[] args) throws Exception
{
	EnvUtil.environmentInit();
    
	// Init the logging...
	//
    LogWriter.getInstance("TransBuilderFilter.log", true, LogWriter.LOG_LEVEL_DETAILED);
    
    // Load the Kettle steps & plugins
	StepLoader.init();
    
    // The parameters we want, optionally this can be 
    String transformationName = "Filter test Transformation";
   
    TransMeta transMeta = buildFilterSample(transformationName);
    System.out.println(transMeta.getXML());
    
    // Now execute the transformation...
    Trans trans = new Trans(transMeta);
    trans.execute(null);
    trans.waitUntilFinished();
    
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:TransBuilderFilter.java

示例2: runTransformationFromResource

import org.pentaho.di.trans.Trans; //导入方法依赖的package包/类
public Trans runTransformationFromResource(String resource, List<TransVariable> listVaribale) {
    try {
        // load latest revision of the transformation
        // The TransMeta object is the programmatic representation of a transformation definition.
        TransMeta transMeta = new TransMeta(getClass().getResourceAsStream(resource), null, false, null, null);

        // Creating a transformation object which is the programmatic representation of a transformation 
        // A transformation object can be executed, report success, etc.
        Trans transformation = new Trans(transMeta);
        if (listVaribale != null) {
            for (TransVariable variable : listVaribale) {
                transformation.setVariable(variable.getName(), variable.getValue());
            }
        }

        // adjust the log level
        transformation.setLogLevel(LogLevel.BASIC);

        // starting the transformation, which will execute asynchronously
        transformation.execute(null);

        // waiting for the transformation to finish
        transformation.waitUntilFinished();

        return transformation;
    } catch (KettleException ex) {
        MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.syncerror"), ex);
        msg.show(this);
        return null;
    }
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:32,代码来源:JPanelTransformation.java

示例3: executeTransformation

import org.pentaho.di.trans.Trans; //导入方法依赖的package包/类
public Map<String, Object> executeTransformation(String ktrPath) {

		Map<String, Object> executionResult = new HashMap<String, Object>();

		try {
			KettleEnvironment.init();
			EnvUtil.environmentInit();

			TransMeta transMeta = new TransMeta(ktrPath);

			List<DatabaseMeta> dbMetaList = transMeta.getDatabases();

			for (DatabaseMeta dbMeta : dbMetaList) {
				if (dbMeta.getName().equals(this.connectionName)) {
					dbMeta.setHostname(this.dbHostName);
					dbMeta.setUsername(this.dbUerName);
					dbMeta.setPassword(this.dbPassword);
					dbMeta.setDBPort(this.dbPort);
					dbMeta.setDBName(this.dbName);
				}
			}

			Trans transformation = new Trans(transMeta);

			if (this.parameters != null) {
				for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
					transformation.setParameterValue((String) entry.getKey(), (String) entry.getValue());
				}
			}

			transformation.execute(null);
			transformation.waitUntilFinished();

			for (StepMetaDataCombi combi : transformation.getSteps()) {

				StepDTO stepDTO = new StepDTO();

				stepDTO.setStepName(combi.step.getStepname());
				stepDTO.setLinesInput(Long.valueOf(combi.step.getLinesInput()));
				stepDTO.setLinesOutput(Long.valueOf(combi.step.getLinesOutput()));
				stepDTO.setLinesRead(Long.valueOf(combi.step.getLinesRead()));
				stepDTO.setLinesRejected(Long.valueOf(combi.step.getLinesRejected()));
				stepDTO.setLinesUpdated(Long.valueOf(combi.step.getLinesUpdated()));

				stepDTO.setStepDestinationNameList(new ArrayList<String>());

				for (RowSet rowSet : combi.step.getOutputRowSets()) {
					stepDTO.getStepDestinationNameList().add(rowSet.getDestinationStepName());
				}

				this.getStepDTOList().add(stepDTO);
			}

			if (transformation.getErrors() > 0) {
				System.out.println("Erroruting Transformation");

				executionResult.put("transformationExecuted", false);
				return executionResult;
			} else {

				executionResult.put("transformationExecuted", true);
				return executionResult;
			}
		} catch (Exception e) {
			e.printStackTrace();

			executionResult.put("transformationExecuted", false);
			return executionResult;
		}
	}
 
开发者ID:rodrifmed,项目名称:pentaho-data-integration,代码行数:71,代码来源:TransformationManager.java

示例4: testCombinationLookup

import org.pentaho.di.trans.Trans; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
  public void testCombinationLookup() throws Exception
  {
      EnvUtil.environmentInit();
      try
      {
          //
          // Create a new transformation...
          //
          TransMeta transMeta = new TransMeta();
          transMeta.setName("transname");

          // Add the database connections
          for (int i=0;i<databasesXML.length;i++)
          {
              DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
              transMeta.addDatabase(databaseMeta);
          }

          DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");

          // Execute our setup SQLs in the database.
          Database lookupDatabase = new Database(lookupDBInfo);
          lookupDatabase.connect();
          createTables(lookupDatabase);
          createData(lookupDatabase);

          StepLoader steploader = StepLoader.getInstance();            

          // 
          // create the source step...
          //
          String fromstepname = "read from [" + source_table + "]";
          TableInputMeta tii = new TableInputMeta();
          tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
          String selectSQL = "SELECT "+Const.CR;
          selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
          selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
          tii.setSQL(selectSQL);

          String fromstepid = steploader.getStepPluginID(tii);
          StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
          fromstep.setLocation(150, 100);
          fromstep.setDraw(true);
          fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
          transMeta.addStep(fromstep);

          // 
          // create the combination lookup/update step...
          //
          String lookupstepname = "lookup from [lookup]";
          CombinationLookupMeta clm = new CombinationLookupMeta();
          String lookupKey[] = { "DLR_CD" };
          clm.setTablename(target_table);
          clm.setKeyField(lookupKey);
          clm.setKeyLookup(lookupKey);
          clm.setTechnicalKeyField("ID");
          clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
          clm.setDatabaseMeta(lookupDBInfo);

          String lookupstepid = steploader.getStepPluginID(clm);
          StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
          lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
          transMeta.addStep(lookupstep);                              

          TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
          transMeta.addTransHop(hi);

          // Now execute the transformation...
          Trans trans = new Trans(transMeta);
          trans.execute(null);            

          trans.waitUntilFinished();            

          checkResults(lookupDatabase);
      }    	
      finally {}    
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:81,代码来源:CombinationLookupTest.java

示例5: executeTrans

import org.pentaho.di.trans.Trans; //导入方法依赖的package包/类
protected void executeTrans(Trans trans) throws KettleException { 
   trans.execute(null);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:4,代码来源:StartTransServlet.java


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