當前位置: 首頁>>代碼示例>>Java>>正文


Java TransMeta類代碼示例

本文整理匯總了Java中org.pentaho.di.trans.TransMeta的典型用法代碼示例。如果您正苦於以下問題:Java TransMeta類的具體用法?Java TransMeta怎麽用?Java TransMeta使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TransMeta類屬於org.pentaho.di.trans包,在下文中一共展示了TransMeta類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateTransformationImage

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
* 生成轉換圖 <br/>
* @author jingma
* @param transMeta
* @return
* @throws Exception
*/
public static BufferedImage generateTransformationImage( TransMeta transMeta ) throws Exception {
  float magnification = 1.0f;
  Point maximum = transMeta.getMaximum();
  maximum.multiply( magnification );

  SwingGC gc = new SwingGC( null, maximum, 32, 0, 0 );
  TransPainter transPainter =
    new TransPainter(
      gc, transMeta, maximum, null, null, null, null, null, new ArrayList<AreaOwner>(),
      new ArrayList<StepMeta>(), 32, 1, 0, 0, true, "Arial", 10 );
  transPainter.setMagnification( magnification );
  transPainter.buildTransformationImage();

  BufferedImage image = (BufferedImage) gc.getImage();

  return image;
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:25,代碼來源:KettleUtils.java

示例2: transCopy

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
* 將指定轉換複製到KettleUtils中的資源庫 <br/>
* @author jingma
* @param jobName 轉換名稱
* @param jobPath 轉換路徑
   * @param fromRepository 來源資源庫
   * @param toRepository 目標資源庫
* @throws KettleException
*/
public static void transCopy(String transName,String transPath,Repository fromRepository,
           Repository toRepository) throws KettleException {
	TransMeta tm = KettleUtils.loadTrans(transName, transPath, fromRepository);
	for(StepMeta sm:tm.getSteps()){
		if(sm.isJobExecutor()){
			JobExecutorMeta jem = (JobExecutorMeta)sm.getStepMetaInterface();
			jobCopy(jem.getJobName(),jem.getDirectoryPath(),fromRepository,toRepository);
		}
		else if(sm.getStepMetaInterface() instanceof TransExecutorMeta){
			TransExecutorMeta te = (TransExecutorMeta)sm.getStepMetaInterface();
			transCopy(te.getTransName(), te.getDirectoryPath(),fromRepository,toRepository);
		}
	}
	if(!isDirectoryExist(toRepository,transPath)){
		//所在目錄不存在則創建
	    toRepository.createRepositoryDirectory(toRepository.findDirectory("/"), transPath);
	}
	tm.setRepository(toRepository);
	tm.setMetaStore(toRepository.getMetaStore());
	KettleUtils.saveTrans(toRepository,tm);
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:31,代碼來源:KettleUtils.java

示例3: diffTransTest

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
@Test
public void diffTransTest() throws Exception {
  File file = new File( "src/test/resources/r1.ktr" );
  InputStream xmlStream = new FileInputStream( file );
  TransMeta transMeta = new TransMeta( xmlStream, null, true, null, null );
  transMeta.sortSteps();

  File file2 = new File( "src/test/resources/r2.ktr" );
  InputStream xmlStream2 = new FileInputStream( file2 );
  TransMeta transMeta2 = new TransMeta( xmlStream2, null, true, null, null );
  transMeta2.sortSteps();

  transMeta = compareSteps( transMeta, transMeta2, true );
  transMeta2 = compareSteps( transMeta2, transMeta, false );
  assertEquals( UNCHANGED, transMeta.getStep( 0 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
  assertEquals( CHANGED, transMeta.getStep( 1 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
  assertEquals( REMOVED, transMeta.getStep( 2 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
  assertEquals( ADDED, transMeta2.getStep( 2 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
}
 
開發者ID:HiromuHota,項目名稱:pdi-git-plugin,代碼行數:20,代碼來源:PdiDiffTest.java

示例4: startTransformation

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
protected void startTransformation( Repository repository, IMetaStore metaStore, final StreamingService service ) {
  try {

    TransMeta transMeta = StreamingConst.loadTransMeta( repository, metaStore, service );
    Trans trans = new Trans( transMeta );
    String carteObjectId = UUID.randomUUID().toString();
    trans.setContainerObjectId( carteObjectId );
    
    if (service.getLogLevel()!=null) {
      trans.setLogLevel(service.getLogLevel());
    }
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );
    transformationMap.addTransformation( transMeta.getName(), carteObjectId, trans, transConfiguration );
    trans.prepareExecution( null );

    // Start the transformation

    trans.startThreads();
    
    // This transformation routinely never ends so we won't wait for it...
    
  } catch ( Exception e ) {
    throw new RuntimeException( "Unable to start transformation for streaming service '" + service.getName() + "'", e );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-streaming,代碼行數:27,代碼來源:ListStreamingServicesServlet.java

示例5: DockerTransExecutorDialog

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
public DockerTransExecutorDialog(Shell parent, Object in, TransMeta transMeta, String stepname) {
    super("com/github/brosander/kettle/docker/dockerTransExecutorDialog.xul", parent, (BaseStepMeta) in, transMeta, stepname);
    loadMeta((DockerTransExecutorMeta) baseStepMeta);
    this.stepname = stepname;
    tempStepName = stepname;
    this.transMeta = transMeta;
    try {
        bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
        bf.createBinding(this, "tempStepName", "step-name", "value").fireSourceChanged();
        bf.createBinding(this, DockerTransExecutorMeta.IMAGE, "image", "value").fireSourceChanged();
        bf.createBinding(this, DockerTransExecutorMeta.TRANSFORMATION, "transformation", "value").fireSourceChanged();
        bf.createBinding(this, DockerTransExecutorMeta.KILL_CONTAINER, "killContainer", "checked").fireSourceChanged();
        bf.createBinding(this, DockerTransExecutorMeta.REMOVE_CONTAINER, "removeContainer", "checked").fireSourceChanged();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:brosander,項目名稱:kettle-docker,代碼行數:18,代碼來源:DockerTransExecutorDialog.java

示例6: callExtensionPoint

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
@Override
public void callExtensionPoint( LogChannelInterface log, Object object ) throws KettleException {
  if ( !( object instanceof TransMeta ) ) {
    return;
  }
  
  TransMeta transMeta = (TransMeta) object;
  
  String unitTestName = transMeta.getAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME );
  
  if (!Const.isEmpty( unitTestName )) {
    // We're running in Spoon and there's a unit test selected : test it
    //
    System.out.println( "==== Running unit test on this transformation ====" );
    transMeta.setVariable( DataSetConst.VAR_RUN_UNIT_TEST, "Y" );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:18,代碼來源:SpoonFlagUnitTestExtensionPoint.java

示例7: editUnitTest

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
protected void editUnitTest(String unitTestName, TransMeta transMeta) {
  try {
    Spoon spoon = Spoon.getInstance();
    MetaStoreFactory<TransUnitTest> setFactory = new MetaStoreFactory<TransUnitTest>(
        TransUnitTest.class, spoon.getMetaStore(), PentahoDefaults.NAMESPACE);
    TransUnitTest unitTest = setFactory.loadElement(unitTestName);
    if (unitTest==null) {
      throw new KettleException(BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Message", unitTestName));
    }
    TransUnitTestDialog dialog = new TransUnitTestDialog(spoon.getShell(), transMeta, spoon.getMetaStore(), unitTest);
    if (dialog.open()) {
      setFactory.saveElement(unitTest);
    }
  } catch(Exception exception) {
    new ErrorDialog(Spoon.getInstance().getShell(), 
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Title"),
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Message", unitTestName), 
        exception);
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:21,代碼來源:ShowUnitTestMenuExtensionPoint.java

示例8: checkTestPresent

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
private boolean checkTestPresent(Spoon spoon, TransMeta transMeta) {
  
  spoon.getLog().logBasic("Check test present...");
  
  String testName = transMeta.getAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME );
  if (!Const.isEmpty( testName )) {
    return false;
  }
  
  // there is no test defined of selected in the transformation.
  // Show a warning
  //
  MessageBox box = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION );
  box.setMessage("Please create a test-case first by left clicking on the test icon.");
  box.setText("First create a test-case");
  box.open();
  
  return true;
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:20,代碼來源:DataSetHelper.java

示例9: detachUnitTest

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
public void detachUnitTest() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  try {
    TransGraph transGraph = spoon.getActiveTransGraph();
    if ( transGraph == null ) {
      return;
    }
    TransMeta transMeta = spoon.getActiveTransformation();
    if (transMeta == null ) {
      return;
    }

    transMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME, null );
    transMeta.setChanged();
    
    DataSetConst.clearStepDataSetIndicators( transMeta );
    
    spoon.refreshGraph();
  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error detaching unit test", e );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:23,代碼來源:DataSetHelper.java

示例10: preview

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
private void preview() {
    CassandraInputMeta oneMeta = new CassandraInputMeta();
    getInfo(oneMeta, true);

    TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(this.transMeta, oneMeta, this.wStepname.getText());

    EnterNumberDialog numberDialog = new EnterNumberDialog(this.shell, this.props.getDefaultPreviewSize(),
            BaseMessages.getString(PKG, "AutSoftCassandraInputDialog.EnterPreviewSize"),
            BaseMessages.getString(PKG, "AutSoftCassandraInputDialog.NumberOfRowsToPreview"));
    int previewSize = numberDialog.open();

    if (previewSize > 0) {
        TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(this.shell, previewMeta,
                new String[]{this.wStepname.getText()}, new int[]{previewSize});
        progressDialog.open();

        Trans trans = progressDialog.getTrans();
        String loggingText = progressDialog.getLoggingText();

        if (!progressDialog.isCancelled()) {
            if ((trans.getResult() != null) && (trans.getResult().getNrErrors() > 0L)) {
                EnterTextDialog etd = new EnterTextDialog(this.shell,
                        BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"),
                        BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            } else {
                PreviewRowsDialog prd = new PreviewRowsDialog(this.shell, this.transMeta, 0, this.wStepname.getText(),
                        progressDialog.getPreviewRowsMeta(this.wStepname.getText()),
                        progressDialog.getPreviewRows(this.wStepname.getText()), loggingText);
                prd.open();
            }
        }
    }
}
 
開發者ID:bcolas,項目名稱:pentaho-cassandra-plugin,代碼行數:36,代碼來源:CassandraInputDialog.java

示例11: stepPreview

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
* 步驟數據預覽 <br/>
* @author jingma
* @param teans 轉換
* @param testStep 步驟名稱
* @param smi 步驟實體
* @param previewSize 預覽的條數
* @return 預覽結果
*/
public static List<List<Object>> stepPreview(TransMeta teans,
		String testStep, StepMetaInterface smi, int previewSize) {
	TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(
			teans,
			smi,
			testStep);
	TransPreviewUtil tpu = new TransPreviewUtil(
			previewMeta,
	        new String[] { testStep },
	        new int[] { previewSize } );
	tpu.doPreview();
	return TransPreviewUtil.getData(tpu.getPreviewRowsMeta(testStep),tpu.getPreviewRows(testStep));
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:23,代碼來源:KettleUtils.java

示例12: repairTransHop

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
* 修複轉換連接線 <br/>
* @author jingma
* @param tm 轉換元數據
*/
public static void repairTransHop(TransMeta tm) {
    for(int i=0;i<tm.nrTransHops();i++){
        TransHopMeta hop = tm.getTransHop(i);
        hop.setFromStep(tm.findStep(hop.getFromStep().getName()));
        hop.setToStep(tm.findStep(hop.getToStep().getName()));
    }
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:13,代碼來源:KettleUtils.java

示例13: getTransMetaTemplate

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
	 * @return transMetaTemplate 
	 */
	public static TransMeta getTransMetaTemplate() {
//		if(transMetaTemplate==null){
//			setTransMetaTemplate(KettleUtils.loadTrans(SysCode.TRANS_TEMPLATE_NAME, SysCode.TEMPLATE_DIR));
//		}
		return transMetaTemplate;
	}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:10,代碼來源:KettleUtils.java

示例14: TransPreviewUtil

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
/**
 * Creates a new dialog that will handle the wait while previewing a transformation...
 */
public TransPreviewUtil( TransMeta transMeta, String[] previewStepNames, int[] previewSize ) {
  this.transMeta = transMeta;
  this.previewStepNames = previewStepNames;
  this.previewSize = previewSize;

  cancelled = false;
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:11,代碼來源:TransPreviewUtil.java

示例15: getDefaultConfigInfo

import org.pentaho.di.trans.TransMeta; //導入依賴的package包/類
public String getDefaultConfigInfo(TransMeta transMeta, String stepName, VariableSpace space) throws Exception {
    if(StringUtils.isNotBlank(getClassName())){
        //實例化配置的類,獲取輸出字段
        EasyExpandRunBase kui = (EasyExpandRunBase) Class.forName(space.environmentSubstitute(getClassName())).newInstance();
        kui.setKu(null);
        kui.setMeta(this,space);
        return kui.getDefaultConfigInfo(transMeta,stepName);
    }
    return null;
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:11,代碼來源:EasyExpandMeta.java


注:本文中的org.pentaho.di.trans.TransMeta類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。