Java Code Examples for org.pentaho.di.repository.Repository#loadJob()
The following examples show how to use
org.pentaho.di.repository.Repository#loadJob() .
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: JobEntryJob.java From pentaho-kettle with Apache License 2.0 | 6 votes |
protected JobMeta getJobMetaFromRepository( Repository rep, CurrentDirectoryResolver r, String transPath, VariableSpace tmpSpace ) throws KettleException { String realJobName = ""; String realDirectory = "/"; int index = transPath.lastIndexOf( RepositoryFile.SEPARATOR ); if ( index != -1 ) { realJobName = transPath.substring( index + 1 ); realDirectory = index == 0 ? RepositoryFile.SEPARATOR : transPath.substring( 0, index ); } realDirectory = r.normalizeSlashes( realDirectory ); RepositoryDirectoryInterface repositoryDirectory = rep.loadRepositoryDirectoryTree().findDirectory( realDirectory ); if ( repositoryDirectory == null ) { throw new KettleException( "Unable to find repository directory [" + Const.NVL( realDirectory, "" ) + "]" ); } JobMeta jobMeta = rep.loadJob( realJobName, repositoryDirectory, null, null ); //reads if ( jobMeta != null ) { jobMeta.initializeVariablesFrom( tmpSpace ); } return jobMeta; }
Example 2
Source File: RunJobServlet.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private JobMeta loadJob( Repository repository, String job ) throws KettleException { if ( repository == null ) { throw new KettleException( "Repository required." ); } else { synchronized ( repository ) { // With a repository we need to load it from /foo/bar/Transformation // We need to extract the folder name from the path in front of the // name... // String directoryPath; String name; int lastSlash = job.lastIndexOf( RepositoryDirectory.DIRECTORY_SEPARATOR ); if ( lastSlash < 0 ) { directoryPath = "/"; name = job; } else { directoryPath = job.substring( 0, lastSlash ); name = job.substring( lastSlash + 1 ); } RepositoryDirectoryInterface directory = repository.loadRepositoryDirectoryTree().findDirectory( directoryPath ); ObjectId jobID = repository.getJobId( name, directory ); JobMeta transJob = repository.loadJob( jobID, null ); return transJob; } } }
Example 3
Source File: KitchenCommandExecutor.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public Job loadJobFromRepository( Repository repository, String dirName, String jobName ) throws Exception { if ( Utils.isEmpty( jobName ) ) { System.out.println( BaseMessages.getString( getPkgClazz(), "Kitchen.Error.canNotLoadJob" ) ); return null; } RepositoryDirectoryInterface directory = loadRepositoryDirectory( repository, dirName, "Kitchen.Error.NoRepProvided", "Kitchen.Log.Alocate&ConnectRep", "Kitchen.Error.CanNotFindSuppliedDirectory" ); if ( directory == null ) { return null; // not much we can do here } // Add the IMetaStore of the repository to our delegation if ( repository.getMetaStore() != null && getMetaStore() != null ) { getMetaStore().addMetaStore( repository.getMetaStore() ); } // Load a job logDebug( "Kitchen.Log.LoadingJobInfo" ); blockAndThrow( getKettleInit() ); JobMeta jobMeta = repository.loadJob( jobName, directory, null, null ); // reads last version logDebug( "Kitchen.Log.AllocateJob" ); return new Job( repository, jobMeta ); }