Search in sources :

Example 11 with BrokerInfo

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

the class UserAuthDbInfoPage method initialBrokerPorts.

/**
	 * 
	 * Initial the broker ports
	 * 
	 * @param brokerIp String
	 * 
	 */
private void initialBrokerPorts(String brokerIp) {
    String ip = server.getHostAddress();
    if (!ip.equals(brokerIp)) {
        allBrokerPorts = null;
        return;
    }
    BrokerInfos brokerInfos = server.getServerInfo().getBrokerInfos();
    if (brokerInfos != null) {
        String brokerStauts = brokerInfos.getBrokerstatus();
        BrokerInfoList brokerInfo = brokerInfos.getBorkerInfoList();
        if (brokerInfo != null) {
            List<BrokerInfo> brokerInfoList = brokerInfo.getBrokerInfoList();
            if (brokerInfoList != null) {
                List<String> brokerPortList = new ArrayList<String>();
                for (int i = 0; i < brokerInfoList.size(); i++) {
                    BrokerInfo info = brokerInfoList.get(i);
                    if (info.getPort() == null || info.getPort().trim().length() == 0) {
                        continue;
                    }
                    String port = info.getPort();
                    String status = "";
                    if (brokerStauts == null || !brokerStauts.equalsIgnoreCase("ON")) {
                        status = "OFF";
                    } else {
                        status = info.getState() == null || info.getState().trim().equalsIgnoreCase("OFF") ? "OFF" : "ON";
                    }
                    brokerPortList.add(info.getName() + "[" + port + "/" + status + "]");
                }
                if (!brokerPortList.isEmpty()) {
                    allBrokerPorts = new String[brokerPortList.size()];
                    brokerPortList.toArray(allBrokerPorts);
                }
            }
        }
    }
}
Also used : BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) ArrayList(java.util.ArrayList) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 12 with BrokerInfo

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

the class BrokerNode method setBrokerInfo.

/**
	 * Set broker info.
	 *
	 * @param brokerInfo BrokerInfo
	 */
public void setBrokerInfo(BrokerInfo brokerInfo) {
    BrokerInfo old = this.brokerInfo;
    this.brokerInfo = brokerInfo;
    this.firePropertyChange(PROP_BROKER_STATUS, old, brokerInfo);
}
Also used : BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 13 with BrokerInfo

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

the class BrokerMonitorPart method setMode2View.

/**
	 * Set model's value to view.
	 * 
	 * @param figure BrokerMonitorFigure
	 * @param broker BrokerNode
	 */
private void setMode2View(BrokerMonitorFigure figure, BrokerNode broker) {
    HostNode hostNode = broker.getParent();
    figure.setTitle(broker.getName());
    figure.setHostName(hostNode.getName());
    String brokerStatus = BrokerMonitorFigure.STATUS_UNKNOWN;
    String accessMode = OnOffType.OFF.getText();
    BrokerInfo brokerInfo = broker.getBrokerInfo();
    if (brokerInfo != null) {
        brokerStatus = brokerInfo.getState();
        accessMode = brokerInfo.getAccess_mode();
    }
    figure.setStatus(true, hostNode.isConnected(), brokerStatus, accessMode, broker.getErrorMsg(), broker.hasNewErrorMsg());
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 14 with BrokerInfo

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

the class BrokerMonitorPartHelper method performUpdate.

/**
	 * Perform the update data
	 * 
	 * @param dataChangedEvent the given event including newest data
	 */
public void performUpdate(DataChangedEvent dataChangedEvent) {
    if (!brokerNode.getParent().isConnected()) {
        brokerNode.setBrokerInfo(null);
        brokerNode.setBrokerDiagData(null);
        brokerNode.setBrokerStatusInfos(null);
        return;
    }
    String brokerName = brokerNode.getBrokerName();
    BrokerInfo brokerInfo = HAUtil.getBrokerInfo(dataChangedEvent.getBrokerInfosMap().get(brokerName), brokerName);
    brokerNode.setBrokerInfo(brokerInfo);
    brokerNode.setBrokerDiagData(dataChangedEvent.getBrokerDiagDataMap().get(brokerName));
    brokerNode.setBrokerStatusInfos(dataChangedEvent.getBrokerStatusInfosMap().get(brokerName));
}
Also used : BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 15 with BrokerInfo

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

the class CubridBrokerFolderLoader method checkBrokerExist.

/**
	 * 
	 * Check broker whether exist
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor
	 * @return <code>0</code> exist;<code>1</code> has error;<code>2</code>
	 *         canceled;<code>3</code> no exist;
	 */
private int checkBrokerExist(final ICubridNode parent, final IProgressMonitor monitor) {
    ServerInfo serverInfo = parent.getServer().getServerInfo();
    BrokerInfos brokerInfos = new BrokerInfos();
    final CommonQueryTask<BrokerInfos> getBrokersTask = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
    monitorCancel(monitor, new ITask[] { getBrokersTask });
    getBrokersTask.execute();
    final String msg = getBrokersTask.getErrorMsg();
    if (!monitor.isCanceled() && msg != null && msg.trim().length() > 0) {
        parent.removeAllChild();
        openErrorBox(msg);
        setLoaded(true);
        return 1;
    }
    if (monitor.isCanceled()) {
        setLoaded(true);
        return 2;
    }
    CubridBroker broker = (CubridBroker) parent;
    String brokerName = broker.getLabel();
    brokerInfos = getBrokersTask.getResultModel();
    boolean isExist = false;
    List<BrokerInfo> brokerInfoList = (brokerInfos == null || brokerInfos.getBorkerInfoList() == null) ? null : brokerInfos.getBorkerInfoList().getBrokerInfoList();
    for (int i = 0; brokerInfoList != null && i < brokerInfoList.size(); i++) {
        BrokerInfo brokerInfo = brokerInfoList.get(i);
        if (brokerInfo.getName().equalsIgnoreCase(brokerName)) {
            broker.setRunning(brokerInfo.getState() == null ? false : brokerInfo.getState().equalsIgnoreCase("ON"));
            isExist = true;
        }
    }
    return isExist ? 0 : 3;
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) 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