• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java KettleFileRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.di.repository.filerep.KettleFileRepository的典型用法代码示例。如果您正苦于以下问题:Java KettleFileRepository类的具体用法?Java KettleFileRepository怎么用?Java KettleFileRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KettleFileRepository类属于org.pentaho.di.repository.filerep包,在下文中一共展示了KettleFileRepository类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: prepareFileRepository

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
private static void prepareFileRepository() throws IOException, KettleException {
  baseDirName = Files.createTempDirectory( "GetRepositoryNamesIT" );
  RepositoryMeta repoMeta =
      new KettleFileRepositoryMeta( UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID()
          .toString(), baseDirName.toString() );
  repo = new KettleFileRepository();
  repo.init( repoMeta );
  repo.connect( null, null );

  // Populate
  RepositoryDirectoryInterface rootDir = repo.findDirectory( "/" );

  RepositoryDirectoryInterface subdir1 = new RepositoryDirectory( rootDir, "subdir1" );
  repo.saveRepositoryDirectory( subdir1 );

  TransMeta transMeta1 = new TransMeta();
  transMeta1.setName( "Trans1" );
  transMeta1.setRepositoryDirectory( subdir1 );
  repo.save( transMeta1, null, null );

  JobMeta jobMeta1 = new JobMeta();
  jobMeta1.setName( "Job1" );
  jobMeta1.setRepositoryDirectory( subdir1 );
  repo.save( jobMeta1, null, null );

  RepositoryDirectoryInterface subdir2 = new RepositoryDirectory( subdir1, "subdir2" );
  repo.saveRepositoryDirectory( subdir2 );

  TransMeta transMeta2 = new TransMeta();
  transMeta2.setName( "Trans2" );
  transMeta2.setRepositoryDirectory( subdir2 );
  repo.save( transMeta2, null, null );

  JobMeta jobMeta2 = new JobMeta();
  jobMeta2.setName( "Job2" );
  jobMeta2.setRepositoryDirectory( subdir2 );
  repo.save( jobMeta2, null, null );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:39,代码来源:GetRepositoryNamesTest.java


示例2: convertFromFileRepository

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
private void convertFromFileRepository(TransMeta transMeta) {

      if (repository instanceof KettleFileRepository) {
        
        KettleFileRepository fileRep = (KettleFileRepository)repository;
        
        // The id of the transformation is the relative filename.
        // Setting the filename also sets internal variables needed to load the trans/job referenced.
        //
        String transMetaFilename = fileRep.calcFilename(transMeta.getObjectId());
        transMeta.setFilename(transMetaFilename);
        
        for (StepMeta stepMeta : transMeta.getSteps()) {
          if (stepMeta.isMapping()) {
            MappingMeta mappingMeta = (MappingMeta) stepMeta.getStepMetaInterface();

            // convert to a named based reference.
            //
            if (mappingMeta.getSpecificationMethod()==ObjectLocationSpecificationMethod.FILENAME) {
              try {
                TransMeta meta = MappingMeta.loadMappingMeta(mappingMeta, repository, transMeta);
                FileObject fileObject = KettleVFS.getFileObject(meta.getFilename());
                mappingMeta.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                mappingMeta.setFileName(null);
                mappingMeta.setTransName(meta.getName());
                mappingMeta.setDirectoryPath(Const.NVL(calcRepositoryDirectory(fileRep, fileObject), "/"));
              } catch(Exception e) {
                log.logError("Unable to load transformation specified in map '"+mappingMeta.getName()+"'", e);
                // Ignore this error, just leave everything the way it is.
              }
            }
          }
        }
      }
    }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:36,代码来源:RepositoryExporter.java


示例3: calcRepositoryDirectory

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
private String calcRepositoryDirectory(KettleFileRepository fileRep, FileObject fileObject) throws FileSystemException{
  String path = fileObject.getParent().getName().getPath(); 
  String baseDirectory = fileRep.getRepositoryMeta().getBaseDirectory();
  // Double check!
  //
  if (path.startsWith(baseDirectory)) {
    return path.substring(baseDirectory.length());
  } else {
    return path;
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:RepositoryExporter.java


示例4: calcRepositoryDirectory

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
private String calcRepositoryDirectory( KettleFileRepository fileRep, FileObject fileObject ) throws FileSystemException {
  String path = fileObject.getParent().getName().getPath();
  String baseDirectory = fileRep.getRepositoryMeta().getBaseDirectory();
  // Double check!
  //
  if ( path.startsWith( baseDirectory ) ) {
    return path.substring( baseDirectory.length() );
  } else {
    return path;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:12,代码来源:RepositoryExporter.java


示例5: setUp

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
@Before
public void setUp() throws KettleException {
  KettleFileRepositoryMeta repositoryMeta = new KettleFileRepositoryMeta( FILE_REPOSITORY_ID, FILE_REPOSITORY_NAME,
    FILE_REPOSITORY_DESC, REPOSITORY_ROOT_DIR );
  repository = new KettleFileRepository();
  repository.init( repositoryMeta );
  repository.connect( null, null );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:JobExportIT.java


示例6: callExtensionPoint

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
@Override
public void callExtensionPoint( LogChannelInterface log, Object object ) throws KettleException {

  Object[] metaInjectObjectArray = (Object[]) object;
  TransMeta transMeta = (TransMeta) metaInjectObjectArray[0];
  Class<?> PKG = (Class<?>) metaInjectObjectArray[1];
  KettleFileRepository fileRep = (KettleFileRepository) metaInjectObjectArray[2];
  StepMeta stepMeta = (StepMeta) metaInjectObjectArray[3];

  if ( stepMeta.isEtlMetaInject() ) {
    MetaInjectMeta metaInjectMeta = (MetaInjectMeta) stepMeta.getStepMetaInterface();
    // convert to a named based reference.
    //
    if ( metaInjectMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) {
      try {
        TransMeta meta =
            MetaInjectMeta.loadTransformationMeta( metaInjectMeta, fileRep, fileRep.metaStore, transMeta );
        FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() );
        metaInjectMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME );
        metaInjectMeta.setFileName( null );
        metaInjectMeta.setTransName( meta.getName() );
        metaInjectMeta.setDirectoryPath( Const.NVL( calcRepositoryDirectory( fileRep, fileObject ), "/" ) );
      } catch ( Exception e ) {
        log.logError( BaseMessages.getString( PKG, "Repository.Exporter.Log.UnableToLoadTransInMDI",
            metaInjectMeta.getName() ), e );
      }
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:30,代码来源:RepositoryExporterExtension.java


示例7: testDatabaseRepository

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
public void testDatabaseRepository() throws Exception {

    KettleEnvironment.init();
    String dirName = System.getProperty( "java.io.tmpdir" ) + "/" + UUID.randomUUID();
    File dirFile = new File( dirName );
    if ( !dirFile.mkdir() ) {
      throw new KettleException( "bad luck, directory '"
        + dirName + "' already exists and can't be used to put a file repository in it." );
    }

    System.out.println( "Using folder '" + dirName + "' to store a file repository in." );

    try {
      repositoryMeta =
        new KettleFileRepositoryMeta( "KettleFileRepository", "FileRep", "File repository", dirName );
      repository = new KettleFileRepository();
      repository.init( repositoryMeta );

      // Test connecting... (no security needed)
      //
      repository.connect( null, null );
      assertTrue( repository.isConnected() );

      // Test loading the directory tree
      //
      tree = repository.loadRepositoryDirectoryTree();
      assertNotNull( tree );

      // Test directory creation
      //
      RepositoryDirectoryInterface fooDirectory = repository.createRepositoryDirectory( tree, "foo" );
      RepositoryDirectoryInterface barDirectory = repository.createRepositoryDirectory( fooDirectory, "bar" );
      RepositoryDirectoryInterface samplesDirectory =
        repository.createRepositoryDirectory( fooDirectory, "samples" );

      // Test directory path lookup
      RepositoryDirectoryInterface checkBar = tree.findDirectory( "/foo/bar" );
      assertNotNull( checkBar );
      assertTrue( checkBar.equals( barDirectory ) );

      // Save all the transformations samples.
      //
      verifyTransformationSamples( samplesDirectory );
      verifyJobSamples( samplesDirectory );

      // Verify metastore functionality
      //
      IMetaStore metaStore = repository.getMetaStore();
      KettleMetaStoreTestBase testBase = new KettleMetaStoreTestBase();
      testBase.testFunctionality( metaStore );

      // Test directory deletion
      repository.deleteRepositoryDirectory( samplesDirectory );
      RepositoryDirectoryInterface checkDelete = tree.findDirectory( "/foo/bar/samples" );
      assertNull( checkDelete );

      // Finally test disconnecting
      repository.disconnect();
      assertFalse( repository.isConnected() );

    } catch ( Exception e ) {
      e.printStackTrace();
      throw new KettleException( "Error during database repository unit testing", e );
    } finally {
      // Remove all the files and folders in the repository...
      //
      FileUtils.deleteDirectory( dirFile );
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:70,代码来源:KettleFileRepositoryIT.java


示例8: convertFromFileRepository

import org.pentaho.di.repository.filerep.KettleFileRepository; //导入依赖的package包/类
private void convertFromFileRepository( TransMeta transMeta ) {

    Object[] metaInjectObjectArray = new Object[4];
    metaInjectObjectArray[0] = transMeta;
    metaInjectObjectArray[1] = PKG;

    if ( repository instanceof KettleFileRepository ) {

      KettleFileRepository fileRep = (KettleFileRepository) repository;

      metaInjectObjectArray[2] = fileRep;

      // The id of the transformation is the relative filename.
      // Setting the filename also sets internal variables needed to load the trans/job referenced.
      //
      String transMetaFilename = fileRep.calcFilename( transMeta.getObjectId() );
      transMeta.setFilename( transMetaFilename );

      for ( StepMeta stepMeta : transMeta.getSteps() ) {
        if ( stepMeta.isMapping() ) {
          MappingMeta mappingMeta = (MappingMeta) stepMeta.getStepMetaInterface();

          // convert to a named based reference.
          //
          if ( mappingMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) {
            try {
              TransMeta meta = MappingMeta.loadMappingMeta( mappingMeta, fileRep, fileRep.metaStore, transMeta );
              FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() );
              mappingMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME );
              mappingMeta.setFileName( null );
              mappingMeta.setTransName( meta.getName() );
              mappingMeta.setDirectoryPath( Const.NVL( calcRepositoryDirectory( fileRep, fileObject ), "/" ) );
            } catch ( Exception e ) {
              log.logError( BaseMessages.getString( PKG, "Repository.Exporter.Log.UnableToLoadTransInMap", mappingMeta
                  .getName() ), e );
            }
          }
        }

        metaInjectObjectArray[3] = stepMeta;

        try {
          ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.RepositoryExporterPatchTransStep.id, metaInjectObjectArray );
        } catch ( KettleException ke ) {
          log.logError( ke.getMessage(), ke );
        }
      }
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:50,代码来源:RepositoryExporter.java



注:本文中的org.pentaho.di.repository.filerep.KettleFileRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FastInfosetUtil类代码示例发布时间:2022-05-23
下一篇:
Java JavacompilerMessages类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap