Search in sources :

Example 91 with ServerUserInfo

use of com.cubrid.cubridmanager.core.common.model.ServerUserInfo in project cubrid-manager by CUBRID.

the class CubridStatusMonitorFolderLoader method load.

/**
	 * 
	 * Load children object for parent
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        ServerInfo serverInfo = parent.getServer().getServerInfo();
        ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
        if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
            parent.removeAllChild();
            CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
            return;
        }
        if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(serverInfo)) {
            String brokerStatusId = parent.getId() + NODE_SEPARATOR + BROKER_STATUS_ID;
            ICubridNode brokerStatusNode = new DefaultCubridNode(brokerStatusId, Messages.msgBrokerStatusMonitorName, "icons/navigator/status_item.png");
            brokerStatusNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
            brokerStatusNode.setViewId(BrokerStatusMonitorViewPart.ID);
            brokerStatusNode.setContainer(false);
            parent.addChild(brokerStatusNode);
            String dbStatusId = parent.getId() + NODE_SEPARATOR + DB_STATUS_ID;
            ICubridNode dbStautsNode = new DefaultCubridNode(dbStatusId, Messages.msgDbStatusMonitorName, "icons/navigator/status_item.png");
            dbStautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
            dbStautsNode.setViewId(DbStatusDumpMonitorViewPart.ID);
            dbStautsNode.setContainer(false);
            parent.addChild(dbStautsNode);
            createTempStatusNode(parent);
        } else {
            if (!loadStatusTempInfoTask(parent, monitor, serverInfo)) {
                return;
            }
        }
        Collections.sort(parent.getChildren());
        setLoaded(true);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
    }
}
Also used : DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 92 with ServerUserInfo

use of com.cubrid.cubridmanager.core.common.model.ServerUserInfo in project cubrid-manager by CUBRID.

the class StopBrokerEnvAction method isSupportedNode.

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

Example 93 with ServerUserInfo

use of com.cubrid.cubridmanager.core.common.model.ServerUserInfo in project cubrid-manager by CUBRID.

the class DatabaseConnectionPropertyPage method loadPreference.

/**
	 * load the preference data.
	 */
private void loadPreference() {
    if (database == null) {
        return;
    }
    String brokerIp = QueryOptions.getBrokerIp(database.getDatabaseInfo());
    if (brokerIp == null || brokerIp.trim().length() == 0) {
        brokerIp = database.getServer().getHostAddress();
    }
    this.oldBrokerIp = brokerIp;
    brokerIpText.setText(brokerIp);
    String brokerPort = QueryOptions.getBrokerPort(database.getDatabaseInfo());
    this.oldBrokerPort = brokerPort;
    String text = (String) brokerPortCombo.getData(brokerPort);
    if (text != null) {
        brokerPortCombo.setText(text);
    }
    if (text == null && brokerPort != null) {
        brokerPortCombo.setText(brokerPort);
    }
    ServerUserInfo userInfo = database.getServer().getServerInfo().getLoginedUserInfo();
    if (!userInfo.isAdmin()) {
        brokerPortCombo.setEnabled(false);
        brokerIpText.setEnabled(false);
    }
    String charset = QueryOptions.getCharset(database.getDatabaseInfo());
    this.oldCharSet = charset;
    charsetCombo.setItems(QueryOptions.getAllCharset(charset));
    if (charset != null && charset.trim().length() > 0) {
        charsetCombo.setText(charset);
    } else {
        charsetCombo.select(0);
    }
}
Also used : ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

Example 94 with ServerUserInfo

use of com.cubrid.cubridmanager.core.common.model.ServerUserInfo in project cubrid-manager by CUBRID.

the class ShowSystemMonitorAction method isSupported.

/**
	 * Return whether this action support this object,if not support,this action
	 * will be disabled
	 * 
	 * @param obj Object
	 * @return boolean true if supported , false otherwise
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) obj;
        if (!CubridNodeType.SYSTEM_MONITOR_TEMPLATE.equals(node.getType())) {
            return false;
        }
        ServerUserInfo userInfo = node.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || (StatusMonitorAuthType.AUTH_ADMIN != userInfo.getStatusMonitorAuth() && StatusMonitorAuthType.AUTH_MONITOR != userInfo.getStatusMonitorAuth())) {
            return false;
        }
        return true;
    }
    return false;
}
Also used : ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 95 with ServerUserInfo

use of com.cubrid.cubridmanager.core.common.model.ServerUserInfo in project cubrid-manager by CUBRID.

the class EditStatusMonitorTemplateAction method isSupported.

/**
	 * Return whether this action support this object,if not support,this action
	 * will be disabled
	 * 
	 * @param obj Object
	 * @return boolean true if supported, false otherwise
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) obj;
        if (!CubridNodeType.STATUS_MONITOR_TEMPLATE.equals(node.getType())) {
            return false;
        }
        ServerUserInfo userInfo = node.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || StatusMonitorAuthType.AUTH_ADMIN != userInfo.getStatusMonitorAuth()) {
            return false;
        }
        return true;
    }
    return false;
}
Also used : ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Aggregations

ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)101 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)33 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)23 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)21 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)19 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)18 ArrayList (java.util.ArrayList)16 UpdateCMUserTask (com.cubrid.cubridmanager.core.common.task.UpdateCMUserTask)12 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)10 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)10 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)9 GetCMUserListTask (com.cubrid.cubridmanager.core.common.task.GetCMUserListTask)8 GetDatabaseListTask (com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask)8 CubridBrokerFolder (com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)8 Map (java.util.Map)8 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)7 ITask (com.cubrid.common.core.task.ITask)6 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)6 GetBrokerConfParameterTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)6 GetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask)6