Search in sources :

Example 1 with DbRunningType

use of com.cubrid.cubridmanager.core.common.model.DbRunningType in project cubrid-manager by CUBRID.

the class SetupEnvTestCase method setupDatabaseInfo.

/**
	 * Setup database 8.4.0
	 *
	 */
private void setupDatabaseInfo() {
    serverInfo = new ServerInfo();
    serverInfo.setHostAddress(host);
    serverInfo.setHostMonPort(monport);
    serverInfo.setHostJSPort(jpport);
    serverInfo.setUserName(userName);
    serverInfo.setUserPassword(passwd);
    serverInfo.setJdbcDriverVersion(serverVersion);
    ServerManager.getInstance().addServer(host, monport, userName, serverInfo);
    MonitoringTask monTask = new MonitoringTask(serverInfo);
    serverInfo = monTask.connectServer(serverVersion, 1000);
    // get the latest token
    token = serverInfo.getHostToken();
    //get evnInfo
    if (envInfo == null) {
        GetEnvInfoTask envTask = new GetEnvInfoTask(serverInfo);
        envTask.loadEnvInfo();
        envTask.execute();
        envInfo = envTask.loadEnvInfo();
        serverInfo.setEnvInfo(envInfo);
    }
    assertNotNull(envInfo);
    serverPath = envInfo.getRootDir();
    dbRootDir = envInfo.getDatabaseDir();
    //get server type
    GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
    getCMConfParameterTask.execute();
    assertEquals(null, getCMConfParameterTask.getErrorMsg());
    Map<String, String> confParameters = getCMConfParameterTask.getConfParameters();
    ServerType serverType = ServerType.BOTH;
    if (confParameters != null) {
        String target = confParameters.get(ConfConstants.CM_TARGET);
        if (target != null) {
            if (target.indexOf("broker") >= 0 && target.indexOf("server") >= 0) {
                serverType = ServerType.BOTH;
            } else if (target.indexOf("broker") >= 0) {
                serverType = ServerType.BROKER;
            } else if (target.indexOf("server") >= 0) {
                serverType = ServerType.DATABASE;
            }
        }
    }
    if (serverInfo != null) {
        serverInfo.setServerType(serverType);
    }
    //Get database list task
    if (serverType == ServerType.DATABASE || serverType == ServerType.BOTH) {
        final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
        getDatabaseListTask.execute();
        assertEquals(null, getDatabaseListTask.getErrorMsg());
        List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
        for (DatabaseInfo dbInfo : databaseInfoList) {
            if (dbInfo.getDbName().equals(testDbName)) {
                databaseInfo = dbInfo;
                break;
            }
        }
        if (databaseInfo == null) {
            return;
        }
    }
    //get CubridManager user list task
    GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo);
    getUserInfoTask.execute();
    assertEquals(null, getUserInfoTask.getErrorMsg());
    List<ServerUserInfo> serverUserInfoList = getUserInfoTask.getServerUserInfoList();
    for (int i = 0; serverUserInfoList != null && i < serverUserInfoList.size(); i++) {
        ServerUserInfo userInfo = serverUserInfoList.get(i);
        if (userInfo != null && userInfo.getUserName().equals(serverInfo.getUserName())) {
            serverInfo.setLoginedUserInfo(userInfo);
            break;
        }
    }
    List<DatabaseInfo> databaseInfoList = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
    String dbDir = databaseInfo.getDbDir();
    DbRunningType type = databaseInfo.getRunningType();
    for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
        if (testDbName.equalsIgnoreCase(databaseInfoList.get(i).getDbName())) {
            databaseInfo = databaseInfoList.get(i);
            databaseInfo.setDbDir(dbDir);
            databaseInfo.setBrokerIP(host);
            databaseInfo.setBrokerPort(port);
            databaseInfo.setCharSet(charset);
            databaseInfo.setRunningType(type);
            break;
        }
    }
    //get CUBRID conf parameter
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
    getCubridConfParameterTask.execute();
    assertEquals(null, getCubridConfParameterTask.getErrorMsg());
    Map<String, Map<String, String>> confParas = getCubridConfParameterTask.getConfParameters();
    if (serverInfo != null) {
        serverInfo.setCubridConfParaMap(confParas);
    }
    //get broker Info
    GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
    getBrokerConfParameterTask.execute();
    assertEquals(null, getBrokerConfParameterTask.getErrorMsg());
    confParas = getBrokerConfParameterTask.getConfParameters();
    if (serverInfo != null) {
        serverInfo.setBrokerConfParaMap(confParas);
    }
    //Set JDBC driver
    String filePath = this.getFilePathInPlugin("/lib/JDBC-8.3.0.1004-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo.setJdbcDriverVersion(version);
        }
    }
    filePath = this.getFilePathInPlugin("/lib/JDBC-8.3.1.0173-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo.setJdbcDriverVersion(version);
        }
    }
    filePath = this.getFilePathInPlugin("/lib/JDBC-8.4.0.0196-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo.setJdbcDriverVersion(version);
        }
    }
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) GetCMUserListTask(com.cubrid.cubridmanager.core.common.task.GetCMUserListTask) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetEnvInfoTask(com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask) GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) MonitoringTask(com.cubrid.cubridmanager.core.common.task.MonitoringTask) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with DbRunningType

