Search in sources :

Example 1 with CubridBrokerFolder

use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method init.

/**
	 * Initializes this view with the given view site.
	 *
	 * @param site the view site
	 * @exception PartInitException if this view was not initialized
	 *            successfully
	 */
public void init(IViewSite site) throws PartInitException {
    super.init(site);
    if (null != cubridNode && CubridNodeType.BROKER_FOLDER.equals(cubridNode.getType())) {
        String serverName = cubridNode.getServer().getLabel();
        String port = cubridNode.getServer().getMonPort();
        setPartName(Messages.bind(Messages.envHeadTitel, serverName, port));
        CubridBrokerFolder brokerFolderNode = (CubridBrokerFolder) cubridNode;
        if (brokerFolderNode != null && brokerFolderNode.isRunning()) {
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_service_started.png"));
        } else {
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_group.png"));
        }
        runflag = brokerFolderNode == null ? false : brokerFolderNode.isRunning();
    }
}
Also used : CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 2 with CubridBrokerFolder

use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.

the class StartRetargetAction method run.

/**
	 * start database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StartServiceAction startServiceAction = (StartServiceAction) ActionManager.getInstance().getAction(StartServiceAction.ID);
        startServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StartDatabaseAction startDatabaseAction = (StartDatabaseAction) ActionManager.getInstance().getAction(StartDatabaseAction.ID);
        startDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StartBrokerAction startBrokerAction = (StartBrokerAction) ActionManager.getInstance().getAction(StartBrokerAction.ID);
        startBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StartBrokerEnvAction startBrokerEnvAction = (StartBrokerEnvAction) ActionManager.getInstance().getAction(StartBrokerEnvAction.ID);
        startBrokerEnvAction.run();
    }
}
Also used : StartBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StartBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) StartDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StartDatabaseAction) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 3 with CubridBrokerFolder

use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.

the class StopRetargetAction method run.

/**
	 * stop database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StopServiceAction stopServiceAction = (StopServiceAction) ActionManager.getInstance().getAction(StopServiceAction.ID);
        stopServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StopDatabaseAction stopDatabaseAction = (StopDatabaseAction) ActionManager.getInstance().getAction(StopDatabaseAction.ID);
        stopDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StopBrokerAction stopBrokerAction = (StopBrokerAction) ActionManager.getInstance().getAction(StopBrokerAction.ID);
        stopBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StopBrokerEnvAction stopBrokerEnvAction = (StopBrokerEnvAction) ActionManager.getInstance().getAction(StopBrokerEnvAction.ID);
        stopBrokerEnvAction.run();
    }
}
Also used : StopBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StopDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StopDatabaseAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder) StopBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerAction)

Example 4 with CubridBrokerFolder

use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method nodeChanged.

/**
	 * Response to cubrid node changes
	 *
	 * @param event the event
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode eventNode = event.getCubridNode();
    if (eventNode == null || this.cubridNode == null) {
        return;
    }
    //if it is not in the same host,return
    if (!eventNode.getServer().getId().equals(this.cubridNode.getServer().getId())) {
        return;
    }
    //if changed node is not broker folder or server,return
    String type = eventNode.getType();
    if (!CubridNodeType.BROKER_FOLDER.equals(type) && !CubridNodeType.SERVER.equals(type)) {
        return;
    }
    synchronized (this) {
        if (type == NodeType.SERVER) {
            String id = eventNode.getId();
            CubridBrokerFolder currentNode = (CubridBrokerFolder) eventNode.getChild(id);
            this.cubridNode = currentNode;
        } else {
            this.cubridNode = eventNode;
        }
        if (this.cubridNode == null || !((CubridBrokerFolder) eventNode).isRunning()) {
            setRunflag(false);
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_group.png"));
            return;
        } else {
            setRunflag(true);
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_service_started.png"));
        }
        refresh(true, false);
    }
}
Also used : ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 5 with CubridBrokerFolder

use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.

the class RestartBrokerAction method isSupportedNode.

public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridBroker) {
        CubridBroker selection = ((CubridBroker) obj);
        if (selection.getServer() == null || selection.getServer().getServerInfo() == null) {
            return false;
        }
        ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
            return false;
        }
        CubridBrokerFolder parent = (CubridBrokerFolder) (selection.getParent());
        return parent.isRunning() && selection.isRunning();
    }
    return false;
}
Also used : CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Aggregations

CubridBrokerFolder (com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)16 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)8 CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)6 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)4 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)1 StartBrokerEnvTask (com.cubrid.cubridmanager.core.broker.task.StartBrokerEnvTask)1 StopBrokerEnvTask (com.cubrid.cubridmanager.core.broker.task.StopBrokerEnvTask)1 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1 StartBrokerAction (com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction)1