Search in sources :

Example 16 with BrokerNode

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

the class BrokerDataProvider method getUpdateValue.

/**
	 * 
	 * Get broker related update value
	 * 
	 * @return DataChangedEvent
	 * 
	 */
public DataChangedEvent getUpdateValue() {
    DataChangedEvent dataChangedEvent = new DataChangedEvent(this);
    if (!isExecGetBrokerTask) {
        setErrorMsg("");
        return dataChangedEvent;
    }
    if (isExecGetBrokerTask) {
        BrokerInfos brokerInfos = performGetBrokersInfoTask();
        if (serverInfo != null) {
            serverInfo.setBrokerInfos(brokerInfos);
        }
        BrokerStatusInfos brokerStatusInfos = performGetBrokersStatusTask();
        if (brokerdiagRequestCount < 2) {
            performGetBrokerDiagDataTask(null);
        }
        for (BrokerNode brokerNode : brokerNodeList) {
            String brokerName = brokerNode.getBrokerName();
            dataChangedEvent.getBrokerInfosMap().put(brokerName, brokerInfos);
            dataChangedEvent.getBrokerStatusInfosMap().put(brokerName, brokerStatusInfos == null ? null : brokerStatusInfos.getSubBrokerByName(brokerName));
            if (brokerdiagRequestCount >= 2) {
                dataChangedEvent.getBrokerDiagDataMap().put(brokerName, performGetBrokerDiagDataTask(brokerName));
            }
        }
    }
    setErrorMsg(errorMsg);
    if (errorMsg != null && errorMsg.trim().length() > 0) {
        LOGGER.error(errorMsg);
    }
    return dataChangedEvent;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 17 with BrokerNode

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

the class DataGenerator method removeDataUpdateListener.

/**
	 * 
	 * remove a instance of DataUpdateListener to make it can be update
	 * 
	 * @param listener an instance of DataUpdateListener
	 */
public void removeDataUpdateListener(DataUpdateListener listener) {
    synchronized (listeners) {
        listeners.remove(listener);
        if (listeners.isEmpty()) {
            setRunflag(false);
            HostNode hostNode = null;
            if (listener.getModel() instanceof HostNode) {
                hostNode = (HostNode) listener.getModel();
            } else if (listener.getModel() instanceof DatabaseNode) {
                hostNode = ((DatabaseNode) listener.getModel()).getParent();
            } else if (listener.getModel() instanceof BrokerNode) {
                hostNode = ((BrokerNode) listener.getModel()).getParent();
            }
            if (hostNode != null) {
                hostNode.setConnecting(false);
            }
            getThreadPoolManager().disposeAll();
            DataGeneratorPool pool = DataGeneratorPool.getInstance();
            pool.removeDataGenerator(getName());
        }
    }
}
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)

Example 18 with BrokerNode

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

the class ShowBrokerClientAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    if (this.isChecked()) {
        if (null == clientNode) {
            clientNode = new ClientNode();
            clientNode.setBrokerNode(model);
            db.addClientNode(clientNode);
        }
        clientNode.setVisible(true);
    } else {
        clientNode.setVisible(false);
    }
    db.refresh();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 19 with BrokerNode

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

the class ShowBrokerClientAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    if (!(selection.getFirstElement() instanceof BrokerMonitorPart)) {
        return false;
    }
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    setChecked(null != clientNode && clientNode.isVisible());
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 20 with BrokerNode

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

the class ShowBrokerDabaseAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    BrokerDBListNode brokerDBListNode = db.getBrokerDBListNodeByBroker(model);
    if (isChecked()) {
        if (null == brokerDBListNode) {
            brokerDBListNode = new BrokerDBListNode();
            brokerDBListNode.setBrokerNode(model);
            db.addBrokerDBListNode(brokerDBListNode);
        }
        brokerDBListNode.setVisible(true);
    } else {
        brokerDBListNode.setVisible(false);
    }
    db.refresh();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

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