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();
}
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);
}
}
}
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);
}
}
}
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;
}
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;
}
Aggregations