use of com.cubrid.cubridmanager.core.common.model.ServerType in project cubrid-manager by CUBRID.
the class DiagStatusMonitorTemplateDialog method insertTreeObject.
/**
* Inserts terms to tree
*
*/
private void insertTreeObject() {
TargetConfigMap targetConfigMap = TargetConfigMap.getInstance();
EnumMap<EnumTargetConfig, TargetConfig> group = targetConfigMap.getMap();
TreeItem root = new TreeItem(targetTree, SWT.NONE);
root.setText(STATUS_MONITOR_LST);
serverInfo = selection.getServer().getServerInfo();
ServerType serverType = serverInfo.getServerType();
TargetConfig tc = null;
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
TreeItem db = new TreeItem(root, SWT.NONE);
db.setText(STATUS_MONITOR_LST_DB);
TreeItem serverQuery = new TreeItem(db, SWT.NONE);
serverQuery.setText(targetConfigMap.getQueryCategory());
TreeItem serverConn = new TreeItem(db, SWT.NONE);
serverConn.setText(targetConfigMap.getConnCategory());
TreeItem serverBuffer = new TreeItem(db, SWT.NONE);
serverBuffer.setText(targetConfigMap.getBufferCategory());
TreeItem serverLock = new TreeItem(db, SWT.NONE);
serverLock.setText(targetConfigMap.getLockCategory());
TreeItem queryOpenedPage = new TreeItem(serverQuery, SWT.NONE);
TreeItem querySlowQuery = new TreeItem(serverQuery, SWT.NONE);
TreeItem queryFullScan = new TreeItem(serverQuery, SWT.NONE);
TreeItem connCliRequest = new TreeItem(serverConn, SWT.NONE);
TreeItem connAbortedClients = new TreeItem(serverConn, SWT.NONE);
TreeItem connConnReq = new TreeItem(serverConn, SWT.NONE);
TreeItem connConnReject = new TreeItem(serverConn, SWT.NONE);
TreeItem bufferPageWrite = new TreeItem(serverBuffer, SWT.NONE);
TreeItem bufferPageRead = new TreeItem(serverBuffer, SWT.NONE);
TreeItem lockDeadlock = new TreeItem(serverLock, SWT.NONE);
TreeItem lockRequest = new TreeItem(serverLock, SWT.NONE);
tc = group.get(EnumTargetConfig.SERVER_QUERY_OPENED_PAGE);
queryOpenedPage.setData(tc);
queryOpenedPage.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_QUERY_SLOW_QUERY);
querySlowQuery.setData(tc);
querySlowQuery.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_QUERY_FULL_SCAN);
queryFullScan.setData(tc);
queryFullScan.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_CONN_CLI_REQUEST);
connCliRequest.setData(tc);
connCliRequest.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_CONN_ABORTED_CLIENTS);
connAbortedClients.setData(tc);
connAbortedClients.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_CONN_CONN_REQ);
connConnReq.setData(tc);
connConnReq.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_CONN_CONN_REJ);
connConnReject.setData(tc);
connConnReject.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_BUFFER_PAGE_WRITE);
bufferPageWrite.setData(tc);
bufferPageWrite.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_BUFFER_PAGE_READ);
bufferPageRead.setData(tc);
bufferPageRead.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_LOCK_DEADLOCK);
lockDeadlock.setData(tc);
lockDeadlock.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.SERVER_LOCK_REQUEST);
lockRequest.setData(tc);
lockRequest.setText(tc.getDisplayName());
db.setExpanded(true);
}
if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
TreeItem broker = new TreeItem(root, SWT.NONE);
broker.setText(STATUS_MONITOR_LST_BROKER);
TreeItem activeSession = new TreeItem(broker, SWT.NONE);
TreeItem requestSec = new TreeItem(broker, SWT.NONE);
TreeItem querySec = new TreeItem(broker, SWT.NONE);
TreeItem transactionSec = new TreeItem(broker, SWT.NONE);
TreeItem longQuery = new TreeItem(broker, SWT.NONE);
TreeItem longTran = new TreeItem(broker, SWT.NONE);
TreeItem errQuery = new TreeItem(broker, SWT.NONE);
tc = group.get(EnumTargetConfig.CAS_ST_ACTIVE_SESSION);
activeSession.setData(tc);
activeSession.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_REQUEST);
requestSec.setData(tc);
requestSec.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_QUERY);
querySec.setData(tc);
querySec.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_TRANSACTION);
transactionSec.setData(tc);
transactionSec.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_LONG_QUERY);
longQuery.setData(tc);
longQuery.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_LONG_TRAN);
longTran.setData(tc);
longTran.setText(tc.getDisplayName());
tc = group.get(EnumTargetConfig.CAS_ST_ERROR_QUERY);
errQuery.setData(tc);
errQuery.setText(tc.getDisplayName());
broker.setExpanded(true);
}
root.setExpanded(true);
}
use of com.cubrid.cubridmanager.core.common.model.ServerType in project cubrid-manager by CUBRID.
the class DiagStatusMonitorTemplateDialog method createTemplateGroup.
/**
* Creates template group
*
* @param composite The composite to contains the template group
*/
private void createTemplateGroup(Composite composite) {
final Group group = new Group(composite, SWT.RESIZE);
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
group.setLayout(new GridLayout(4, false));
group.setText(TEMPLATE_GROUP);
final Label nameLabel = new Label(group, SWT.NONE);
final GridData gdNameLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdNameLabel.widthHint = 90;
nameLabel.setLayoutData(gdNameLabel);
nameLabel.setText(TEMPLATE_NAME);
nameText = new Text(group, SWT.BORDER);
final GridData gdNameText = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdNameText.widthHint = 60;
nameText.setLayoutData(gdNameText);
final Label samplingTermsLbl = new Label(group, SWT.NONE);
final GridData gdSamplingTermsLbl = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdSamplingTermsLbl.widthHint = 130;
samplingTermsLbl.setLayoutData(gdSamplingTermsLbl);
samplingTermsLbl.setText(SAMPLE_TERM);
samplingTermscombo = new Combo(group, SWT.NONE);
final GridData gdSamplingTermscombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdSamplingTermscombo.widthHint = 60;
samplingTermscombo.setLayoutData(gdSamplingTermscombo);
samplingTermscombo.setItems(samplingTermsItems);
samplingTermscombo.setText(samplingTermsItems[0]);
final Label descriptionLabel = new Label(group, SWT.NONE);
final GridData gdDescriptionLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdDescriptionLabel.widthHint = 90;
descriptionLabel.setLayoutData(gdDescriptionLabel);
descriptionLabel.setText(TEMPLATE_DESC);
discriptionText = new Text(group, SWT.BORDER);
final GridData gdDiscriptionText = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdDiscriptionText.widthHint = 60;
discriptionText.setLayoutData(gdDiscriptionText);
ServerType serverType = serverInfo.getServerType();
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
final Label targetDbNameLbl = new Label(group, SWT.NONE);
final GridData gdTargetDbNameLbl = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdTargetDbNameLbl.widthHint = 130;
targetDbNameLbl.setLayoutData(gdTargetDbNameLbl);
targetDbNameLbl.setText(TARGET_DB);
targetDbNameCombo = new Combo(group, SWT.NULL);
final GridData gdTargetDbNameCombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdTargetDbNameCombo.widthHint = 60;
targetDbNameCombo.setLayoutData(gdTargetDbNameCombo);
}
}
use of com.cubrid.cubridmanager.core.common.model.ServerType 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.core.common.model.ServerType in project cubrid-manager by CUBRID.
the class PreferenceUtil method createPropertyDialog.
/**
* Create property dialog related with CUBRID node
*
* @param parentShell the parent shell
* @param node the ICubridNode object
* @return the Dialog object
*/
public static Dialog createPropertyDialog(Shell parentShell, ICubridNode node) {
PreferenceManager mgr = new PreferenceManager();
String type = node.getType();
ServerType serverType = node.getServer().getServerInfo().getServerType();
if (CubridNodeType.SERVER.equals(type)) {
// cubrid manager server property
ServerConfigPropertyPage cmServerPropertyPage = new ServerConfigPropertyPage(node, Messages.msgCmServerPropertyPageName);
PreferenceNode cmServerNode = new PreferenceNode(Messages.msgCmServerPropertyPageName);
cmServerNode.setPage(cmServerPropertyPage);
mgr.addToRoot(cmServerNode);
PreferenceNode categoryNode = createCategoryNode(Messages.msgConfigureParameterPageName, Messages.msgConfigureParameterPageName, Messages.msgDetailConfigureParameter);
mgr.addToRoot(categoryNode);
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
// service node
ServicePropertyPage servicePorpertyPage = new ServicePropertyPage(node, Messages.msgServicePropertyPageName);
PreferenceNode serviceNode = new PreferenceNode(Messages.msgServicePropertyPageName);
serviceNode.setPage(servicePorpertyPage);
categoryNode.add(serviceNode);
// database server node
DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
databaseServerNode.setPage(databaseServerPorpertyPage);
categoryNode.add(databaseServerNode);
// HA configuraiton
if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
HAPropertyPage haPropertyPage = new HAPropertyPage(node, Messages.msgHAPropertyPageName);
PreferenceNode haNode = new PreferenceNode(Messages.msgHAPropertyPageName);
haNode.setPage(haPropertyPage);
categoryNode.add(haNode);
}
}
if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
// brokers node
BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
brokersParameterNode.setPage(brokersParameterPorpertyPage);
categoryNode.add(brokersParameterNode);
}
// mananger node
ManagerServerPropertyPage managerPorpertyPage = new ManagerServerPropertyPage(node, Messages.msgManagerPropertyPageName);
PreferenceNode managerNode = new PreferenceNode(Messages.msgManagerPropertyPageName);
managerNode.setPage(managerPorpertyPage);
categoryNode.add(managerNode);
// query editor node
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
CubridServer server = node.getServer();
QueryOptionPreferencePage queryEditorPage = new QueryOptionPreferencePage(server);
PreferenceNode queryEditorNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
queryEditorNode.setPage(queryEditorPage);
mgr.addToRoot(queryEditorNode);
}
} else if (CubridNodeType.DATABASE_FOLDER.equals(type)) {
// database server node
DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
databaseServerNode.setPage(databaseServerPorpertyPage);
mgr.addToRoot(databaseServerNode);
} else if (CubridNodeType.DATABASE.equals(type)) {
// database parameter
DatabaseConfigPropertyPage databaseParameterPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerPropertyPageName, false);
PreferenceNode databaseParameterNode = new PreferenceNode(Messages.msgDatabaseServerPropertyPageName);
databaseParameterNode.setPage(databaseParameterPorpertyPage);
// database query
CubridDatabase database = (CubridDatabase) node;
DatabaseConnectionPropertyPage page = new DatabaseConnectionPropertyPage(database, Messages.msgQueryPropertyPageName);
PreferenceNode queryNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
queryNode.setPage(page);
mgr.addToRoot(queryNode);
mgr.addToRoot(databaseParameterNode);
} else if (CubridNodeType.BROKER_FOLDER.equals(type)) {
// brokers node
BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
brokersParameterNode.setPage(brokersParameterPorpertyPage);
mgr.addToRoot(brokersParameterNode);
}
if (CubridNodeType.BROKER.equals(type)) {
BrokerParameterPropertyPage brokerParameterPorpertyPage = new BrokerParameterPropertyPage(node, node.getLabel());
PreferenceNode brokerParameterNode = new PreferenceNode(node.getLabel());
brokerParameterNode.setPage(brokerParameterPorpertyPage);
mgr.addToRoot(brokerParameterNode);
} else if (CubridNodeType.SHARD_FOLDER.equals(type)) {
ShardsParameterPropertyPage shardsParameterPorpertyPage = new ShardsParameterPropertyPage(node, node.getName());
PreferenceNode shardsParameterNode = new PreferenceNode(Messages.msgShardsFolderName);
shardsParameterNode.setPage(shardsParameterPorpertyPage);
mgr.addToRoot(shardsParameterNode);
} else if (CubridNodeType.SHARD.equals(type)) {
ShardParameterPropertyPage shardParameterPorpertyPage = new ShardParameterPropertyPage(node, node.getName());
PreferenceNode shardParameterNode = new PreferenceNode(node.getName());
shardParameterNode.setPage(shardParameterPorpertyPage);
mgr.addToRoot(shardParameterNode);
}
CMPreferenceDialog dlg = new CMPreferenceDialog(parentShell, mgr, Messages.titlePropertiesDialog);
dlg.setPreferenceStore(CubridManagerUIPlugin.getDefault().getPreferenceStore());
return dlg;
}
use of com.cubrid.cubridmanager.core.common.model.ServerType in project cubrid-manager by CUBRID.
the class HostDashboardViewPart method init.
/**
* Initializes
*
* @param hostNode The HostNode
*/
public void init(HostNode hostNode) {
this.hostNode = hostNode;
String partName = getPartName();
String postfix = " - " + hostNode.getIp() + ":" + hostNode.getPort();
if (!partName.endsWith(postfix)) {
setPartName(partName + postfix);
}
ServerInfo serverInfo = hostNode.getServerInfo();
ServerType serverType = null;
if (serverInfo != null) {
serverType = serverInfo.getServerType();
}
if (serverType != ServerType.DATABASE && brokerChartPart == null) {
loadBrokerChart(chartComp);
chartComp.layout();
composite.layout();
}
if (serverInfo != null) {
String hostAddress = serverInfo.getHostAddress();
int monPort = serverInfo.getHostMonPort();
historyFileName = HistoryComposite.HOSTDASHBOARD_HISTORY_FILE_PREFIX + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
IPath histPath = CubridManagerCorePlugin.getDefault().getStateLocation();
historyPath = histPath.toOSString() + File.separator + historyFileName;
historyFileHelp = new HistoryFileHelp();
historyFileHelp.setHistoryPath(historyPath);
isNewBrokerDiag = CompatibleUtil.isNewBrokerDiag(serverInfo);
}
List<String> typeLst = new ArrayList<String>();
for (HostStatEnum hostEnum : HostStatEnum.values()) {
typeLst.add(hostEnum.getName());
}
for (BrokerDiagEnum brokerEnum : BrokerDiagEnum.values()) {
typeLst.add(brokerEnum.getName());
}
typeNames = typeLst.toArray(new String[typeLst.size()]);
DataGeneratorPool pool = DataGeneratorPool.getInstance();
String generatorName = hostNode.getUserName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
generator = pool.getDataGenerator(generatorName, new DataProvider());
generator.addDataUpdateListener(this);
}
Aggregations