use of com.cubrid.cubridmanager.core.common.model.DbRunningType in project cubrid-manager by CUBRID.

the class SetupEnvTestCase method setupDatabaseInfo930.

/**
	 * Setup database 9.3.0
	 *
	 */
private void setupDatabaseInfo930() throws Exception {
    serverInfo930 = new ServerInfo();
    serverInfo930.setHostAddress(host930);
    serverInfo930.setHostMonPort(monport930);
    serverInfo930.setHostJSPort(jpport930);
    serverInfo930.setUserName(userName930);
    serverInfo930.setUserPassword(passwd930);
    serverInfo930.setJdbcDriverVersion(serverVersion930);
    ServerManager.getInstance().addServer(host930, monport930, userName930, serverInfo930);
    MonitoringTask monTask = new MonitoringTask(serverInfo930);
    serverInfo930 = monTask.connectServer(serverVersion930, 1000);
    // get the latest token
    token930 = serverInfo930.getHostToken();
    //get evnInfo
    if (envInfo930 == null) {
        GetEnvInfoTask envTask = new GetEnvInfoTask(serverInfo930);
        envTask.loadEnvInfo();
        envTask.execute();
        envInfo930 = envTask.loadEnvInfo();
        serverInfo930.setEnvInfo(envInfo930);
    }
    assertNotNull(envInfo930);
    serverPath930 = envInfo930.getRootDir();
    dbRootDir930 = envInfo930.getDatabaseDir();
    //get server type
    GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo930);
    getCMConfParameterTask.execute();
    assertEquals(null, getCMConfParameterTask.getErrorMsg());
    Map<String, String> confParameters = getCMConfParameterTask.getConfParameters();
    ServerType serverType = ServerType.BOTH;
    if (confParameters != null) {
        String target = confParameters.get(ConfConstants.CM_TARGET);
        if (target != null) {
            if (target.indexOf("broker") >= 0 && target.indexOf("server") >= 0) {
                serverType = ServerType.BOTH;
            } else if (target.indexOf("broker") >= 0) {
                serverType = ServerType.BROKER;
            } else if (target.indexOf("server") >= 0) {
                serverType = ServerType.DATABASE;
            }
        }
    }
    if (serverInfo930 != null) {
        serverInfo930.setServerType(serverType);
    }
    //Get database list task
    if (serverType == ServerType.DATABASE || serverType == ServerType.BOTH) {
        final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo930);
        getDatabaseListTask.execute();
        assertEquals(null, getDatabaseListTask.getErrorMsg());
        List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
        for (DatabaseInfo dbInfo : databaseInfoList) {
            if (dbInfo.getDbName().equals(testDbName930)) {
                databaseInfo930 = dbInfo;
                break;
            }
        }
        if (databaseInfo930 == null) {
            return;
        }
    }
    //get CubridManager user list task
    GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo930);
    getUserInfoTask.execute();
    assertEquals(null, getUserInfoTask.getErrorMsg());
    List<ServerUserInfo> serverUserInfoList = getUserInfoTask.getServerUserInfoList();
    for (int i = 0; serverUserInfoList != null && i < serverUserInfoList.size(); i++) {
        ServerUserInfo userInfo = serverUserInfoList.get(i);
        if (userInfo != null && userInfo.getUserName().equals(serverInfo930.getUserName())) {
            serverInfo930.setLoginedUserInfo(userInfo);
            break;
        }
    }
    List<DatabaseInfo> databaseInfoList = serverInfo930.getLoginedUserInfo().getDatabaseInfoList();
    String dbDir = databaseInfo930.getDbDir();
    DbRunningType type = databaseInfo930.getRunningType();
    for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
        if (testDbName930.equalsIgnoreCase(databaseInfoList.get(i).getDbName())) {
            databaseInfo930 = databaseInfoList.get(i);
            databaseInfo930.setDbDir(dbDir);
            databaseInfo930.setBrokerIP(host930);
            databaseInfo930.setBrokerPort(port930);
            databaseInfo930.setCharSet(charset930);
            databaseInfo930.setRunningType(type);
            break;
        }
    }
    //get CUBRID conf parameter
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo930);
    getCubridConfParameterTask.execute();
    assertEquals(null, getCubridConfParameterTask.getErrorMsg());
    Map<String, Map<String, String>> confParas = getCubridConfParameterTask.getConfParameters();
    if (serverInfo930 != null) {
        serverInfo930.setCubridConfParaMap(confParas);
    }
    //get broker Info
    GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo930);
    getBrokerConfParameterTask.execute();
    assertEquals(null, getBrokerConfParameterTask.getErrorMsg());
    confParas = getBrokerConfParameterTask.getConfParameters();
    if (serverInfo930 != null) {
        serverInfo930.setBrokerConfParaMap(confParas);
    }
    //Set JDBC driver
    String filePath = this.getFilePathInPlugin("/lib/JDBC-9.2.0.0155-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo930.setJdbcDriverVersion(version);
        }
    }
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) GetCMUserListTask(com.cubrid.cubridmanager.core.common.task.GetCMUserListTask) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetEnvInfoTask(com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask) GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) MonitoringTask(com.cubrid.cubridmanager.core.common.task.MonitoringTask) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with DbRunningType

