Search in sources :

Example 11 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode in project cubrid-manager by CUBRID.

the class ClientMonitorPart method refreshVisuals.

/**
	 * Refreshes this EditPart's <i>visuals</i>. This method is called by
	 * {@link #refresh()}, and may also be called in response to notifications
	 * from the model.
	 */
protected void refreshVisuals() {
    ClientFigure figure = (ClientFigure) this.getFigure();
    ClientNode clientNode = (ClientNode) this.getModel();
    figure.setName(clientNode.getName());
    figure.setClients(clientNode.getClientList());
    BrokerNode broker = clientNode.getBrokerNode();
    if (broker != null) {
        figure.setHostConnected(broker.getParent().isConnected());
    }
    super.refreshVisuals();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) ClientFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.ClientFigure) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)

Example 12 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode in project cubrid-manager by CUBRID.

the class HAUtil method mergeHostChildNode.

/**
	 * 
	 * Merge the database node
	 * 
	 * @param hostNode The HostNode
	 * @param addedHostNode The HostNode
	 */
private static void mergeHostChildNode(HostNode hostNode, HostNode addedHostNode) {
    //merge database node
    List<DatabaseNode> dbNodeList = hostNode.getDbNodeList();
    List<DatabaseNode> addedDbNodeList = addedHostNode.getCopyedDbNodeList();
    for (int i = 0; i < addedDbNodeList.size(); i++) {
        DatabaseNode addDbNode = addedDbNodeList.get(i);
        if (dbNodeList.contains(addDbNode)) {
            DatabaseNode node = dbNodeList.get(dbNodeList.indexOf(addDbNode));
            node.setConnected(addDbNode.isConnected());
            node.setDbPassword(addDbNode.getDbPassword());
            node.setHaDatabaseStatus(addDbNode.getHaDatabaseStatus());
            for (int j = 0; addDbNode.getIncomingConnections() != null && j < addDbNode.getIncomingConnections().size(); j++) {
                node.addInput(addDbNode.getIncomingConnections().get(j));
            }
            for (int j = 0; addDbNode.getOutgoingConnections() != null && j < addDbNode.getOutgoingConnections().size(); j++) {
                node.addOutput(addDbNode.getOutgoingConnections().get(j));
            }
        } else {
            addDbNode.setParent(hostNode);
            hostNode.addDbNode(addDbNode);
        }
    }
    //merge broker node
    List<BrokerNode> brokerNodeList = hostNode.getBrokerNodeList();
    List<BrokerNode> addedBrokerNodeList = addedHostNode.getCopyedBrokerNodeList();
    for (int i = 0; i < addedBrokerNodeList.size(); i++) {
        BrokerNode addedBrokerNode = addedBrokerNodeList.get(i);
        if (brokerNodeList.contains(addedBrokerNode)) {
            BrokerNode node = brokerNodeList.get(brokerNodeList.indexOf(addedBrokerNode));
            node.setBrokerInfo(addedBrokerNode.getBrokerInfo());
        } else {
            addedBrokerNode.setParent(hostNode);
            hostNode.addBrokerNode(addedBrokerNode);
        }
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) Point(org.eclipse.draw2d.geometry.Point)

Example 13 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode in project cubrid-manager by CUBRID.

the class HAUtil method mergeCopyedHostChildNode.

/**
	 * 
	 * Merge the database node
	 * 
	 * @param hostNode The HostNode
	 * @param addedHostNode The HostNode
	 */
private static void mergeCopyedHostChildNode(HostNode hostNode, HostNode addedHostNode) {
    List<HANode> haNodeList = hostNode.getCopyedHaNodeList();
    //merge database node
    List<DatabaseNode> addedDbNodeList = addedHostNode.getCopyedDbNodeList();
    for (int i = 0; i < addedDbNodeList.size(); i++) {
        DatabaseNode addDbNode = addedDbNodeList.get(i);
        addDbNode.setParent(hostNode);
        if (haNodeList.contains(addDbNode)) {
            haNodeList.remove(addDbNode);
            haNodeList.add(addDbNode);
        } else {
            haNodeList.add(addDbNode);
        }
    }
    //merge broker node
    List<BrokerNode> addedBrokerNodeList = addedHostNode.getCopyedBrokerNodeList();
    for (int i = 0; i < addedBrokerNodeList.size(); i++) {
        BrokerNode addBrokerNode = addedBrokerNodeList.get(i);
        addBrokerNode.setParent(hostNode);
        if (haNodeList.contains(addBrokerNode)) {
            haNodeList.remove(addBrokerNode);
            haNodeList.add(addBrokerNode);
        } else {
            haNodeList.add(addBrokerNode);
        }
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) Point(org.eclipse.draw2d.geometry.Point)

Example 14 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode in project cubrid-manager by CUBRID.

the class AddHostAndDbWizard method performFinish.

/**
	 * Called when user clicks Finish
	 * 
	 * @return boolean
	 */
public boolean performFinish() {
    List<Map<String, Object>> dbNodeList = selectDbPage == null ? null : selectDbPage.getDbNodeList();
    List<Map<String, Object>> brokerNodeNodeList = selectBrokerPage == null ? null : selectBrokerPage.getBrokerNodeList();
    HostNode hostNode = mergeHostNode(setHostInfoPage == null ? null : setHostInfoPage.getHostNode());
    for (int i = 0; dbNodeList != null && i < dbNodeList.size(); i++) {
        Map<String, Object> map = dbNodeList.get(i);
        hostNode = mergeHostNode((HostNode) map.get("6"));
        DatabaseNode dbNode = (DatabaseNode) map.get("7");
        if (hostNode != null) {
            dbNode.setParent(hostNode);
            hostNode.getCopyedHaNodeList().remove(dbNode);
            hostNode.getCopyedHaNodeList().add(dbNode);
        }
    }
    for (int i = 0; brokerNodeNodeList != null && i < brokerNodeNodeList.size(); i++) {
        Map<String, Object> map = brokerNodeNodeList.get(i);
        hostNode = mergeHostNode((HostNode) map.get("8"));
        BrokerNode brokerNode = (BrokerNode) map.get("9");
        if (hostNode != null) {
            brokerNode.setParent(hostNode);
            hostNode.getCopyedHaNodeList().remove(brokerNode);
            hostNode.getCopyedHaNodeList().add(brokerNode);
        }
    }
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) Map(java.util.Map)

Example 15 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode in project cubrid-manager by CUBRID.

the class SelectBrokerPage method isBrokerNodeExist.

/**
	 * 
	 * Whether broker node exist
	 * 
	 * @param brokerName String
	 * @return boolean
	 */
private boolean isBrokerNodeExist(String brokerName) {
    for (int i = 0; i < brokerNodeList.size(); i++) {
        Map<String, Object> map = brokerNodeList.get(i);
        HostNode hostNode1 = (HostNode) map.get("8");
        BrokerNode brokerNode1 = (BrokerNode) map.get("9");
        if (hostNode.getIp().equals(hostNode1.getIp()) && hostNode.getPort().equals(hostNode1.getPort()) && hostNode.getUserName().equals(hostNode1.getUserName()) && brokerName.equalsIgnoreCase(brokerNode1.getBrokerName())) {
            return true;
        }
    }
    return false;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Aggregations

BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)28 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)14 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)12 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)8 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)7 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)5 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)4 Point (org.eclipse.draw2d.geometry.Point)4 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)3 ArrayList (java.util.ArrayList)3 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)2 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 BrokerDashboardViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart)2 BrokerMonitorFigure (com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerMonitorFigure)2 HashMap (java.util.HashMap)2 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)1 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1