use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method connect.
/**
* each page of log connect
*
* @param qindex String
* @param queryString StringBuffer
* @return queryString
*/
public StringBuilder connect(String qindex, StringBuilder queryString) {
final GetCasLogTopResultTask task = new GetCasLogTopResultTask(node.getServer().getServerInfo());
task.setFileName(resultFile);
task.setQindex(qindex);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess() && task.getAnalyzeCasLogTopResultList() != null) {
AnalyzeCasLogTopResultInfo resultInfo = (AnalyzeCasLogTopResultInfo) task.getAnalyzeCasLogTopResultList();
if (resultInfo != null && resultInfo.getLogString() != null) {
for (String logString : resultInfo.getLogString()) {
queryString.append(logString + "\n");
}
}
}
return queryString;
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method createGroupQuery.
/**
* This method initializes groupQuery
*/
private void createGroupQuery() {
GridData gridData22 = new GridData(GridData.FILL_HORIZONTAL);
gridData22.heightHint = 26;
gridData22.widthHint = 122;
GridData gridData21 = new GridData(GridData.FILL_BOTH);
gridData21.horizontalSpan = 3;
gridData21.widthHint = 432;
gridData21.heightHint = 150;
GridData gridData11 = new GridData(GridData.FILL_BOTH);
gridData11.horizontalSpan = 3;
gridData11.widthHint = 432;
gridData11.heightHint = 250;
GridLayout gridLayout2 = new GridLayout();
gridLayout2.numColumns = 3;
gridLayout2.horizontalSpacing = 45;
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.verticalSpan = 2;
Group groupQuery = new Group(composite, SWT.NONE);
groupQuery.setText("");
groupQuery.setLayout(gridLayout2);
groupQuery.setLayoutData(gridData);
Label label1 = new Label(groupQuery, SWT.NONE);
label1.setText(Messages.labelLogContents);
textQuery = new Text(groupQuery, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
textQuery.setEditable(true);
textQuery.setLayoutData(gridData11);
Label label2 = new Label(groupQuery, SWT.NONE);
label2.setText(Messages.labelExecuteResult);
textQueryResult = new Text(groupQuery, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
textQueryResult.setLayoutData(gridData21);
buttonRunOriginalQuery = new Button(groupQuery, SWT.NONE);
buttonRunOriginalQuery.setEnabled(false);
buttonRunOriginalQuery.setText(Messages.buttonExecuteOriginalQuery);
Label dummy5 = new Label(groupQuery, SWT.NONE);
dummy5.setLayoutData(gridData22);
buttonRunOriginalQuery.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String queryString = textQuery.getText();
LogInfo logInfo = null;
String targetBroker = null;
if (node.getId().indexOf("Sql log/") < 0) {
targetBroker = node.getParent().getLabel();
} else {
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.setLogstring(queryString);
casRunnerConfigDialog.setBrokerInfos(brokerInfos);
casRunnerConfigDialog.setAllDatabaseList(allDatabaseList);
casRunnerConfigDialog.setLogInfo(logInfo);
casRunnerConfigDialog.setTargetBroker(targetBroker);
casRunnerConfigDialog.create();
if (casRunnerConfigDialog.open() == Dialog.OK) {
final GetExecuteCasRunnerContentResultTask task = new GetExecuteCasRunnerContentResultTask(node.getServer().getServerInfo());
task.setBrokerName(CasRunnerConfigDialog.getBrokerName());
task.setUserName(CasRunnerConfigDialog.getUserName());
task.setPasswd(CasRunnerConfigDialog.getPassword());
task.setNumThread(CasRunnerConfigDialog.getNumThread());
task.setRepeatCount(casRunnerConfigDialog.getNumRepeatCount());
String isShowqueryresult = "";
String isShowqueryplan = "";
if (casRunnerConfigDialog.isShowqueryresult()) {
isShowqueryresult = "yes";
isShowqueryplan = casRunnerConfigDialog.isShowqueryresult() ? "yes" : "no";
} else {
isShowqueryresult = "no";
isShowqueryplan = "no";
}
task.setShowQueryResult(isShowqueryresult);
task.setShowQueryResult(isShowqueryplan);
task.setDbName(CasRunnerConfigDialog.getDbname());
task.setExecuteLogFile("no");
String[] queryStringArr = queryString.split("\\r\\n");
task.setLogstring(queryStringArr);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.loadSqlLogExecResultTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
GetExecuteCasRunnerResultInfo getExecuteCasRunnerResultInfo = (GetExecuteCasRunnerResultInfo) task.getContent();
StringBuffer result = new StringBuffer("");
for (int i = 0, n = getExecuteCasRunnerResultInfo.getResult().size(); i < n; i++) {
result.append(getExecuteCasRunnerResultInfo.getResult().get(i) + "\n");
}
String logPath = null;
String totalResultNum = null;
logPath = getExecuteCasRunnerResultInfo.getQueryResultFile();
totalResultNum = getExecuteCasRunnerResultInfo.getQueryResultFileNum();
if (queryString.length() > 0) {
textQueryResult.setText(result.toString());
if (casRunnerConfigDialog.isShowqueryresult()) {
CasRunnerResultViewDialog casRunnerResultViewDialog = new CasRunnerResultViewDialog(getShell());
casRunnerResultViewDialog.create();
casRunnerResultViewDialog.connectInit(logPath, CasRunnerConfigDialog.getDbname(), node);
casRunnerResultViewDialog.setTotalResultNum(Integer.parseInt(totalResultNum));
casRunnerResultViewDialog.getShell().setSize(665, 555);
casRunnerResultViewDialog.open();
}
}
}
}
}
});
buttonSaveToFile = new Button(groupQuery, SWT.NONE);
buttonSaveToFile.setEnabled(false);
buttonSaveToFile.setText(Messages.buttonSaveLogString);
buttonSaveToFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String savedFilename = saveAsFile();
if (isBlank(savedFilename)) {
return;
}
if (analyzeCasLogResultList == null || analyzeCasLogResultList.getLogFileInfoList() == null) {
return;
}
AnalyzeCasLogResultInfo analyzeCasLogResultInfo = (AnalyzeCasLogResultInfo) (analyzeCasLogResultList.getLogFileInfoList().get(currentResultIndex));
if (savedFilename.length() > 0) {
analyzeCasLogResultInfo.setSavedFileName(savedFilename);
}
}
});
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class HARoleChangeAction method run.
/**
* HA role change.
*/
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
TaskExecutor taskExcutor = new CommonTaskExec(Messages.changeRoleTaskName);
HostMonitorPart hostPart = (HostMonitorPart) obj[0];
//deactive data gather first.
hostPart.stopMonitorGather();
//role change task execution.
HARoleChangeTask task = new HARoleChangeTask(((HostNode) hostPart.getModel()).getServerInfo());
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
hostPart.startMonitorGather();
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class ConfigParaHelp method performImportCmConf.
/**
* Perform the import task for cm.conf
*
* @param serverInfo the CubridServer
* @param confParamList the List<String>
*/
public static void performImportCmConf(ServerInfo serverInfo, List<String> confParamList) {
CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCMParameterTaskName);
SetCMConfParameterTask task = new SetCMConfParameterTask(serverInfo);
task.setConfContents(confParamList);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeCMParaSuccess);
}
}
use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.
the class ConfigParaHelp method performImportHAConf.
/**
* Perform the import task for ha.conf
*
* @param serverInfo the CubridServer
* @param confParamList the List<String>
*/
public static void performImportHAConf(ServerInfo serverInfo, List<String> confParamList) {
CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setHAConfTaskName);
SetHAConfParameterTask task = new SetHAConfParameterTask(serverInfo);
task.setConfContents(confParamList);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgSetHAConfSuccess);
}
}
Aggregations