Search in sources :

Example 1 with EnumTargetConfig

use of com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig in project cubrid-manager by CUBRID.

the class DiagStatusMonitorTemplateDialog method insertTreeObject.

/**
	 * Inserts terms to tree
	 * 
	 */
private void insertTreeObject() {
    TargetConfigMap targetConfigMap = TargetConfigMap.getInstance();
    EnumMap<EnumTargetConfig, TargetConfig> group = targetConfigMap.getMap();
    TreeItem root = new TreeItem(targetTree, SWT.NONE);
    root.setText(STATUS_MONITOR_LST);
    serverInfo = selection.getServer().getServerInfo();
    ServerType serverType = serverInfo.getServerType();
    TargetConfig tc = null;
    if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
        TreeItem db = new TreeItem(root, SWT.NONE);
        db.setText(STATUS_MONITOR_LST_DB);
        TreeItem serverQuery = new TreeItem(db, SWT.NONE);
        serverQuery.setText(targetConfigMap.getQueryCategory());
        TreeItem serverConn = new TreeItem(db, SWT.NONE);
        serverConn.setText(targetConfigMap.getConnCategory());
        TreeItem serverBuffer = new TreeItem(db, SWT.NONE);
        serverBuffer.setText(targetConfigMap.getBufferCategory());
        TreeItem serverLock = new TreeItem(db, SWT.NONE);
        serverLock.setText(targetConfigMap.getLockCategory());
        TreeItem queryOpenedPage = new TreeItem(serverQuery, SWT.NONE);
        TreeItem querySlowQuery = new TreeItem(serverQuery, SWT.NONE);
        TreeItem queryFullScan = new TreeItem(serverQuery, SWT.NONE);
        TreeItem connCliRequest = new TreeItem(serverConn, SWT.NONE);
        TreeItem connAbortedClients = new TreeItem(serverConn, SWT.NONE);
        TreeItem connConnReq = new TreeItem(serverConn, SWT.NONE);
        TreeItem connConnReject = new TreeItem(serverConn, SWT.NONE);
        TreeItem bufferPageWrite = new TreeItem(serverBuffer, SWT.NONE);
        TreeItem bufferPageRead = new TreeItem(serverBuffer, SWT.NONE);
        TreeItem lockDeadlock = new TreeItem(serverLock, SWT.NONE);
        TreeItem lockRequest = new TreeItem(serverLock, SWT.NONE);
        tc = group.get(EnumTargetConfig.SERVER_QUERY_OPENED_PAGE);
        queryOpenedPage.setData(tc);
        queryOpenedPage.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_QUERY_SLOW_QUERY);
        querySlowQuery.setData(tc);
        querySlowQuery.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_QUERY_FULL_SCAN);
        queryFullScan.setData(tc);
        queryFullScan.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_CONN_CLI_REQUEST);
        connCliRequest.setData(tc);
        connCliRequest.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_CONN_ABORTED_CLIENTS);
        connAbortedClients.setData(tc);
        connAbortedClients.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_CONN_CONN_REQ);
        connConnReq.setData(tc);
        connConnReq.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_CONN_CONN_REJ);
        connConnReject.setData(tc);
        connConnReject.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_BUFFER_PAGE_WRITE);
        bufferPageWrite.setData(tc);
        bufferPageWrite.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_BUFFER_PAGE_READ);
        bufferPageRead.setData(tc);
        bufferPageRead.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_LOCK_DEADLOCK);
        lockDeadlock.setData(tc);
        lockDeadlock.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.SERVER_LOCK_REQUEST);
        lockRequest.setData(tc);
        lockRequest.setText(tc.getDisplayName());
        db.setExpanded(true);
    }
    if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
        TreeItem broker = new TreeItem(root, SWT.NONE);
        broker.setText(STATUS_MONITOR_LST_BROKER);
        TreeItem activeSession = new TreeItem(broker, SWT.NONE);
        TreeItem requestSec = new TreeItem(broker, SWT.NONE);
        TreeItem querySec = new TreeItem(broker, SWT.NONE);
        TreeItem transactionSec = new TreeItem(broker, SWT.NONE);
        TreeItem longQuery = new TreeItem(broker, SWT.NONE);
        TreeItem longTran = new TreeItem(broker, SWT.NONE);
        TreeItem errQuery = new TreeItem(broker, SWT.NONE);
        tc = group.get(EnumTargetConfig.CAS_ST_ACTIVE_SESSION);
        activeSession.setData(tc);
        activeSession.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_REQUEST);
        requestSec.setData(tc);
        requestSec.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_QUERY);
        querySec.setData(tc);
        querySec.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_TRANSACTION);
        transactionSec.setData(tc);
        transactionSec.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_LONG_QUERY);
        longQuery.setData(tc);
        longQuery.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_LONG_TRAN);
        longTran.setData(tc);
        longTran.setText(tc.getDisplayName());
        tc = group.get(EnumTargetConfig.CAS_ST_ERROR_QUERY);
        errQuery.setData(tc);
        errQuery.setText(tc.getDisplayName());
        broker.setExpanded(true);
    }
    root.setExpanded(true);
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) TargetConfigMap(com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfigMap) TreeItem(org.eclipse.swt.widgets.TreeItem) EnumTargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig) TargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfig) EnumTargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig)

