Search in sources :

Example 6 with HostNode

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;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 7 with HostNode

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;
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 8 with HostNode

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;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 9 with 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);
    }
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 10 with HostNode

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();
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) ArrayList(java.util.ArrayList) EditPart(org.eclipse.gef.EditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Aggregations

HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)57 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)20 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)12 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)10 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)9 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)8 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)7 ArrayList (java.util.ArrayList)6 Point (org.eclipse.draw2d.geometry.Point)6 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)4 AddHostAndDbWizard (com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard)4 DataProvider (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider)4 IViewPart (org.eclipse.ui.IViewPart)4 IViewReference (org.eclipse.ui.IViewReference)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)4 PartInitException (org.eclipse.ui.PartInitException)4 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)3 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)3 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)3