package com.zhaxd.common.kettle.environment;


public class StartInit {

	public void init() throws Exception {
		System.out.println("****** 启动kettle运行环境 ******");

		//如果是linux，加载器需要重新设置，要不然log4j匹配不上
		if(isLinux()) {
			Thread thread = Thread.currentThread();
			ClassLoader loader = thread.getContextClassLoader();
			System.out.println("********** - "+thread.getContextClassLoader().toString());
			loader = loader.getParent();
			System.out.println("********** - "+loader.toString());
			thread.setContextClassLoader(loader);
		}


		//初始化环境***
//		com.zhaxd.common.kettle.environment.KettleInit.init();
		com.zhaxd.common.kettle.environment.KettleInit.environmentInit();
		org.pentaho.di.core.KettleEnvironment.init();
	}

	private boolean isLinux() {
		String os = System.getProperty("os.name");
		return os.toUpperCase().contains("LINUX");
	}
}