Example 2 with EnumTargetConfig

use of com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig in project cubrid-manager by CUBRID.

the class DiagStatusMonitorTemplateDialog method init.

/**
	 * Initializes the parameter of this view
	 */
private void init() {
    // Sets the title and message
    if (operation == AddEditType.ADD) {
        setTitle(ADD_TITLE);
        setMessage(ADD_MESSAGE);
        getShell().setText(ADD_TITLE);
        isOkenable[2] = true;
        isOkenable[3] = true;
    } else if (operation == AddEditType.EDIT) {
        setTitle(EDIT_TITLE);
        setMessage(EDIT_MESSAGE);
        getShell().setText(EDIT_TITLE);
        for (int i = 0; i < isOkenable.length; i++) {
            isOkenable[i] = true;
        }
    }
    // Sets contents in controls
    if (null == selection) {
        return;
    }
    StatusTemplateInfo statusTemplateInfo = new StatusTemplateInfo();
    List<String> dbs = null;
    if (CubridNodeType.STATUS_MONITOR_FOLDER.equals(selection.getType())) {
        dbs = selection.getServer().getServerInfo().getAllDatabaseList();
        if (null != targetDbNameCombo) {
            targetDbNameCombo.setItems((String[]) (dbs.toArray(new String[dbs.size()])));
            targetDbNameCombo.setEnabled(false);
        }
        return;
    }
    if (CubridNodeType.STATUS_MONITOR_TEMPLATE.equals(selection.getType())) {
        dbs = selection.getServer().getServerInfo().getAllDatabaseList();
        statusTemplateInfo = (StatusTemplateInfo) selection.getAdapter(StatusTemplateInfo.class);
    }
    if (null != dbs && null != targetDbNameCombo) {
        targetDbNameCombo.setItems((String[]) (dbs.toArray(new String[dbs.size()])));
    }
    String name = statusTemplateInfo.getName();
    nameText.setText(name);
    nameText.setEnabled(false);
    String sampling = statusTemplateInfo.getSampling_term();
    samplingTermscombo.setText(sampling);
    String desc = statusTemplateInfo.getDesc();
    discriptionText.setText(desc);
    if (null != targetDbNameCombo) {
        String dbName = statusTemplateInfo.getDb_name();
        targetDbNameCombo.setText(dbName);
    }
    List<TargetConfigInfo> list = statusTemplateInfo.getTargetConfigInfoList();
    EnumMap<EnumTargetConfig, TargetConfig> group = TargetConfigMap.getInstance().getMap();
    boolean hasServer = false;
    for (TargetConfigInfo tcf : list) {
        for (String[] strings : tcf.getList()) {
            for (Map.Entry<EnumTargetConfig, TargetConfig> entry : group.entrySet()) {
                TargetConfig tc = entry.getValue();
                if (strings[0].equals(tc.getName())) {
                    TableItem newItem = new TableItem(tagetTbl, SWT.NONE);
                    newItem.setText(0, tc.getCategory());
                    newItem.setText(1, tc.getDisplayName());
                    newItem.setData(tc);
                    if (tc.getTopCategory().equals(TargetConfigMap.getInstance().getDbCategory())) {
                        hasServer = true;
                    }
                    break;
                }
            }
        }
    }
    if (null != targetDbNameCombo) {
        if (hasServer) {
            targetDbNameCombo.setEnabled(true);
        } else {
            targetDbNameCombo.setEnabled(false);
        }
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) EnumTargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig) TargetConfigInfo(com.cubrid.cubridmanager.core.monitoring.model.TargetConfigInfo) TargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfig) EnumTargetConfig(com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig) StatusTemplateInfo(com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfo) TargetConfigMap(com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfigMap) Map(java.util.Map) EnumMap(java.util.EnumMap)

Aggregations

EnumTargetConfig (com.cubrid.cubridmanager.ui.monitoring.editor.EnumTargetConfig)2 TargetConfig (com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfig)2 TargetConfigMap (com.cubrid.cubridmanager.ui.monitoring.editor.TargetConfigMap)2 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1 StatusTemplateInfo (com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfo)1 TargetConfigInfo (com.cubrid.cubridmanager.core.monitoring.model.TargetConfigInfo)1 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1 TableItem (org.eclipse.swt.widgets.TableItem)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1