use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class MonitorDetailAction method isSupported.
/**
*
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
* @param obj Object
* @return is supported.
*/
public boolean isSupported(Object obj) {
HostNode hostNode = null;
if (obj instanceof HostMonitorPart) {
hostNode = (HostNode) ((HostMonitorPart) obj).getModel();
} else if (obj instanceof BrokerMonitorPart) {
BrokerNode brokerNode = (BrokerNode) ((BrokerMonitorPart) obj).getModel();
hostNode = brokerNode.getParent();
}
if (hostNode != null) {
return hostNode.isConnected();
}
if (obj instanceof DatabaseMonitorPart) {
DatabaseNode dbNode = (DatabaseNode) ((DatabaseMonitorPart) obj).getModel();
hostNode = dbNode.getParent();
return hostNode.isConnected() && dbNode.isConnected();
}
return false;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class SelectDbPage method isDbNodeExist.
/**
*
* Check whether this DatabaseNode already exist
*
* @param dbNode The DatabaseNode
* @return boolean
*/
private boolean isDbNodeExist(DatabaseNode dbNode) {
HostNode hostNode = dbNode.getParent();
for (int i = 0; i < dbNodeList.size(); i++) {
Map<String, Object> map = dbNodeList.get(i);
HostNode hostNode1 = (HostNode) map.get("6");
DatabaseNode dbNode1 = (DatabaseNode) map.get("7");
if (com.cubrid.common.core.util.StringUtil.isIpEqual(hostNode1.getIp(), hostNode.getIp()) && hostNode.getPort().equals(hostNode1.getPort()) && hostNode.getUserName().equals(hostNode1.getUserName()) && dbNode.getDbName().equals(dbNode1.getDbName())) {
return true;
}
}
return false;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class SetHostInfoPage method getHostNode.
/**
*
* Get Host Node
*
* @return The HostNode
*/
public HostNode getHostNode() {
HostNode hostNode = new HostNode();
String nickName = nickNameText.getText();
if (nickName.trim().length() == 0) {
nickName = ipText.getText() + ":" + portText.getText();
}
hostNode.setName(nickName);
hostNode.setIp(ipText.getText());
hostNode.setPort(portText.getText());
hostNode.setUserName(userNameText.getText());
hostNode.setPassword(passwordText.getText());
hostNode.setConnected(true);
HAHostStatusInfo hostStatusInfo = null;
if (heartbeatNodeInfoTask != null) {
hostStatusInfo = heartbeatNodeInfoTask.getHostStatusInfo(ipText.getText());
}
if (hostStatusInfo == null) {
hostStatusInfo = getHostStatusInfo(ipText.getText(), portText.getText());
}
if (hostStatusInfo == null) {
ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(ipText.getText(), Integer.parseInt(portText.getText()), userNameText.getText());
hostStatusInfo = HAUtil.getHAHostStatusInfo(serverInfo);
}
hostNode.setHostStatusInfo(hostStatusInfo);
return hostNode;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class ConnectionManager method connectAll.
/**
*
* Connect all hosts in dash board
*
* @param dashboard The Dashboard
*/
public static void connectAll(Dashboard dashboard) {
if (dashboard == null) {
return;
}
List<HostNode> hostNodList = dashboard.getHostNodeList();
for (int i = 0; i < hostNodList.size(); i++) {
HostNode hostNode = hostNodList.get(i);
if (hostNode.isConnecting()) {
continue;
}
connectHostInJob(hostNode, true, false);
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode in project cubrid-manager by CUBRID.
the class ShowHostAction method run.
/**
* Create a new figure in dashboard.
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IStructuredSelection selection = (IStructuredSelection) getSelection();
Iterator<?> iterator = selection.iterator();
List<HostNode> hosts = new ArrayList<HostNode>();
EditPart root = null;
while (iterator.hasNext()) {
Object objSelected = iterator.next();
if (objSelected instanceof DatabaseMonitorPart) {
DatabaseMonitorPart cmp = (DatabaseMonitorPart) objSelected;
DatabaseNode dn = ((DatabaseNode) cmp.getModel());
if (!hosts.contains(dn.getParent())) {
hosts.add(dn.getParent());
}
root = cmp.getParent();
} else if (objSelected instanceof BrokerMonitorPart) {
BrokerMonitorPart cmp = (BrokerMonitorPart) objSelected;
BrokerNode bn = ((BrokerNode) cmp.getModel());
if (!hosts.contains(bn.getParent())) {
hosts.add(bn.getParent());
}
root = cmp.getParent();
}
}
for (HostNode host : hosts) {
if (host.isVisible() == isChecked()) {
continue;
}
host.setVisible(isChecked());
}
if (root != null) {
root.refresh();
}
}
Aggregations