use of org.pentaho.di.job.entry.JobEntryInterface in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method testImportJob_patchJobEntries_without_variables.
@Test
public void testImportJob_patchJobEntries_without_variables() throws KettleException {
JobEntryInterface jobEntry = createJobEntry("/userName");
StepMetaInterface stepMeta = createStepMeta("");
RepositoryImporter importer = createRepositoryImporter(jobEntry, stepMeta, true);
importer.setBaseDirectory(baseDirectory);
importer.importJob(entityNode, feedback);
verify((HasRepositoryDirectories) jobEntry).setDirectories(new String[] { ROOT_PATH + USER_NAME_PATH });
}
use of org.pentaho.di.job.entry.JobEntryInterface in project pentaho-kettle by pentaho.
the class RunConfigurationDelegate method updateLoadedJobs.
protected void updateLoadedJobs(String key, RunConfiguration runConfig) {
for (JobMeta job : spoonSupplier.get().getLoadedJobs()) {
for (int i = 0; i < job.nrJobEntries(); i++) {
JobEntryInterface entry = job.getJobEntry(i).getEntry();
if (entry instanceof JobEntryRunConfigurableInterface) {
JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry;
if (jet.getRunConfiguration() != null) {
if (jet.getRunConfiguration().equals(key)) {
try {
ExtensionPointHandler.callExtensionPoint(job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() });
} catch (KettleException e) {
spoonSupplier.get().getLog().logBasic("Unable to set run configuration in job " + job.getName());
}
jet.setRunConfiguration(runConfig.getName());
if (runConfig instanceof DefaultRunConfiguration) {
jet.setRemoteSlaveServerName(((DefaultRunConfiguration) runConfig).getServer());
jet.setLoggingRemoteWork(((DefaultRunConfiguration) runConfig).isLogRemoteExecutionLocally());
}
jet.setChanged();
}
}
}
}
}
}
use of org.pentaho.di.job.entry.JobEntryInterface in project pentaho-kettle by pentaho.
the class SpoonJobDelegate method newJobEntry.
public JobEntryCopy newJobEntry(JobMeta jobMeta, String type_desc, boolean openit) {
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface jobPlugin;
try {
jobPlugin = PluginRegistry.getInstance().findPluginWithName(JobEntryPluginType.class, type_desc);
if (jobPlugin == null) {
// Check if it's not START or DUMMY
if (JobMeta.STRING_SPECIAL_START.equalsIgnoreCase(type_desc) || JobMeta.STRING_SPECIAL_DUMMY.equalsIgnoreCase(type_desc)) {
jobPlugin = registry.findPluginWithId(JobEntryPluginType.class, JobMeta.STRING_SPECIAL);
}
}
if (jobPlugin != null) {
// Determine name & number for this entry.
// See if the name is already used...
//
String entry_name = type_desc;
int nr = 2;
JobEntryCopy check = jobMeta.findJobEntry(entry_name, 0, true);
while (check != null) {
entry_name = type_desc + " " + nr++;
check = jobMeta.findJobEntry(entry_name, 0, true);
}
// Generate the appropriate class...
JobEntryInterface jei = (JobEntryInterface) registry.loadClass(jobPlugin);
jei.setPluginId(jobPlugin.getIds()[0]);
jei.setName(entry_name);
if (jei.isSpecial()) {
if (JobMeta.STRING_SPECIAL_START.equalsIgnoreCase(type_desc)) {
// Check if start is already on the canvas...
if (jobMeta.findStart() != null) {
JobGraph.showOnlyStartOnceMessage(spoon.getShell());
return null;
}
((JobEntrySpecial) jei).setStart(true);
}
if (JobMeta.STRING_SPECIAL_DUMMY.equalsIgnoreCase(type_desc)) {
((JobEntrySpecial) jei).setDummy(true);
}
}
if (openit) {
JobEntryDialogInterface d = getJobEntryDialog(jei, jobMeta);
if (d != null && d.open() != null) {
JobEntryCopy jge = new JobEntryCopy();
jge.setEntry(jei);
jge.setLocation(50, 50);
jge.setNr(0);
jobMeta.addJobEntry(jge);
// Verify that the name is not already used in the job.
//
jobMeta.renameJobEntryIfNameCollides(jge);
spoon.addUndoNew(jobMeta, new JobEntryCopy[] { jge }, new int[] { jobMeta.indexOfJobEntry(jge) });
spoon.refreshGraph();
spoon.refreshTree();
return jge;
} else {
return null;
}
} else {
JobEntryCopy jge = new JobEntryCopy();
jge.setEntry(jei);
jge.setLocation(50, 50);
jge.setNr(0);
jobMeta.addJobEntry(jge);
spoon.addUndoNew(jobMeta, new JobEntryCopy[] { jge }, new int[] { jobMeta.indexOfJobEntry(jge) });
spoon.refreshGraph();
spoon.refreshTree();
return jge;
}
} else {
return null;
}
} catch (Throwable e) {
new ErrorDialog(spoon.getShell(), BaseMessages.getString(PKG, "Spoon.ErrorDialog.UnexpectedErrorCreatingNewJobGraphEntry.Title"), BaseMessages.getString(PKG, "Spoon.ErrorDialog.UnexpectedErrorCreatingNewJobGraphEntry.Message"), new Exception(e));
return null;
}
}
use of org.pentaho.di.job.entry.JobEntryInterface in project pentaho-kettle by pentaho.
the class SpoonJobDelegate method getJobEntryDialog.
public JobEntryDialogInterface getJobEntryDialog(JobEntryInterface jobEntryInterface, JobMeta jobMeta) {
Class<?>[] paramClasses = new Class<?>[] { Shell.class, JobEntryInterface.class, Repository.class, JobMeta.class };
Object[] paramArgs = new Object[] { spoon.getShell(), jobEntryInterface, spoon.getRepository(), jobMeta };
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.getPlugin(JobEntryPluginType.class, jobEntryInterface);
String dialogClassName = plugin.getClassMap().get(JobEntryDialogInterface.class);
if (dialogClassName == null) {
// try the deprecated way
log.logDebug("Use of JobEntryInterface#getDialogClassName is deprecated, use PluginDialog annotation instead.");
dialogClassName = jobEntryInterface.getDialogClassName();
}
try {
Class<JobEntryDialogInterface> dialogClass = registry.getClass(plugin, dialogClassName);
Constructor<JobEntryDialogInterface> dialogConstructor = dialogClass.getConstructor(paramClasses);
JobEntryDialogInterface entryDialogInterface = dialogConstructor.newInstance(paramArgs);
entryDialogInterface.setMetaStore(spoon.getMetaStore());
return entryDialogInterface;
} catch (Throwable t) {
t.printStackTrace();
String errorTitle = BaseMessages.getString(PKG, "Spoon.Dialog.ErrorCreatingJobDialog.Title");
String errorMsg = BaseMessages.getString(PKG, "Spoon.Dialog.ErrorCreatingJobEntryDialog.Message", dialogClassName);
spoon.getLog().logError(spoon.toString(), errorMsg);
new ErrorDialog(spoon.getShell(), errorTitle, errorMsg, t);
return null;
}
}
use of org.pentaho.di.job.entry.JobEntryInterface in project pentaho-kettle by pentaho.
the class JobGraph method openTransformation.
public void openTransformation() {
JobEntryCopy jobEntryCopy = getJobEntry();
final JobEntryInterface entry = jobEntryCopy.getEntry();
openTransformation((JobEntryTrans) entry, jobEntryCopy);
}
Aggregations