use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class EditBrokerConfigAction method isSupported.
public boolean isSupported(Object obj) {
if (obj instanceof CubridServer) {
CubridServer server = (CubridServer) obj;
ServerUserInfo userInfo = server.getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
return true;
} else if (obj instanceof CubridBrokerFolder) {
CubridServer server = ((CubridBrokerFolder) obj).getServer();
ServerUserInfo userInfo = server.getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
return true;
}
return false;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method getImage.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
public Image getImage(Object element) {
String iconPath = "";
if (element instanceof CubridServer) {
CubridServer server = (CubridServer) element;
if (server.isConnected()) {
iconPath = server.getConnectedIconPath();
} else {
iconPath = server.getDisConnectedIconPath();
}
Image serverImage = CubridManagerUIPlugin.getImage(iconPath);
return decorateServerImgae(serverImage, server);
} else if (element instanceof CubridDatabase) {
CubridDatabase database = (CubridDatabase) element;
if (database.getRunningType() == DbRunningType.STANDALONE && database.isLogined()) {
iconPath = database.getStopAndLoginIconPath();
} else if (database.getRunningType() == DbRunningType.STANDALONE && !database.isLogined()) {
iconPath = database.getStopAndLogoutIconPath();
} else if (database.getRunningType() == DbRunningType.CS && database.isLogined()) {
iconPath = database.getStartAndLoginIconPath();
} else if (database.getRunningType() == DbRunningType.CS && !database.isLogined()) {
iconPath = database.getStartAndLogoutIconPath();
}
Image databaseImage = CubridManagerUIPlugin.getImage(iconPath);
return decorateDatabaseImgae(databaseImage, database);
} else if (element instanceof CubridBrokerFolder) {
CubridBrokerFolder brokerFolder = (CubridBrokerFolder) element;
if (brokerFolder.isRunning()) {
iconPath = brokerFolder.getStartedIconPath();
} else {
iconPath = brokerFolder.getStopedIconPath();
}
} else if (element instanceof CubridBroker) {
CubridBroker broker = (CubridBroker) element;
if (broker.isRunning()) {
iconPath = broker.getStartedIconPath();
} else {
iconPath = broker.getStopedIconPath();
}
} else if (element instanceof CubridShardFolder) {
// TODO shard
CubridShardFolder shardFolder = (CubridShardFolder) element;
// if (shardFolder.isEnable()) {
if (shardFolder.isRunning()) {
iconPath = shardFolder.getStartedIconPath();
} else {
iconPath = shardFolder.getStopedIconPath();
}
// } else {
// iconPath = shardFolder.getDisableIconPath();
// }
} else if (element instanceof CubridShard) {
CubridShard shard = (CubridShard) element;
if (shard.isRunning()) {
iconPath = shard.getStartedIconPath();
} else {
iconPath = shard.getStopedIconPath();
}
} else if (element instanceof ICubridNode) {
ICubridNode node = (ICubridNode) element;
iconPath = node.getIconPath();
}
if (iconPath != null && iconPath.length() > 0) {
return CubridManagerUIPlugin.getImage(iconPath.trim());
}
return super.getImage(element);
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class CubridServerLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
parent.setEditorId(HostDashboardEditor.ID);
CubridServer server = parent.getServer();
if (!server.isConnected()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
ServerType serverType = server.getServerInfo().getServerType();
// add database folder
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
String databaseFolderId = parent.getId() + NODE_SEPARATOR + DATABASE_FOLDER_ID;
ICubridNode databaseFolder = parent.getChild(databaseFolderId);
if (databaseFolder == null) {
databaseFolder = new DefaultCubridNode(databaseFolderId, DATABASE_FOLDER_NAME, "icons/navigator/database_group.png");
databaseFolder.setType(NodeType.DATABASE_FOLDER);
databaseFolder.setContainer(true);
ICubridNodeLoader loader = new CubridDatabasesFolderLoader();
loader.setLevel(getLevel());
databaseFolder.setLoader(loader);
parent.addChild(databaseFolder);
if (getLevel() == DEFINITE_LEVEL) {
databaseFolder.getChildren(monitor);
}
} else {
if (databaseFolder.getLoader() != null && databaseFolder.getLoader().isLoaded()) {
databaseFolder.getLoader().setLoaded(false);
databaseFolder.getChildren(monitor);
}
}
}
ServerUserInfo userInfo = parent.getServer().getServerInfo().getLoginedUserInfo();
// add broker folder
if ((serverType == ServerType.BOTH || serverType == ServerType.BROKER) && userInfo != null && (CasAuthType.AUTH_ADMIN == userInfo.getCasAuth() || CasAuthType.AUTH_MONITOR == userInfo.getCasAuth())) {
String brokerFolderId = parent.getId() + NODE_SEPARATOR + BROKER_FOLDER_ID;
ICubridNode brokerFolder = parent.getChild(brokerFolderId);
if (brokerFolder == null) {
brokerFolder = new CubridBrokerFolder(brokerFolderId, BROKER_FOLDER_NAME, "icons/navigator/broker_group.png");
((CubridBrokerFolder) brokerFolder).setStartedIconPath("icons/navigator/broker_service_started.png");
brokerFolder.setContainer(true);
brokerFolder.setViewId(BrokerEnvStatusView.ID);
ICubridNodeLoader loader = new CubridBrokersFolderLoader();
loader.setLevel(getLevel());
brokerFolder.setLoader(loader);
parent.addChild(brokerFolder);
if (getLevel() == DEFINITE_LEVEL) {
brokerFolder.getChildren(monitor);
}
} else {
if (brokerFolder.getLoader() != null && brokerFolder.getLoader().isLoaded()) {
brokerFolder.getLoader().setLoaded(false);
brokerFolder.getChildren(monitor);
}
}
}
// #2 Remove the legacy monitoring menu
// // add monitor folder
// if (userInfo != null
// && (StatusMonitorAuthType.AUTH_ADMIN == userInfo.getStatusMonitorAuth() || StatusMonitorAuthType.AUTH_MONITOR == userInfo.getStatusMonitorAuth())) {
// String monitroingId = parent.getId() + NODE_SEPARATOR
// + MONITORING_FOLDER_ID;
// ICubridNode monitoringFolder = parent.getChild(monitroingId);
// if (monitoringFolder == null) {
// monitoringFolder = new DefaultCubridNode(monitroingId,
// MONITORING_FOLDER_NAME,
// "icons/navigator/status_group.png");
// monitoringFolder.setType(CubridNodeType.MONITOR_FOLDER);
// monitoringFolder.setContainer(true);
// ICubridNodeLoader loader = new CubridMonitorFolderLoader();
// loader.setLevel(getLevel());
// monitoringFolder.setLoader(loader);
// parent.addChild(monitoringFolder);
// if (getLevel() == DEFINITE_LEVEL) {
// monitoringFolder.getChildren(monitor);
// }
// } else {
// if (monitoringFolder.getLoader() != null
// && monitoringFolder.getLoader().isLoaded()) {
// monitoringFolder.getLoader().setLoaded(false);
// monitoringFolder.getChildren(monitor);
// }
// }
// }
// add logs folder
String logsFolderId = parent.getId() + NODE_SEPARATOR + LOGS_FOLDER_ID;
ICubridNode logsFolder = parent.getChild(logsFolderId);
if (logsFolder == null) {
logsFolder = new DefaultCubridNode(logsFolderId, LOGS_FOLDER_NAME, "icons/navigator/log_group_big.png");
logsFolder.setType(CubridNodeType.LOGS_FOLDER);
logsFolder.setContainer(true);
ICubridNodeLoader loader = new CubridLogsFolderLoader();
loader.setLevel(getLevel());
logsFolder.setLoader(loader);
parent.addChild(logsFolder);
if (getLevel() == DEFINITE_LEVEL) {
logsFolder.getChildren(monitor);
}
} else {
if (logsFolder.getLoader() != null && logsFolder.getLoader().isLoaded()) {
logsFolder.getLoader().setLoaded(false);
logsFolder.getChildren(monitor);
}
}
if (server.isConnected() && CompatibleUtil.isSupportHA(server.getServerInfo())) {
getHostStatus(server);
}
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class ShowBrokerEnvStatusAction method isSupported.
/**
* 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 boolean isSupported(Object obj) {
if (obj instanceof CubridBrokerFolder) {
CubridBrokerFolder selection = ((CubridBrokerFolder) obj);
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;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class StartBrokerAction 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 CubridBroker) {
CubridBroker selection = ((CubridBroker) obj);
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;
}
Aggregations