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


Java KettleClientEnvironment类代码示例

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


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

示例1: initEnv

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的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: main

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

    Display display = new Display(  );
    try {
      KettleEnvironment.init();

      PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );

      KettleLogStore
          .init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes() );

    } catch ( KettleException e ) {
      e.printStackTrace();
    }

    KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON );
    Shell shell = new Shell( display, SWT.DIALOG_TRIM );
    shell.open();
    CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog( shell );
    capabilityManagerDialog.open();
    while ( !shell.isDisposed() ) {
      if ( !display.readAndDispatch() ) {
        display.sleep();
      }
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:CapabilityManagerDialog.java

示例3: initRepository

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
/**
 * 初始化资源库
 * 
 * @param repo
 *            资源库
 * @param isConnected
 *            (是否重新连接)
 */
private void initRepository(T entity, boolean isConnected)
		throws KettleException {
	if (null != entity) {
		RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
		DatabaseMeta db = new DatabaseMeta();
		db.setDatabaseType(entity.getDialect());
		db.setAccessType(Integer.parseInt(entity.getAccess()));
		db.setDBName(entity.getDb());
		db.setHostname(entity.getServer());
		db.setDBPort(entity.getPort());
		db.setUsername(entity.getUsername());
		db.setPassword(entity.getPassword());
		KettleDatabaseRepositoryMeta rmeta = new KettleDatabaseRepositoryMeta();
		rmeta.setConnection(db);
		rmeta.setId(entity.getType());
		rmeta.setName(entity.getName());
		repositoriesMeta.addDatabase(db);
		repositoriesMeta.addRepository(rmeta);
		// 选择加载过的资源库
		RepositoryMeta meta = repositoriesMeta.findRepository(entity
				.getName());
		 KettleClientEnvironment.init();
		// 获得资源库实例
		repo = PluginRegistry.getInstance().loadClass(
				RepositoryPluginType.class, meta.getId(), Repository.class);
		repo.init(meta);
		// 连接资源库
		repo.connect(entity.getUser(), entity.getPass());
		if (!isConnected) {
			list.add(repo);
		}
	}
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:42,代码来源:KettleReposServiceImpl.java

示例4: main

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		KettleClientEnvironment.init();
	} catch (KettleException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	String obfuscated = Encr.encryptPasswordIfNotUsingVariables( "root" );
    System.out.println( obfuscated );
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:11,代码来源:KettleReposServiceImpl.java

示例5: initEnv

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

示例6: setUp

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Before
public void setUp() throws KettleException {
  KettleClientEnvironment.init();
  metaStore = new MemoryMetaStore();

  repo = new GitRepository();
  repo.setName( NAME );
  repo.setDescription( DESCRIPTION );
  repo.setDirectory( DIRECTORY );
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:11,代码来源:GitRepositoryTest.java

示例7: setUp

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  KettleClientEnvironment.init();
  metaStore = new MemoryMetaStore();

  inputs = new ArrayList<TransUnitTestSetLocation>();
  inputs.add( new TransUnitTestSetLocation( "input-step1", "data-set-name1", 
      Arrays.asList( 
          new TransUnitTestFieldMapping( "fieldA", "setFieldA"),
          new TransUnitTestFieldMapping( "fieldB", "setFieldB"),
          new TransUnitTestFieldMapping( "fieldC", "setFieldC")            
        ), Arrays.asList("order1", "order2", "order3")));
  inputs.add( new TransUnitTestSetLocation( "input-step2", "data-set-name2", 
      Arrays.asList( 
          new TransUnitTestFieldMapping( "fieldX", "setFieldX"),
          new TransUnitTestFieldMapping( "fieldY", "setFieldY"),
          new TransUnitTestFieldMapping( "fieldW", "setFieldW"),
          new TransUnitTestFieldMapping( "fieldZ", "setFieldZ")           
         ), Arrays.asList("order1", "order2", "order3", "order4")));
  
  goldens = new ArrayList<TransUnitTestSetLocation>();
  
  List<TransUnitTestTweak> tweaks = new ArrayList<TransUnitTestTweak>();
  tweaks.add( new TransUnitTestTweak(TransTweak.NONE, "step1") );
  tweaks.add( new TransUnitTestTweak(TransTweak.BYPASS_STEP, "step2") );
  tweaks.add( new TransUnitTestTweak(TransTweak.REMOVE_STEP, "step3") );
  
  test = new TransUnitTest(NAME, DESCRIPTION, 
      null, null, "sometrans.ktr",
      inputs,
      goldens,
      tweaks,
      TestType.UNIT_TEST,
      null, new ArrayList<TransUnitTestDatabaseReplacement>()
      );
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:37,代码来源:TransUnitTestTest.java

示例8: setUp

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  KettleClientEnvironment.init();
  metaStore = new MemoryMetaStore();
  databaseMeta = new DatabaseMeta( "dataset", "H2", "JDBC", null, "/tmp/datasets", null, null, null );
  dataSetGroup = new DataSetGroup( GROUP_NAME, GROUP_DESC, databaseMeta, GROUP_SCHEMA );

  List<DataSetField> fields = new ArrayList<>();
  for ( int i = 0; i < NR_FIELDS; i++ ) {
    fields.add( new DataSetField( "field" + i, "column" + i, ValueMetaInterface.TYPE_STRING, 50, 0, "comment" + i ) );
  }
  dataSet = new DataSet( NAME, DESC, dataSetGroup, TABLE, fields );
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:14,代码来源:DataSetTest.java

示例9: testResolvingPathVariables

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Test
public void testResolvingPathVariables() throws KettleException {
  String hostConcrete = "host_concrete";
  String portConcrete = "12345";
  String trustStorePath = "${KETTLE_SSL_PATH}";
  String trustStorePathResolved = "/home/test_path";
  String trustStorePassword = "TEST_PASSWORD";

  when( mockLdapMeta.getHost() ).thenReturn( hostConcrete );
  when( mockLdapMeta.getPort() ).thenReturn( portConcrete );
  when( mockLdapMeta.getDerefAliases() ).thenReturn( "always" );
  when( mockLdapMeta.getReferrals() ).thenReturn( "follow" );
  when( mockLdapMeta.isUseCertificate() ).thenReturn( true );
  when( mockLdapMeta.isTrustAllCertificates() ).thenReturn( true );
  when( mockLdapMeta.getTrustStorePath() ).thenReturn( trustStorePath );
  when( mockLdapMeta.getTrustStorePassword() ).thenReturn( trustStorePassword );

  when( mockVariableSpace.environmentSubstitute( eq( hostConcrete ) ) ).thenReturn( hostConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( portConcrete ) ) ).thenReturn( portConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePath ) ) ).thenReturn( trustStorePathResolved );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePassword ) ) ).thenReturn( trustStorePassword );

  KettleClientEnvironment.init();
  TestableLdapProtocol testableLdapProtocol =
          new TestableLdapProtocol( mockLogChannelInterface, mockVariableSpace, mockLdapMeta, null );
  testableLdapProtocol.connect( null, null );
  assertEquals( trustStorePathResolved, testableLdapProtocol.trustStorePath );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:LdapSslProtocolIT.java

