use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class HostUtils method processHostDeleted.
/**
* Process resource when delete host
*
* @param server CubridServer
* @return boolean
*/
public static boolean processHostDeleted(CubridServer server) {
if (server == null) {
LOGGER.debug("The server is a null.");
return false;
}
final JobFamily jobFamily = new JobFamily();
String serverName = server.getLabel();
String dbName = JobFamily.ALL_DB;
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
boolean isHaveDashboard = DataGeneratorPool.getInstance().isHasConnection(server.getHostAddress(), server.getMonPort(), server.getUserName());
// check whether have jobs and monitoring dashboard in this server
if ((jobs != null && jobs.length > 0) || isHaveDashboard) {
String msg = Messages.bind(Messages.msgConfirmDeleteHostWithJob, serverName);
boolean isDisconnectHost = CommonUITool.openConfirmBox(msg);
if (!isDisconnectHost) {
return false;
}
}
// check the query editor in this server
if (!LayoutUtil.checkAllQueryEditor(server)) {
return false;
}
boolean isSaved = server.getServerInfo().isConnected();
boolean isCloseAll = CubridWorkbenchContrItem.closeAllEditorAndViewInServer(server, isSaved);
if (!isCloseAll) {
return false;
}
cancelJob(jobFamily);
QueryOptions.removePref(server.getServerInfo());
BrokerIntervalSettingManager.getInstance().removeAllBrokerIntervalSettingInServer(server.getLabel());
CMHostNodePersistManager.getInstance().removeServer(server);
return true;
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class HostUtils method processHostDisconnected.
/**
* Process the resource when disconnect host
*
* @param server CubridServer
* @return boolean
*/
public static boolean processHostDisconnected(CubridServer server) {
if (server == null) {
LOGGER.debug("The server is a null.");
return false;
}
final JobFamily jobFamily = new JobFamily();
String serverName = server.getLabel();
String dbName = JobFamily.ALL_DB;
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
boolean isHaveDashboard = DataGeneratorPool.getInstance().isHasConnection(server.getHostAddress(), server.getMonPort(), server.getUserName());
// check whether have jobs and monitoring dashboard in this server
if ((jobs != null && jobs.length > 0) || isHaveDashboard) {
String msg = Messages.bind(Messages.msgConfirmDisconnectHostWithJob, serverName);
boolean isDisconnectHost = CommonUITool.openConfirmBox(msg);
if (!isDisconnectHost) {
return false;
}
}
// check the query editor in this server
if (!LayoutUtil.checkAllQueryEditor(server)) {
return false;
}
boolean isSaved = server.getServerInfo().isConnected();
boolean isCloseAll = CubridWorkbenchContrItem.closeAllEditorAndViewInServer(server, isSaved);
if (!isCloseAll) {
return false;
}
cancelJob(jobFamily);
server.getLoader().setLoaded(false);
server.removeAllChild();
ServerManager.getInstance().setConnected(server.getHostAddress(), server.getMonPort() == null ? 0 : Integer.parseInt(server.getMonPort()), server.getUserName(), false);
if (!server.isAutoSavePassword()) {
server.getServerInfo().setUserPassword("");
}
return true;
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class DatabaseUtils method processDatabaseLogout.
/**
*
* Process the resource when logout database
*
* @param database CubridDatabase
* @return boolean
*/
public static boolean processDatabaseLogout(CubridDatabase database) {
final JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
if (jobs.length > 0) {
boolean isLogout = CommonUITool.openConfirmBox(Messages.bind(Messages.msgConfirmLogoutDBwithJob, dbName));
if (!isLogout) {
return false;
}
}
// check the query editor in this database
if (!LayoutUtil.checkAllQueryEditor(database)) {
return false;
}
cancelJob(jobFamily);
database.getLoader().setLoaded(false);
database.setLogined(false);
database.removeAllChild();
if (!database.isAutoSavePassword()) {
CMDBNodePersistManager.getInstance().deleteDbParameter(database);
}
return true;
}
use of com.cubrid.common.ui.spi.progress.JobFamily in project cubrid-manager by CUBRID.
the class DatabaseUtils method processDatabaseDeleted.
/**
*
* Process resource when delete database
*
* @param database CubridDatabase
* @return boolean
*/
public static boolean processDatabaseDeleted(CubridDatabase database) {
final JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
Job[] jobs = Job.getJobManager().find(jobFamily);
if (jobs.length > 0) {
boolean isLogout = CommonUITool.openConfirmBox(Messages.bind(Messages.msgConfirmDeleteDBwithJob, dbName));
if (!isLogout) {
return false;
}
}
// check the query editor in this database
if (!LayoutUtil.checkAllQueryEditor(database)) {
return false;
}
cancelJob(jobFamily);
CubridServer server = database.getServer();
CMDBNodePersistManager.getInstance().deleteDbParameter(database);
server.getServerInfo().getAllDatabaseList().remove(database.getName());
server.getServerInfo().getLoginedUserInfo().removeDatabaseInfo(database.getDatabaseInfo());
QueryOptions.removePref(database.getDatabaseInfo());
database.setLogined(false);
database.removeAllChild();
return true;
}
Aggregations