• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Job类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: jobStopAll

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 停止作业,包含子作业和转换 <br/>
* @author jingma
* @param job
*/
public static void jobStopAll(Job job){
       job.stopAll();
       JobMeta jobMeta = job.getJobMeta();
       for(JobEntryCopy jec:jobMeta.getJobCopies()){
           if(jec.isTransformation()){
               JobEntryTrans jet = (JobEntryTrans)jec.getEntry();
               if(jet.getTrans()!=null){
                   jet.getTrans().stopAll();
               }
           }else if(jec.isJob()){
               JobEntryJob jej = (JobEntryJob)jec.getEntry();
               if(jej.getJob()!=null){
                   jobStopAll(jej.getJob());
               }
           }
       }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:23,代码来源:KettleUtils.java


示例2: jobKillAll

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 结束作业,包含子作业和转换 <br/>
* @author jingma
* @param job
*/
@SuppressWarnings("deprecation")
public static void jobKillAll(Job job){
    job.stopAll();
    JobMeta jobMeta = job.getJobMeta();
    for(JobEntryCopy jec:jobMeta.getJobCopies()){
        if(jec.isTransformation()){
            JobEntryTrans jet = (JobEntryTrans)jec.getEntry();
            if(jet.getTrans()!=null){
                jet.getTrans().killAll();
            }
        }else if(jec.isJob()){
            JobEntryJob jej = (JobEntryJob)jec.getEntry();
            if(jej.getJob()!=null){
                jobKillAll(jej.getJob());
            }
        }
    }
    //采用线程中断结束卡住的线程
    if(job.getState().equals(State.BLOCKED)||job.getState().equals(State.TIMED_WAITING)){
        job.stop();
    }else{
        job.interrupt();
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:30,代码来源:KettleUtils.java


示例3: setUp

import org.pentaho.di.job.Job; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  StepMeta stepMeta = mock( StepMeta.class );
  TransMeta transMeta = mock( TransMeta.class );
  Trans trans = mock( Trans.class );
  when( stepMeta.getName() ).thenReturn( "someName" );
  when( transMeta.findStep( "someName" ) ).thenReturn( stepMeta );
  doReturn( mock( Trans.class ) ).when( trans ).getParentTrans();
  Job job = mock( Job.class );
  when( trans.getParentJob() ).thenReturn( job );

  setSessionVariableData = mock( SetSessionVariableData.class );

  setSessionVariableStep = new SetSessionVariableStep( stepMeta, setSessionVariableData, 0, transMeta, trans );
  setSessionVariableStepSpy = spy( setSessionVariableStep );

  doReturn( setSessionVariableData ).when( setSessionVariableStepSpy ).getData();
  doNothing().when( setSessionVariableStepSpy ).logBasic( anyString() );
}
 
开发者ID:pentaho,项目名称:pdi-platform-utils-plugin,代码行数:20,代码来源:SetSessionVariableStepTest.java


示例4: setUp

import org.pentaho.di.job.Job; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  StepMeta stepMeta = mock( StepMeta.class );
  TransMeta transMeta = mock( TransMeta.class );
  Trans trans = mock( Trans.class );

  when( stepMeta.getName() ).thenReturn( "someName" );
  when( transMeta.findStep( "someName" ) ).thenReturn( stepMeta );
  doReturn( mock( Trans.class ) ).when( trans ).getParentTrans();
  Job job = mock( Job.class );
  when( trans.getParentJob() ).thenReturn( job );

  getSessionVariableData = mock( GetSessionVariableData.class );

  getSessionVariableStep = new GetSessionVariableStep( stepMeta, getSessionVariableData, 0, transMeta, trans );
  getSessionVariableStepSpy = spy( getSessionVariableStep );

  doReturn( new Object[] {} ).when( getSessionVariableStepSpy ).getRow();
}
 
开发者ID:pentaho,项目名称:pdi-platform-utils-plugin,代码行数:20,代码来源:GetSessionVariableStepTest.java


示例5: addFileToResultFilenames

import org.pentaho.di.job.Job; //导入依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,LogWriter log,Result result,Job parentJob)
	{	
		try
		{
			ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry), parentJob.getJobname(), toString());
			result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
	    
			if(log.isDebug())
			{
				log.logDebug(toString()," ------ ");
				log.logDebug(toString(),Messages.getString("JobMoveFiles.Log.FileAddedToResultFilesName",fileaddentry));
			}
			
		}catch (Exception e)
		{
			log.logError(Messages.getString("JobMoveFiles.Error.AddingToFilenameResult"),fileaddentry + ""+e.getMessage());
		}

}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:20,代码来源:JobEntryMoveFiles.java


