use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method saveAutoParam.
private void saveAutoParam(Set<String> settingAutoStartDB) {
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
getCubridConfParameterTask.execute();
if (!getCubridConfParameterTask.isSuccess()) {
CommonUITool.openInformationBox(com.cubrid.cubridmanager.ui.common.Messages.titleError, getCubridConfParameterTask.getErrorMsg());
return;
}
List<String> cubridConfContentList = getCubridConfParameterTask.getConfContents();
List<String> currentAutoStartDBList = getCubridConfParameterTask.getAutoStartDb(false);
/*Merge the data*/
for (String db : currentAutoStartDBList) {
if (!settingAutoStartDB.contains(db)) {
cubridConfContentList = CoreUtils.deleteDatabaseFromServiceServer(getCubridConfParameterTask, cubridConfContentList, db);
}
}
for (String db : settingAutoStartDB) {
if (!currentAutoStartDBList.contains(db)) {
cubridConfContentList = CoreUtils.addDatabaseToServiceServer(getCubridConfParameterTask, cubridConfContentList, db);
}
}
/*Update the config*/
SetCubridConfParameterTask setParaTask = new SetCubridConfParameterTask(serverInfo);
setParaTask.setConfContents(cubridConfContentList);
CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.common.Messages.setCubridParameterTaskName);
taskExcutor.addTask(setParaTask);
new ExecTaskWithProgress(taskExcutor).exec(true, true);
if (taskExcutor.isSuccess()) {
isDirty = false;
updateToolBar();
CommonUITool.openInformationBox(com.cubrid.cubridmanager.ui.common.Messages.titleSuccess, com.cubrid.cubridmanager.ui.common.Messages.msgChangeServiceParaSuccess);
}
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class ServicePropertyPage method perform.
/**
*
* Perform the task and set cubrid.conf configuration file service section
* parameter
*
* @param confParaMap the conf parameter map
*/
private void perform(Map<String, Map<String, String>> confParaMap) {
SetCubridConfParameterTask task = new SetCubridConfParameterTask(node.getServer().getServerInfo());
task.setConfParameters(confParaMap);
CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCubridParameterTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec(true, true);
if (taskExcutor.isSuccess()) {
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeServiceParaSuccess);
}
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class CreateReplicationUtil method createSlaveMasterTaskGroup.
/**
*
* Fill in the related tasks of creating master to executor according to
* slave and master information,this slave node is also master node.
*
* @param master MasterNode
* @param slave SlaveNode
* @param executor CreateReplicationJobExecutor
* @return null or error message
*/
public static String createSlaveMasterTaskGroup(MasterNode master, SlaveNode slave, CreateReplicationJobExecutor executor) {
TaskGroup taskGroup = new TaskGroup(IConstants.REPL_GROUP_NAME_CREATE_MASTER);
taskGroup.setTarget(master.getDbName());
HostNode slaveHost = (HostNode) slave.getParent();
final String ip = slaveHost.getIp();
final String port = slaveHost.getPort();
final String userName = slaveHost.getUserName();
final String password = slaveHost.getPassword();
boolean isConnected = ServerManager.getInstance().isConnected(ip, Integer.parseInt(port), userName);
ServerInfo serverInfo = new ServerInfo();
if (isConnected) {
serverInfo = ServerManager.getInstance().getServer(ip, Integer.parseInt(port), userName);
if (!serverInfo.getLoginedUserInfo().isAdmin()) {
return Messages.bind(Messages.errInvalidUser, ip);
}
} else {
serverInfo.setHostAddress(ip);
serverInfo.setHostMonPort(Integer.parseInt(port));
serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
serverInfo.setUserName(userName);
serverInfo.setUserPassword(password);
MonitoringTask monitoringTask = new MonitoringTask(serverInfo);
taskGroup.addTask(monitoringTask);
}
GetReplServerStatusTask getReplServerStatusTask = new GetReplServerStatusTask(serverInfo);
getReplServerStatusTask.setDbName(slave.getDbName());
taskGroup.addTask(getReplServerStatusTask);
StopReplServerTask stopReplServerTask = new StopReplServerTask(serverInfo);
stopReplServerTask.setDbName(slave.getDbName());
taskGroup.addTask(stopReplServerTask);
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
getCubridConfParameterTask.putData("dbName", slave.getDbName());
taskGroup.addTask(getCubridConfParameterTask);
SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(serverInfo);
taskGroup.addTask(setCubridConfParameterTask);
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
getDatabaseListTask.putData("dbName", slave.getDbName());
taskGroup.addTask(getDatabaseListTask);
CommonUpdateTask stopDbTask = new CommonUpdateTask(CommonTaskName.STOP_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
stopDbTask.setDbName(slave.getDbName());
taskGroup.addTask(stopDbTask);
CommonUpdateTask startDbTask = new CommonUpdateTask(CommonTaskName.START_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
startDbTask.setDbName(slave.getDbName());
taskGroup.addTask(startDbTask);
BackupDbTask backupDbTask = new BackupDbTask(serverInfo);
backupDbTask.setDbName(slave.getDbName());
backupDbTask.setLevel("0");
backupDbTask.setVolumeName(slave.getDbName() + "_bk0v000");
backupDbTask.setBackupDir(slave.getDbPath());
backupDbTask.setRemoveLog(false);
backupDbTask.setCheckDatabaseConsist(true);
backupDbTask.setThreadCount(String.valueOf(0));
backupDbTask.setZiped(false);
backupDbTask.setSafeReplication(false);
taskGroup.addTask(backupDbTask);
executor.addGroupTask(taskGroup);
return null;
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class UnifyHostConfigUtil method saveCubridConf.
/**
* save cubrid broker conf
* @param monitor
* @param brokerConfMap
* @param editorInput
* @return failed server
*/
public List<String> saveCubridConf(IProgressMonitor monitor, LinkedHashMap<String, CubridConfConfig> cubridConfMap, CubridServer[] cubridServers) {
List<String> failedServer = new ArrayList<String>();
for (Entry<String, CubridConfConfig> entry : cubridConfMap.entrySet()) {
CubridConfConfig cubridConfConfig = entry.getValue();
String serverName = entry.getKey();
String contents = parseCubridConfConfigToDocumnetString(cubridConfConfig);
CubridServer cubridServer = getCubridServer(serverName, cubridServers);
if (cubridServer != null) {
monitor.subTask(Messages.bind(Messages.unifyHostConfigEditorSavingDataMsg2, "cubrid.conf", serverName));
String[] lines = contents.split(System.getProperty("line.separator"));
SetCubridConfParameterTask task = new SetCubridConfParameterTask(cubridServer.getServerInfo());
task.setConfContents(Arrays.asList(lines));
task.execute();
if (!task.isSuccess()) {
failedServer.add(cubridServer.getName());
}
task.finish();
monitor.worked(1);
}
}
return failedServer;
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class ConfigHAWizard method performFinish.
public boolean performFinish() {
ServerInfo masterServerInfo = haModel.getMasterServer().getServer().getServerInfo();
ServerInfo slaveServerInfo = haModel.getSlaveServer().getServer().getServerInfo();
Map<String, Map<String, String>> masterParams = haModel.getMasterServer().getCubridParameters();
Map<String, Map<String, String>> slaveParams = haModel.getSlaveServer().getCubridParameters();
Map<String, Map<String, String>> masterHaParams = haModel.getMasterServer().getCubridHAParameters();
Map<String, Map<String, String>> slaveHaParams = haModel.getSlaveServer().getCubridHAParameters();
setCubridConfParameterTaskMaster = new SetCubridConfParameterTask(masterServerInfo);
setCubridConfParameterTaskMaster.setConfParameters(masterParams);
setHAConfParameterTaskMaster = new SetHAConfParameterTask(masterServerInfo);
setHAConfParameterTaskMaster.setConfParameters(masterHaParams);
setCubridConfParameterTaskSlave = new SetCubridConfParameterTask(slaveServerInfo);
setCubridConfParameterTaskSlave.setConfParameters(slaveParams);
setHAConfParameterTaskSlave = new SetHAConfParameterTask(slaveServerInfo);
setHAConfParameterTaskSlave.setConfParameters(slaveHaParams);
CommonTaskExec taskExec = new CommonTaskExec(Messages.msgUploading);
taskExec.addTask(setCubridConfParameterTaskMaster);
taskExec.addTask(setCubridConfParameterTaskSlave);
taskExec.addTask(setHAConfParameterTaskMaster);
taskExec.addTask(setHAConfParameterTaskSlave);
new ExecTaskWithProgress(taskExec).exec();
if (taskExec.isSuccess()) {
StartHAServiceDialog dialog = new StartHAServiceDialog(getShell(), haModel);
dialog.open();
return true;
} else {
CommonUITool.openErrorBox(getErrMsg());
return false;
}
}
Aggregations