Search in sources :

Example 1 with BrokerInfo

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.

the class HaNode method genBrokerInfo.

public void genBrokerInfo() {
    StringBuilder sb = new StringBuilder();
    if (brokerInfoList != null) {
        int count = 0;
        for (BrokerInfo brokerInfo : brokerInfoList.getBrokerInfoList()) {
            if (brokerInfo != null) {
                sb.append(brokerInfo.getPort()).append(":");
                sb.append(brokerInfo.getState()).append(", ");
                count++;
            }
        }
        if (count > 0) {
            sb.delete(sb.length() - 2, sb.length());
        }
    }
    super.setBrokerInfo(sb.toString());
}
Also used : BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 2 with BrokerInfo

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.

the class BrokerBasicInfoLabelProvider method getColumnText.

/**
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
	 *      int)
	 * @param element the object representing the entire row, or
	 *        <code>null</code> indicating that no input object is set in the
	 *        viewer
	 * @param columnIndex the zero-based index of the column in which the label
	 *        appears
	 * @return String or or <code>null</code> if there is no text for the given
	 *         object at columnIndex
	 */
public String getColumnText(Object element, int columnIndex) {
    BrokerInfo brokerInfo = (BrokerInfo) element;
    boolean isQueryOrTransTimeUseMs = false;
    if (serverInfo != null) {
        isQueryOrTransTimeUseMs = CompatibleUtil.isQueryOrTransTimeUseMs(serverInfo);
    }
    switch(columnIndex) {
        case 0:
            return brokerInfo.getPid();
        case 1:
            return brokerInfo.getPort();
        case 2:
            return brokerInfo.getJq();
        case 3:
            return brokerInfo.getAuto();
        case 4:
            return brokerInfo.getSqll();
        case 5:
            String longTranTime = brokerInfo.getLong_tran_time();
            if (isQueryOrTransTimeUseMs) {
                double dVal = Double.parseDouble(longTranTime) * 1000;
                longTranTime = String.valueOf((int) (dVal + 0.5));
            }
            return longTranTime;
        case 6:
            String longQueryTime = brokerInfo.getLong_query_time();
            if (isQueryOrTransTimeUseMs) {
                double dVal = Double.parseDouble(longQueryTime) * 1000;
                longQueryTime = String.valueOf((int) (dVal + 0.5));
            }
            return longQueryTime;
        case 7:
            return brokerInfo.getSes();
        case 8:
            return brokerInfo.getKeep_conn();
        case 9:
            return brokerInfo.getAccess_mode();
        default:
            return "";
    }
}
Also used : BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 3 with BrokerInfo

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method refresh.

/**
	 * Refreshes this view
	 *
	 * @param isUpdateTable whether update table
	 * @param isRefreshChanged whether refresh changed
	 *
	 */
