Java Code Examples for org.pentaho.di.job.JobMeta#getFilename()

The following examples show how to use org.pentaho.di.job.JobMeta#getFilename() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobTracker.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * @param jobMeta
 *          The job metadata to track
 * @param maxChildren
 *          The maximum number of children to keep track of (1000 is the default)
 */
public JobTracker( JobMeta jobMeta, int maxChildren ) {
  if ( jobMeta != null ) {
    this.jobName = jobMeta.getName();
    this.jobFilename = jobMeta.getFilename();
  }

  this.jobTrackers = new LinkedList<JobTracker>();
  this.maxChildren = maxChildren;
  this.lock = new ReentrantReadWriteLock();
}
 
Example 2
Source File: JobEntryJob.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Make sure that we are not loading jobs recursively...
 *
 * @param parentJobMeta
 *          the parent job metadata
 * @param jobMeta
 *          the job metadata
 * @throws KettleException
 *           in case both jobs are loaded from the same source
 */
private void verifyRecursiveExecution( Job parentJob, JobMeta jobMeta ) throws KettleException {

  if ( parentJob == null ) {
    return; // OK!
  }

  JobMeta parentJobMeta = parentJob.getJobMeta();

  if ( parentJobMeta.getName() == null && jobMeta.getName() != null ) {
    return; // OK
  }
  if ( parentJobMeta.getName() != null && jobMeta.getName() == null ) {
    return; // OK as well.
  }

  // Not from the repository? just verify the filename
  //
  if ( jobMeta.getFilename() != null && jobMeta.getFilename().equals( parentJobMeta.getFilename() ) ) {
    throw new KettleException( BaseMessages.getString( PKG, "JobJobError.Recursive", jobMeta.getFilename() ) );
  }

  // Different directories: OK
  if ( parentJobMeta.getRepositoryDirectory() == null && jobMeta.getRepositoryDirectory() != null ) {
    return;
  }
  if ( parentJobMeta.getRepositoryDirectory() != null && jobMeta.getRepositoryDirectory() == null ) {
    return;
  }
  if ( jobMeta.getRepositoryDirectory().getObjectId() != parentJobMeta.getRepositoryDirectory().getObjectId() ) {
    return;
  }

  // Same names, same directories : loaded from same location in the
  // repository:
  // --> recursive loading taking place!
  //
  if ( parentJobMeta.getName().equals( jobMeta.getName() ) ) {
    throw new KettleException( BaseMessages.getString( PKG, "JobJobError.Recursive", jobMeta.getFilename() ) );
  }

  // Also compare with the grand-parent (if there is any)
  verifyRecursiveExecution( parentJob.getParentJob(), jobMeta );
}