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

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

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

Repository.connect介绍

[英]Connect to the repository. Make sure you don't connect more than once to the same repository with this repository object.
[中]连接到存储库。请确保不要多次使用此存储库对象连接到同一存储库。

代码示例

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

@Override
public void connect( String s, String s1 ) throws KettleException, KettleSecurityException {
 getDelegate().connect( s, s1 );
}

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

private void repositoryConnect( Repository repository, String username, String password ) throws KettleException {
 ExecutorService executorService = ExecutorUtil.getExecutor();
 Future<KettleException> future = executorService.submit( () -> {
  ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
  try {
   Thread.currentThread().setContextClassLoader( Trans.class.getClassLoader() );
   repository.connect( username, password );
  } catch ( KettleException e ) {
   return e;
  } finally {
   Thread.currentThread().setContextClassLoader( currentClassLoader );
  }
  return null;
 } );
 try {
  KettleException exception = future.get();
  if ( exception != null ) {
   throw exception;
  }
 } catch ( InterruptedException | ExecutionException e ) {
  throw new KettleException();
 }
}

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

/**
  * Resets the repository so that next time {@link #getRepository()} is called a new repository is returned.
  * This is called whenever the user or password is changed for this instance of the repository
  */
 public void reconnectToRepository() {
  if ( this.repository == null ) {
   return;
  }

  if ( this.repository.isConnected() ) {
   this.repository.disconnect();
  }

  try {
   this.repository.connect( this.getUsername(), this.getPassword() );
   this.shouldReconnect = false;
  } catch ( KettleException e ) {
   logger.debug( "Unable to connect to repository \"{}\".", this.repository.getRepositoryMeta().getId() );
  }
 }
}

代码示例来源: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

job.getRep().connect(
  job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword() );
} else {
 job.getRep().connect( null, 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

job.getRep().connect( job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword() );
} else {
 job.getRep().connect( null, null );

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

repository.connect( optionUsername != null ? optionUsername.toString() : null, optionPassword != null
  ? optionPassword.toString() : null );
} catch ( KettleException ke ) {

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

} ).when( repository ).connect( anyString(), anyString() );

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

} ).when( repository ).connect( anyString(), anyString() );

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

repository.connect( PentahoSessionHolder.getSession().getName(), "password" );

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

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

代码示例来源: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

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

repos.connect( jobMeta.environmentSubstitute( wUserName.getText() ), jobMeta
  .environmentSubstitute( wPassword.getText() ) );
} catch ( Exception e ) {

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

repos.connect( jobMeta.environmentSubstitute( wUserName.getText() ), Utils
  .resolvePassword( jobMeta, wPassword.getText() ) );
} catch ( Exception e ) {

相关文章

Repository类方法