當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。