Search in sources :

Example 6 with CubridShardFolder

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

the class ShardEnvStatusView 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.SHARD_FOLDER.equals(cubridNode.getType())) {
        String serverName = cubridNode.getServer().getLabel();
        String port = cubridNode.getServer().getMonPort();
        // Shard Broker Status - All@{0}-{1}
        setPartName(Messages.bind(Messages.envHeadTitel, serverName, port));
        CubridShardFolder shardFolderNode = (CubridShardFolder) cubridNode;
        if (shardFolderNode != null && shardFolderNode.isRunning()) {
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_service_started.png"));
            runflag = true;
        } else {
            this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_group.png"));
        }
    }
}
Also used : CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder)

Example 7 with CubridShardFolder

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

the class StopShardEnvAction method isSupportedNode.

/**
	 * Return whether this action support this object,if not support,this action
	 * will be disabled
	 * 
	 * @param obj
	 *            the object
	 * @return <code>true</code> if supported;<code>false</code>
	 */
public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridShardFolder) {
        CubridShardFolder selection = ((CubridShardFolder) obj);
        if (!selection.isEnable()) {
            return false;
        }
        ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
            return false;
        }
        return selection.isRunning();
    }
    return false;
}
Also used : CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

Example 8 with CubridShardFolder

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

the class StopShardEnvAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    CubridShardFolder selection = (CubridShardFolder) obj[0];
    if (null == selection) {
        return;
    }
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopShardTask task = new StopShardTask(serverInfo, null);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardEnvActionName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    if (!task.isSuccess()) {
        String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
        CommonUITool.openErrorBox(msg);
        return;
    }
    selection.setRunning(false);
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection);
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) StopShardTask(com.cubrid.cubridmanager.core.shard.task.StopShardTask)

Example 9 with CubridShardFolder

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

the class ShowShardStatusAction method isSupported.

/**
	 * Return whether this action support this object,if not support,this action
	 * will be disabled
	 * 
	 * @param obj
	 *            the object
	 * @return <code>true</code> if supported;<code>false</code>
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof CubridShardFolder) {
        CubridShardFolder selection = ((CubridShardFolder) obj);
        if (!selection.isEnable()) {
            return false;
        }
        ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || (CasAuthType.AUTH_ADMIN != userInfo.getCasAuth() && CasAuthType.AUTH_MONITOR != userInfo.getCasAuth())) {
            return false;
        }
        return true;
    }
    return false;
}
Also used : CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

Aggregations

CubridShardFolder (com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder)9 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)4 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 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 CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 IMessageHandler (com.cubrid.common.ui.spi.IMessageHandler)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)1 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)1 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)1 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)1 Shards (com.cubrid.cubridmanager.core.shard.model.Shards)1 GetShardConfTask (com.cubrid.cubridmanager.core.shard.task.GetShardConfTask)1