public String getJobname() { if ( jobMeta == null ) { return null; } return jobMeta.getName(); }
public String toString() { if ( jobMeta == null ) { return Spoon.APP_NAME; } else { return jobMeta.getName(); } }
@Override public int showChangedWarning() throws KettleException { return showChangedWarning( jobMeta.getName() ); }
/** * @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(); }
public synchronized void registerJob( Job job, JobConfiguration jobConfiguration ) { job.setContainerObjectId( UUID.randomUUID().toString() ); CarteObjectEntry entry = new CarteObjectEntry( job.getJobMeta().getName(), job.getContainerObjectId() ); jobMap.put( entry, job ); configurationMap.put( entry, jobConfiguration ); }
/** * Checks if is rep reference. * * @return true, if is rep reference */ public boolean isRepReference() { return isRepReference( getFilename(), this.getName() ); }
/** * Checks if is file reference. * * @return true, if is file reference */ public boolean isFileReference() { return !isRepReference( getFilename(), this.getName() ); }
private static JobMeta mockJobMeta( String name ) { JobMeta meta = mock( JobMeta.class ); when( meta.getName() ).thenReturn( name ); return meta; }
public JobMeta getJob( String name ) { TabMapEntry entry = spoon.delegates.tabs.findTabMapEntry( name, ObjectType.JOB_GRAPH ); if ( entry != null ) { return (JobMeta) entry.getObject().getManagedObject(); } // TODO: remove part below // for ( JobMeta jobMeta : jobMap ) { if ( name != null && name.equals( jobMeta.getName() ) ) { return jobMeta; } } return null; }
@Override public JobMeta answer( InvocationOnMock invocation ) throws Throwable { String jobName = String.class.cast( invocation.getArguments()[ 0 ] ); JobMeta jobMeta = Mockito.mock( JobMeta.class ); Mockito.when( jobMeta.getXML() ).thenReturn( "<" + jobName + ">" + "found" + "</" + jobName + ">" ); Mockito.when( jobMeta.getName() ).thenReturn( jobName ); return jobMeta; } };
private boolean isJobOpened( String id, String path, String name ) { List<JobMeta> openedJobFiles = getSpoon().delegates.jobs.getJobList(); for ( JobMeta j : openedJobFiles ) { if ( j.getObjectId() != null && id.equals( j.getObjectId().getId() ) || ( path.equals( j.getRepositoryDirectory().getPath() ) && name.equals( j.getName() ) ) ) { return true; } } return false; }
public void export( ProgressMonitorListener monitor, List<RepositoryFile> files, OutputStreamWriter writer ) throws KettleException { List<JobMeta> jobs = repository.loadJobs( monitor, log, files, true ); Iterator<JobMeta> jobsMeta = jobs.iterator(); Iterator<RepositoryFile> filesIter = files.iterator(); while ( ( monitor == null || !monitor.isCanceled() ) && jobsMeta.hasNext() ) { JobMeta meta = jobsMeta.next(); setGlobalVariablesOfLogTablesNull( meta.getLogTables() ); RepositoryFile file = filesIter.next(); try { // Validate against the import rules first! if ( toExport( meta ) ) { writer.write( meta.getXML() + Const.CR ); } } catch ( Exception ex ) { // if exception while writing one item is occurred logging it and continue looping log.logError( BaseMessages.getString( PKG, "PurRepositoryExporter.ERROR_SAVE_JOB", meta.getName(), file .getPath() ), ex ); //$NON-NLS-1$ } } } }
public void run() { if ( Job.this.isFinished() ) { log.logBasic( "Shutting down heartbeat signal for " + jobMeta.getName() ); shutdownHeartbeat( heartbeat ); return; } try { log.logDebug( "Triggering heartbeat signal for " + jobMeta.getName() + " at every " + intervalInSeconds + " seconds" ); ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobHeartbeat.id, Job.this ); } catch ( KettleException e ) { log.logError( e.getMessage(), e ); } } }, intervalInSeconds /* initial delay */, intervalInSeconds /* interval delay */, TimeUnit.SECONDS );
public static String getName( ReportSubjectLocation filename ) throws KettleException { if ( filename.isTransformation() ) { return TransformationInformation.getInstance().getTransMeta( filename ).getName(); } else { return JobInformation.getInstance().getJobMeta( filename ).getName(); } }
private void saveJobToRepo( JobMeta jobMeta, RepositoryImportFeedbackInterface feedback ) throws KettleException { try { jobMeta.lookupRepositoryReferences( rep ); } catch ( LookupReferencesException e ) { // log and continue; might fail from exports performed before PDI-5294 feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log", jobMeta.getName(), RepositoryObjectType.JOB ) ); feedback.addLog( BaseMessages .getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log.Cause", e.objectTypePairsToString() ) ); } rep.save( jobMeta, "import object reference specification", null ); }
public void browseVersionHistory() { try { RepositoryRevisionBrowserDialogInterface dialog = RepositoryExplorerDialog.getVersionBrowserDialog( shell, spoon.rep, jobMeta ); String versionLabel = dialog.open(); if ( versionLabel != null ) { spoon.loadObjectFromRepository( jobMeta.getName(), jobMeta.getRepositoryElementType(), jobMeta .getRepositoryDirectory(), versionLabel ); } } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobGraph.VersionBrowserException.Title" ), BaseMessages.getString( PKG, "JobGraph.VersionBrowserException.Message" ), e ); } }
private void selectRepositoryJob() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.kjb", log ); try { if ( repositoryObject != null ) { loadRepositoryJob( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), executorJobMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + executorJobMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
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(); } } } } } }
public boolean jobOverwritePrompt( JobMeta jobMeta ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteJob.Title" ), null, BaseMessages .getString( PKG, "RepositoryImportDialog.OverwriteJob.Message", jobMeta.getName() ), MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 1, BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); askOverwrite = !md.getToggleState(); return ( answer & 0xFF ) == 0; }