use of org.pentaho.di.repository.RepositoriesMeta in project pentaho-kettle by pentaho.
the class ExecuteTransServlet method openRepository.
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;
}
use of org.pentaho.di.repository.RepositoriesMeta in project pentaho-kettle by pentaho.
the class SlaveServerConfig method openRepository.
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);
//
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);
}
}
use of org.pentaho.di.repository.RepositoriesMeta in project pentaho-kettle by pentaho.
the class JobEntryExportRepository method connectRep.
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);
}
}
use of org.pentaho.di.repository.RepositoriesMeta in project pentaho-kettle by pentaho.
the class AbstractBaseCommandExecutor method loadRepositoryInfo.
public RepositoriesMeta loadRepositoryInfo(String loadingAvailableRepMsgTkn, String noRepsDefinedMsgTkn) throws KettleException {
RepositoriesMeta repsinfo = new RepositoriesMeta();
repsinfo.getLog().setLogLevel(getLog().getLogLevel());
logDebug(loadingAvailableRepMsgTkn);
try {
repsinfo.readData();
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(getPkgClazz(), noRepsDefinedMsgTkn), e);
}
return repsinfo;
}
use of org.pentaho.di.repository.RepositoriesMeta in project pentaho-kettle by pentaho.
the class AbstractBaseCommandExecutor method loadRepositoryConnection.
public RepositoryMeta loadRepositoryConnection(final String repoName, String loadingAvailableRepMsgTkn, String noRepsDefinedMsgTkn, String findingRepMsgTkn) throws KettleException {
RepositoriesMeta repsinfo;
if (Utils.isEmpty(repoName) || (repsinfo = loadRepositoryInfo(loadingAvailableRepMsgTkn, noRepsDefinedMsgTkn)) == null) {
return null;
}
logDebug(findingRepMsgTkn, repoName);
return repsinfo.findRepository(repoName);
}
Aggregations