Search in sources :

Example 6 with CommonQueryTask

use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.

the class BackupErrLogDialog method loadData.

/**
	 * load the data
	 * 
	 * @param shell Shell
	 * @return boolean
	 */
public boolean loadData(Shell shell) {
    CommonQueryTask<BackUpErrorLogList> task = new CommonQueryTask<BackUpErrorLogList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonSimpleSendMsg(), new BackUpErrorLogList());
    connect(-1, new SocketTask[] { task }, true, shell);
    if (task.getErrorMsg() != null) {
        return false;
    }
    List<BackUpErrorLog> allErrLogList = task.getResultModel().getErrorLogList();
    if (allErrLogList != null) {
        for (BackUpErrorLog backUpErrorLog : allErrLogList) {
            if (backUpErrorLog.getDbname().equals(database.getName())) {
                errorLogList.addError(backUpErrorLog);
            }
        }
    }
    return true;
}
Also used : CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) BackUpErrorLogList(com.cubrid.cubridmanager.core.cubrid.jobauto.model.errlog.BackUpErrorLogList) BackUpErrorLog(com.cubrid.cubridmanager.core.cubrid.jobauto.model.errlog.BackUpErrorLog)

Example 7 with CommonQueryTask

use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.

the class GetDbSpaceInfoTaskTest method testNotExistDb.

public void testNotExistDb() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
    task.setDbName("notexistdb");
    task.setUsingSpecialDelimiter(false);
    task.execute();
    assertFalse(task.isSuccess());
    DbSpaceInfoList bean = task.getResultModel();
    assertNotNull(task.getErrorMsg());
    assertEquals("{\"dbname\":\"notexistdb\",\"freespace\":\"0\",\"pagesize\":\"-1\",\"spaceInfoMap\":{},\"spaceinfo\":\"\",\"taskName\":\"dbspaceinfo\"}", JsonObjectUtil.object2json(bean));
// I expect failure result perfectly. But, fragment result attributes are exists. This may be the cmserver bug.
}
Also used : DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 8 with CommonQueryTask

use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.

the class GetDbSpaceInfoTaskTest method testExistDb.

public void testExistDb() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
    task.setDbName("demodb");
    task.setUsingSpecialDelimiter(false);
    task.execute();
    assertTrue(task.isSuccess());
    DbSpaceInfoList bean = task.getResultModel();
    assertNull(task.getErrorMsg());
    assertEquals(true, bean.getSpaceinfo().size() > 0);
    assertEquals("{\"dbname\":\"demodb\",\"freespace\":\"15216\",\"pagesize\":\"4096\",\"spaceInfoMap\":{\"\":{\"date\":\"\",\"freepage\":\"0\",\"location\":\"\",\"spacename\":\"\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"0\",\"type\":\"\",\"volumeCount\":\"1\"},\"ACTIVE_LOG\":{\"date\":\"20090703\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"Active_log\",\"volumeCount\":\"1\"},\"ARCHIVE_LOG\":{\"date\":\"20090620\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"4839\",\"type\":\"Archive_log\",\"volumeCount\":\"3\"},\"DATA\":{\"date\":\"20090702\",\"freepage\":\"2020\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"DATA\",\"volumeCount\":\"1\"},\"GENERIC\":{\"date\":\"20090703\",\"freepage\":\"1836\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"GENERIC\",\"volumeCount\":\"1\"}},\"spaceinfo\":[{\"date\":\"20090703\",\"freepage\":\"1836\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"GENERIC\",\"volumeCount\":\"0\"},{\"date\":\"20090702\",\"freepage\":\"2020\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb_data_x001\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"DATA\",\"volumeCount\":\"0\"},{\"date\":\"20090620\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb_lgar001\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2188\",\"type\":\"Archive_log\",\"volumeCount\":\"0\"},{\"date\":\"20090703\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb_lgat\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"Active_log\",\"volumeCount\":\"0\"},{\"date\":\"20090626\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb_lgar002\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"91\",\"type\":\"Archive_log\",\"volumeCount\":\"0\"},{\"date\":\"20090614\",\"freepage\":\"0\",\"location\":\"\\/opt\\/frameworks\\/cubrid2\\/databases\\/demodb\",\"spacename\":\"demodb_lgar000\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"2560\",\"type\":\"Archive_log\",\"volumeCount\":\"0\"},{\"date\":\"\",\"freepage\":\"0\",\"location\":\"\",\"spacename\":\"Total\",\"totalPageStr\":\"\",\"totalSizeStr\":\"\",\"totalpage\":\"0\",\"type\":\"\",\"volumeCount\":\"0\"}],\"taskName\":\"dbspaceinfo\"}", JsonObjectUtil.object2json(bean));
}
Also used : DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 9 with CommonQueryTask

