Search in sources :

Example 1 with CQBDbConnectionLoader

use of com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader in project cubrid-manager by CUBRID.

the class CQBDBNodePersistManager method loadDatabases.

/**
	 *
	 * Load databases from xml memento
	 *
	 * @param memento IXMLMemento
	 * @param isLoadOptions boolean
	 * @param optionPath String
	 */
protected void loadDatabases(IXMLMemento memento, boolean isLoadOptions, String optionPath) {
    //when import connections, load the global preference
    if (isLoadOptions) {
        QueryOptions.load(optionPath, null);
    }
    IXMLMemento[] children = memento == null ? null : memento.getChildren("database");
    for (int i = 0; children != null && i < children.length; i++) {
        String name = children[i].getString("name");
        String dbName = children[i].getString("dbName");
        String dbUser = children[i].getString("dbUser");
        String dbPassword = children[i].getString("dbPassword");
        String jdbcDriver = children[i].getString("jdbcDriver");
        boolean savePassword = children[i].getBoolean("savePassword");
        // [TOOLS-2425]Support shard broker
        Boolean isShardObj = children[i].getBoolean("isShard");
        boolean isShard = isShardObj == null ? false : isShardObj;
        String shardQueryTypeStr = children[i].getString("shardQueryType");
        int shardQueryType = StringUtil.intValue(shardQueryTypeStr, 0);
        if (shardQueryType == 0) {
            shardQueryType = DatabaseInfo.SHARD_QUERY_TYPE_VAL;
        }
        String brokerIp = children[i].getString("brokerIp");
        String brokerPort = children[i].getString("brokerPort");
        String charset = children[i].getString("charset");
        String jdbcAttrs = children[i].getString("jdbcAttrs");
        DatabaseEditorConfig editorConfig = null;
        IXMLMemento editorConfigElement = children[i].getChild("editorConfig");
        if (editorConfigElement != null) {
            editorConfig = new DatabaseEditorConfig();
            String strBGPos = editorConfigElement.getString("purpose-code");
            if (strBGPos == null) {
                strBGPos = "0";
            }
            int bgPos = StringUtil.intValue(strBGPos, 0);
            RGB background = EditorConstance.getRGBByPos(bgPos);
            editorConfig.setBackGround(background);
            editorConfig.setDatabaseComment(editorConfigElement.getString("database-comment"));
        }
        ServerInfo serverInfo = new ServerInfo();
        serverInfo.setServerName(name);
        serverInfo.setHostAddress(brokerIp);
        serverInfo.setHostMonPort(Integer.parseInt(brokerPort));
        serverInfo.setHostJSPort(Integer.parseInt(brokerPort) + 1);
        serverInfo.setUserName(dbName + "@" + brokerIp);
        serverInfo.setJdbcDriverVersion(jdbcDriver);
        CubridServer server = new CubridServer(name, name, null, null);
        server.setServerInfo(serverInfo);
        server.setType(NodeType.SERVER);
        DatabaseInfo dbInfo = new DatabaseInfo(dbName, serverInfo);
        dbInfo.setBrokerIP(brokerIp);
        dbInfo.setBrokerPort(brokerPort);
        dbInfo.setCharSet(charset);
        dbInfo.setJdbcAttrs(jdbcAttrs);
        dbInfo.setRunningType(DbRunningType.CS);
        // [TOOLS-2425]Support shard broker
        dbInfo.setShard(isShard);
        dbInfo.setShardQueryType(shardQueryType);
        String decDbPassword = null;
        if (dbPassword != null && dbPassword.trim().length() > 0) {
            decDbPassword = CipherUtils.decrypt(dbPassword);
        }
        DbUserInfo dbUserInfo = new DbUserInfo(dbName, dbUser, dbPassword, decDbPassword, false);
        dbInfo.setAuthLoginedDbUserInfo(dbUserInfo);
        String dbId = name + ICubridNodeLoader.NODE_SEPARATOR + name;
        if (this.getDatabase(dbId) != null) {
            continue;
        }
        CubridDatabase database = new CubridDatabase(dbId, name);
        database.setServer(server);
        database.setStartAndLoginIconPath("icons/navigator/database_start_connected.png");
        database.setStartAndLogoutIconPath("icons/navigator/database_start_disconnected.png");
        database.setDatabaseInfo(dbInfo);
        CubridNodeLoader loader = new CQBDbConnectionLoader();
        loader.setLevel(ICubridNodeLoader.FIRST_LEVEL);
        database.setLoader(loader);
        database.setAutoSavePassword(savePassword);
        if (isLoadOptions) {
            QueryOptions.load(optionPath, serverInfo);
        }
        /*Save the DatabaseEditorConfig to the memory*/
        QueryOptions.putEditorConfig(database, editorConfig, false);
        databaseList.add(database);
        fireAddDatabase(database);
    }
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) IXMLMemento(com.cubrid.cubridmanager.core.common.xml.IXMLMemento) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CQBDbConnectionLoader(com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader) ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridNodeLoader(com.cubrid.common.ui.spi.model.CubridNodeLoader) RGB(org.eclipse.swt.graphics.RGB) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DatabaseEditorConfig(com.cubrid.common.ui.spi.model.DatabaseEditorConfig)