public void refresh(boolean isUpdateTable, boolean isRefreshChanged) {
    ServerInfo site = cubridNode.getServer().getServerInfo();
    BrokerInfos brokerInfos = new BrokerInfos();
    final CommonQueryTask<BrokerInfos> task = new CommonQueryTask<BrokerInfos>(site, CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
    task.execute();
    brokerInfos = task.getResultModel();
    List<BrokerInfo> newBrokerInfoList = null;
    if (null != brokerInfos) {
        BrokerInfoList list = brokerInfos.getBorkerInfoList();
        if (list != null && list.getBrokerInfoList() != null) {
            newBrokerInfoList = list.getBrokerInfoList();
        }
    }
    List<BrokerInfo> changedBrokerInfoList = new ArrayList<BrokerInfo>();
    for (int i = 0; newBrokerInfoList != null && i < newBrokerInfoList.size(); i++) {
        BrokerInfo newBrokerInfo = newBrokerInfoList.get(i);
        BrokerInfo changedBrokerInfo = newBrokerInfo.clone();
        for (int j = 0; oldBrokerInfoList != null && j < oldBrokerInfoList.size(); j++) {
            BrokerInfo oldBrokerInfo = oldBrokerInfoList.get(j);
            if (newBrokerInfo.getName().equalsIgnoreCase(oldBrokerInfo.getName())) {
                // FIXME more simple
                long newTran = StringUtil.intValue(newBrokerInfo.getTran());
                long newQuery = StringUtil.intValue(newBrokerInfo.getQuery());
                long newLongTran = StringUtil.longValue(newBrokerInfo.getLong_tran());
                long newLongQuery = StringUtil.longValue(newBrokerInfo.getLong_query());
                long newErrQuery = StringUtil.intValue(newBrokerInfo.getError_query());
                long oldTran = StringUtil.intValue(oldBrokerInfo.getTran());
                long oldQuery = StringUtil.intValue(oldBrokerInfo.getQuery());
                long oldLongTran = StringUtil.longValue(oldBrokerInfo.getLong_tran());
                long oldLongQuery = StringUtil.longValue(oldBrokerInfo.getLong_query());
                long oldErrQuery = StringUtil.intValue(oldBrokerInfo.getError_query());
                long changedTran = newTran - oldTran;
                long changedQuery = newQuery - oldQuery;
                long changedLongTran = newLongTran - oldLongTran;
                long changedLongQuery = newLongQuery - oldLongQuery;
                long changedErrQuery = newErrQuery - oldErrQuery;
                changedBrokerInfo.setTran(String.valueOf(changedTran > 0 ? changedTran : 0));
                changedBrokerInfo.setQuery(String.valueOf(changedQuery > 0 ? changedQuery : 0));
                changedBrokerInfo.setLong_tran(String.valueOf(changedLongTran > 0 ? changedLongTran : 0));
                changedBrokerInfo.setLong_query(String.valueOf(changedLongQuery > 0 ? changedLongQuery : 0));
                changedBrokerInfo.setError_query(String.valueOf(changedErrQuery > 0 ? changedErrQuery : 0));
                break;
            }
        }
        changedBrokerInfoList.add(changedBrokerInfo);
    }
    oldBrokerInfoList = newBrokerInfoList;
    if (isUpdateTable) {
        if (isRefreshChanged) {
            tableViewer.setInput(changedBrokerInfoList);
        } else {
            tableViewer.setInput(oldBrokerInfoList);
        }
        tableViewer.refresh();
    }
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) ArrayList(java.util.ArrayList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 4 with BrokerInfo

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.

the class LoginDatabaseDialog method saveBrokerInfo.

private void saveBrokerInfo() {
    DatabaseInfo databaseInfo = database.getDatabaseInfo();
    String charset = charsetCombo.getText();
    QueryOptions.setCharset(databaseInfo, charset);
    String brokerPort = "";
    if (database != null) {
        String text = brokerPortCombo.getText();
        BrokerInfo brokerInfo = null;
        if (brokerPortCombo.getData(text) instanceof BrokerInfo) {
            brokerInfo = (BrokerInfo) brokerPortCombo.getData(text);
        }
        if (brokerInfo != null) {
            brokerPort = brokerInfo.getPort();
        } else {
            brokerPort = getBrokerPort();
        }
    }
    if (brokerPort != null) {
        QueryOptions.setBrokerPort(databaseInfo, brokerPort);
    }
    QueryOptions.setBrokerIp(databaseInfo, brokerIpText.getText());
    QueryOptions.savePref();
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 5 with BrokerInfo

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.

the class LoginQueryEditDialog method fillBrokerPortCombo.

/**
	 * 
	 * Fill in the broker port combo
	 * 
	 * @param serverName the server name
	 */
private void fillBrokerPortCombo(String serverName) {
    CubridServer cubridServer = serverMap.get(serverName);
    BrokerInfos brokerInfos = cubridServer.getServerInfo().getBrokerInfos();
    if (brokerInfos != null && brokerInfos.getBorkerInfoList() != null && brokerInfos.getBorkerInfoList().getBrokerInfoList() != null) {
        List<BrokerInfo> brokerList = brokerInfos.getBorkerInfoList().getBrokerInfoList();
        Combo brokerPortCombo = connectionComp.getBrokerPortCombo();
        brokerPortCombo.removeAll();
        for (int i = 0; i < brokerList.size(); i++) {
            brokerPortCombo.add(brokerList.get(i).getPort());
        }
        if (!brokerList.isEmpty()) {
            brokerPortCombo.select(0);
        }
    }
}
Also used : BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) Combo(org.eclipse.swt.widgets.Combo) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Aggregations

BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)35 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)16 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)11 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)6 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)5 ArrayList (java.util.ArrayList)5 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)4 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)4 CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)4 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)3 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 BrokerStatusInfos (com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)3 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)3 Combo (org.eclipse.swt.widgets.Combo)3 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)2 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)2 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)2 GetBrokerStatusInfosTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask)2