本文整理汇总了Java中org.pentaho.di.job.JobMeta类的典型用法代码示例。如果您正苦于以下问题:Java JobMeta类的具体用法?Java JobMeta怎么用?Java JobMeta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobMeta类属于org.pentaho.di.job包,在下文中一共展示了JobMeta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jobStopAll
import org.pentaho.di.job.JobMeta; //导入依赖的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());
}
}
}
}
示例2: jobKillAll
import org.pentaho.di.job.JobMeta; //导入依赖的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();
}
}
示例3: jobCopy
import org.pentaho.di.job.JobMeta; //导入依赖的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);
}
示例4: generateJobImage
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
/**
* 生成作业图 <br/>
* @author jingma
* @param jobMeta
* @return
* @throws Exception
*/
public static BufferedImage generateJobImage( JobMeta jobMeta ) throws Exception {
float magnification = 1.0f;
Point maximum = jobMeta.getMaximum();
maximum.multiply( magnification );
SwingGC gc = new SwingGC( null, maximum, 32, 0, 0 );
JobPainter jobPainter =
new JobPainter(
gc, jobMeta, maximum, null, null, null, null, null, new ArrayList<AreaOwner>(),
new ArrayList<JobEntryCopy>(), 32, 1, 0, 0, true, "Arial", 10 );
jobPainter.setMagnification( magnification );
jobPainter.drawJob();
BufferedImage image = (BufferedImage) gc.getImage();
return image;
}
示例5: diffJobEntryTest
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
@Test
public void diffJobEntryTest() throws Exception {
File file = new File( "src/test/resources/r1.kjb" );
InputStream xmlStream = new FileInputStream( file );
JobMeta jobMeta = new JobMeta( xmlStream, null, null );
File file2 = new File( "src/test/resources/r2.kjb" );
InputStream xmlStream2 = new FileInputStream( file2 );
JobMeta jobMeta2 = new JobMeta( xmlStream2, null, null );
jobMeta = compareJobEntries( jobMeta, jobMeta2, true );
jobMeta2 = compareJobEntries( jobMeta2, jobMeta, false );
assertEquals( CHANGED, jobMeta.getJobEntry( 0 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
assertEquals( UNCHANGED, jobMeta.getJobEntry( 1 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
assertEquals( REMOVED, jobMeta.getJobEntry( 2 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
assertEquals( ADDED, jobMeta2.getJobEntry( 2 ).getAttribute( ATTR_GIT, ATTR_STATUS ) );
}
示例6: check
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
@Override
public void check(List<CheckResultInterface> remarks, JobMeta jobMeta)
{
ValidatorContext ctx1 = new ValidatorContext();
putVariableSpace(ctx1, getVariables());
putValidators(ctx1, notBlankValidator(), fileDoesNotExistValidator());
andValidator().validate(this, "zipFilename", remarks, ctx1);//$NON-NLS-1$
if (2 == afterunzip) {
// setting says to move
andValidator().validate(this, "moveToDirectory", remarks, putValidators(notBlankValidator())); //$NON-NLS-1$
}
andValidator().validate(this, "sourceDirectory", remarks, putValidators(notBlankValidator())); //$NON-NLS-1$
}
示例7: check
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public void check(List<CheckResultInterface> remarks, JobMeta jobMeta)
{
boolean res = andValidator().validate(this, "arguments", remarks, putValidators(notNullValidator()));
if (res == false)
{
return;
}
ValidatorContext ctx = new ValidatorContext();
putVariableSpace(ctx, getVariables());
putValidators(ctx, notNullValidator(), fileExistsValidator());
for (int i = 0; i < arguments.length; i++)
{
andValidator().validate(this, "arguments[" + i + "]", remarks, ctx);
}
}
示例8: check
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public void check(List<CheckResultInterface> remarks, JobMeta jobMeta)
{
boolean res = andValidator().validate(this, "arguments", remarks, putValidators(notNullValidator()));
if (res == false)
{
return;
}
ValidatorContext ctx = new ValidatorContext();
putVariableSpace(ctx, getVariables());
putValidators(ctx, notNullValidator(), fileExistsValidator());
for (int i = 0; i < source_filefolder.length; i++)
{
andValidator().validate(this, "arguments[" + i + "]", remarks, ctx);
}
}
示例9: JobExecutionConfigurationDialog
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public JobExecutionConfigurationDialog(Shell parent, JobExecutionConfiguration configuration, JobMeta jobMeta)
{
super(parent);
this.parent = parent;
this.configuration = configuration;
this.jobMeta = jobMeta;
// Fill the parameters, maybe do this in another place?
Map<String, String> params = configuration.getParams();
params.clear();
String[] paramNames = jobMeta.listParameters();
for ( String name : paramNames ) {
params.put(name, "");
}
props = PropsUI.getInstance();
}
示例10: copyJobEntries
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public void copyJobEntries(JobMeta jobMeta, JobEntryCopy jec[])
{
if (jec == null || jec.length == 0)
return;
String xml = XMLHandler.getXMLHeader();
xml += XMLHandler.openTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
for (int i = 0; i < jec.length; i++)
{
if (jec[i]==null)
continue;
xml += jec[i].getXML();
}
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
spoon.toClipboard(xml);
}
示例11: undoAction
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public void undoAction(UndoInterface undoInterface) {
if (undoInterface == null)
return;
TransAction ta = undoInterface.previousUndo();
if (ta == null)
return;
setUndoMenu(undoInterface); // something changed: change the menu
if (undoInterface instanceof TransMeta)
delegates.trans.undoTransformationAction((TransMeta) undoInterface, ta);
if (undoInterface instanceof JobMeta)
delegates.jobs.undoJobAction((JobMeta) undoInterface, ta);
// Put what we undo in focus
if (undoInterface instanceof TransMeta) {
TransGraph transGraph = delegates.trans.findTransGraphOfTransformation((TransMeta) undoInterface);
transGraph.forceFocus();
}
if (undoInterface instanceof JobMeta) {
JobGraph jobGraph = delegates.jobs.findJobGraphOfJob((JobMeta) undoInterface);
jobGraph.forceFocus();
}
}
示例12: selectInRect
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public void selectInRect(JobMeta jobMeta, org.pentaho.di.core.gui.Rectangle rect) {
int i;
for (i = 0; i < jobMeta.nrJobEntries(); i++) {
JobEntryCopy je = jobMeta.getJobEntry(i);
Point p = je.getLocation();
if (((p.x >= rect.x && p.x <= rect.x + rect.width) || (p.x >= rect.x + rect.width && p.x <= rect.x))
&& ((p.y >= rect.y && p.y <= rect.y + rect.height) || (p.y >= rect.y + rect.height && p.y <= rect.y)))
je.setSelected(true);
}
for (i = 0; i < jobMeta.nrNotes(); i++) {
NotePadMeta ni = jobMeta.getNote(i);
Point a = ni.getLocation();
Point b = new Point(a.x + ni.width, a.y + ni.height);
if (rect.contains(a.x, a.y) && rect.contains(b.x, b.y))
ni.setSelected(true);
}
}
示例13: setJobMetaVariables
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
/**
* Set previously defined variables (set variables dialog) on the specified
* job
*
* @param jobMeta
*/
public void setJobMetaVariables(JobMeta jobMeta) {
for (int i = 0; i < variables.size(); i++) {
try {
String name = variables.getValueMeta(i).getName();
String value = variables.getString(i, "");
jobMeta.setVariable(name, Const.NVL(value, ""));
} catch (Exception e) {
// Ignore the exception, it should never happen on a getString()
// anyway.
}
}
// Also set the parameters
//
setParametersAsVariablesInUI(jobMeta, jobMeta);
}
示例14: getLogging
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
public static String getLogging(ReportSubjectLocation filename) throws KettleException {
List<LogTableInterface> logTables;
if (filename.isTransformation()) {
TransMeta transMeta = TransformationInformation.getInstance().getTransMeta(filename);
logTables = transMeta.getLogTables();
} else {
JobMeta jobMeta = JobInformation.getInstance().getJobMeta(filename);
logTables = jobMeta.getLogTables();
}
String logging="";
for (Iterator<LogTableInterface> iterator = logTables.iterator(); iterator.hasNext();) {
LogTableInterface logTableInterface = (LogTableInterface) iterator.next();
if (logTableInterface.getDatabaseMeta()!=null && !Const.isEmpty(logTableInterface.getTableName())) {
if (logging.length()>0) logging+=", ";
logging+=logTableInterface.getTableName()+"@"+logTableInterface.getDatabaseMeta().getName();
}
}
return logging;
}
示例15: check
import org.pentaho.di.job.JobMeta; //导入依赖的package包/类
@Override
public void check(List<CheckResultInterface> remarks, JobMeta jobMeta) {
ValidatorContext ctx1 = new ValidatorContext();
putVariableSpace(ctx1, getVariables());
putValidators(ctx1, notBlankValidator(), fileDoesNotExistValidator());
if (3 == ifzipfileexists) {
// execute method fails if the file already exists; we should too
putFailIfExists(ctx1, true);
}
andValidator().validate(this, "zipFilename", remarks, ctx1);//$NON-NLS-1$
if (2 == afterzip) {
// setting says to move
andValidator().validate(this, "moveToDirectory", remarks, putValidators(notBlankValidator())); //$NON-NLS-1$
}
andValidator().validate(this, "sourceDirectory", remarks, putValidators(notBlankValidator())); //$NON-NLS-1$
}