示例10: testResolvingPasswordVariables

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Test
public void testResolvingPasswordVariables() throws KettleException {
  String hostConcrete = "host_concrete";
  String portConcrete = "12345";
  String trustStorePath = "/home/test_path";
  String trustStorePassword = "${PASSWORD_VARIABLE}";
  String trustStorePasswordResolved = "TEST_PASSWORD_VALUE";

  when( mockLdapMeta.getHost() ).thenReturn( hostConcrete );
  when( mockLdapMeta.getPort() ).thenReturn( portConcrete );
  when( mockLdapMeta.getDerefAliases() ).thenReturn( "always" );
  when( mockLdapMeta.getReferrals() ).thenReturn( "follow" );
  when( mockLdapMeta.isUseCertificate() ).thenReturn( true );
  when( mockLdapMeta.isTrustAllCertificates() ).thenReturn( true );
  when( mockLdapMeta.getTrustStorePath() ).thenReturn( trustStorePath );
  when( mockLdapMeta.getTrustStorePassword() ).thenReturn( trustStorePassword );

  when( mockVariableSpace.environmentSubstitute( eq( hostConcrete ) ) ).thenReturn( hostConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( portConcrete ) ) ).thenReturn( portConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePath ) ) ).thenReturn( trustStorePath );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePassword ) ) ).thenReturn( trustStorePasswordResolved );

  KettleClientEnvironment.init();
  TestableLdapProtocol testableLdapProtocol =
          new TestableLdapProtocol( mockLogChannelInterface, mockVariableSpace, mockLdapMeta, null );
  testableLdapProtocol.connect( null, null );
  assertEquals( trustStorePasswordResolved, testableLdapProtocol.trustStorePassword );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:LdapSslProtocolIT.java