use of com.cubrid.cubridmanager.core.common.model.DbRunningType in project cubrid-manager by CUBRID.

the class DbSystemMonitorHistoryViewPart method createPartControl.

/**
	 * Creates the SWT controls for this workbench part.
	 *
	 * @param parent the parent control
	 */
public void createPartControl(Composite parent) {
    final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    composite = new Composite(scrolledComp, SWT.RESIZE);
    GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final HistoryComposite historyComposite = new HistoryComposite();
    historyComposite.loadTimeSelection(composite);
    Label sepWithResult = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_OUT);
    sepWithResult.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    chartComp = new Composite(composite, SWT.RESIZE);
    GridLayout chartCompLayout = new GridLayout(1, true);
    chartComp.setLayout(chartCompLayout);
    chartComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    loadCpuChart(chartComp);
    loadMemoryChart(chartComp);
    scrolledComp.setContent(composite);
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setMinHeight(800);
    scrolledComp.setMinWidth(545);
    historyComposite.getQueryBtn().addSelectionListener(new HistoryBtnSelectionListener(historyComposite));
    List<String> databaseLst = new ArrayList<String>();
    List<DatabaseInfo> databaseInfoLst = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
    for (DatabaseInfo databaseInfo : databaseInfoLst) {
        DbRunningType dbRunningType = databaseInfo.getRunningType();
        if (dbRunningType == DbRunningType.CS) {
            databaseLst.add(databaseInfo.getDbName());
        }
    }
    dbCombo = new DbComboContribution("database");
    dbCombo.setDatabaseLst(databaseLst);
    if (!databaseLst.isEmpty()) {
        databaseLst.add(0, ALL_DB_NAME);
        dbCombo.setSelectedDb(databaseLst.get(0));
    }
    String selectDb = dbCombo.getSelectedDb();
    if (ALL_DB_NAME.equals(selectDb)) {
        dbName = "";
    } else {
        dbName = selectDb;
    }
    makeActions();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType)

