org.pentaho.di.repository.Repository.loadRepositoryDirectoryTree()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(13.7k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中org.pentaho.di.repository.Repository.loadRepositoryDirectoryTree方法的一些代码示例,展示了Repository.loadRepositoryDirectoryTree的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.loadRepositoryDirectoryTree方法的具体详情如下:
包路径:org.pentaho.di.repository.Repository
类名称:Repository
方法名:loadRepositoryDirectoryTree

Repository.loadRepositoryDirectoryTree介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

private RepositoryDirectoryInterface getRepositoryRoot() throws KettleException {
 if ( root == null ) {
  root = rep.loadRepositoryDirectoryTree();
 }
 return root;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public RepositoryDirectoryInterface loadRepositoryDirectoryTree() throws KettleException {
 return getDelegate().loadRepositoryDirectoryTree();
}

代码示例来源:origin: pentaho/pentaho-kettle

private JobMeta getJobMetaFromRepository( Repository rep, CurrentDirectoryResolver r, String transPath ) 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, "" ) + "]" );
 }
 return rep.loadJob( realJobName, repositoryDirectory, null, null ); // reads
}

代码示例来源:origin: pentaho/pentaho-kettle

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;
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private TransMeta loadTrans( Repository repository, String transformationName ) 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 = transformationName.lastIndexOf( RepositoryDirectory.DIRECTORY_SEPARATOR );
   if ( lastSlash < 0 ) {
    directoryPath = "/";
    name = transformationName;
   } else {
    directoryPath = transformationName.substring( 0, lastSlash );
    name = transformationName.substring( lastSlash + 1 );
   }
   RepositoryDirectoryInterface directory =
    repository.loadRepositoryDirectoryTree().findDirectory( directoryPath );
   ObjectId transformationId = repository.getTransformationID( name, directory );
   TransMeta transMeta = repository.loadTransformation( transformationId, null );
   return transMeta;
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private TransMeta getTransMetaFromRepository( Repository rep, CurrentDirectoryResolver r, String transPath ) throws KettleException {
 String realTransName = "";
 String realDirectory = "/";
 if ( StringUtils.isBlank( transPath ) ) {
  throw new KettleException( BaseMessages.getString( PKG, "JobTrans.Exception.MissingTransFileName" ) );
 }
 int index = transPath.lastIndexOf( RepositoryFile.SEPARATOR );
 if ( index != -1 ) {
  realTransName = 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, "" ) + "]" );
 }
 return rep.loadTransformation( realTransName, repositoryDirectory, null, true, null );
}

代码示例来源:origin: pentaho/pentaho-kettle