Example 2 with CQBDbConnectionLoader

use of com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader in project cubrid-manager by CUBRID.

the class QueryConnDialog method buttonPressed.

/**
	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
	 * @param buttonId the id of the button that was pressed (see
	 *        <code>IDialogConstants.*_ID</code> constants)
	 */
protected void buttonPressed(int buttonId) {
    if (buttonId == TEST_CONNECT_ID || buttonId == CONNECT_ID || buttonId == SAVE_ID) {
        String name = queryConnNameText.getText();
        String dbName = connectionComp.getDatabaseText().getText();
        String brokerIp = connectionComp.getBrokerIpText().getText();
        String brokerPort = connectionComp.getBrokerPortText().getText();
        String userName = connectionComp.getUserNameText().getText();
        String password = connectionComp.getPasswordText().getText();
        String charset = connectionComp.getCharsetCombo().getText();
        String jdbcDriver = connectionComp.getJdbcCombo().getText();
        String jdbcAttrs = connectionComp.getAttrText().getText().trim();
        boolean isAutoCommit = connectionComp.isAutoCommit();
        // [TOOLS-2425]Support shard broker
        boolean isShard = connectionComp.getBtnShard().getSelection();
        int currentShardId = connectionComp.getCurShardId();
        int currentShardVal = connectionComp.getCurShardVal();
        int defaultShardQueryType = connectionComp.getShardQueryType();
        ServerInfo serverInfo = new ServerInfo();
        serverInfo.setServerName(name);
        serverInfo.setHostAddress(brokerIp);
        serverInfo.setHostMonPort(Integer.parseInt(brokerPort));
        serverInfo.setHostJSPort(Integer.parseInt(brokerPort) + 1);
        serverInfo.setUserName(dbName + "@" + brokerIp);
        serverInfo.setJdbcDriverVersion(jdbcDriver);
        DatabaseInfo dbInfo = new DatabaseInfo(dbName, serverInfo);
        dbInfo.setBrokerIP(brokerIp);
        dbInfo.setBrokerPort(brokerPort);
        dbInfo.setCharSet(charset);
        dbInfo.setJdbcAttrs(jdbcAttrs);
        // [TOOLS-2425]Support shard broker
        dbInfo.setShard(isShard);
        dbInfo.setCurrentShardId(currentShardId);
        dbInfo.setCurrentShardVal(currentShardVal);
        dbInfo.setShardQueryType(defaultShardQueryType);
        DbUserInfo userInfo = new DbUserInfo();
        userInfo.setDbName(dbName);
        userInfo.setName(userName);
        userInfo.setNoEncryptPassword(password);
        dbInfo.setAuthLoginedDbUserInfo(userInfo);
        if (buttonId == TEST_CONNECT_ID || buttonId == CONNECT_ID) {
            TaskExecutor taskExcutor = new ConnectDatabaseExecutor(dbInfo);
            new ExecTaskWithProgress(taskExcutor).exec();
            if (!taskExcutor.isSuccess()) {
                return;
            }
            if (buttonId == TEST_CONNECT_ID) {
                CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgTestConnSuccess);
                return;
            }
        }
        if (buttonId == CONNECT_ID) {
            // check whether dba authorization
            IsDBAUserTask checkTask = new IsDBAUserTask(dbInfo);
            checkTask.execute();
            userInfo.setDbaAuthority(checkTask.isDBAUser());
            dbInfo.setRunningType(DbRunningType.CS);
            dbInfo.getServerInfo().setConnected(true);
            dbInfo.setLogined(true);
            boolean userChanged = !name.equals(oldLoginUserName);
            fireLogoutEvent = oldDatabaseIsLogin && userChanged;
        }
        if (!isNewQueryConn && database != null) {
            boolean isContinue = CQBConnectionUtils.processConnectionLogout(database);
            if (!isContinue) {
                return;
            }
        }
        // If this is new connection,then warning charset setting
        if (isNewQueryConn) {
            boolean sureCharset = CommonUITool.openConfirmBox(Messages.bind(com.cubrid.cubridquery.ui.connection.Messages.msgConfirmCharset, charset));
            if (!sureCharset) {
                connectionComp.getCharsetCombo().setFocus();
                return;
            }
        }
        if (isNewQueryConn && (buttonId == CONNECT_ID || buttonId == SAVE_ID) && EditorConstance.getDefaultBackground().equals(getSelectedBackground())) {
            boolean surePurpose = CommonUITool.openConfirmBox(Messages.msgUseDefaultPurpose);
            if (!surePurpose) {
                selectColorCombo.expandMenu();
                return;
            }
        }
        CubridServer server = new CubridServer(name, name, null, null);
        server.setServerInfo(serverInfo);
        server.setType(NodeType.SERVER);
        String dbId = name + ICubridNodeLoader.NODE_SEPARATOR + name;
        if (isNewQueryConn) {
            database = new CubridDatabase(dbId, name);
        } else {
            database.setId(dbId);
            database.setLabel(name);
        }
        database.setDatabaseInfo(dbInfo);
        database.setServer(server);
        database.setStartAndLoginIconPath("icons/navigator/database_start_connected.png");
        database.setStartAndLogoutIconPath("icons/navigator/database_start_disconnected.png");
        CubridNodeLoader loader = new CQBDbConnectionLoader();
        loader.setLevel(ICubridNodeLoader.FIRST_LEVEL);
        database.setLoader(loader);
        database.setAutoSavePassword(connectionComp.isAutoSavePassword());
        if (buttonId == CONNECT_ID || buttonId == SAVE_ID) {
            if (database != null) {
                DatabaseEditorConfig editorConfig = QueryOptions.getEditorConfig(database, false);
                if (editorConfig == null) {
                    editorConfig = new DatabaseEditorConfig();
                }
                editorConfig.setBackGround(getSelectedBackground());
                editorConfig.setDatabaseComment(getDatabaseComment());
                QueryOptions.putEditorConfig(database, editorConfig, false);
            }
            newInfo = CQBDBNodePersistManager.getInstance().getConnectionInfo(database);
            if (isNewQueryConn) {
                CQBDBNodePersistManager.getInstance().fireAddDatabase(database);
            } else if (oldInfo != null) {
                CQBDBNodePersistManager.getInstance().fireModifyDatabase(oldInfo, newInfo);
            }
        }
        QueryOptions.setAutoCommit(serverInfo, isAutoCommit);
    }
    setReturnCode(buttonId);
    close();
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CQBDbConnectionLoader(com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader) ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridNodeLoader(com.cubrid.common.ui.spi.model.CubridNodeLoader) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) IsDBAUserTask(com.cubrid.cubridmanager.core.cubrid.user.task.IsDBAUserTask) ConnectDatabaseExecutor(com.cubrid.common.ui.spi.util.ConnectDatabaseExecutor) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DatabaseEditorConfig(com.cubrid.common.ui.spi.model.DatabaseEditorConfig)

