use of org.pentaho.di.repository.RepositoryMeta in project pentaho-kettle by pentaho.
the class SessionTimeoutHandler method showLoginScreen.
boolean showLoginScreen(RepositoryConnectController repositoryConnectController) {
String message = BaseMessages.getString(PKG, "Repository.Reconnection.Message");
RepositoryDialog loginDialog = new RepositoryDialog(getSpoon().getShell(), repositoryConnectController);
RepositoryMeta repositoryMeta = repositoryConnectController.getConnectedRepository();
return loginDialog.openRelogin(repositoryMeta, message);
}
use of org.pentaho.di.repository.RepositoryMeta in project pentaho-kettle by pentaho.
the class RepositoriesModel method setSelectedRepository.
public void setSelectedRepository(RepositoryMeta selectedRepository) {
RepositoryMeta previousValue = this.selectedRepository;
this.selectedRepository = selectedRepository;
this.firePropertyChange("selectedRepository", previousValue, selectedRepository);
checkIfModelValid();
}
use of org.pentaho.di.repository.RepositoryMeta in project pentaho-kettle by pentaho.
the class RepositoriesHelper method loginToRepository.
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"));
}
}
use of org.pentaho.di.repository.RepositoryMeta in project pentaho-kettle by pentaho.
the class RepositoriesHelper method deleteRepository.
public void deleteRepository() {
try {
XulConfirmBox confirmBox = (XulConfirmBox) document.createElement("confirmbox");
final RepositoryMeta repositoryMeta = input.searchRepository(model.getSelectedRepository().getName());
if (repositoryMeta != null) {
confirmBox.setTitle(BaseMessages.getString(PKG, "RepositoryLogin.ConfirmDeleteRepositoryDialog.Title"));
confirmBox.setMessage(BaseMessages.getString(PKG, "RepositoryLogin.ConfirmDeleteRepositoryDialog.Message"));
confirmBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
confirmBox.setCancelLabel(BaseMessages.getString(PKG, "Dialog.Cancel"));
confirmBox.addDialogCallback(new XulDialogCallback<Object>() {
public void onClose(XulComponent sender, Status returnCode, Object retVal) {
if (returnCode == Status.ACCEPT) {
int idx = input.indexOfRepository(repositoryMeta);
input.removeRepository(idx);
fillRepositories();
writeData();
}
}
public void onError(XulComponent sender, Throwable t) {
log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", t.getLocalizedMessage()));
new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", t.getLocalizedMessage()), t);
}
});
confirmBox.open();
}
} catch (Exception e) {
log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", e.getLocalizedMessage()));
new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", e.getLocalizedMessage()), e);
}
}
use of org.pentaho.di.repository.RepositoryMeta in project pentaho-kettle by pentaho.
the class RepositoriesHelper method newRepository.
public void newRepository() {
PluginRegistry registry = PluginRegistry.getInstance();
Class<? extends PluginTypeInterface> pluginType = RepositoryPluginType.class;
List<PluginInterface> plugins = registry.getPlugins(pluginType);
String[] names = new String[plugins.size()];
for (int i = 0; i < names.length; i++) {
PluginInterface plugin = plugins.get(i);
names[i] = plugin.getName() + " - " + plugin.getDescription();
}
// TODO: make this a bit fancier!
EnterSelectionDialog selectRepositoryType = new EnterSelectionDialog(this.shell, names, BaseMessages.getString(PKG, "RepositoryLogin.SelectRepositoryType"), BaseMessages.getString(PKG, "RepositoryLogin.SelectRepositoryTypeCreate"));
String choice = selectRepositoryType.openRepoDialog();
if (choice != null) {
int index = selectRepositoryType.getSelectionNr();
PluginInterface plugin = plugins.get(index);
String id = plugin.getIds()[0];
try {
// With this ID we can create a new Repository object...
//
RepositoryMeta repositoryMeta = PluginRegistry.getInstance().loadClass(RepositoryPluginType.class, id, RepositoryMeta.class);
RepositoryDialogInterface dialog = getRepositoryDialog(plugin, repositoryMeta, input, this.shell);
RepositoryMeta meta = dialog.open(MODE.ADD);
if (meta != null) {
// If it does then display a error to the user
if (meta.getName() != null) {
input.addRepository(meta);
fillRepositories();
model.setSelectedRepository(meta);
writeData();
}
}
} catch (Exception e) {
log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.ErrorCreatingRepository", e.getLocalizedMessage()));
new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.ErrorCreatingRepository", e.getLocalizedMessage()), e);
}
}
}
Aggregations