repository.loadRepositoryDirectoryTree().findDirectory( directoryPath );
if ( directory == null ) {
 throw new KettleException( "Unable to find directory path '" + directoryPath + "' in the repository" );

代码示例来源:origin: pentaho/pentaho-kettle

repository.loadRepositoryDirectoryTree().findDirectory( directoryPath );
if ( directory == null ) {
 throw new KettleException( "Unable to find directory path '" + directoryPath + "' in the repository" );

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * When connected to the repository and {@link JobEntryJob} references a child job by name using a single parameter,
 * keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
 * Load the job from the repository using the specified job name and directory.
 */
@Test
public void testConnectedLoad_RepByName_SingleParameter() throws Exception {
 Repository myrepo = mock( Repository.class );
 doReturn( true ).when( myrepo ).isConnected();
 doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
 doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
 doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
 doReturn( "${repositoryfullfilepath}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
 JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
 jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
 jej.getJobMeta( myrepo, store, space );
 assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
 verify( myrepo, times( 1 ) ).loadJob( "job.kjb", directory, null, null );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 doReturn( true ).when( repository ).isConnected();
 doReturn( null ).when( repository ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
 doReturn( rdi ).when( repository ).loadRepositoryDirectoryTree();
 doReturn( directory ).when( rdi ).findDirectory( JOB_ENTRY_FILE_DIRECTORY );
 doReturn( directory ).when( rdi ).findDirectory( "/home/admin/folder" );
 doReturn( null ).when( space ).environmentSubstitute( anyString() );
 doReturn( "" ).when( space ).environmentSubstitute( "" );
 doReturn( JOB_ENTRY_FILE_PATH ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_PATH );
 doReturn( JOB_ENTRY_FILE_NAME ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_NAME );
 doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_DIRECTORY );
 doReturn( "hdfs://server/path/" ).when( space ).environmentSubstitute( "${hdfs}" );
 doReturn( "/home/admin/folder/job.kjb" ).when( space ).environmentSubstitute( "${repositoryfullfilepath}" );
 doReturn( "/home/admin/folder/" ).when( space ).environmentSubstitute( "${repositorypath}" );
 doReturn( "job.kjb" ).when( space ).environmentSubstitute( "${jobname}" );
 doReturn( "job" ).when( space ).environmentSubstitute( "job" );
 doCallRealMethod().when( resolver ).normalizeSlashes( anyString() );
 doReturn( space ).when( resolver ).resolveCurrentDirectory(
  any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() );
 whenNew( CurrentDirectoryResolver.class ).withNoArguments().thenReturn( resolver );
 whenNew( JobMeta.class ).withAnyArguments().thenReturn( mock( JobMeta.class ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * When connected to the repository and {@link JobEntryJob} references a child job by name,
 * guess {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
 * Load the job from the repository using the specified job name and directory.
 */
@Test
public void testConnectedLoad_RepByName_Guess() throws Exception {
 Repository myrepo = mock( Repository.class );
 doReturn( true ).when( myrepo ).isConnected();
 doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
 doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
 doReturn( JOB_ENTRY_FILE_NAME ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
 doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
 JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
 jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
 jej.getJobMeta( myrepo, store, space );
 assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
 verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_FILE_NAME, directory, null, null );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * When connected to the repository and {@link JobEntryJob} references a child job by name,
 * keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
 * Load the job from the repository using the specified job name and directory.
 */
@Test
public void testConnectedLoad_RepByName() throws Exception {
 Repository myrepo = mock( Repository.class );
 doReturn( true ).when( myrepo ).isConnected();
 doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
 doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
 doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
 doReturn( JOB_ENTRY_FILE_NAME ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
 doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
 JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
 jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
 jej.getJobMeta( myrepo, store, space );
 assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
 verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_FILE_NAME, directory, null, null );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * When connected to the repository and {@link JobEntryJob} references a child job by name using multiple parameters,
 * keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
 * Load the job from the repository using the specified job name and directory.
 */
@Test
public void testConnectedLoad_RepByName_MultipleParameters() throws Exception {
 Repository myrepo = mock( Repository.class );
 doReturn( true ).when( myrepo ).isConnected();
 doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
 doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
 doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
 doReturn( "${jobname}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
 doReturn( "${repositorypath}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
 JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
 jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
 jej.getJobMeta( myrepo, store, space );
 assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
 verify( myrepo, times( 1 ) ).loadJob( "job.kjb", directory, null, null );
}

代码示例来源:origin: pentaho/pentaho-kettle

@SuppressWarnings( "deprecation" )
public void init( Repository repository ) throws ControllerInitializationException {
 try {
  this.repository = repository;
  mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" );
  RepositoryDirectoryInterface root;
  try {
   if ( repository instanceof RepositoryExtended ) {
    root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( false );
   } else {
    root = repository.loadRepositoryDirectoryTree();
   }
   this.repositoryDirectory =
    UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root,
     null, repository );
  } catch ( UIObjectCreationException uoe ) {
   this.repositoryDirectory =
    new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository );
  }
  this.repositoryDirectory.populateChildren();
  dirMap = new HashMap<ObjectId, UIRepositoryDirectory>();
  populateDirMap( repositoryDirectory );
  bf = new SwtBindingFactory();
  bf.setDocument( this.getXulDomContainer().getDocumentRoot() );
  messageBox = (XulMessageBox) document.createElement( "messagebox" );
  createBindings();
 } catch ( Exception e ) {
  throw new ControllerInitializationException( e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

when( mockRepository.loadRepositoryDirectoryTree() ).thenReturn( mockRepositoryDirectory );

代码示例来源:origin: pentaho/pentaho-kettle

when( mockRepository.loadRepositoryDirectoryTree() ).thenReturn( mockRepositoryDirectory );

代码示例来源:origin: pentaho/pentaho-kettle

when( mockRepository.loadRepositoryDirectoryTree() ).thenReturn( mockRepositoryDirectory );

代码示例来源:origin: pentaho/pentaho-kettle

when( mockRepository.loadRepositoryDirectoryTree() ).thenReturn( mockRepositoryDirectory );

代码示例来源:origin: pentaho/pentaho-kettle

public RepositoryTree loadDirectoryTree() {
 if ( getRepository() != null ) {
  try {
   if ( getRepository() instanceof RepositoryExtended ) {
    rootDirectory = ( (RepositoryExtended) getRepository() ).loadRepositoryDirectoryTree( false );
   } else {
    rootDirectory = getRepository().loadRepositoryDirectoryTree();
   }
   RepositoryTree repositoryTree = new RepositoryTree();
   RepositoryDirectory repositoryDirectory = RepositoryDirectory.build( null, rootDirectory );
   populateFolders( repositoryDirectory, rootDirectory );
   boolean isPentahoRepository =
    getRepository().getRepositoryMeta().getId().equals( PENTAHO_ENTERPRISE_REPOSITORY );
   repositoryTree.setIncludeRoot( !isPentahoRepository );
   repositoryTree.addChild( repositoryDirectory );
   return repositoryTree;
  } catch ( Exception e ) {
   return null;
  }
 }
 return null;
}

代码示例来源:origin: pentaho/pentaho-kettle

RepositoryDirectoryInterface directory = repository.loadRepositoryDirectoryTree(); // Default = root

相关文章

Repository类方法