Search in sources :

Example 36 with ServerUserInfo

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

the class StopSlaveDbAction method isSupportedNode.

/**
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 * @param obj Object
	 * @return boolean(whether to support)
	 */
public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) obj;
        if (!database.isLogined()) {
            return false;
        }
        ServerUserInfo serverUserInfo = database.getServer().getServerInfo().getLoginedUserInfo();
        if (serverUserInfo == null || !serverUserInfo.isAdmin()) {
            return false;
        }
        if (!database.isDistributorDb()) {
            return false;
        }
        ReplicationInfo replInfo = (ReplicationInfo) database.getAdapter(ReplicationInfo.class);
        boolean isSupported = false;
        if (replInfo != null && replInfo.getSlaveList() != null) {
            for (int i = 0; i < replInfo.getSlaveList().size(); i++) {
                DatabaseInfo dbInfo = serverUserInfo.getDatabaseInfo(replInfo.getSlaveList().get(i).getSlaveDbName());
                if (dbInfo == null || dbInfo.getRunningType() == DbRunningType.STANDALONE) {
                    isSupported = false;
                    break;
                } else {
                    isSupported = true;
                }
            }
        }
        return isSupported;
    }
    return false;
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) ReplicationInfo(com.cubrid.cubridmanager.core.replication.model.ReplicationInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 37 with ServerUserInfo

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

the class StartReplicationAgentAction method isSupportedNode.

/**
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 * @param obj Object
	 * @return boolean(whether to support)
	 */
public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) obj;
        if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
            return false;
        }
        ServerUserInfo serverUserInfo = database.getServer().getServerInfo().getLoginedUserInfo();
        if (serverUserInfo == null || !serverUserInfo.isAdmin()) {
            return false;
        }
        if (!database.isDistributorDb()) {
            return false;
        }
        ReplicationInfo replInfo = (ReplicationInfo) database.getAdapter(ReplicationInfo.class);
        for (int i = 0; replInfo != null && replInfo.getSlaveList() != null && i < replInfo.getSlaveList().size(); i++) {
            DatabaseInfo dbInfo = serverUserInfo.getDatabaseInfo(replInfo.getSlaveList().get(i).getSlaveDbName());
            if (dbInfo == null || dbInfo.getRunningType() == DbRunningType.STANDALONE) {
                return false;
            }
        }
        if (replInfo != null && replInfo.getDistInfo() != null) {
            return !replInfo.getDistInfo().isAgentActive();
        }
        return false;
    }
    return false;
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) ReplicationInfo(com.cubrid.cubridmanager.core.replication.model.ReplicationInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 38 with ServerUserInfo

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

the class StartReplicationServerAction method isSupported.

/**
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 * @param obj Object
	 * @return boolean(whether to support)
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) obj;
        if (!database.isLogined()) {
            return false;
        }
        ServerUserInfo serverUserInfo = database.getServer().getServerInfo().getLoginedUserInfo();
        if (serverUserInfo == null || !serverUserInfo.isAdmin()) {
            return false;
        }
        return database.isDistributorDb();
    }
    return false;
}
Also used : ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 39 with ServerUserInfo

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

the class StartSlaveDbAction method isSupportedNode.

/**
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
	 *      .lang.Object)
	 * @param obj Object
	 * @return boolean(whether to support)
	 */
public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) obj;
        if (!database.isLogined()) {
            return false;
        }
        ServerUserInfo serverUserInfo = database.getServer().getServerInfo().getLoginedUserInfo();
        if (serverUserInfo == null || !serverUserInfo.isAdmin()) {
            return false;
        }
        if (!database.isDistributorDb()) {
            return false;
        }
        ReplicationInfo replInfo = (ReplicationInfo) database.getAdapter(ReplicationInfo.class);
        boolean isSupported = false;
        if (replInfo != null && replInfo.getSlaveList() != null) {
            for (int i = 0; i < replInfo.getSlaveList().size(); i++) {
                DatabaseInfo dbInfo = serverUserInfo.getDatabaseInfo(replInfo.getSlaveList().get(i).getSlaveDbName());
                if (dbInfo == null || dbInfo.getRunningType() == DbRunningType.CS) {
                    isSupported = false;
                    break;
                } else {
                    isSupported = true;
                }
            }
        }
        return isSupported;
    }
    return false;
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) ReplicationInfo(com.cubrid.cubridmanager.core.replication.model.ReplicationInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 40 with ServerUserInfo

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

the class StartShardAction 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 CubridShard) {
        CubridShard selection = ((CubridShard) obj);
        ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
        if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
            return false;
        }
        return !selection.isRunning();
    }
    return false;
}
Also used : CubridShard(com.cubrid.cubridmanager.ui.spi.model.CubridShard) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo)

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