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


Java KettleException类代码示例

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


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

示例1: initLifecycleListeners

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
/**
 * 提醒所有生命周期的插件水壶环境。 初始化。
 * 
 * @throws KettleException
 *             当一个生命周期侦听器抛出一个异常
 */
private static void initLifecycleListeners() throws KettleException {
	final KettleLifecycleSupport s = new KettleLifecycleSupport();
	s.onEnvironmentInit();
	// 注册关闭hook监听的调用OnExit()方法
	Runtime.getRuntime().addShutdownHook(new Thread() {
		public void run() {
			try {
				s.onEnvironmentShutdown();
			} catch (Throwable t) {
				System.err.println(BaseMessages
						.getString(PKG,
								"LifecycleSupport.ErrorInvokingKettleEnvironmentShutdownListeners"));
				t.printStackTrace();
			}
		};
	});

}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:25,代码来源:KettleEnvironment.java

示例2: tree

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@RequestMapping(value = ACTION_TREE, method = RequestMethod.POST)
public void tree(HttpServletRequest request, HttpServletResponse response)
		throws IOException {
	try {
		Iterator<?> it = request.getParameterMap().entrySet().iterator();
		KettleRepos entity = new KettleRepos();
		while (it.hasNext()) {
			Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
			entity.setValue((String) ent.getKey(),
					((String[]) ent.getValue())[0]);
		}
		List<?> list = service.iKettleReposService.getJobAndTrans(entity);
		response.getWriter().write(JSONArray.fromObject(list).toString());
	} catch (KettleException e) {
		e.printStackTrace();
	} finally {
		response.getWriter().close();
	}
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:20,代码来源:KettleSpoonController.java

示例3: get

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@SuppressWarnings("all")
@RequestMapping(value = ACTION_GET, method = RequestMethod.POST)
public void get(HttpServletRequest request, HttpServletResponse response)
		throws IOException {
	try {
		Iterator<?> it = request.getParameterMap().entrySet().iterator();
		KettleSpoon entity = new KettleSpoon();
		while (it.hasNext()) {
			Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
			entity.setValue((String) ent.getKey(),
					((String[]) ent.getValue())[0]);
		}
		Map<String, String> map = (Map<String, String>) service.iKettleReposService
				.getParameters(entity);
		response.getWriter().write(JSONArray.fromObject(map).toString());
	} catch (KettleException e) {
		e.printStackTrace();
	} finally {
		response.getWriter().close();
	}
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:22,代码来源:KettleSpoonController.java

示例4: setParameters

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
/**
 * 重置旧参数,设置新参数
 * 
 * @param entity
 * @return JobMeta
 */
@Override
public Object setParameters(T entity) throws KettleException {
	jobMeta.clearParameters();
	Iterator<Entry<String, String>> it = entity.getValue().entrySet()
			.iterator();
	while (it.hasNext()) {
		Entry<String, String> obj = it.next();
		try {
			jobMeta.setParameterValue(obj.getKey(), obj.getValue());
		} catch (UnknownParamException e) {
			e.printStackTrace();
		}
	}
	return jobMeta;
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:22,代码来源:KettleJobServiceImpl.java

示例5: getXML

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@Override public String getXML() throws KettleException {

        StringBuilder retVal = new StringBuilder();
        retVal.append(super.getXML());

        retVal.append("  ")
            .append(XMLHandler.addTagValue("truncate", isTruncate() ? "true" : "false"));

        for (int i = 0; i < streamFields.size(); i++) {
            String streamField = streamFields.get(i);
            retVal.append("  <stream_fields>").append(Const.CR);
            retVal.append("  ").append(XMLHandler.addTagValue("name", streamField.toLowerCase()));
            retVal.append("  </stream_fields>").append(Const.CR);
        }

        return retVal.toString();
    }
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:18,代码来源:OdpsOutputMeta.java

示例6: readRep

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@Override public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step,
    List<DatabaseMeta> databases) throws KettleException {
    super.readRep(rep, metaStore, id_step, databases);

    String truncateStr = rep.getStepAttributeString(id_step, "truncate");
    if (truncateStr.equals("true")) {
        setTruncate(true);
    } else {
        setTruncate(false);
    }

    int nrStreamFields = rep.countNrStepAttributes(id_step, "stream_field_name");
    streamFields = new ArrayList<String>(nrStreamFields);
    for (int i = 0; i < nrStreamFields; i++) {
        streamFields.add(rep.getStepAttributeString(id_step, i, "stream_field_name"));
    }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:18,代码来源:OdpsOutputMeta.java

示例7: readRep

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@Override public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step,
    List<DatabaseMeta> databases) throws KettleException {
    setEndpoint(rep.getStepAttributeString(id_step, "endpoint"));
    setTunnelEndpoint(rep.getStepAttributeString(id_step, "tunnelEndpoint"));
    setAccessId(rep.getStepAttributeString(id_step, "accessId"));
    setAccessKey(rep.getStepAttributeString(id_step, "accessKey"));
    setProjectName(rep.getStepAttributeString(id_step, "projectName"));
    setTableName(rep.getStepAttributeString(id_step, "tableName"));
    setPartition(rep.getStepAttributeString(id_step, "partition"));

    int nrFields = rep.countNrStepAttributes(id_step, "field_name");
    odpsFields = new ArrayList<OdpsField>(nrFields);
    for (int i = 0; i < nrFields; i++) {
        OdpsField field = new OdpsField();
        field.setName(rep.getStepAttributeString(id_step, i, "field_name"));
        field.setType(rep.getStepAttributeString(id_step, i, "field_type"));
        field.setComment(rep.getStepAttributeString(id_step, i, "field_comment"));
        odpsFields.add(field);
    }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:21,代码来源:OdpsMeta.java

示例8: initEnv

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

示例9: transCopy

import org.pentaho.di.core.exception.KettleException; //导入依赖的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,项目名称:KettleUtil,代码行数:31,代码来源:KettleUtils.java

示例10: processRow

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
	meta = (EasyExpandMeta) smi;
	data = (EasyExpandData) sdi;
	if(StringUtils.isNotBlank(meta.getClassName())){
           try {
               //实例化配置的类
               if(first){
                   kui = (EasyExpandRunBase) Class.forName(
                           environmentSubstitute(meta.getClassName())).newInstance();
                   kui.setKu(this);
                   kui.setMeta(meta,this);
               }
               kui.setData(data);
               return kui.run();
           } catch (Exception e) {
               setErrors(getErrors()+1);
               logError("运行失败,"+meta.getClassName()+","
               +environmentSubstitute(meta.getConfigInfo()), e);
               return defaultRun();
           }
	}else{
        return defaultRun();
	}

}
 
开发者ID:majinju,项目名称:KettleUtil,代码行数:26,代码来源:EasyExpand.java

示例11: getOrMakeDirectory

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
/**
 * 获取或创建目录 <br/>
 * @author jingma
 * @param parentDirectory 父级目录
 * @param directoryName 要创建的目录
 * @return
 * @throws KettleException 
 * @since JDK 1.6
 */
public static RepositoryDirectoryInterface getOrMakeDirectory(String parentDirectory,String directoryName) throws KettleException {
    RepositoryDirectoryInterface parent = repository.findDirectory(parentDirectory);
    if(StringUtil.isBlank(parentDirectory)){
        parent = repository.findDirectory("/");
    }
    if(StringUtil.isNotBlank(directoryName)){
        RepositoryDirectoryInterface dir = repository.findDirectory(parentDirectory+"/"+directoryName);
        if(dir==null){
            return repository.createRepositoryDirectory(parent, directoryName);
        }else{
            return dir;
        }
    }else{
        return parent;
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:26,代码来源:KettleUtils.java

示例12: jobCopy

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
/**
* 将指定job复制到KettleUtils中的资源库 <br/>
* @author jingma
* @param jobName job名称
* @param jobPath job路径
* @param fromRepository 来源资源库
   * @param toRepository 目标资源库
* @throws KettleException
*/
public static void jobCopy(String jobName,String jobPath,Repository fromRepository,
        Repository toRepository) throws KettleException {
	JobMeta jobMeta = KettleUtils.loadJob(jobName,jobPath,fromRepository);
	for(JobEntryCopy jec:jobMeta.getJobCopies()){
		if(jec.isTransformation()){
			JobEntryTrans jet = (JobEntryTrans)jec.getEntry();
			transCopy(jet.getObjectName(), jet.getDirectory(),fromRepository,toRepository);
		}else if(jec.isJob()){
			JobEntryJob jej = (JobEntryJob)jec.getEntry();
			jobCopy(jej.getObjectName(),jej.getDirectory(),fromRepository,toRepository);
		}
	}
	jobMeta.setRepository(toRepository);
	jobMeta.setMetaStore(toRepository.getMetaStore());
	if(!isDirectoryExist(toRepository,jobPath)){
		//所在目录不存在则创建
	    toRepository.createRepositoryDirectory(toRepository.findDirectory("/"), jobPath);
	}
	KettleUtils.saveJob(toRepository,jobMeta);
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:30,代码来源:KettleUtils.java

示例13: processRow

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
	meta = (EasyExpandMeta) smi;
	data = (EasyExpandData) sdi;
	if(StringUtils.isNotBlank(meta.getClassName())){
           try {
               //实例化配置的类
               if(first){
                   kui = (EasyExpandRunBase) Class.forName(
                           environmentSubstitute(meta.getClassName())).newInstance();
                   kui.setKu(this);
                   kui.setMeta(meta,this);
               }
               kui.setData(data);
               return kui.run();
           } catch (Exception e) {
               setErrors(getErrors()+1);
               logError("运行失败,"+meta.getClassName()+","+Arrays.toString(getRow())+","
               +environmentSubstitute(meta.getConfigInfo()), e);
               return defaultRun();
           }
	}else{
        return defaultRun();
	}

}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:26,代码来源:EasyExpand.java

示例14: discard

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
@RequestMapping(value = ACTION_DISCARD, method = RequestMethod.POST)
public String discard(HttpServletRequest request,
		HttpServletResponse response) throws IOException, KettleException {
	Iterator<?> it = request.getParameterMap().entrySet().iterator();
	KettleRepos entity = new KettleRepos();
	while (it.hasNext()) {
		Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
		entity.setValue((String) ent.getKey(),
				((String[]) ent.getValue())[0]);
	}
	service.iKettleReposService.discard(entity);
	return VIEW_WIDGET + VIEW_KETTLE + VIEW_REPOS + PAGE_LIST;
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:14,代码来源:KettleReposController.java

示例15: getTransformationID

import org.pentaho.di.core.exception.KettleException; //导入依赖的package包/类
/**
* 获取转换id <br/>
* @author jingma
* @param name 转换名称
* @param repositoryDirectory 转换目录
* @return 存在则返回id,不存在则返回null
*/
public static ObjectId getTransformationID(String name,
        RepositoryDirectoryInterface repositoryDirectory) {
    try {
        return repository.getTransformationID(name, repositoryDirectory);
    } catch (KettleException e) {
        log.debug("获取转换id失败", e);
    }
    return null;
}
 
开发者ID:majinju,项目名称:KettleUtil,代码行数:17,代码来源:KettleUtils.java


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