use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.

the class AddAndDelStatusTemplateTaskTest method testExec2.

public void testExec2() {
    StatusTemplateInfo info = new StatusTemplateInfo();
    info.setDb_name(testDbName);
    info.setDesc("testStatus");
    info.setName("newStatus");
    TargetConfigInfo targetConfigInfo = new TargetConfigInfo();
    targetConfigInfo.setCas_st_long_tran(new String[] { "aaa", "dd", "dd" });
    info.addTarget_config(targetConfigInfo);
    info.setSampling_term("1");
    AddStatusTemplateTask task = new AddStatusTemplateTask(serverInfo);
    task.setStatusTemplateInfo(info);
    task.buildMsg();
    task.execute();
    assertNull(task.getErrorMsg());
    StatusTemplateInfos bean = new StatusTemplateInfos();
    final CommonQueryTask<StatusTemplateInfos> showTask = new CommonQueryTask<StatusTemplateInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), bean);
    showTask.execute();
    bean.getStatusTemplateInfoList();
    assertEquals(bean.getTaskName(), "getstatustemplate");
    DelStatusTemplateTask delTsk = new DelStatusTemplateTask(serverInfo);
    delTsk.setTemplateName("newStatus");
    delTsk.execute();
    assertNull(delTsk.getErrorMsg());
}
Also used : StatusTemplateInfo(com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfo) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) StatusTemplateInfos(com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfos) TargetConfigInfo(com.cubrid.cubridmanager.core.monitoring.model.TargetConfigInfo)

Example 10 with CommonQueryTask

use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.

the class DeleteDatabaseAction method run.

public void run() {
    Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        setEnabled(false);
        return;
    }
    ISelectionProvider provider = this.getSelectionProvider();
    if (!(provider instanceof TreeViewer)) {
        return;
    }
    ISchemaNode node = (ISchemaNode) obj[0];
    CubridDatabase database = node.getDatabase();
    if (database == null) {
        CommonUITool.openErrorBox(getShell(), Messages.msgSelectDB);
        return;
    }
    CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
    task.setDbName(database.getName());
    TaskExecutor taskExcutor = new CommonTaskExec(Messages.getDbSpaceInfoTaskName);
    taskExcutor.addTask(task);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (!taskExcutor.isSuccess()) {
        return;
    }
    DeleteDatabaseDialog dlg = new DeleteDatabaseDialog(getShell());
    dlg.setDbSpaceInfo(task.getResultModel());
    dlg.setDatabase(database);
    ICubridNode parent = database.getParent();
    if (dlg.open() == DeleteDatabaseDialog.DELETE_ID) {
        boolean isContinue = DatabaseUtils.processDatabaseDeleted(database);
        if (isContinue) {
            TreeViewer viewer = (TreeViewer) provider;
            parent.removeChild(database);
            viewer.remove(parent, obj);
            viewer.setSelection(new StructuredSelection(parent));
        }
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) DeleteDatabaseDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.DeleteDatabaseDialog) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Aggregations

CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)60 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)19 ITask (com.cubrid.common.core.task.ITask)14 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)12 IStatus (org.eclipse.core.runtime.IStatus)12 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)11 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)11 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)11 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)8 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)7 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)7 CommonTaskJobExec (com.cubrid.common.ui.spi.progress.CommonTaskJobExec)7 ArrayList (java.util.ArrayList)7 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)6 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)6 ITaskExecutorInterceptor (com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor)6 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)6 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)6 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)5 GetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)5