Example 4 with DbRunningType

use of com.cubrid.cubridmanager.core.common.model.DbRunningType in project cubrid-manager by CUBRID.

the class SetupEnvTestCase method setupDatabaseInfo831.

/**
	 * * Setup database 8.3.1
	 *
	 */
private void setupDatabaseInfo831() {
    /*Setting Cubrid 8.3.1*/
    serverInfo831 = new ServerInfo();
    serverInfo831.setHostAddress(host831);
    serverInfo831.setHostMonPort(monport831);
    serverInfo831.setHostJSPort(jpport831);
    serverInfo831.setUserName(userName831);
    serverInfo831.setUserPassword(passwd831);
    serverInfo831.setJdbcDriverVersion(serverVersion831);
    ServerManager.getInstance().addServer(host831, monport831, userName831, serverInfo831);
    MonitoringTask monTask = new MonitoringTask(serverInfo831);
    serverInfo831 = monTask.connectServer(serverVersion831, 1000);
    // get the latest token
    token831 = serverInfo831.getHostToken();
    //get evnInfo
    if (envInfo831 == null) {
        GetEnvInfoTask envTask = new GetEnvInfoTask(serverInfo831);
        envTask.loadEnvInfo();
        envTask.execute();
        envInfo831 = envTask.loadEnvInfo();
        serverInfo831.setEnvInfo(envInfo831);
    }
    assertNotNull(envInfo831);
    serverPath831 = envInfo831.getRootDir();
    dbRootDir831 = envInfo831.getDatabaseDir();
    //get server type
    GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo831);
    getCMConfParameterTask.execute();
    assertEquals(null, getCMConfParameterTask.getErrorMsg());
    Map<String, String> confParameters = getCMConfParameterTask.getConfParameters();
    ServerType serverType = ServerType.BOTH;
    if (confParameters != null) {
        String target = confParameters.get(ConfConstants.CM_TARGET);
        if (target != null) {
            if (target.indexOf("broker") >= 0 && target.indexOf("server") >= 0) {
                serverType = ServerType.BOTH;
            } else if (target.indexOf("broker") >= 0) {
                serverType = ServerType.BROKER;
            } else if (target.indexOf("server") >= 0) {
                serverType = ServerType.DATABASE;
            }
        }
    }
    if (serverInfo831 != null) {
        serverInfo831.setServerType(serverType);
    }
    //Get database list task
    if (serverType == ServerType.DATABASE || serverType == ServerType.BOTH) {
        final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo831);
        getDatabaseListTask.execute();
        assertEquals(null, getDatabaseListTask.getErrorMsg());
        List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
        for (DatabaseInfo dbInfo : databaseInfoList) {
            if (dbInfo.getDbName().equals(testDbName831)) {
                databaseInfo831 = dbInfo;
                break;
            }
        }
        if (databaseInfo831 == null) {
            return;
        }
    }
    //get CubridManager user list task
    GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo831);
    getUserInfoTask.execute();
    assertEquals(null, getUserInfoTask.getErrorMsg());
    List<ServerUserInfo> serverUserInfoList = getUserInfoTask.getServerUserInfoList();
    for (int i = 0; serverUserInfoList != null && i < serverUserInfoList.size(); i++) {
        ServerUserInfo userInfo = serverUserInfoList.get(i);
        if (userInfo != null && userInfo.getUserName().equals(serverInfo831.getUserName())) {
            serverInfo831.setLoginedUserInfo(userInfo);
            break;
        }
    }
    List<DatabaseInfo> databaseInfoList = serverInfo831.getLoginedUserInfo().getDatabaseInfoList();
    String dbDir = databaseInfo831.getDbDir();
    DbRunningType type = databaseInfo831.getRunningType();
    for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
        if (testDbName831.equalsIgnoreCase(databaseInfoList.get(i).getDbName())) {
            databaseInfo831 = databaseInfoList.get(i);
            databaseInfo831.setDbDir(dbDir);
            databaseInfo831.setBrokerIP(host831);
            databaseInfo831.setBrokerPort(port831);
            databaseInfo831.setCharSet(charset831);
            databaseInfo831.setRunningType(type);
            break;
        }
    }
    //get CUBRID conf parameter
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo831);
    getCubridConfParameterTask.execute();
    assertEquals(null, getCubridConfParameterTask.getErrorMsg());
    Map<String, Map<String, String>> confParas = getCubridConfParameterTask.getConfParameters();
    if (serverInfo831 != null) {
        serverInfo831.setCubridConfParaMap(confParas);
    }
    //get broker Info
    GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo831);
    getBrokerConfParameterTask.execute();
    assertEquals(null, getBrokerConfParameterTask.getErrorMsg());
    confParas = getBrokerConfParameterTask.getConfParameters();
    if (serverInfo831 != null) {
        serverInfo831.setBrokerConfParaMap(confParas);
    }
    //Set JDBC driver
    String filePath = this.getFilePathInPlugin("/lib/JDBC-8.3.0.1004-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo831.setJdbcDriverVersion(version);
        }
    }
    filePath = this.getFilePathInPlugin("/lib/JDBC-8.3.1.0173-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo831.setJdbcDriverVersion(version);
        }
    }
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) GetCMUserListTask(com.cubrid.cubridmanager.core.common.task.GetCMUserListTask) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetEnvInfoTask(com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask) GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) MonitoringTask(com.cubrid.cubridmanager.core.common.task.MonitoringTask) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with DbRunningType

