use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class SettingCubridHAConfPage method loadServerData.
private void loadServerData(HAServer haServer) {
CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getCubridConfTaskRunning);
GetHAConfParameterTask getCubridConfParameterTask = new GetHAConfParameterTask(haServer.getServer().getServerInfo());
taskExcutor.addTask(getCubridConfParameterTask);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
Map<String, Map<String, String>> haConfigMap = getCubridConfParameterTask.getConfParameters();
haServer.setOrigincCubridHAParameters(haConfigMap);
haServer.setCubridHAParameters(getConfigHAWizard().cloneParameters(haConfigMap));
appendDefaultHAConfig(haServer.getCubridHAParameters());
} else {
CommonUITool.openErrorBox(Messages.errLoadCubridHAConf);
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class EditBackupPlanDialog method okPressed.
/**
* When press ok button,call it
*/
public void okPressed() {
// Gets the data of dialog
int intLever = leverCombo.getSelectionIndex();
if (intLever == 1 && !CommonUITool.openConfirmBox(Messages.msgLevelOneWarning)) {
return;
}
if (intLever == 2 && !CommonUITool.openConfirmBox(Messages.msgLevelTwoWarning)) {
return;
}
String newBackupid = idText.getText().trim();
String newPath = pathText.getText().trim();
String newPeriodType = periodGroup.getTextOfTypeCombo();
String newPeriodDate = periodGroup.getDetailValue();
String newTime = periodGroup.getTime();
String newLever = Integer.toString(intLever);
OnOffType newArchivedel = deleteButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
OnOffType newUpdatestatus = updateButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
String bkNum = null;
OnOffType newStroreold = null;
if (isBkNumSupports) {
newStroreold = OnOffType.OFF;
bkNum = String.valueOf(numKeepBackups.getSelection());
if (StringUtil.isEmpty(bkNum)) {
bkNum = "0";
}
} else {
newStroreold = storeButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
bkNum = "0";
}
OnOffType newOnoff = onlineButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
YesNoType newZip = useCompressButton.getSelection() ? YesNoType.Y : YesNoType.N;
YesNoType newCheck = checkingButton.getSelection() ? YesNoType.Y : YesNoType.N;
String newMt = Integer.valueOf(numThreadspinner.getSelection()).toString();
// Sets the object of backupPlanInfo
backupPlanInfo.setBackupid(newBackupid);
backupPlanInfo.setPath(newPath);
backupPlanInfo.setPeriod_type(newPeriodType);
backupPlanInfo.setPeriod_date(newPeriodDate);
backupPlanInfo.setTime(newTime);
backupPlanInfo.setLevel(newLever);
backupPlanInfo.setArchivedel(newArchivedel.getText());
backupPlanInfo.setUpdatestatus(newUpdatestatus.getText());
backupPlanInfo.setStoreold(newStroreold.getText());
backupPlanInfo.setOnoff(newOnoff.getText());
backupPlanInfo.setZip(newZip.getText());
backupPlanInfo.setCheck(newCheck.getText());
backupPlanInfo.setMt(newMt);
backupPlanInfo.setBknum(bkNum);
// Executes the task
ServerInfo serverInfo = database.getServer().getServerInfo();
BackupPlanTask backupPlanTask = new BackupPlanTask(opBackupInfo, serverInfo);
backupPlanTask.setDbname(database.getName());
backupPlanTask.setBackupid(newBackupid);
backupPlanTask.setPath(newPath);
backupPlanTask.setPeriodType(newPeriodType);
backupPlanTask.setPeriodDate(newPeriodDate);
backupPlanTask.setTime(newTime);
backupPlanTask.setLevel(newLever);
backupPlanTask.setArchivedel(newArchivedel);
backupPlanTask.setUpdatestatus(newUpdatestatus);
backupPlanTask.setStoreold(newStroreold);
backupPlanTask.setOnoff(newOnoff);
backupPlanTask.setZip(newZip);
backupPlanTask.setCheck(newCheck);
backupPlanTask.setMt(newMt);
backupPlanTask.setBknum(bkNum);
String taskName = Messages.bind(Messages.editBackupPlanTaskName, newBackupid);
TaskExecutor taskExecutor = new CommonTaskExec(taskName);
taskExecutor.addTask(backupPlanTask);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
super.okPressed();
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class AnalyzeSqlLogAction method run.
/**
* Open dialog
*/
public void run() {
Object[] obj = this.getSelectedObj();
DefaultCubridNode node = null;
LogInfo logInfo = null;
node = (DefaultCubridNode) obj[0];
logInfo = (LogInfo) node.getAdapter(LogInfo.class);
SqlLogFileListDialog cASLogTopConfigDialog = new SqlLogFileListDialog(getShell());
List<String> targetStringList = new ArrayList<String>();
if (logInfo == null) {
for (int j = 0, m = node.getChildren().size(); j < m; j++) {
targetStringList.add(((LogInfo) node.getChildren().get(j).getAdapter(LogInfo.class)).getPath());
}
} else {
targetStringList.add(logInfo.getPath());
}
cASLogTopConfigDialog.create();
cASLogTopConfigDialog.setInfo(targetStringList);
int returnCode = cASLogTopConfigDialog.open();
if (returnCode == SqlLogFileListDialog.OK) {
String optionT;
final GetAnalyzeCasLogTask task = new GetAnalyzeCasLogTask(node.getServer().getServerInfo());
if (cASLogTopConfigDialog.isOption()) {
optionT = "yes";
} else {
optionT = "no";
}
List<String> selectedStringList = cASLogTopConfigDialog.getSelectedStringList();
String[] path = new String[selectedStringList.size()];
selectedStringList.toArray(path);
task.setLogFiles(path);
task.setOptionT(optionT);
TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
if (!taskExcutor.isSuccess()) {
return;
}
AnalyzeCasLogResultList analyzeCasLogResultList = (AnalyzeCasLogResultList) task.getAnalyzeCasLogResultList();
SqlLogAnalyzeResultDialog activityCASLogPathDialog = new SqlLogAnalyzeResultDialog(getShell());
activityCASLogPathDialog.setOption(cASLogTopConfigDialog.isOption());
activityCASLogPathDialog.setNode(node);
activityCASLogPathDialog.setResultFile(analyzeCasLogResultList.getResultfile());
activityCASLogPathDialog.setAnalyzeCasLogResultList(analyzeCasLogResultList);
activityCASLogPathDialog.create();
activityCASLogPathDialog.setLabel(selectedStringList);
activityCASLogPathDialog.insertArrayToTable(analyzeCasLogResultList);
activityCASLogPathDialog.open();
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class ExecuteSqlLogAction method run.
/**
* Open dialog
*/
public void run() {
Object[] obj = this.getSelectedObj();
DefaultCubridNode node = null;
LogInfo logInfo = null;
node = (DefaultCubridNode) obj[0];
String targetBroker = node.getParent().getParent().getLabel();
logInfo = (LogInfo) node.getAdapter(LogInfo.class);
List<String> allDatabaseList = node.getServer().getServerInfo().getAllDatabaseList();
BrokerInfos brokerInfos = node.getServer().getServerInfo().getBrokerInfos();
CasRunnerConfigDialog casRunnerConfigDialog = new CasRunnerConfigDialog(getShell());
casRunnerConfigDialog.setBrokerInfos(brokerInfos);
casRunnerConfigDialog.setAllDatabaseList(allDatabaseList);
casRunnerConfigDialog.setLogInfo(logInfo);
casRunnerConfigDialog.setTargetBroker(targetBroker);
casRunnerConfigDialog.setExecwithFile(true);
casRunnerConfigDialog.create();
if (casRunnerConfigDialog.open() == Dialog.OK) {
final GetExecuteCasRunnerResultTask task = new GetExecuteCasRunnerResultTask(((DefaultCubridNode) obj[0]).getServer().getServerInfo());
task.setBrokerName(CasRunnerConfigDialog.getBrokerName());
task.setUserName(CasRunnerConfigDialog.getUserName());
task.setPasswd(CasRunnerConfigDialog.getPassword());
task.setNumThread(CasRunnerConfigDialog.getNumThread());
task.setRepeatCount(casRunnerConfigDialog.getNumRepeatCount());
String isShowqueryresult = "";
if (casRunnerConfigDialog.isShowqueryresult()) {
isShowqueryresult = "yes";
} else {
isShowqueryresult = "no";
}
task.setShowQueryResult(isShowqueryresult);
String isShowqueryplan = "";
if (casRunnerConfigDialog.isShowqueryplan()) {
isShowqueryplan = "yes";
} else {
isShowqueryplan = "no";
}
task.setShowQueryResult(isShowqueryplan);
task.setDbName(CasRunnerConfigDialog.getDbname());
task.setExecuteLogFile("yes");
task.setLogFile(logInfo.getPath());
TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadSqlLogExecResultTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
if (!taskExcutor.isSuccess()) {
return;
}
GetExecuteCasRunnerResultInfo getExecuteCasRunnerResultInfo = (GetExecuteCasRunnerResultInfo) task.getContent();
StringBuffer result = new StringBuffer("");
if (getExecuteCasRunnerResultInfo.getResult() != null) {
for (int i = 0, n = getExecuteCasRunnerResultInfo.getResult().size(); i < n; i++) {
result.append(getExecuteCasRunnerResultInfo.getResult().get(i) + "\n");
}
}
CasRunnerResultDialog casRunnerResultDialog = new CasRunnerResultDialog(getShell());
casRunnerResultDialog.setResult(result);
casRunnerResultDialog.open();
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class CasRunnerResultViewDialog method connectInit.
/**
* initialize log view table.
*
* @param logPath String
* @param dbName String
* @param node DefaultCubridNode
*/
public void connectInit(String logPath, String dbName, DefaultCubridNode node) {
this.selection = node;
final GetLogListTask taskGetLog = new GetLogListTask(node.getServer().getServerInfo());
path = logPath;
this.dbName = dbName;
taskGetLog.setPath(path + "." + String.valueOf(currentResultFileIndex - 1));
taskGetLog.setDbName(dbName);
taskGetLog.setStart("1");
taskGetLog.setEnd(Long.toString(LINE_NUM_TO_DISPLAY));
TaskExecutor taskExecutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExecutor.addTask(taskGetLog);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
LogContentInfo logContentInfo = (LogContentInfo) taskGetLog.getLogContent();
this.setinfo(logContentInfo, selection);
}
}
Aggregations