use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class BrokerDashboardViewPart method performUpdate.
/**
* Perform update UI when data change event happen
*
* @param dataChangedEvent the instance of DataChangedEvent
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
if (composite == null || composite.isDisposed()) {
return;
}
if (dataChangedEvent != null) {
String brokerName = brokerNode.getBrokerName();
BrokerInfos brokerInfos = dataChangedEvent.getBrokerInfosMap().get(brokerName);
BrokerStatusInfos brokerStatusInfos = dataChangedEvent.getBrokerStatusInfosMap().get(brokerName);
BrokerDiagData brokerDiagData = dataChangedEvent.getBrokerDiagDataMap().get(brokerName);
List<String> basicTableLst = new ArrayList<String>();
if (brokerInfos == null) {
for (int i = 0; i < 10; i++) {
basicTableLst.add("");
}
} else {
BrokerInfoList brokerInfoList = brokerInfos.getBorkerInfoList();
if (brokerInfoList.getBrokerInfoList().isEmpty()) {
for (int i = 0; i < 10; i++) {
basicTableLst.add("");
}
}
for (BrokerInfo bi : brokerInfoList.getBrokerInfoList()) {
if (brokerName.equals(bi.getName())) {
basicTableLst.add(bi.getPid());
basicTableLst.add(bi.getPort());
basicTableLst.add(bi.getJq());
basicTableLst.add(bi.getAuto());
basicTableLst.add(bi.getSqll());
basicTableLst.add(bi.getLong_tran_time());
basicTableLst.add(bi.getLong_query_time());
basicTableLst.add(bi.getSes());
basicTableLst.add(bi.getKeep_conn());
basicTableLst.add(bi.getAccess_mode());
}
}
}
if (brokerDiagData == null) {
for (int i = 0; i < 3; i++) {
basicTableLst.add("");
}
} else {
basicTableLst.add(brokerDiagData.getCas_mon_active());
basicTableLst.add(brokerDiagData.getCas_mon_session());
basicTableLst.add(brokerDiagData.getCas_mon_tran());
}
//test
List<List<String>> basicColumnLst = new ArrayList<List<String>>();
basicColumnLst.add(basicTableLst);
basicTableViewer.setInput(basicColumnLst);
basicTableViewer.refresh();
List<ApplyServerInfo> asinfoLst = null;
List<JobInfo> jobinfoLst = null;
if (brokerStatusInfos == null) {
asinfoLst = new ArrayList<ApplyServerInfo>();
jobinfoLst = new ArrayList<JobInfo>();
} else {
asinfoLst = brokerStatusInfos.getAsinfo();
jobinfoLst = brokerStatusInfos.getJobinfo();
if (asinfoLst == null) {
asinfoLst = new ArrayList<ApplyServerInfo>();
}
if (jobinfoLst == null) {
jobinfoLst = new ArrayList<JobInfo>();
}
}
asTableViewer.setInput(asinfoLst);
asTableViewer.refresh();
jqTableViewer.setInput(jobinfoLst);
jqTableViewer.refresh();
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method getText.
public String getText(Object element) {
if (element instanceof ICubridNode) {
if (element instanceof CubridDatabase) {
CubridDatabase database = (CubridDatabase) element;
StringBuffer sbLabel = new StringBuffer();
sbLabel.append(((ICubridNode) element).getLabel());
DatabaseEditorConfig editorConfig = QueryOptions.getEditorConfig(database, true);
if (editorConfig != null && editorConfig.getDatabaseComment() != null && editorConfig.getDatabaseComment().length() > 0) {
sbLabel.append("(").append(editorConfig.getDatabaseComment()).append(")");
return sbLabel.toString();
}
} else if (element instanceof CubridBroker) {
CubridBroker broker = (CubridBroker) element;
BrokerInfo brokerInfo = broker.getBrokerInfo();
if (brokerInfo == null || brokerInfo.getAccess_mode() == null) {
return broker.getName();
}
return broker.getName() + " (" + brokerInfo.getPort() + "," + brokerInfo.getAccess_mode() + ")";
} else if (element instanceof CubridServer) {
CubridServer server = (CubridServer) element;
return decorateServerText(server.getLabel(), server);
}
return ((ICubridNode) element).getLabel();
} else if (element instanceof PendingUpdateAdapter) {
return com.cubrid.common.ui.common.Messages.msgLoading;
}
return element == null ? "" : element.toString();
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class CubridHostNavigatorView method getToolTip.
/**
* Get tooltip string
*
* @param cubridNode ICubridNode
* @return String
*/
protected String getToolTip(ICubridNode cubridNode) {
StringBuffer toolTipText = new StringBuffer();
if (cubridNode instanceof CubridServer) {
CubridServer server = (CubridServer) cubridNode;
String ip = server.getHostAddress();
toolTipText.append(Messages.bind(Messages.tipIP, ip == null ? "" : ip)).append("\r\n");
String port = server.getMonPort();
toolTipText.append(Messages.bind(Messages.tipPort, port == null ? "" : port)).append("\r\n");
String userName = server.getUserName();
toolTipText.append(Messages.bind(Messages.tipUser, userName == null ? "" : userName)).append("\r\n");
String jdbcVersion = server.getJdbcDriverVersion();
toolTipText.append(Messages.bind(Messages.tipJDBC, jdbcVersion == null ? "" : jdbcVersion));
} else if (cubridNode instanceof CubridBroker) {
CubridBroker broker = (CubridBroker) cubridNode;
BrokerInfo brokerInfo = broker.getBrokerInfo();
String brokerMode = brokerInfo.getAccess_mode() == null ? Messages.tipBrokerAccessModeNotWorking : brokerInfo.getAccess_mode();
toolTipText.append(Messages.bind(Messages.tipBrokerPort, brokerInfo.getPort())).append("\r\n");
toolTipText.append(Messages.bind(Messages.tipBrokerAccessMode, brokerMode)).append("\r\n");
if (OnOffType.ON.getText().equalsIgnoreCase(brokerInfo.getState())) {
toolTipText.append(Messages.tipBrokerStatusON);
} else {
toolTipText.append(Messages.tipBrokerStatusOFF);
}
}
return toolTipText.toString();
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class EditStatisticHostDialog method refreshDbAndBrokerData.
/**
* Refresh database and broker data for the selected host.
*
* @param isSupported whether selected CUBRID host support monitor statistic
* feature
*/
private void refreshDbAndBrokerData(boolean isSupported, boolean isInitial) {
boolean isDbDataValid = false;
boolean isBrokerDataValid = false;
boolean isNeedInitDbNameValue = isNewHost || !isInitial || dbNameValue == null;
boolean isNeedInitBrokerNameValue = isNewHost || !isInitial || brokerNameValue == null;
boolean isDbContained = false;
if (isSupported) {
List<String> dbNameList = serverInfo.getAllDatabaseList();
if (dbNameList != null && dbNameList.size() > 0) {
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
getDatabaseListTask.execute();
if (getDatabaseListTask.isSuccess()) {
List<DatabaseInfo> dbInfoList = getDatabaseListTask.loadDatabaseInfo();
int activeDbCount = 0;
for (DatabaseInfo dbInfo : dbInfoList) {
if (DbRunningType.CS.equals(dbInfo.getRunningType())) {
for (String dbName : dbNameList) {
if (dbName.equals(dbInfo.getDbName())) {
activeDbCount++;
break;
}
}
}
}
if (activeDbCount != 0) {
isDbDataValid = true;
itemsDbName = new String[activeDbCount];
int itemsDbNameIndex = 0;
for (DatabaseInfo dbInfo : dbInfoList) {
if (DbRunningType.CS.equals(dbInfo.getRunningType())) {
for (String dbName : dbNameList) {
if (dbName.equals(dbInfo.getDbName())) {
itemsDbName[itemsDbNameIndex++] = dbName;
//check whether the DB name is in the DB name list when edit host
if (isInitial && !isNewHost && dbName.equals(dbNameValue)) {
isDbContained = true;
}
break;
}
}
}
}
if (isNeedInitDbNameValue) {
dbNameValue = itemsDbName[0];
}
}
}
if (serverInfo.getBrokerInfos() != null && serverInfo.getBrokerInfos().getBorkerInfoList() != null && serverInfo.getBrokerInfos().getBorkerInfoList().getBrokerInfoList() != null && serverInfo.getBrokerInfos().getBorkerInfoList().getBrokerInfoList().size() > 0) {
List<BrokerInfo> brokerInfoList = serverInfo.getBrokerInfos().getBorkerInfoList().getBrokerInfoList();
itemsBrokerName = new String[brokerInfoList.size()];
for (int i = 0; i < brokerInfoList.size(); i++) {
itemsBrokerName[i] = brokerInfoList.get(i).getName();
}
if (isNeedInitBrokerNameValue) {
brokerNameValue = itemsBrokerName[0];
}
isBrokerDataValid = true;
}
}
}
if (!isDbDataValid) {
itemsDbName = ITEMS_EMPTY;
if (isNeedInitDbNameValue) {
dbNameValue = VALUE_DEFAULT;
}
}
if (!isBrokerDataValid) {
itemsBrokerName = ITEMS_EMPTY;
if (isNeedInitBrokerNameValue) {
brokerNameValue = VALUE_DEFAULT;
}
}
StatisticType type = StatisticType.getEnumByMessage(comboDataType.getText());
type = type == null ? StatisticType.DB : type;
switch(type) {
case DB:
comboDbName.setItems(itemsDbName);
comboDbName.setText(dbNameValue);
isOkEnable[1] = (isInitial && !isNewHost) ? (isDbDataValid && isDbContained) : isDbDataValid;
isOkEnable[2] = true;
isOkEnable[3] = true;
break;
case DB_VOL:
comboDbName.setItems(itemsDbName);
comboDbName.setText(dbNameValue);
isOkEnable[1] = isDbDataValid;
if (isDbDataValid) {
refreshDbVolData(dbNameValue, isInitial);
isOkEnable[2] = !VALUE_DEFAULT.equals(dbVolNameValue);
} else {
itemsVolName = ITEMS_EMPTY;
if (isNewHost || !isInitial || dbVolNameValue == null) {
dbVolNameValue = VALUE_DEFAULT;
}
isOkEnable[2] = false;
}
comboVolName.setItems(itemsVolName);
comboVolName.setText(dbVolNameValue);
isOkEnable[3] = true;
break;
case BROKER:
comboBrokerName.setItems(itemsBrokerName);
comboBrokerName.setText(brokerNameValue);
isOkEnable[1] = true;
isOkEnable[2] = true;
isOkEnable[3] = isBrokerDataValid;
break;
case OS:
isOkEnable[1] = true;
isOkEnable[2] = true;
isOkEnable[3] = true;
break;
default:
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method setBrokerData.
/**
* Set Server Broker Data
*/
private void setBrokerData(ServiceDashboardInfo sDashInfo, BrokerInfos brokerInfos) {
String brokerPort = "";
int tps = 0, qps = 0, errorQ = 0;
if (brokerInfos != null) {
List<BrokerInfo> newBrokerInfoList = null;
BrokerInfoList list = brokerInfos.getBorkerInfoList();
if (list != null && list.getBrokerInfoList() != null) {
newBrokerInfoList = list.getBrokerInfoList();
}
if (newBrokerInfoList != null) {
for (BrokerInfo brokerInfo : newBrokerInfoList) {
brokerPort += brokerInfo.getPort() + " ";
tps += StringUtil.doubleValue(brokerInfo.getTran(), 0);
qps += StringUtil.doubleValue(brokerInfo.getQuery(), 0);
errorQ += StringUtil.doubleValue(brokerInfo.getError_query(), 0);
}
}
sDashInfo.setServerTps(tps);
sDashInfo.setServerQps(qps);
sDashInfo.setServerErrorQ(errorQ);
sDashInfo.setBrokerPort(brokerPort);
}
}
Aggregations