use of com.cubrid.cubridmanager.core.common.model.DbRunningType in project cubrid-manager by CUBRID.

the class DbSystemMonitorViewPart method createPartControl.

/**
	 * Creates the SWT controls for this workbench part.
	 *
	 * @param parent the parent control
	 */
public void createPartControl(Composite parent) {
    final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    composite = new Composite(scrolledComp, SWT.RESIZE);
    GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    compositePart = new DbSystemMonitorCompositePart(composite);
    compositePart.setCpuSeriesKey(new String[] { DbProcStatEnum.USER_PERCENT.name(), DbProcStatEnum.KERNEL_PERCENT.name() });
    compositePart.setMemorySeriesKey(new String[] { DbProcStatEnum.MEMPHY_PERCENT.name() });
    //history setting
    compositePart.setHistoryFileName(historyFileName);
    compositePart.setHistoryPath(historyPath);
    compositePart.setHistoryFileHelp(historyFileHelp);
    compositePart.load();
    scrolledComp.setContent(composite);
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setMinHeight(800);
    scrolledComp.setMinWidth(350);
    ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
    ArrayList<String> databaseLst = new ArrayList<String>();
    List<DatabaseInfo> databaseInfoLst = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
    for (DatabaseInfo databaseInfo : databaseInfoLst) {
        DbRunningType dbRunningType = databaseInfo.getRunningType();
        if (dbRunningType == DbRunningType.CS) {
            databaseLst.add(databaseInfo.getDbName());
        }
    }
    dbCombo = new DbComboContribution("database");
    dbCombo.setDatabaseLst(databaseLst);
    if (databaseLst.isEmpty()) {
        runflag = false;
    } else {
        databaseLst.add(0, ALL_DB_NAME);
        dbCombo.setSelectedDb(databaseLst.get(0));
    }
    String selectDb = dbCombo.getSelectedDb();
    if (ALL_DB_NAME.equals(selectDb)) {
        dbName = "";
    } else {
        dbName = selectDb;
    }
    makeActions();
    new DataGenerator().start();
}
Also used : DbSystemMonitorCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.DbSystemMonitorCompositePart) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType)

Aggregations

DbRunningType (com.cubrid.cubridmanager.core.common.model.DbRunningType)7 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)7 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)5 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)4 GetCMUserListTask (com.cubrid.cubridmanager.core.common.task.GetCMUserListTask)4 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)4 GetDatabaseListTask (com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask)4 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 GetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)3 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)3 GetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask)3 GetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)3 GetEnvInfoTask (com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask)3 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)3 HashMap (java.util.HashMap)3 Composite (org.eclipse.swt.widgets.Composite)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2