use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class DataProvider method performBrokerDiagTask.
/**
*
* Perform the task of BrokerDiagData
*
* @param returnMap the instance of TreeMap<IDiagPara, String>
*/
public void performBrokerDiagTask(Map<IDiagPara, String> returnMap) {
BrokerDiagData brokerDiagStatusResult = brokerDiagTask == null ? null : brokerDiagTask.getResultModel();
if (brokerDiagStatusResult == null) {
return;
}
if (!brokerDiagStatusResult.getStatus()) {
String detailMsg = "can not get broker diagnosis information.";
showErrorMsg(brokerDiagStatusResult.getNote(), detailMsg);
return;
}
if (brokerdiagRequestCount == 0) {
brokerDiagOldOneStatusResult = new BrokerDiagData();
brokerDiagOldTwoStatusResult = new BrokerDiagData();
brokerdiagRequestCount++;
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
} else if (brokerdiagRequestCount == 1) {
lastSec = Calendar.getInstance();
BrokerDiagData brokerDiagDataDelta = new BrokerDiagData();
brokerDiagDataDelta.getDelta(brokerDiagStatusResult, brokerDiagOldOneStatusResult);
returnMap.putAll(brokerDiagDataDelta.getDiagStatusResultMap());
brokerdiagRequestCount++;
brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
} else {
nowSec = Calendar.getInstance();
double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
inter = (float) interval;
lastSec = nowSec;
BrokerDiagData brokerDiagStatusResultDelta = new BrokerDiagData();
brokerDiagStatusResultDelta.getDelta(brokerDiagStatusResult, brokerDiagOldOneStatusResult, brokerDiagOldTwoStatusResult, inter);
returnMap.putAll(brokerDiagStatusResultDelta.getDiagStatusResultMap());
brokerDiagOldTwoStatusResult.copyFrom(brokerDiagOldOneStatusResult);
brokerDiagOldOneStatusResult.copyFrom(brokerDiagStatusResult);
}
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class HostDashboardViewPart method loadBrokerChart.
/**
* Load an instance of ChartCompositePart stand for broker monitor info
*
* @param parent the instance of Composite
*/
private void loadBrokerChart(Composite parent) {
brokerComp = new Composite(parent, SWT.NULL);
brokerComp.setLayout(new GridLayout());
brokerComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group brokerGrp = new Group(brokerComp, SWT.NONE);
brokerGrp.setText(Messages.hostBrokerSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
brokerGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
brokerGrp.setLayoutData(gridData);
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
brokerChartPart = new ChartCompositePart(brokerGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = brokerChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER);
}
brokerChartPart.loadContent();
JFreeChart chart = (JFreeChart) brokerChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) brokerChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(false);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData in project cubrid-manager by CUBRID.
the class AddMonitorInstanceDlg method createDialogArea.
/**
* Creates and returns the contents of the upper part of this dialog (above
* the button bar).
*
* @param parent The parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
initial();
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite comp = new Composite(parentComp, SWT.NO_FOCUS);
GridLayout layout = new GridLayout();
comp.setLayout(layout);
comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite typeComp = new Composite(comp, SWT.NONE);
typeComp.setLayout(new GridLayout(4, false));
typeComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Label typeLbl = new Label(typeComp, SWT.NONE);
typeLbl.setText(Messages.addMonInsDlgTypeLbl);
typeCombo = new Combo(typeComp, SWT.READ_ONLY);
final GridData gdContentTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
typeCombo.setLayoutData(gdContentTxt);
typeCombo.setItems(monitorTypes);
Label nodeLbl = new Label(typeComp, SWT.NONE);
nodeLbl.setText(Messages.addMonInsDlgNodeName);
nodeTxt = new Text(typeComp, SWT.BORDER);
nodeTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (monData == null) {
typeCombo.select(0);
} else {
MonitorType monitorType = monData.getMonitorType();
typeCombo.setText(monitorType.toString());
nodeTxt.setEnabled(false);
String noteLabel = selection.getLabel();
nodeTxt.setText(noteLabel);
}
nodeTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent ex) {
if (ValidateUtil.isValidDBName(nodeTxt.getText())) {
//using db name rule
isOkenable[0] = true;
} else {
isOkenable[0] = false;
}
enableOk();
}
});
typeCombo.addSelectionListener(new TypeSelectionAdapter());
final CTabFolder folder = new CTabFolder(comp, SWT.BORDER);
folder.setLayout(new GridLayout());
GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
folder.setLayoutData(gdTabFolder);
folder.setSimple(false);
TreeMap<String, ShowSetting> settingMap = new TreeMap<String, ShowSetting>();
chartSettingDlg = new ChartSettingDlg(null);
chartSettingDlg.setFolder(folder);
chartSettingDlg.setShowTitlteContent(true);
String historyFileName = hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
if (typeCombo.getSelectionIndex() == 0) {
historyFileName = HistoryComposite.BROKER_HISTORY_FILE_PREFIX + historyFileName;
} else if (typeCombo.getSelectionIndex() == 1) {
historyFileName = HistoryComposite.DB_HISTORY_FILE_PREFIX + historyFileName;
}
chartSettingDlg.setHistoryFileName(historyFileName);
if (monData == null) {
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = new ShowSetting();
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER, isNewBrokerDiag);
settingMap.put(key, showSetting);
}
IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
chartSettingDlg.setTitleName(defaultMonitorTtl[0]);
String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
chartSettingDlg.setHistoryPath(sHistoryPath);
} else {
//title
String titleName = monData.getTitleName();
String titleBgColor = monData.getTitleBgColor();
String titleFontName = monData.getTitleFontName();
int titleFontSize = monData.getTitleFontSize();
String titleFontColor = monData.getTitleFontColor();
chartSettingDlg.setTitleName(titleName);
chartSettingDlg.setTtlBgColor(titleBgColor);
chartSettingDlg.setTtlFontName(titleFontName);
chartSettingDlg.setTtlFontSize(titleFontSize);
chartSettingDlg.setTtlFontColor(titleFontColor);
//plot
String plotBgColor = monData.getPlotBgColor();
String plotDateAxisColor = monData.getPlotDateAxisColor();
String plotDomainGridColor = monData.getPlotDomainGridColor();
String plotNumberAxisColor = monData.getPlotNumberAxisColor();
String plotRangGridColor = monData.getPlotRangGridColor();
chartSettingDlg.setPlotBgColor(plotBgColor);
chartSettingDlg.setPlotDateAxisColor(plotDateAxisColor);
chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
chartSettingDlg.setPlotNumberAxisColor(plotNumberAxisColor);
chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
//series
settingMap = monData.getSettingMap();
//history path
String historyPath = monData.getHistoryPath();
chartSettingDlg.setHistoryPath(historyPath);
}
chartSettingDlg.setSettingMap(settingMap);
chartSettingDlg.createTtlTab();
chartSettingDlg.createPlotItem();
chartSettingDlg.createSeriesItemByDefault();
chartSettingDlg.createHistoryPathItem();
folder.setSelection(0);
saveBtn = new Button(comp, SWT.CHECK);
saveBtn.setText(Messages.btnSaveMonitorSetting);
setTitle(Messages.addMonInsDlgTtl);
setMessage(Messages.addMonInsDlgMsg);
return comp;
}
Aggregations