示例11: testResolvingPasswordAndDecryptVariables

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@Test
public void testResolvingPasswordAndDecryptVariables() throws KettleException {
  String hostConcrete = "host_concrete";
  String portConcrete = "12345";
  String trustStorePath = "/home/test_path";
  String trustStorePassword = "${PASSWORD_VARIABLE}";
  String trustStorePasswordResolved = "Encrypted 2be98afc86aa7f2e4cb79ff228dc6fa8c"; //original value 123456


  when( mockLdapMeta.getHost() ).thenReturn( hostConcrete );
  when( mockLdapMeta.getPort() ).thenReturn( portConcrete );
  when( mockLdapMeta.getDerefAliases() ).thenReturn( "always" );
  when( mockLdapMeta.getReferrals() ).thenReturn( "follow" );
  when( mockLdapMeta.isUseCertificate() ).thenReturn( true );
  when( mockLdapMeta.isTrustAllCertificates() ).thenReturn( true );
  when( mockLdapMeta.getTrustStorePath() ).thenReturn( trustStorePath );
  when( mockLdapMeta.getTrustStorePassword() ).thenReturn( trustStorePassword );

  when( mockVariableSpace.environmentSubstitute( eq( hostConcrete ) ) ).thenReturn( hostConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( portConcrete ) ) ).thenReturn( portConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePath ) ) ).thenReturn( trustStorePath );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePassword ) ) ).thenReturn( trustStorePasswordResolved );

  KettleClientEnvironment.init();
  TestableLdapProtocol testableLdapProtocol =
          new TestableLdapProtocol( mockLogChannelInterface, mockVariableSpace, mockLdapMeta, null );
  testableLdapProtocol.connect( null, null );
  assertEquals( "123456", testableLdapProtocol.trustStorePassword );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:30,代码来源:LdapSslProtocolIT.java

示例12: init

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:SafeStopTest.java

示例13: init

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@BeforeClass
public static void init() throws Exception {
  if ( !KettleClientEnvironment.isInitialized() ) {
    KettleClientEnvironment.init();
  }
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:12,代码来源:TransMetaConverterTest.java

示例14: setupBeforeClass

import org.pentaho.di.core.KettleClientEnvironment; //导入依赖的package包/类
@BeforeClass
public static void setupBeforeClass() throws KettleException {
  if ( Const.isWindows() ) {
    wasEncoding = System.getProperty( "file.encoding" );
    fiddleWithDefaultCharset( "utf8" );
  }
  KettleClientEnvironment.init();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:LoadFileInputTest.java

示例15: main

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

    if ( args.length != 2 ) {
      System.err.println( "Usage: Translator <translator.xml> <path-to-source>" );
      System.err.println( "Example:" );
      System.err.println( "sh translator.sh translator.xml ." );
      System.exit( 1 );
    }

    KettleClientEnvironment.init();

    String configFile = args[0];
    String sourceFolder = args[1];

    Display display = new Display();
    LogChannelInterface log = new LogChannel( APP_NAME );
    PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );

    Translator2 translator = new Translator2( display );
    translator.loadConfiguration( configFile, sourceFolder );
    translator.open();

    try {
      while ( !display.isDisposed() ) {
        if ( !display.readAndDispatch() ) {
          display.sleep();
        }
      }
    } catch ( Throwable e ) {
      log.logError( BaseMessages.getString( PKG, "i18n.UnexpectedError", e.getMessage() ) );
      log.logError( Const.getStackTracker( e ) );
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:Translator2.java


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