Example 3 with CQBDbConnectionLoader

use of com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader in project cubrid-manager by CUBRID.

the class LoginQueryEditorDialog method buttonPressed.

/**
	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
	 * @param buttonId the id of the button that was pressed (see
	 *        <code>IDialogConstants.*_ID</code> constants)
	 */
protected void buttonPressed(int buttonId) {
    if (buttonId == TEST_CONNECT_ID || buttonId == IDialogConstants.OK_ID) {
        String dbName = connectionComp.getDatabaseText().getText();
        String brokerIp = connectionComp.getBrokerIpText().getText();
        String brokerPort = connectionComp.getBrokerPortText().getText();
        String userName = connectionComp.getUserNameText().getText();
        String password = connectionComp.getPasswordText().getText();
        String charset = connectionComp.getCharsetCombo().getText();
        String jdbcDriver = connectionComp.getJdbcCombo().getText();
        String jdbcAttrs = connectionComp.getAttrText().getText().trim();
        boolean isShard = connectionComp.getBtnShard().getSelection();
        int currentShardId = connectionComp.getCurShardId();
        ServerInfo serverInfo = new ServerInfo();
        serverInfo.setServerName(DatabaseNavigatorMenu.SELF_DATABASE_ID);
        serverInfo.setHostAddress(brokerIp);
        serverInfo.setHostMonPort(Integer.parseInt(brokerPort));
        serverInfo.setHostJSPort(Integer.parseInt(brokerPort) + 1);
        serverInfo.setJdbcDriverVersion(jdbcDriver);
        DatabaseInfo dbInfo = new DatabaseInfo(dbName, serverInfo);
        dbInfo.setBrokerIP(brokerIp);
        dbInfo.setBrokerPort(brokerPort);
        dbInfo.setCharSet(charset);
        dbInfo.setJdbcAttrs(jdbcAttrs);
        dbInfo.setShard(isShard);
        dbInfo.setCurrentShardId(currentShardId);
        DbUserInfo userInfo = new DbUserInfo();
        userInfo.setDbName(dbName);
        userInfo.setName(userName);
        userInfo.setNoEncryptPassword(password);
        dbInfo.setAuthLoginedDbUserInfo(userInfo);
        TaskExecutor taskExcutor = new ConnectDatabaseExecutor(dbInfo);
        new ExecTaskWithProgress(taskExcutor).exec();
        if (!taskExcutor.isSuccess()) {
            return;
        }
        if (buttonId == TEST_CONNECT_ID) {
            CommonUITool.openInformationBox(com.cubrid.cubridquery.ui.connection.Messages.titleSuccess, com.cubrid.cubridquery.ui.connection.Messages.msgTestConnSuccess);
            return;
        }
        // check whether dba authorization
        IsDBAUserTask checkTask = new IsDBAUserTask(dbInfo);
        checkTask.execute();
        userInfo.setDbaAuthority(checkTask.isDBAUser());
        dbInfo.setLogined(true);
        dbInfo.setRunningType(DbRunningType.CS);
        dbInfo.getServerInfo().setConnected(true);
        dbInfo.setLogined(true);
        CubridServer server = new CubridServer(DatabaseNavigatorMenu.SELF_DATABASE_ID, DatabaseNavigatorMenu.SELF_DATABASE_SELECTED_LABEL, null, null);
        server.setServerInfo(serverInfo);
        server.setType(NodeType.SERVER);
        DatabaseNavigatorMenu.SELF_DATABASE.setDatabaseInfo(dbInfo);
        DatabaseNavigatorMenu.SELF_DATABASE.setServer(server);
        DatabaseNavigatorMenu.SELF_DATABASE.setStartAndLoginIconPath("icons/navigator/database_start_connected.png");
        DatabaseNavigatorMenu.SELF_DATABASE.setStartAndLogoutIconPath("icons/navigator/database_start_disconnected.png");
        DatabaseNavigatorMenu.SELF_DATABASE.setLoader(new CQBDbConnectionLoader());
    }
    super.buttonPressed(buttonId);
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CQBDbConnectionLoader(com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) IsDBAUserTask(com.cubrid.cubridmanager.core.cubrid.user.task.IsDBAUserTask) ConnectDatabaseExecutor(com.cubrid.common.ui.spi.util.ConnectDatabaseExecutor) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 4 with CQBDbConnectionLoader

use of com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader in project cubrid-manager by CUBRID.

the class TableLabelProvider method parseURL.

/**
	 * Parse the databases from the url
	 *
	 * @return
	 */
private CubridDatabase parseURL(String url) {
    // FIXME extract
    CubridDatabase database = null;
    String mainParams = null;
    String otherParams = null;
    /*Split the parameter by ?*/
    int questionIndex = url.indexOf("?");
    if (questionIndex > 0) {
        mainParams = url.substring(0, questionIndex);
        if (questionIndex + 1 < url.length()) {
            otherParams = url.substring(questionIndex + 1);
        }
    } else {
        mainParams = url;
    }
    String[] colonParams = mainParams.split(":");
    if (colonParams.length >= 5) {
        String host = colonParams[2];
        String port = colonParams[3];
        String dbName = colonParams[4];
        String dbUser = "", dbPassword = "";
        if (colonParams.length >= 6) {
            dbUser = colonParams[5];
        }
        if (colonParams.length >= 7) {
            dbPassword = colonParams[6];
        }
        String charset = null;
        StringBuilder jdbcAttrSB = new StringBuilder();
        /*Parse the connection parameters*/
        if (otherParams != null) {
            /*find the charset parameter*/
            String[] propertyArray = otherParams.split("&");
            for (int i = 0; i < propertyArray.length; i++) {
                String str = propertyArray[i];
                if (str.toLowerCase().indexOf("charset") >= 0) {
                    int index = str.indexOf("=");
                    if (index >= 0 && index + 1 < str.length()) {
                        charset = str.substring(index + 1);
                        propertyArray[i] = null;
                    }
                }
            }
            /*find other parameters*/
            for (int i = 0; i < propertyArray.length; i++) {
                if (propertyArray[i] != null) {
                    jdbcAttrSB.append(propertyArray[i]);
                }
                if (i + 1 < propertyArray.length && propertyArray[i + 1] != null) {
                    jdbcAttrSB.append("&");
                }
            }
        }
        String connenctionName = host + ":" + port + ":" + dbName + ":" + dbUser;
        ServerInfo serverInfo = new ServerInfo();
        serverInfo.setServerName(connenctionName);
        serverInfo.setHostAddress(host);
        serverInfo.setHostMonPort(Integer.parseInt(port));
        serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
        serverInfo.setUserName(dbName + "@" + host);
        DatabaseInfo dbInfo = new DatabaseInfo(dbName, serverInfo);
        dbInfo.setBrokerIP(host);
        dbInfo.setBrokerPort(port);
        if (charset != null) {
            dbInfo.setCharSet(charset);
        }
        dbInfo.setJdbcAttrs(jdbcAttrSB.toString());
        DbUserInfo userInfo = new DbUserInfo();
        userInfo.setDbName(dbName);
        userInfo.setName(dbUser);
        userInfo.setNoEncryptPassword(dbPassword);
        dbInfo.setAuthLoginedDbUserInfo(userInfo);
        CubridServer server = new CubridServer(connenctionName, connenctionName, null, null);
        server.setServerInfo(serverInfo);
        server.setType(NodeType.SERVER);
        String dbId = connenctionName + ICubridNodeLoader.NODE_SEPARATOR + connenctionName;
        database = new CubridDatabase(dbId, dbName);
        database.setDatabaseInfo(dbInfo);
        database.setServer(server);
        database.setStartAndLoginIconPath("icons/navigator/database_start_connected.png");
        database.setStartAndLogoutIconPath("icons/navigator/database_start_disconnected.png");
        database.setAutoSavePassword(true);
        database.setLabel(connenctionName);
        CubridNodeLoader loader = new CQBDbConnectionLoader();
        loader.setLevel(ICubridNodeLoader.FIRST_LEVEL);
        database.setLoader(loader);
    }
    return database;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CQBDbConnectionLoader(com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader) ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridNodeLoader(com.cubrid.common.ui.spi.model.CubridNodeLoader) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 5 with CQBDbConnectionLoader

use of com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader in project cubrid-manager by CUBRID.

the class CQBDatabaseFactory method createDatabase.

/**
	 * Create database object
	 * @param connInfo
	 * @return
	 */
public static CubridDatabase createDatabase(IJDBCConnecInfo connInfo) {
    if (connInfo == null || StringUtil.isEmpty(connInfo.getConName())) {
        return null;
    }
    /*Create a new object*/
    String connName = getUniqueName(connInfo.getConName());
    String dbId = connName + ICubridNodeLoader.NODE_SEPARATOR + connName;
    ServerInfo serverInfo = new ServerInfo();
    serverInfo.setServerName(connName);
    serverInfo.setHostAddress(connInfo.getHost());
    serverInfo.setUserName(connInfo.getDbName() + "@" + connInfo.getHost());
    if (!StringUtil.isEmpty(connInfo.getVersion())) {
        serverInfo.setJdbcDriverVersion(connInfo.getVersion());
    } else if (!StringUtil.isEmpty(connInfo.getDriverFileName())) {
        serverInfo.setServerVersion(CubridJdbcManager.getInstance().getDriverFileByVersion(connInfo.getDriverFileName()));
    } else {
        serverInfo.setServerVersion("");
    }
    CubridServer server = new CubridServer(connName, connName, null, null);
    server.setServerInfo(serverInfo);
    server.setType(NodeType.SERVER);
    DatabaseInfo dbInfo = new DatabaseInfo(connInfo.getDbName(), serverInfo);
    dbInfo.setBrokerIP(connInfo.getHost());
    dbInfo.setBrokerPort(String.valueOf(connInfo.getPort()));
    dbInfo.setCharSet(connInfo.getCharset());
    dbInfo.setJdbcAttrs(connInfo.getJDBCAttrs());
    DbUserInfo userInfo = new DbUserInfo();
    userInfo.setDbName(connInfo.getDbName());
    userInfo.setName(connInfo.getConUser());
    userInfo.setNoEncryptPassword(connInfo.getConPassword());
    dbInfo.setAuthLoginedDbUserInfo(userInfo);
    CubridDatabase database = new CubridDatabase(dbId, connName);
    database.setDatabaseInfo(dbInfo);
    database.setServer(server);
    database.setStartAndLoginIconPath("icons/navigator/database_start_connected.png");
    database.setStartAndLogoutIconPath("icons/navigator/database_start_disconnected.png");
    CubridNodeLoader loader = new CQBDbConnectionLoader();
    loader.setLevel(ICubridNodeLoader.FIRST_LEVEL);
    database.setLoader(loader);
    return database;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CQBDbConnectionLoader(com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader) CubridNodeLoader(com.cubrid.common.ui.spi.model.CubridNodeLoader) ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Aggregations

CubridServer (com.cubrid.common.ui.spi.model.CubridServer)6 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)6 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)6 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)6 CQBDbConnectionLoader (com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader)6 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)5 CubridNodeLoader (com.cubrid.common.ui.spi.model.CubridNodeLoader)5 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)5 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)3 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 ConnectDatabaseExecutor (com.cubrid.common.ui.spi.util.ConnectDatabaseExecutor)2 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 IsDBAUserTask (com.cubrid.cubridmanager.core.cubrid.user.task.IsDBAUserTask)2 RGB (org.eclipse.swt.graphics.RGB)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1