Search in sources :

Example 46 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class Job method init.

/**
 * Initializes the Job.
 */
public void init() {
    jobListeners = new ArrayList<JobListener>();
    jobEntryListeners = new ArrayList<JobEntryListener>();
    delegationListeners = new ArrayList<DelegationListener>();
    activeJobEntryTransformations = new HashMap<JobEntryCopy, JobEntryTrans>();
    activeJobEntryJobs = new HashMap<JobEntryCopy, JobEntryJob>();
    extensionDataMap = new HashMap<String, Object>();
    active = new AtomicBoolean(false);
    stopped = new AtomicBoolean(false);
    jobTracker = new JobTracker(jobMeta);
    synchronized (jobEntryResults) {
        jobEntryResults.clear();
    }
    initialized = new AtomicBoolean(false);
    finished = new AtomicBoolean(false);
    errors = new AtomicInteger(0);
    batchId = -1;
    passedBatchId = -1;
    maxJobEntriesLogged = Const.toInt(EnvUtil.getSystemProperty(Const.KETTLE_MAX_JOB_ENTRIES_LOGGED), 1000);
    result = null;
    startJobEntryCopy = null;
    startJobEntryResult = null;
    this.setDefaultLogCommitSize();
}
Also used : JobTracker(org.pentaho.di.core.gui.JobTracker) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) FileObject(org.apache.commons.vfs2.FileObject) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob)

Example 47 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobExecutionConfiguration method getUsedArguments.

public void getUsedArguments(JobMeta jobMeta, String[] commandLineArguments, IMetaStore metaStore) {
    for (JobEntryCopy jobEntryCopy : jobMeta.jobcopies) {
        if (jobEntryCopy.isTransformation()) {
            JobEntryTrans jobEntryTrans = (JobEntryTrans) jobEntryCopy.getEntry();
            try {
                TransMeta transMeta = jobEntryTrans.getTransMeta(repository, metaStore, jobMeta);
                Map<String, String> map = transMeta.getUsedArguments(commandLineArguments);
                for (String key : map.keySet()) {
                    String value = map.get(key);
                    if (!arguments.containsKey(key)) {
                        arguments.put(key, value);
                    }
                }
            } catch (KettleException ke) {
            // suppress exceptions at this time - we will let the runtime report on any errors
            }
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) TransMeta(org.pentaho.di.trans.TransMeta)

Example 48 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class RepositoryTestBase method createJobEntry2Copy.

protected JobEntryCopy createJobEntry2Copy(final DatabaseMeta dbMeta) throws Exception {
    JobEntryCopy copy = new JobEntryCopy(createJobEntry2(dbMeta));
    copy.setLocation(EXP_JOB_ENTRY_2_COPY_X_LOC, EXP_JOB_ENTRY_2_COPY_Y_LOC);
    return copy;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy)

Example 49 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobDelegateTest method testElementToDataNodeSavesCopyAttributes.

@Test
public void testElementToDataNodeSavesCopyAttributes() throws KettleException {
    JobMeta mockJobMeta = mock(JobMeta.class);
    IUnifiedRepository mockUnifiedRepository = mock(IUnifiedRepository.class);
    JobDelegate jobDelegate = new JobDelegate(mockPurRepository, mockUnifiedRepository);
    JobLogTable mockJobLogTable = mock(JobLogTable.class);
    JobEntryCopy mockJobEntryCopy = mock(JobEntryCopy.class);
    Map<String, Map<String, String>> attributes = new HashMap<String, Map<String, String>>();
    Map<String, String> group = new HashMap<String, String>();
    final String mockGroup = "MOCK_GROUP";
    final String mockProperty = "MOCK_PROPERTY";
    final String mockValue = "MOCK_VALUE";
    group.put(mockProperty, mockValue);
    attributes.put(mockGroup, group);
    when(mockJobEntryCopy.getAttributesMap()).thenReturn(attributes);
    JobEntryBaseAndInterface mockJobEntry = mock(JobEntryBaseAndInterface.class);
    when(mockJobMeta.listParameters()).thenReturn(new String[] {});
    when(mockJobMeta.getJobLogTable()).thenReturn(mockJobLogTable);
    when(mockJobMeta.nrJobEntries()).thenReturn(1);
    when(mockJobMeta.getJobEntry(0)).thenReturn(mockJobEntryCopy);
    when(mockJobEntryCopy.getName()).thenReturn("MOCK_NAME");
    when(mockJobEntryCopy.getLocation()).thenReturn(new Point(0, 0));
    when(mockJobEntryCopy.getEntry()).thenReturn(mockJobEntry);
    DataNode dataNode = jobDelegate.elementToDataNode(mockJobMeta);
    DataNode groups = dataNode.getNode("entries").getNodes().iterator().next().getNode(AttributesMapUtil.NODE_ATTRIBUTE_GROUPS);
    DataNode mockGroupNode = groups.getNode(mockGroup);
    assertEquals(mockValue, mockGroupNode.getProperty(mockProperty).getString());
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobLogTable(org.pentaho.di.core.logging.JobLogTable) HashMap(java.util.HashMap) Point(org.pentaho.di.core.gui.Point) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode) HashMap(java.util.HashMap) Map(java.util.Map) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) Test(org.junit.Test)

Example 50 with JobEntryCopy

use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.

the class JobFileListener method processLinkedJobs.

protected JobMeta processLinkedJobs(JobMeta jobMeta) {
    for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
        JobEntryCopy jec = jobMeta.getJobEntry(i);
        if (jec.getEntry() instanceof JobEntryJob) {
            JobEntryJob jej = (JobEntryJob) jec.getEntry();
            ObjectLocationSpecificationMethod specMethod = jej.getSpecificationMethod();
            // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone
            if (specMethod == ObjectLocationSpecificationMethod.FILENAME) {
                jej.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                String filename = jej.getFilename();
                // handle any exceptions that arise from this
                if (filename.indexOf("/") > -1) {
                    String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
                    String directory = filename.substring(0, filename.lastIndexOf("/"));
                    jej.setJobName(jobname);
                    jej.setDirectory(directory);
                } else {
                    jej.setJobName(filename);
                }
                jobMeta.setJobEntry(i, jec);
            }
        }
    }
    return jobMeta;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Aggregations

JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)149 Point (org.pentaho.di.core.gui.Point)54 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)51 JobMeta (org.pentaho.di.job.JobMeta)47 KettleException (org.pentaho.di.core.exception.KettleException)30 Test (org.junit.Test)28 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)28 NotePadMeta (org.pentaho.di.core.NotePadMeta)24 JobHopMeta (org.pentaho.di.job.JobHopMeta)24 ArrayList (java.util.ArrayList)18 Job (org.pentaho.di.job.Job)18 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)16 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)15 MessageBox (org.eclipse.swt.widgets.MessageBox)13 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)10 Result (org.pentaho.di.core.Result)8 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)8 AreaOwner (org.pentaho.di.core.gui.AreaOwner)8 JobEntrySpecial (org.pentaho.di.job.entries.special.JobEntrySpecial)8 Before (org.junit.Before)7