示例6: addFileToResultFilenames

import org.pentaho.di.job.Job; //导入依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,LogWriter log,Result result,Job parentJob)
	{	
		try
		{
			ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry), parentJob.getName(), toString());
			result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
	    
			if(log.isDetailed())
			{
				log.logDetailed(toString(),Messages.getString("JobXMLWellFormed.Log.FileAddedToResultFilesName",fileaddentry));
			}
			
		}catch (Exception e)
		{
			log.logError(toString(),Messages.getString("JobXMLWellFormed.Error.AddingToFilenameResult",fileaddentry,e.getMessage()));
		}

}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:19,代码来源:JobEntryXMLWellFormed.java


示例7: TextFileSelector

import org.pentaho.di.job.Job; //导入依赖的package包/类
public TextFileSelector(String sourcefolderin,String destinationfolderin,String filewildcard, Job parentJob) 
{

 if ( !Const.isEmpty(sourcefolderin))
 {
	 source_folder=sourcefolderin;
 }
 if ( !Const.isEmpty(destinationfolderin))
 {
	 destination_folder=destinationfolderin;
 }
 if ( !Const.isEmpty(filewildcard))
 {
	 file_wildcard=filewildcard;
 }
 parentjob=parentJob;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:18,代码来源:JobEntryCopyFiles.java


示例8: addFileToResultFilenames

import org.pentaho.di.job.Job; //导入依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,Result result,Job parentJob)
	{	
		try
		{
			ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry, this), parentJob.getJobname(), toString());
			result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
	    
			if(log.isDebug())
			{
				logDebug(" ------ ");
				logDebug(BaseMessages.getString(PKG, "JobMoveFiles.Log.FileAddedToResultFilesName",fileaddentry));
			}
			
		}catch (Exception e)
		{
			log.logError(BaseMessages.getString(PKG, "JobMoveFiles.Error.AddingToFilenameResult"),fileaddentry + ""+e.getMessage());
		}

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:20,代码来源:JobEntryMoveFiles.java


示例9: copyRecursive

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
 * copy a directory from the remote host to the local one recursivly.
 * 
 * @param sourceLocation the source directory on the remote host
 * @param targetLocation the target directory on the local host
 * @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
 * @return the number of files successfully copied
 * @throws Exception
 */
 	private void copyRecursive(String sourceLocation, String targetLocation,
	SFTPv3Client sftpClient,Pattern pattern,Job parentJob) throws Exception 
{
	String sourceFolder="."+FTPUtils.FILE_SEPARATOR;
	if (sourceLocation!=null) sourceFolder=sourceLocation;
		
	if (this.isDirectory(sftpClient, sourceFolder)) {	
        Vector<?> filelist = sftpClient.ls(sourceFolder);
        Iterator<?> iterator = filelist.iterator();

        while (iterator.hasNext()) {

        SFTPv3DirectoryEntry dirEntry = (SFTPv3DirectoryEntry) iterator .next();

        if (dirEntry == null)   continue;
        if (dirEntry.filename.equals(".")  || dirEntry.filename.equals(".."))  continue;
        copyRecursive(sourceFolder + FTPUtils.FILE_SEPARATOR+dirEntry.filename, targetLocation + Const.FILE_SEPARATOR 
        		+ dirEntry.filename, sftpClient,pattern,parentJob);
       } 
      } else if (isFile(sftpClient, sourceFolder))
      {
   	  if(getFileWildcard(sourceFolder,pattern))
           copyFile(sourceFolder, targetLocation, sftpClient);
      }
 }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:JobEntrySSH2GET.java


示例10: getFileSize

