use of com.cubrid.cubridmanager.ui.mondashboard.dialog.ConnectHostNodeDialog in project cubrid-manager by CUBRID.
the class ConnectHostJobExecutor method connectHost.
/**
*
* Connect host
*
* @param task The MonitoringTask
* @return IStatus
*/
private IStatus connectHost(MonitoringTask task) {
MonitorDashboardPreference monPref = new MonitorDashboardPreference();
while (!serverInfo.isConnected() && isContinue) {
serverInfo = task.connectServer(Version.releaseVersion, monPref.getHAHeartBeatTimeout());
final String msg = task.getErrorMsg();
if (this.isPing && msg != null && msg.length() > 0) {
return Status.CANCEL_STATUS;
}
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (msg != null && msg.length() > 0) {
ConnectHostNodeDialog dialog = new ConnectHostNodeDialog(null, hostNode, msg);
if (dialog.open() == IDialogConstants.OK_ID) {
serverInfo.setHostMonPort(Integer.parseInt(dialog.getPort()));
serverInfo.setUserPassword(dialog.getPassword());
} else {
isContinue = false;
}
}
}
});
}
if (serverInfo.isConnected()) {
CMHostNodePersistManager.getInstance().addServer(serverInfo.getHostAddress(), serverInfo.getHostMonPort(), serverInfo.getUserName(), serverInfo);
}
changePassword();
if (!isContinue) {
disConnect();
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
Aggregations