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();
}
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
}
}
}
}
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;
}
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());
}
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;
}
Aggregations