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

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

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

Repository.init介绍

[英]Initialize the repository with the repository metadata and user information.
[中]使用存储库元数据和用户信息初始化存储库。

代码示例

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

@Override
public void init( RepositoryMeta repositoryMeta ) {
 getDelegate().init( repositoryMeta );
}

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

public void setLocationUrl( String locationUrl ) {
 RepositoryMeta repositoryMeta = this.createPurRepositoryMetaRepositoryMeta( locationUrl );
 this.getDelegate().init( repositoryMeta );
 this.locationUrl = locationUrl;
}

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

public boolean updateRepository( String id, Map<String, Object> items ) {
 RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( (String) items.get( ORIGINAL_NAME ) );
 boolean isConnected = repositoryMeta == connectedRepository;
 repositoryMeta.populate( items, repositoriesMeta );
 save();
 if ( isConnected ) {
  Spoon spoon = spoonSupplier.get();
  Runnable execute = () -> {
   spoon.setRepositoryName( repositoryMeta.getName() );
   fireListeners();
  };
  if ( spoon.getShell() != null ) {
   spoon.getShell().getDisplay().asyncExec( execute );
  } else {
   execute.run();
  }
 }
 try {
  Repository repository =
   pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class );
  repository.init( repositoryMeta );
  if ( !testRepository( repository ) ) {
   return false;
  }
 } catch ( KettleException e ) {
  return false;
 }
 currentRepository = repositoryMeta;
 return true;
}

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

public void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ) throws KettleException {
 final Repository repository = loadRepositoryObject( repositoryMeta.getId() );
 repository.init( repositoryMeta );
 repositoryConnect( repository, username, password );
 if ( username != null ) {
  getPropsUI().setLastRepositoryLogin( username );
 }
 Spoon spoon = spoonSupplier.get();
 Runnable execute = () -> {
  if ( spoon.getRepository() != null ) {
   spoon.closeRepository();
  } else {
   spoon.closeAllJobsAndTransformations( true );
  }
  spoon.setRepository( repository );
  setConnectedRepository( repositoryMeta );
  fireListeners();
 };
 if ( spoon.getShell() != null ) {
  spoon.getShell().getDisplay().asyncExec( execute );
 } else {
  execute.run();
 }
}

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

private Repository openRepository( String repositoryName, String user, String pass ) throws KettleException {
 if ( Utils.isEmpty( repositoryName ) ) {
  return null;
 }
 RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
 repositoriesMeta.readData();
 RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
 if ( repositoryMeta == null ) {
  throw new KettleException( "Unable to find repository: " + repositoryName );
 }
 PluginRegistry registry = PluginRegistry.getInstance();
 Repository repository = registry.loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
 repository.init( repositoryMeta );
 repository.connect( user, pass );
 return repository;
}

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

public Repository establishRepositoryConnection( RepositoryMeta repositoryMeta, final String username, final String password,
                          final RepositoryOperation... operations ) throws KettleException, KettleSecurityException {
 Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
 rep.init( repositoryMeta );
 rep.getLog().setLogLevel( getLog().getLogLevel() );
 rep.connect( username != null ? username : null, password != null ? password : null );
 if ( operations != null ) {
  // throws KettleSecurityException if username does does have permission for given operations
  rep.getSecurityProvider().validateAction( operations );
 }
 return rep;
}

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

private Repository openRepository( String repositoryName, String user, String pass ) throws KettleException {
 if ( Utils.isEmpty( repositoryName ) ) {
  return null;
 }
 RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
 repositoriesMeta.readData();
 RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
 if ( repositoryMeta == null ) {
  throw new KettleException( "Unable to find repository: " + repositoryName );
 }
 PluginRegistry registry = PluginRegistry.getInstance();
 Repository repository = registry.loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
 repository.init( repositoryMeta );
 repository.connect( user, pass );
 return repository;
}

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

public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException {
 RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
 if ( repositoryMeta == null ) {
  log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" );
  return null;
 }
 Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta,
   Repository.class );
 rep.init( repositoryMeta );
 try {
  rep.connect( username, password );
  log.logBasic( "Connected to " + repositoryName + " as " + username );
  setRepository( rep );
  return rep;
 } catch ( Exception e ) {
  log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" );
  return null;
 }
}

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

public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException {
 RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
 if ( repositoryMeta == null ) {
  log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" );
  return null;
 }
 Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
 if ( rep == null ) {
  log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" );
  return null;
 }
 rep.init( repositoryMeta );
 try {
  rep.connect( username, password );
  setRepository( rep );
  return rep;
 } catch ( Exception e ) {
  log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" );
  return null;
 }
}

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

