Search in sources :

Example 11 with DatabaseNode

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

the class DatabaseMonitorPart 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() {
    DatabaseMonitorFigure dmfg = (DatabaseMonitorFigure) this.getFigure();
    DatabaseNode dn = (DatabaseNode) this.getModel();
    dmfg.setTitle(dn.getName());
    HADatabaseStatusInfo haDatabaseStatus = dn.getHaDatabaseStatus();
    String dbStatus = "";
    if (haDatabaseStatus != null) {
        dmfg.setCpuUsage(haDatabaseStatus.getCpuUsage());
        dmfg.setMemUsage(haDatabaseStatus.getMemUsage());
        dmfg.setDelay(haDatabaseStatus.getDelay());
        dbStatus = DBStatusType.getShowText(haDatabaseStatus.getStatusType());
    }
    dmfg.setStatus(true, dn.getParent().isConnected(), dn.isConnected(), dbStatus, dn.getErrorMsg(), dn.hasNewErrorMsg());
    super.refreshVisuals();
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) DatabaseMonitorFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.DatabaseMonitorFigure) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Example 12 with DatabaseNode

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

the class DatabaseMonitorPart method createFigure.

/**
	 * get a database monitor figure.
	 * 
	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
	 * @return a database figure
	 */
protected IFigure createFigure() {
    DatabaseMonitorFigure dbMonitorFigure = new DatabaseMonitorFigure();
    DatabaseNode databaseNode = (DatabaseNode) getModel();
    HostNode hostNode = databaseNode.getParent();
    dbMonitorFigure.setTitle(databaseNode.getName());
    dbMonitorFigure.setHostName(hostNode.getName());
    String statusText = DBStatusType.getShowText(databaseNode.getDbStatusType());
    dbMonitorFigure.setStatus(true, hostNode.isConnected(), databaseNode.isConnected(), statusText, databaseNode.getErrorMsg(), databaseNode.hasNewErrorMsg());
    dbMonitorFigure.setHint(new StringBuffer(" ").append(databaseNode.getDbName()).append("@").append(hostNode.getIp()).append(":").append(hostNode.getPort()).append(" ").toString());
    return dbMonitorFigure;
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) DatabaseMonitorFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.DatabaseMonitorFigure) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 13 with DatabaseNode

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

the class OpenApplyLogDBLogAction method run.

/**
	 * open apply database log
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
    DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
    HostNode hostNode = dbNode.getParent();
    ServerInfo serverInfo = hostNode.getServerInfo();
    CubridServer server = new CubridServer(serverInfo.getHostAddress(), serverInfo.getHostAddress(), null, null);
    server.setServerInfo(serverInfo);
    LogInfo logInfo = new LogInfo();
    String logPath = serverInfo.getEnvInfo().getRootDir() + serverInfo.getPathSeparator() + "log" + serverInfo.getPathSeparator();
    String fileName = dbNode.getDbName() + "@localhost_applylogdb_" + dbNode.getDbName() + "_" + hostNode.getHostStatusInfo().getMasterHostStatusInfo().getHostName() + ".err";
    logInfo.setPath(logPath + fileName);
    DefaultCubridNode dbLogInfoNode = new DefaultCubridNode(dbNode.getDbName() + ICubridNodeLoader.NODE_SEPARATOR + "apply_database_log", logInfo.getName(), "icons/navigator/log_item.png");
    dbLogInfoNode.setType(CubridNodeType.LOGS_APPLY_DATABASE_LOG);
    dbLogInfoNode.setModelObj(logInfo);
    dbLogInfoNode.setEditorId(LogEditorPart.ID);
    dbLogInfoNode.setContainer(false);
    dbLogInfoNode.setServer(server);
    LogViewAction action = (LogViewAction) ActionManager.getInstance().getAction(LogViewAction.ID);
    action.setCubridNode(dbLogInfoNode);
    action.run();
}
Also used : LogViewAction(com.cubrid.cubridmanager.ui.logs.action.LogViewAction) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) LogInfo(com.cubrid.cubridmanager.core.logs.model.LogInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 14 with DatabaseNode

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

the class OpenCopyLogDBLogAction 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) {
    if (obj instanceof DatabaseMonitorPart) {
        DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) obj;
        DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
        HostNode hostNode = dbNode.getParent();
        if (hostNode != null && hostNode.getServerInfo() != null && hostNode.getServerInfo().isConnected() && (dbNode.getDbStatusType() == DBStatusType.STANDBY || dbNode.getDbStatusType() == DBStatusType.MAINTENANCE) && hostNode.getHostStatusInfo() != null && hostNode.getHostStatusInfo().getMasterHostStatusInfo() != null) {
            return true;
        }
    }
    return false;
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 15 with DatabaseNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode 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)

Aggregations

DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)36 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)20 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)14 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)11 ArrayList (java.util.ArrayList)9 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)6 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)5 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)4 HashMap (java.util.HashMap)4 List (java.util.List)4 Point (org.eclipse.draw2d.geometry.Point)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridData (org.eclipse.swt.layout.GridData)4 RowLayout (org.eclipse.swt.layout.RowLayout)4 Button (org.eclipse.swt.widgets.Button)4 Composite (org.eclipse.swt.widgets.Composite)4 Label (org.eclipse.swt.widgets.Label)4 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)3 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)3