use of org.pentaho.di.ui.cluster.dialog.SlaveServerDialog in project pentaho-kettle by pentaho.
the class SpoonSlaveDelegate method edit.
public boolean edit(SlaveServer slaveServer, List<SlaveServer> existingServers) {
String originalName = slaveServer.getName();
SlaveServerDialog dialog = new SlaveServerDialog(spoon.getShell(), slaveServer, existingServers);
if (dialog.open()) {
if (spoon.rep != null) {
try {
saveSharedObjectToRepository(slaveServer, null);
} catch (KettleException e) {
showSaveErrorDialog(slaveServer, e);
}
}
if (sharedObjectSyncUtil != null) {
sharedObjectSyncUtil.synchronizeSlaveServers(slaveServer, originalName);
}
spoon.refreshTree();
spoon.refreshGraph();
return true;
}
return false;
}
use of org.pentaho.di.ui.cluster.dialog.SlaveServerDialog in project pentaho-kettle by pentaho.
the class SlavesController method createSlave.
public void createSlave() {
try {
// Create a new SlaveServer for storing the result
SlaveServer slaveServer = new SlaveServer();
SlaveServerDialog ssd = new SlaveServerDialog(shell, slaveServer);
if (ssd.open()) {
ObjectId slaveId = repository.getSlaveID(slaveServer.getName());
// Make sure the slave does not already exist
if (slaveId != null) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.AlreadyExists.Message", slaveServer.getName()));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"));
mb.open();
} else {
if (slaveServer.getName() != null && !slaveServer.getName().equals("")) {
repository.insertLogEntry(BaseMessages.getString(PKG, "SlavesController.Message.CreatingSlave", slaveServer.getName()));
repository.save(slaveServer, Const.VERSION_COMMENT_INITIAL_VERSION, null);
if (getSharedObjectSyncUtil() != null) {
getSharedObjectSyncUtil().reloadJobRepositoryObjects(true);
getSharedObjectSyncUtil().reloadTransformationRepositoryObjects(true);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.InvalidName.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"));
mb.open();
}
}
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.UnexpectedError.Message"), e);
}
} finally {
refreshSlaves();
}
}
use of org.pentaho.di.ui.cluster.dialog.SlaveServerDialog in project pentaho-kettle by pentaho.
the class RepositoryExplorerDialog method editSlaveServer.
public void editSlaveServer(String slaveName) {
try {
ObjectId id = rep.getSlaveID(slaveName);
// Load the last version
SlaveServer slaveServer = rep.loadSlaveServer(id, null);
SlaveServerDialog dd = new SlaveServerDialog(shell, slaveServer);
if (dd.open()) {
rep.insertLogEntry("Updating slave server '" + slaveServer.getName() + "'");
rep.save(slaveServer, Const.VERSION_COMMENT_EDIT_VERSION, null);
if (!slaveName.equalsIgnoreCase(slaveServer.getName())) {
refreshTree();
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Message") + slaveName + "]", e);
}
}
use of org.pentaho.di.ui.cluster.dialog.SlaveServerDialog in project pentaho-kettle by pentaho.
the class SpoonSlaveDelegate method newSlaveServer.
public void newSlaveServer(HasSlaveServersInterface hasSlaveServersInterface) {
SlaveServer slaveServer = new SlaveServer();
SlaveServerDialog dialog = new SlaveServerDialog(spoon.getShell(), slaveServer, hasSlaveServersInterface.getSlaveServers());
if (dialog.open()) {
slaveServer.verifyAndModifySlaveServerName(hasSlaveServersInterface.getSlaveServers(), null);
hasSlaveServersInterface.getSlaveServers().add(slaveServer);
if (spoon.rep != null) {
try {
if (!spoon.rep.getSecurityProvider().isReadOnly()) {
spoon.rep.save(slaveServer, Const.VERSION_COMMENT_INITIAL_VERSION, null);
// repository objects are "global"
if (sharedObjectSyncUtil != null) {
sharedObjectSyncUtil.reloadJobRepositoryObjects(false);
sharedObjectSyncUtil.reloadTransformationRepositoryObjects(false);
}
} else {
showSaveErrorDialog(slaveServer, new KettleException(BaseMessages.getString(PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser")));
}
} catch (KettleException e) {
showSaveErrorDialog(slaveServer, e);
}
}
spoon.refreshTree();
}
}
use of org.pentaho.di.ui.cluster.dialog.SlaveServerDialog in project pentaho-kettle by pentaho.
the class SlavesController method editSlave.
public void editSlave() {
String slaveServerName = "";
try {
Collection<UISlave> slaves = slavesTable.getSelectedItems();
if (slaves != null && !slaves.isEmpty()) {
// Grab the first item in the list & send it to the slave dialog
SlaveServer slaveServer = ((UISlave) slaves.toArray()[0]).getSlaveServer();
slaveServerName = slaveServer.getName();
// Make sure the slave already exists
ObjectId slaveId = repository.getSlaveID(slaveServer.getName());
if (slaveId == null) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.DoesNotExists.Message", slaveServerName));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.Title"));
mb.open();
} else {
SlaveServerDialog ssd = new SlaveServerDialog(shell, slaveServer);
if (ssd.open()) {
if (slaveServer.getName() != null && !slaveServer.getName().equals("")) {
repository.insertLogEntry(BaseMessages.getString(PKG, "SlavesController.Message.UpdatingSlave", slaveServer.getName()));
repository.save(slaveServer, Const.VERSION_COMMENT_EDIT_VERSION, null);
if (getSharedObjectSyncUtil() != null) {
getSharedObjectSyncUtil().synchronizeSlaveServers(slaveServer, slaveServerName);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.InvalidName.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.Title"));
mb.open();
}
}
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.NoItemSelected.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.Title"));
mb.open();
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Message") + slaveServerName + "]", e);
}
} finally {
refreshSlaves();
}
}
Aggregations