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


Java KettleEnvironment类代码示例

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


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

示例1: initEnv

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
/**
* 初始化环境变量 <br/>
* @author jingma
* @throws KettleException 
*/
public static void initEnv() throws KettleException {
    if(System.getenv("KETTLE_HOME")!=null){
        System.setProperty("DI_HOME", System.getenv("KETTLE_HOME"));
        System.setProperty("KETTLE_HOME", System.getenv("KETTLE_HOME"));
        System.setProperty("org.osjava.sj.root", System.getenv("KETTLE_HOME")+"/simple-jndi");
        log.debug("KETTLE_HOME配置[能自动加载该目录下plugins中的插件]:"+System.getenv("KETTLE_HOME"));
    }
    if(System.getenv("KETTLE_JNDI_ROOT")!=null){
        System.setProperty("org.osjava.sj.root", System.getenv("KETTLE_JNDI_ROOT"));
        log.debug("Simple-jndi配置根路径:"+System.getenv("KETTLE_JNDI_ROOT"));
    }
    //初始化kettle环境
    if(!KettleEnvironment.isInitialized()){
        KettleEnvironment.init();
        KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON );
    }
}
 
开发者ID:majinju,项目名称:KettleUtil,代码行数:23,代码来源:KettleUtils.java

示例2: init

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Override
    public void init(AppView app) throws BeanFactoryException {
        this.app = app;        
//        dlSystem = (DataLogicSystem) app.getBean(DataLogicSystem.class.getName());
//        hostProp = dlSystem.getResourceAsProperties(app.getProperties() + "/properties");

        this.app.waitCursorBegin();
        try {
            KettleEnvironment.init(false);
            EnvUtil.environmentInit();
        } catch (KettleException ex) {
            MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.syncerror"), ex);
            msg.show(this);
        }
        this.app.waitCursorEnd();
    }
 
开发者ID:nordpos,项目名称:nordpos,代码行数:17,代码来源:JPanelTransformation.java

示例3: main

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

    Display display = new Display();
    
    KettleEnvironment.init();
    PropsUI.init(display, PropsUI.TYPE_PROPERTIES_SPOON);
    
    Shell shell = new Shell(display);
    
    ImportRules importRules = new ImportRules();
    importRules.loadXML(XMLHandler.getSubNode(XMLHandler.loadXMLFile("bin/import-rules.xml"), ImportRules.XML_TAG));
    
    ImportRulesDialog dialog = new ImportRulesDialog(shell, importRules);
    if (dialog.open()) {
      for (ImportRuleInterface rule : importRules.getRules()) {
        System.out.println(" - "+rule.toString());
      }
    }
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:20,代码来源:ImportRulesDialog.java

