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


Java Job类代码示例

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


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


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