import org.pentaho.di.job.Job; //导入依赖的package包/类
private void getFileSize(FileObject file, Result result,Job parentJob) {
	try{

		incrementFilesCount();
		if(isDetailed()) logDetailed( BaseMessages.getString(PKG, "JobEvalFilesMetrics.Log.GetFile",file.toString(), String.valueOf(getFilesCount())));
		switch(evaluationType) {
			case EVALUATE_TYPE_SIZE : 
				BigDecimal fileSize=BigDecimal.valueOf(file.getContent().getSize());
				evaluationValue=evaluationValue.add(fileSize);
				if(isDebug()) logDebug( BaseMessages.getString(PKG, "JobEvalFilesMetrics.Log.AddedFileSize", String.valueOf(fileSize), file.toString()));
			break;
			default:
				evaluationValue=evaluationValue.add(ONE);
			break;	
		}
	}catch (Exception e) {
		incrementErrors();
		logError(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Error.GettingFileSize", file.toString(),e.toString()));
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:JobEntryEvalFilesMetrics.java


示例11: addFileToResultFilenames

import org.pentaho.di.job.Job; //导入依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,Result result,Job parentJob)
	{	
		try
		{
			ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry, this), parentJob.getName(), toString());
			result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
	    
			if(log.isDetailed())
			{
				logDetailed(BaseMessages.getString(PKG, "JobXMLWellFormed.Log.FileAddedToResultFilesName",fileaddentry));
			}
			
		}catch (Exception e)
		{
			logError(BaseMessages.getString(PKG, "JobXMLWellFormed.Error.AddingToFilenameResult",fileaddentry,e.getMessage()));
		}

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:JobEntryXMLWellFormed.java


示例12: TextFileSelector

import org.pentaho.di.job.Job; //导入依赖的package包/类
public TextFileSelector(FileObject sourcefolderin,FileObject destinationfolderin,String filewildcard, Job parentJob) 
{

 if ( sourcefolderin != null)
 {
	 source_folder=sourcefolderin.toString();
 }
 if ( destinationfolderin != null)
 {
   destinationFolderObject = destinationfolderin;
	 destination_folder=destinationFolderObject.toString();
 }
 if ( !Const.isEmpty(filewildcard))
 {
	 file_wildcard=filewildcard;
	 pattern = Pattern.compile(file_wildcard);
 }
 parentjob=parentJob;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:20,代码来源:JobEntryCopyFiles.java


示例13: iMonitor

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
 * 记录job操作信息
 * 
 * @param job
 * @param entity
 * @throws KettleException
 */
private String iMonitor(Job job, T entity) {
	KettleResult m = new KettleResult();
	m.setName(entity.getName());
	m.setParams(JSONObject.fromObject(entity.getValue()).toString());
	m.setStartTime(entity.getCreated());
	m.setEndTime(DateUtils.getTime24());
	m.setDeleted(String.valueOf(job.getResult().getNrLinesDeleted()));
	m.setInput(String.valueOf(job.getResult().getNrLinesInput()));
	m.setError(String.valueOf(job.getErrors()));
	m.setOutput(String.valueOf(job.getResult().getNrLinesOutput()));
	m.setRead(String.valueOf(job.getResult().getNrLinesRead()));
	m.setUpdated(String.valueOf(job.getResult().getNrLinesUpdated()));
	m.setWritten(String.valueOf(job.getResult().getNrLinesWritten()));
	m.setRetrieved(String.valueOf(job.getResult().getNrFilesRetrieved()));
	m.setRejected(String.valueOf(job.getResult().getNrLinesRejected()));
	m.setHost(ServerUtils.getName() + ":" + ServerUtils.getHost());
	m.setCreated(entity.getCreated());
	m.setCreator(Shiro.get().getId());
	m.setModifier(Shiro.get().getId());
	m.setModified(DateUtils.getTime24());
	int second = DateUtils.getInterval(entity.getCreated(), m.getEndTime());
	m.setTimes(String.valueOf(second));
	m.setType(Constant.TYPE_RUNNING);
	if (entity.isTest()) {
		m.setType(Constant.TYPE_TESTING);
	}
	m.setStatus(Constant.STATUS_COMPLETE);
	m.setAgain("0");
	if (job.getErrors() > 0) {
		m.setStatus(Constant.STATUS_ERROR);
	}
	return (String) service.iKettleResultService.insert(m);
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:41,代码来源:KettleJobServiceImpl.java


示例14: iLogging

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
 * 记录job日志信息
 * 
 * @param job
 * @param entity
 * @throws KettleException
 */
private void iLogging(Job job, T entity) {
	KettleLogs log = new KettleLogs();
	log.setId(ObjectID.id());
	log.setMid(entity.getId());
	log.setLogs(job.getResult().getLogText());
	log.setCreator(Shiro.get().getId());
	log.setCreated(DateUtils.getTime24());
	service.iKettleLogsService.insert(log);
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:17,代码来源:KettleJobServiceImpl.java


示例15: iEmail

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
 * 邮件预警
 * 
 * @param job
 * @param entity
 */
private void iEmail(Job job, T entity) {
	if (null != entity && !entity.isTest()) {
		if (null != job.getResult().getLogText()
				&& !"".equals(job.getResult().getLogText())) {
			User u = new User();
			u.setType(Constant.TYPE_USER_KETTLE);
			u.setStatus(Constant.STATUS_ENABLED);
			@SuppressWarnings("all")
			List<User> list = (List<User>) service.iUserService
					.selectByWhere(u);
			if (null != list && list.size() > 0) {
				for (User user : list) {
					try {
						Message.iMessage(Constant.MAIL_USERNAME,
								Constant.MAIL_PASSWORD, Constant.MAIL_SMTP,
								Integer.valueOf(Constant.MAIL_PORT),
								Constant.MAIL_SENDER, user.getEmail(),
								entity.getName(), job.getResult()
										.getLogText());
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}
	}
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:34,代码来源:KettleJobServiceImpl.java


示例16: getRootJob

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 获取根job <br/>
* @author jingma
* @param rootjob 
* @return
*/
public static Job getRootJob(Job rootjob) {
    while(rootjob!=null&&rootjob.getParentJob()!=null){
        rootjob = rootjob.getParentJob();
    }
    return rootjob;
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:13,代码来源:KettleUtils.java


示例17: getRootJobId

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 获取根job的id <br/>
* @author jingma
* @param si 
* @return
*/
public static String getRootJobId(StepInterface si) {
    Job rootjob = getRootJob(si);
    if(rootjob!=null){
        return rootjob.getObjectId().getId();
    }else{
        return null;
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:15,代码来源:KettleUtils.java


示例18: getRootJobName

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 获取根job的名称 <br/>
* @author jingma
* @param si 
* @return
*/
public static String getRootJobName(StepInterface si) {
    Job rootjob = getRootJob(si);
    if(rootjob!=null){
        return rootjob.getObjectName();
    }else{
        return null;
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:15,代码来源:KettleUtils.java


示例19: setVariableRootJob

import org.pentaho.di.job.Job; //导入依赖的package包/类
/**
* 设置变量到根作业 <br/>
* @author jingma
* @param variableName 变量名
* @param variableValue 变量值
*/
public void setVariableRootJob(String variableName,String variableValue){
    ku.setVariable(variableName, variableValue);
    Trans trans = ku.getTrans();
    while(trans.getParentTrans()!=null){
        trans.setVariable(variableName, variableValue);
        trans = trans.getParentTrans();
    }
    trans.setVariable(variableName, variableValue);
    Job job = trans.getParentJob();
    while(job!=null){
        job.setVariable(variableName, variableValue);
        job = job.getParentJob();
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:21,代码来源:EasyExpandRunBase.java


示例20: testCallExtensionPoint

import org.pentaho.di.job.Job; //导入依赖的package包/类
@Test
public void testCallExtensionPoint() throws Exception {
  MetastoreLocatorOsgi mockMetastoreLocator = mock( MetastoreLocatorOsgi.class );
  LogChannelInterface logChannelInterface = mock( LogChannelInterface.class );
  JobExecutionExtension mockJobExecutionExtension = mock( JobExecutionExtension.class );
  Job mockJob = mock( Job.class );
  JobMeta mockJobMeta = mock( JobMeta.class );
  mockJobExecutionExtension.job = mockJob;
  when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
  MetastoreLocatorBeforeJobSaveExtensionPoint metastoreLocatorBeforeJobSaveExtensionPoint =
    new MetastoreLocatorBeforeJobSaveExtensionPoint( mockMetastoreLocator );

  metastoreLocatorBeforeJobSaveExtensionPoint.callExtensionPoint( logChannelInterface, mockJobExecutionExtension );
  verify( mockJobMeta ).setMetastoreLocatorOsgi( eq( mockMetastoreLocator ) );
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:16,代码来源:MetastoreLocatorBeforeJobSaveExtensionPointTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EncodingType类代码示例发布时间:2022-05-21
下一篇:
Java SwitchButton类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap