use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class DatabaseConfigPropertyPage method perform.
/**
* Perform the task and set cubrid.conf file parameter
*
* @param confParaMap the conf parameters 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.msgChangeServerParaSuccess);
}
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class RenameDatabaseDialog method renameDb.
/**
* Execute task and rename database
*/
private void renameDb() {
newDBName = databaseNameText.getText();
isCanFinished = true;
TaskJobExecutor taskExec = new TaskJobExecutor() {
public IStatus exec(final IProgressMonitor monitor) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
getShell().setVisible(false);
}
});
if (monitor.isCanceled()) {
cancel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
close();
}
});
return Status.CANCEL_STATUS;
}
List<String> cubridConfContentList = null;
for (ITask task : taskList) {
if (task instanceof SetCubridConfParameterTask) {
if (cubridConfContentList == null) {
LOGGER.warn("cubridConfContentList is null. Skip SetCubridConfParameterTask.");
continue;
}
SetCubridConfParameterTask setParaTask = (SetCubridConfParameterTask) task;
setParaTask.setConfContents(cubridConfContentList);
}
task.execute();
final String msg = task.getErrorMsg();
if (msg != null && msg.length() > 0 && !monitor.isCanceled() && !isCanceled()) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
getShell().setVisible(true);
}
});
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
}
if (isCanceled()) {
return Status.CANCEL_STATUS;
}
if (task instanceof CheckDirTask) {
CheckDirTask checkDirTask = (CheckDirTask) task;
final String[] dirs = checkDirTask.getNoExistDirectory();
if (dirs != null && dirs.length > 0) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
CreateDirDialog dialog = new CreateDirDialog(getShell());
dialog.setDirs(dirs);
if (dialog.open() != IDialogConstants.OK_ID) {
isCanFinished = false;
}
}
});
}
} else if (task instanceof GetCubridConfParameterTask) {
GetCubridConfParameterTask getCubridConfParameterTask = (GetCubridConfParameterTask) task;
cubridConfContentList = CoreUtils.renameDatabaseFromServiceServer(getCubridConfParameterTask, cubridConfContentList, database.getName(), newDBName);
}
if (!isCanFinished || monitor.isCanceled()) {
cancel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
close();
}
});
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
public void done(IJobChangeEvent event) {
if (event.getResult() == Status.OK_STATUS) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
iUpdateUIWithJob.completeAll();
close();
}
});
}
}
};
CheckDirTask checkDirTask = new CheckDirTask(database.getServer().getServerInfo());
RenameDbTask renameDbTask = new RenameDbTask(database.getServer().getServerInfo());
renameDbTask.setDbName(database.getLabel());
renameDbTask.setNewDbName(newDBName);
if (exVolumePathButton.getSelection()) {
checkDirTask.setDirectory(new String[] { exVolumePathText.getText() });
renameDbTask.setExVolumePath(exVolumePathText.getText());
renameDbTask.setAdvanced(false);
} else if (renameVolumeButton.getSelection()) {
List<String> pathList = new ArrayList<String>();
List<String> volumeChangedList = new ArrayList<String>();
for (int i = 0; spaceInfoList != null && i < spaceInfoList.size(); i++) {
Map<String, String> map = spaceInfoList.get(i);
String oldName = map.get("0");
String newName = map.get("1");
String oldPath = map.get("2");
String newPath = map.get("3");
addVolumePath(pathList, newPath);
oldPath = oldPath.replaceAll(":", "|");
newPath = newPath.replaceAll(":", "|");
volumeChangedList.add(oldPath + "/" + oldName + ":" + newPath + "/" + newName);
}
String[] checkedDirs = new String[pathList.size()];
pathList.toArray(checkedDirs);
checkDirTask.setDirectory(checkedDirs);
renameDbTask.setAdvanced(true);
renameDbTask.setIndividualVolume(volumeChangedList);
}
if (forceDelBackupVolumeButton.getSelection()) {
renameDbTask.setForceDel(true);
} else {
renameDbTask.setForceDel(false);
}
taskExec.addTask(renameDbTask);
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(database.getServer().getServerInfo());
taskExec.addTask(getCubridConfParameterTask);
SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(database.getServer().getServerInfo());
taskExec.addTask(setCubridConfParameterTask);
JobFamily jobFamily = new JobFamily();
String serverName = database.getServer().getName();
String dbName = database.getName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
String jobName = Messages.msgRenameDBRearJobName + " - " + dbName + "@" + serverName;
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class DeleteDatabaseDialog method deleteDatabase.
/**
*
* Delete the database
*
* @return <code>true</code> if successful;<code>false</code> otherwise
*/
private boolean deleteDatabase() {
TaskExecutor taskExcutor = new TaskExecutor() {
public boolean exec(final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return false;
}
String taskName = Messages.bind(Messages.delDbTaskName, database.getName());
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
boolean isActiveReplServer = false;
boolean isActiveReplAgent = false;
List<String> cubridConfContentList = null;
for (ITask task : taskList) {
if (task instanceof GetReplServerStatusTask) {
GetReplServerStatusTask getReplServerStatusTask = (GetReplServerStatusTask) task;
getReplServerStatusTask.execute();
isActiveReplServer = getReplServerStatusTask.isActive();
} else if (task instanceof StopReplServerTask) {
if (isActiveReplServer) {
task.execute();
}
} else if (task instanceof GetReplAgentStatusTask) {
GetReplAgentStatusTask getReplAgentStatusTask = (GetReplAgentStatusTask) task;
getReplAgentStatusTask.execute();
isActiveReplAgent = getReplAgentStatusTask.isActive();
} else if (task instanceof StopReplicationAgentTask) {
if (isActiveReplAgent) {
task.execute();
}
} else if (task instanceof SetCubridConfParameterTask) {
if (cubridConfContentList == null) {
continue;
} else {
SetCubridConfParameterTask setParaTask = (SetCubridConfParameterTask) task;
setParaTask.setConfContents(cubridConfContentList);
setParaTask.execute();
}
} else {
task.execute();
}
final String msg = task.getErrorMsg();
if (openErrorBox(getShell(), msg, monitor)) {
return false;
}
if (monitor.isCanceled()) {
return false;
}
if (task instanceof GetCubridConfParameterTask) {
GetCubridConfParameterTask getCubridConfParameterTask = (GetCubridConfParameterTask) task;
cubridConfContentList = CoreUtils.deleteDatabaseFromServiceServer(getCubridConfParameterTask, cubridConfContentList, database.getName());
}
}
return true;
}
};
ServerInfo serverInfo = database.getServer().getServerInfo();
//check the replication server and agent
if (serverInfo.isSupportReplication() == 0) {
if (database.isDistributorDb()) {
GetReplAgentStatusTask getReplAgentStatusTask = new GetReplAgentStatusTask(serverInfo);
getReplAgentStatusTask.setDbName(database.getLabel());
taskExcutor.addTask(getReplAgentStatusTask);
StopReplicationAgentTask stopReplAgentTask = new StopReplicationAgentTask(serverInfo);
stopReplAgentTask.setDbName(database.getLabel());
taskExcutor.addTask(stopReplAgentTask);
} else {
GetReplServerStatusTask getReplServerStatusTask = new GetReplServerStatusTask(serverInfo);
getReplServerStatusTask.setDbName(database.getLabel());
taskExcutor.addTask(getReplServerStatusTask);
StopReplServerTask stopReplServerTask = new StopReplServerTask(serverInfo);
stopReplServerTask.setDbName(database.getLabel());
taskExcutor.addTask(stopReplServerTask);
}
}
CommonUpdateTask deleteDbtask = new CommonUpdateTask(CommonTaskName.DELETE_DATABASE_TASK_NAME, serverInfo, CommonSendMsg.getDeletedbSendMsg());
deleteDbtask.setDbName(database.getName());
if (deleteBackupVolumesButton.getSelection()) {
deleteDbtask.setDelbackup(YesNoType.Y);
} else {
deleteDbtask.setDelbackup(YesNoType.N);
}
taskExcutor.addTask(deleteDbtask);
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
taskExcutor.addTask(getCubridConfParameterTask);
SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(serverInfo);
taskExcutor.addTask(setCubridConfParameterTask);
new ExecTaskWithProgress(taskExcutor).exec(true, false);
if (taskExcutor.isSuccess()) {
setReturnCode(DELETE_ID);
close();
return true;
} else {
return false;
}
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class CreateDatabaseWizard method performFinish.
/**
* Called when user clicks Finish
*
* @return boolean
*/
public boolean performFinish() {
isCanFinished = true;
isOverride = true;
final String databaseName = generalInfoPage.getDatabaseName();
String pageSize = generalInfoPage.getPageSize();
String logPageSize = generalInfoPage.getLogPageSize();
String generalPageNum = generalInfoPage.getGenericPageNum();
String generalVolumePath = generalInfoPage.getGenericVolumePath();
String charset = generalInfoPage.getCharset();
final boolean isAutoStart = generalInfoPage.isAutoStart();
TaskJobExecutor taskExcutor = new TaskJobExecutor() {
public IStatus exec(final IProgressMonitor monitor) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
getShell().setVisible(false);
}
});
if (monitor.isCanceled()) {
isCanFinished = true;
Display.getDefault().syncExec(new Runnable() {
public void run() {
cancel();
close();
}
});
return Status.CANCEL_STATUS;
}
List<String> cubridConfContentList = null;
for (ITask task : taskList) {
if (task instanceof CreateDbTask) {
CreateDbTask createDbTask = (CreateDbTask) task;
createDbTask.setOverwriteConfigFile(isOverride);
} else if (task instanceof SetCubridConfParameterTask) {
if (cubridConfContentList == null) {
continue;
} else {
SetCubridConfParameterTask setParaTask = (SetCubridConfParameterTask) task;
setParaTask.setConfContents(cubridConfContentList);
}
}
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
cancel();
close();
}
});
isCanFinished = true;
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled() && !isCanceled()) {
//start database failed
if (task instanceof CommonUpdateTask && task.getTaskname().equals(CommonTaskName.START_DB_TASK_NAME)) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(getShell(), msg + StringUtil.NEWLINE + Messages.createDBFailedMsg);
}
});
return Status.OK_STATUS;
}
Display.getDefault().syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(getShell(), msg);
isCanFinished = false;
getShell().setVisible(true);
}
});
return Status.CANCEL_STATUS;
}
if (isCanceled()) {
return Status.CANCEL_STATUS;
}
if (task instanceof CheckDirTask) {
CheckDirTask checkDirTask = (CheckDirTask) task;
final String[] dirs = checkDirTask.getNoExistDirectory();
if (dirs != null && dirs.length > 0) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
CreateDirDialog dialog = new CreateDirDialog(getShell());
dialog.setDirs(dirs);
if (dialog.open() != IDialogConstants.OK_ID) {
isCanFinished = false;
getShell().setVisible(true);
}
}
});
}
} else if (task instanceof CheckFileTask) {
CheckFileTask checkFileTask = (CheckFileTask) task;
final String[] files = checkFileTask.getExistFiles();
if (files != null && files.length > 0) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
OverrideFileDialog dialog = new OverrideFileDialog(getShell());
dialog.setFiles(files);
isOverride = dialog.open() == IDialogConstants.OK_ID;
getShell().setVisible(!isOverride);
}
});
}
} else if (task instanceof GetCubridConfParameterTask) {
GetCubridConfParameterTask getCubridConfParameterTask = (GetCubridConfParameterTask) task;
List<String> cubridConfContentListCandidate1 = null;
if (isAutoStart) {
cubridConfContentListCandidate1 = CoreUtils.addDatabaseToServiceServer(getCubridConfParameterTask, null, databaseName);
}
List<String> cubridConfContentListCandidate2 = null;
if (CompatibleUtil.isNeedCheckHAModeOnNewDb(server.getServerInfo())) {
cubridConfContentListCandidate2 = CoreUtils.changeHAModeFromCubridConf(getCubridConfParameterTask, cubridConfContentListCandidate1, databaseName);
}
if (cubridConfContentListCandidate2 == null) {
cubridConfContentList = cubridConfContentListCandidate1;
} else {
cubridConfContentList = cubridConfContentListCandidate2;
}
}
if (!isCanFinished) {
return Status.CANCEL_STATUS;
}
if (monitor.isCanceled()) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
completeAll();
close();
cancel();
}
});
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
public void cancel() {
super.cancel();
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(server.getServerInfo());
getDatabaseListTask.execute();
boolean isExist = false;
List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
if (databaseInfoList != null) {
for (int i = 0; i < databaseInfoList.size(); i++) {
DatabaseInfo dbInfo = databaseInfoList.get(i);
String dbName = dbInfo.getDbName();
if (dbName.equals(databaseName)) {
isExist = true;
}
}
}
if (isExist) {
CommonUpdateTask deleteTask = new CommonUpdateTask(CommonTaskName.DELETE_DATABASE_TASK_NAME, server.getServerInfo(), CommonSendMsg.getDeletedbSendMsg());
deleteTask.setDbName(databaseName);
deleteTask.setDelbackup(YesNoType.Y);
deleteTask.execute();
}
}
public void done(IJobChangeEvent event) {
if (event.getResult() == Status.OK_STATUS) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
completeAll();
close();
}
});
}
}
};
CheckDirTask checkDirTask = new CheckDirTask(server.getServerInfo());
CheckFileTask checkFileTask = new CheckFileTask(server.getServerInfo());
CreateDbTask createDbTask = new CreateDbTask(server.getServerInfo());
List<String> checkedDirsList = new ArrayList<String>();
List<String> checkedFilesList = new ArrayList<String>();
// add checked directory(general volume path)
addVolumePath(checkedDirsList, generalVolumePath);
String logPageNum = generalInfoPage.getLogPageNum();
String logVolumePath = generalInfoPage.getLogVolumePath();
// add checked directory(log volume path)
addVolumePath(checkedDirsList, logVolumePath);
List<Map<String, String>> volumeList = volumeInfoPage.getVolumeList();
for (int i = 0; i < volumeList.size(); i++) {
Map<String, String> map = volumeList.get(i);
String volumeName = map.get("0");
String volumePath = map.get("4");
// add checked directory(additional volume path)
addVolumePath(checkedDirsList, volumePath);
// add checked file(additional volume)
addVolumePath(checkedFilesList, volumePath + server.getServerInfo().getPathSeparator() + volumeName);
}
String[] dirs = new String[checkedDirsList.size()];
checkDirTask.setDirectory(checkedDirsList.toArray(dirs));
String[] files = new String[checkedFilesList.size()];
checkFileTask.setFile(checkedFilesList.toArray(files));
createDbTask.setDbName(databaseName);
createDbTask.setPageSize(pageSize);
if (logPageSize != null) {
createDbTask.setLogPageSize(logPageSize);
}
if (charset != null) {
createDbTask.setCharset(charset);
}
createDbTask.setNumPage(generalPageNum);
createDbTask.setGeneralVolumePath(generalVolumePath);
createDbTask.setLogSize(logPageNum);
createDbTask.setLogVolumePath(logVolumePath);
createDbTask.setExVolumes(volumeList);
if (!checkedDirsList.isEmpty()) {
taskExcutor.addTask(checkDirTask);
}
if (!checkedFilesList.isEmpty()) {
taskExcutor.addTask(checkFileTask);
}
taskExcutor.addTask(createDbTask);
//add set auto added volume
GetAutoAddVolumeInfo returnInfo = setAutoAddVolumeInfoPage.getAutoAddVolumeInfo();
if (returnInfo != null) {
SetAutoAddVolumeTask setTask = new SetAutoAddVolumeTask(server.getServerInfo());
setTask.setDbname(databaseName);
setTask.setData(returnInfo.getData());
setTask.setDataWarnOutofspace(returnInfo.getData_warn_outofspace());
setTask.setDataExtPage(returnInfo.getData_ext_page());
setTask.setIndex(returnInfo.getIndex());
setTask.setIndexWarnOutofspace(returnInfo.getIndex_warn_outofspace());
setTask.setIndexExtPage(returnInfo.getIndex_ext_page());
taskExcutor.addTask(setTask);
}
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(server.getServerInfo());
taskExcutor.addTask(getCubridConfParameterTask);
SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(server.getServerInfo());
taskExcutor.addTask(setCubridConfParameterTask);
//start database
CommonUpdateTask startDbTask = new CommonUpdateTask(CommonTaskName.START_DB_TASK_NAME, server.getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg());
startDbTask.setDbName(databaseName);
taskExcutor.addTask(startDbTask);
//set dba password
UpdateAddUserTask updateUserTask = new UpdateAddUserTask(server.getServerInfo(), false);
UserSendObj userSendObj = new UserSendObj();
userSendObj.setDbname(databaseName);
userSendObj.setUsername("dba");
String password = setDbaPasswordPage.getPassword();
userSendObj.setUserpass(password);
updateUserTask.setUserSendObj(userSendObj);
taskExcutor.addTask(updateUserTask);
JobFamily jobFamily = new JobFamily();
String serverName = server.getName();
jobFamily.setServerName(serverName);
String jobName = Messages.msgCreateDbrearJobName + " - " + serverName;
taskExcutor.schedule(jobName, jobFamily, true, Job.SHORT);
//the close is in the job
return false;
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class CreateReplicationJobExecutor method createMaster.
/**
* create master database
*
* @param dbName String
* @param monitor IProgressMonitor
* @param taskList List<ITask>
* @return status
*/
private IStatus createMaster(final String dbName, final IProgressMonitor monitor, List<ITask> taskList) {
monitor.subTask(Messages.bind(Messages.createMasterJobName, dbName));
Display display = Display.getDefault();
MonitoringTask monitoringTask = null;
boolean isExecuteSetParaTask = true;
boolean isExecuteStopDbTask = true;
boolean isExecuteStartDbTask = false;
Map<String, Map<String, String>> confParaMaps = null;
MonitorDashboardPreference monPref = new MonitorDashboardPreference();
for (ITask task : taskList) {
if (task instanceof MonitoringTask) {
monitoringTask = (MonitoringTask) task;
ServerInfo serverInfo = monitoringTask.getServerInfo();
CMHostNodePersistManager.getInstance().addServer(serverInfo.getHostAddress(), serverInfo.getHostMonPort(), serverInfo.getUserName(), serverInfo);
monitoringTask.connectServer(Version.releaseVersion, monPref.getHAHeartBeatTimeout());
} else if (task instanceof StopReplServerTask) {
if (isExecuteStopReplServerTask) {
task.execute();
} else {
continue;
}
} else if (task instanceof SetCubridConfParameterTask) {
if (isExecuteSetParaTask) {
SetCubridConfParameterTask setCubridConfParameterTask = (SetCubridConfParameterTask) task;
setCubridConfParameterTask.setConfParameters(confParaMaps);
task.execute();
} else {
continue;
}
} else if (task instanceof CommonUpdateTask && task.getTaskname().equals(CommonTaskName.STOP_DB_TASK_NAME)) {
if (isExecuteStopDbTask) {
task.execute();
} else {
continue;
}
} else if (task instanceof CommonUpdateTask && task.getTaskname().equals(CommonTaskName.START_DB_TASK_NAME)) {
if (isExecuteStartDbTask) {
task.execute();
} else {
continue;
}
} else if (task instanceof GetTransferProgressTask) {
GetTransferProgressTask getTransferProgressTask = (GetTransferProgressTask) task;
monitor.subTask(Messages.transFileJobName);
if (pid != null) {
while (!isCanceled()) {
getTransferProgressTask.setPid(pid);
getTransferProgressTask.execute();
TransFileProgressInfo progressInfo = getTransferProgressTask.getProgressInfo();
if (getTransferProgressTask.isSuccess() && progressInfo != null) {
String transferStatus = progressInfo.getTransferStatus();
String transferNote = progressInfo.getTransferNote();
if (transferStatus != null && transferStatus.equals("success")) {
pid = null;
cancelTransFileTask = null;
break;
} else if (transferStatus != null && transferStatus.equals("failure")) {
pid = null;
cancelTransFileTask = null;
getTransferProgressTask.setErrorMsg(transferNote);
break;
} else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} else {
break;
}
}
}
} else if (task instanceof CancelTransFileTask) {
cancelTransFileTask = (CancelTransFileTask) task;
} else {
task.execute();
}
if (monitor.isCanceled()) {
disConnect(monitoringTask);
return Status.CANCEL_STATUS;
}
final String msg = task.getErrorMsg();
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
disConnect(monitoringTask);
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
}
if (task instanceof GetReplServerStatusTask) {
GetReplServerStatusTask getReplServerStatusTask = (GetReplServerStatusTask) task;
boolean isActive = getReplServerStatusTask.isActive();
if (isActive) {
display.syncExec(new Runnable() {
public void run() {
isExecuteStopReplServerTask = CommonUITool.openConfirmBox(Messages.bind(Messages.msgConfirmStopReplServer, dbName));
}
});
if (!isExecuteStopReplServerTask) {
disConnect(monitoringTask);
return Status.CANCEL_STATUS;
}
}
} else if (task instanceof GetCubridConfParameterTask) {
GetCubridConfParameterTask getCubridConfParameterTask = (GetCubridConfParameterTask) task;
confParaMaps = getCubridConfParameterTask.getConfParameters();
String mdbName = (String) getCubridConfParameterTask.getData("dbName");
Map<String, String> dbMap = confParaMaps.get("[@" + mdbName + "]");
if (dbMap == null) {
Map<String, String> commonMap = confParaMaps.get(ConfConstants.COMMON_SECTION_NAME);
if (commonMap != null && commonMap.get(ConfConstants.REPLICATION) != null && commonMap.get(ConfConstants.REPLICATION).equalsIgnoreCase("yes")) {
isExecuteSetParaTask = false;
} else if (commonMap != null) {
isExecuteSetParaTask = true;
commonMap.put(ConfConstants.REPLICATION, "yes");
}
} else {
String replStr = dbMap.get(ConfConstants.REPLICATION);
if (replStr == null || replStr.equalsIgnoreCase("no")) {
isExecuteSetParaTask = true;
dbMap.put(ConfConstants.REPLICATION, "yes");
} else {
isExecuteSetParaTask = false;
}
}
} else if (task instanceof GetDatabaseListTask) {
GetDatabaseListTask getDatabaseListTask = (GetDatabaseListTask) task;
String mdbName = (String) getDatabaseListTask.getData("dbName");
List<DatabaseInfo> dbInfoList = getDatabaseListTask.loadDatabaseInfo();
for (int i = 0; i < dbInfoList.size(); i++) {
DatabaseInfo dbInfo = dbInfoList.get(i);
if (mdbName.equalsIgnoreCase(dbInfo.getDbName())) {
if (dbInfo.getRunningType() == DbRunningType.CS) {
isExecuteStopDbTask = isExecuteSetParaTask;
}
isExecuteStartDbTask = dbInfo.getRunningType() == DbRunningType.STANDALONE || isExecuteStopDbTask;
break;
}
}
} else if (task instanceof TransFileTask) {
TransFileTask transFileTask = (TransFileTask) task;
pid = transFileTask.getTransFilePid();
}
}
disConnect(monitoringTask);
return Status.OK_STATUS;
}
Aggregations