private void connectRep( LogChannelInterface log, String realrepName, String realusername, String realpassword ) throws Exception {
 this.repsinfo = new RepositoriesMeta();
 this.repsinfo.getLog().setLogLevel( log.getLogLevel() );
 try {
  this.repsinfo.readData();
 } catch ( Exception e ) {
  logError( BaseMessages.getString( PKG, "JobExportRepository.Error.NoRep" ) );
  throw new Exception( BaseMessages.getString( PKG, "JobExportRepository.Error.NoRep" ) );
 }
 this.repositoryMeta = this.repsinfo.findRepository( realrepName );
 if ( this.repositoryMeta == null ) {
  logError( BaseMessages.getString( PKG, "JobExportRepository.Error.NoRepSystem" ) );
  throw new Exception( BaseMessages.getString( PKG, "JobExportRepository.Error.NoRepSystem" ) );
 }
 this.repository =
  PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, this.repositoryMeta, Repository.class );
 this.repository.init( repositoryMeta );
 try {
  this.repository.connect( realusername, realpassword );
 } catch ( Exception e ) {
  logError( BaseMessages.getString( PKG, "JobExportRepository.Error.CanNotConnectRep" ) );
  throw new Exception( BaseMessages.getString( PKG, "JobExportRepository.Error.CanNotConnectRep" ), e );
 }
}

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

repository =
  PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
 repository.init( repositoryMeta );
 repository.getLog().setLogLevel( log.getLogLevel() );
} catch ( Exception e ) {

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

public RepositoryMeta createRepository( String id, Map<String, Object> items ) {
 RepositoryMeta repositoryMeta;
 try {
  repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class );
  repositoryMeta.populate( items, repositoriesMeta );
  if ( repositoryMeta.getName() != null ) {
   Repository repository =
    pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class );
   repository.init( repositoryMeta );
   repositoriesMeta.addRepository( repositoryMeta );
   repositoriesMeta.writeData();
   currentRepository = repositoryMeta;
   if ( !testRepository( repository ) ) {
    return null;
   }
   ( (AbstractRepository) repository ).create();
  }
 } catch ( KettleException ke ) {
  log.logError( "Unable to load repository type", ke );
  return null;
 }
 return repositoryMeta;
}

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

PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta.getId(),
    Repository.class );
repository.init( repositoryMeta );

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

.toString(), baseDirName.toString() );
repo = new KettleFileRepository();
repo.init( repoMeta );
repo.connect( null, null );

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

private void openRepository( String repositoryId ) throws KettleException {
 try {
  RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
  repositoriesMeta.readData();
  repositoryMeta = repositoriesMeta.findRepository( repositoryId );
  if ( repositoryMeta == null ) {
   throw new KettleException( "Unable to find repository: " + repositoryId );
  }
  PluginRegistry registry = PluginRegistry.getInstance();
  repository = registry.loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
  repository.init( repositoryMeta );
  repository.connect( repositoryUsername, repositoryPassword );
  // Add the repository MetaStore to the delegation as well.
  // Set this one as active with the highest priority
  //
  if ( repository.getMetaStore() != null ) {
   metaStore.addMetaStore( 0, repository.getMetaStore() );
   metaStore.setActiveMetaStoreName( repository.getMetaStore().getName() );
  }
  LogChannel.GENERAL.logBasic( "Connected to repository '" + repository.getName() + "'" );
 } catch ( Exception e ) {
  throw new KettleException( "Unable to open repository connection", e );
 }
}

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

public void loginToRepository() throws KettleException, KettleSecurityException {
 if ( model != null && model.getSelectedRepository() != null ) {
  RepositoryMeta repositoryMeta =
   input.getRepository( model.getRepositoryIndex( model.getSelectedRepository() ) );
  repository =
   PluginRegistry.getInstance().loadClass(
    RepositoryPluginType.class, repositoryMeta.getId(), Repository.class );
  repository.init( repositoryMeta );
  repository.connect( model.getUsername(), model.getPassword() );
  props.setLastRepository( repositoryMeta.getName() );
  props.setLastRepositoryLogin( model.getUsername() );
 } else {
  log.logDetailed( BaseMessages.getString( PKG, "RepositoryLogin.ErrorLoginToRepository" ) );
  throw new KettleException( BaseMessages.getString( PKG, "RepositoryLogin.ErrorLoginToRepository" ) );
 }
}

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

repos.init( repositoryMeta );

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

repos.init( repositoryMeta );

代码示例来源:origin: pentaho/pdi-sdk-plugins

repository.init( repositoryMeta );
repository.connect( username, password );

代码示例来源:origin: pentaho/pdi-sdk-plugins

repository.init( repositoryMeta );
repository.connect( username, password );

相关文章

Repository类方法