示例4: test02_SelectFrom

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
public void test02_SelectFrom() throws Exception {
  KettleEnvironment.init();
  
  String sqlQuery = "SELECT Category, Country, products_sold as nr, sales_amount as sales FROM Service";
  
  SqlTransExecutor executor = new SqlTransExecutor(sqlQuery, getServices());

  final List<RowMetaAndData> rows = new ArrayList<RowMetaAndData>();
  
  // print the eventual result rows...
  //
  executor.executeQuery(new RowAdapter() { @Override
  public void rowWrittenEvent(RowMetaInterface rowMeta, Object[] row) throws KettleStepException {
    rows.add(new RowMetaAndData(rowMeta, row));
  } });
      
  // Now the generated transformation is waiting for input so we
  // can start the service transformation
  //
  executor.waitUntilFinished();
  
  assertEquals(8, rows.size());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:24,代码来源:SqlTransMetaTest.java

示例5: testCSVInput1

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
/**
 * Test case for Get XML Data step, very simple example.
 *
 * @throws Exception
 *           Upon any exception
 */
@Test
public void testCSVInput1() throws Exception {
  KettleEnvironment.init();

  //
  // Create a new transformation...
  //
  TransMeta transMeta = new TransMeta();
  transMeta.setName( "csvinput1" );

  PluginRegistry registry = PluginRegistry.getInstance();

  String fileName = writeInputFile();

  StepMeta injectorStep = createInjectorStep( transMeta, registry );
  StepMeta csvInputStep = createCsvInputStep( transMeta, registry, "\'", true );

  createAndTestTrans(
    registry, transMeta, injectorStep, csvInputStep, fileName, createTextFileInputFields().length );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:CsvInput1NoTrailingSpaceIT.java

示例6: runTransWhenMappingsIsFollowedByCopiedStep

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
/**
 * This method runs transformations related to PDI-13545.<br/> The scenario is the following: there are two step
 * generating data, the latter of which is a Mapping step. They are followed with a Join Rows step, that has two
 * copies. The last in a row is a Dummy step, named "Last". Since both generating steps output 3 rows ([10, 20, 30]
 * and [1, 2, 3] respectively), the last step must obtain 3*3=9 rows.
 *
 * @param transPath a path to transformation file
 * @throws Exception
 */
private void runTransWhenMappingsIsFollowedByCopiedStep( String transPath ) throws Exception {
  KettleEnvironment.init();

  TransMeta transMeta = new TransMeta( transPath );
  transMeta.setTransformationType( TransMeta.TransformationType.Normal );

  Trans trans = new Trans( transMeta );
  trans.prepareExecution( null );
  trans.startThreads();
  trans.waitUntilFinished();

  assertEquals( 0, trans.getErrors() );

  List<StepInterface> list = trans.findBaseSteps( "Last" );
  assertEquals( 1, list.size() );
  assertEquals( 9, list.get( 0 ).getLinesRead() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:MappingIT.java

示例7: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
      Arrays.asList( "gPGLocation", "passphrase", "passphraseFieldName", "passphraseFieldName", "streamField", "resultFieldName" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PGPDecryptStreamMetaTest.java

示例8: setUp

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  KettleEnvironment.init();

  virtualFolder = "ram://file-repo/" + UUID.randomUUID();
  KettleVFS.getFileObject( virtualFolder ).createFolder();

  KettleFileRepositoryMeta repositoryMeta =
    new KettleFileRepositoryMeta( "KettleFileRepository", "FileRep", "File repository", virtualFolder );
  repository = new KettleFileRepository();
  repository.init( repositoryMeta );

  // Test connecting... (no security needed)
  //
  repository.connect( null, null );
  assertTrue( repository.isConnected() );

  // Test loading the directory tree
  //
  tree = repository.loadRepositoryDirectoryTree();
  assertNotNull( tree );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:KettleFileRepositoryTestBase.java

示例9: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
      Arrays.asList( "filename", "headerPresent", "lineWidth", "bufferSize", "lazyConversionActive", "lineFeedPresent",
          "runningInParallel", "fileType", "addResultFile", "encoding", "fieldDefinition" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();
  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "fieldDefinition",
      new ArrayLoadSaveValidator<FixedFileInputField>( new FixedFileInputFieldLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "fileType", new IntLoadSaveValidator( FixedInputMeta.fileTypeDesc.length ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:FixedInputMetaTest.java

示例10: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
      Arrays.asList( "inputSorted", "memoryPreservationActive", "usingSortedList", "usingIntegerPair", "keystream",
          "keylookup", "value", "valueName", "valueDefault", "valueDefaultType" );

  FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
      new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 );

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "keystream", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "keylookup", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "value", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "valueName", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "valueDefault", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "valueDefaultType", new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator( 7 ), 5 ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          new HashMap<String, String>(), new HashMap<String, String>(), attrValidatorMap, typeValidatorMap, this );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:StreamLookupMetaTest.java

示例11: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
      Arrays.asList( "fieldname", "type", "length", "precision" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "fieldname",
      new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "type",
      new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator( 7 ), 5 ) );
  attrValidatorMap.put( "length",
      new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator( 100 ), 5 ) );
  attrValidatorMap.put( "precision",
      new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator( 9 ), 5 ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:InjectorMetaTest.java

示例12: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
    Arrays.asList( "filename", "fileCreated", "tablename", "tableCreated", "tableTruncated", "commitSize", "addToResultFiles", "DoNotOpenNewFileInit" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
    new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:AccessOutputMetaTest.java

示例13: testCSVInput1

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
/**
 * Test case for Get XML Data step, very simple example.
 *
 * @throws Exception
 *           Upon any exception
 */
@Test
public void testCSVInput1() throws Exception {
  KettleEnvironment.init();

  //
  // Create a new transformation...
  //
  TransMeta transMeta = new TransMeta();
  transMeta.setName( "csvinput1" );

  PluginRegistry registry = PluginRegistry.getInstance();

  String fileName = writeInputFile();

  StepMeta injectorStep = createInjectorStep( transMeta, registry );
  StepMeta csvInputStep = createCsvInputStep( transMeta, registry, "++", true );

  createAndTestTrans(
    registry, transMeta, injectorStep, csvInputStep, fileName, createTextFileInputFields().length );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:CsvInput2TrailingSpacesTwoCharEnclosuresIT.java

示例14: testCSVInput1

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
/**
 * Test case for Get XML Data step, very simple example.
 *
 * @throws Exception
 *           Upon any exception
 */
@Test
public void testCSVInput1() throws Exception {
  KettleEnvironment.init();

  //
  // Create a new transformation...
  //
  TransMeta transMeta = new TransMeta();
  transMeta.setName( "csvinput1" );

  PluginRegistry registry = PluginRegistry.getInstance();

  String fileName = writeInputFile();

  StepMeta injectorStep = createInjectorStep( transMeta, registry );
  StepMeta csvInputStep = createCsvInputStep( transMeta, registry, "\"", false );

  createAndTestTrans(
    registry, transMeta, injectorStep, csvInputStep, fileName, createTextFileInputFields().length );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:CsvInput3IT.java

示例15: setUpLoadSave

import org.pentaho.di.core.KettleEnvironment; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( true );
  List<String> attributes =
      Arrays.asList( "databaseMeta", "sQL", "rowLimit", "executeEachInputRow", "variableReplacementActive", "lazyConversionActive" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:18,代码来源:TableInputMetaTest.java


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