use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class UserAuthDbInfoPage method initialBrokerPorts.
/**
*
* Initial the broker ports
*
* @param brokerIp String
*
*/
private void initialBrokerPorts(String brokerIp) {
String ip = server.getHostAddress();
if (!ip.equals(brokerIp)) {
allBrokerPorts = null;
return;
}
BrokerInfos brokerInfos = server.getServerInfo().getBrokerInfos();
if (brokerInfos != null) {
String brokerStauts = brokerInfos.getBrokerstatus();
BrokerInfoList brokerInfo = brokerInfos.getBorkerInfoList();
if (brokerInfo != null) {
List<BrokerInfo> brokerInfoList = brokerInfo.getBrokerInfoList();
if (brokerInfoList != null) {
List<String> brokerPortList = new ArrayList<String>();
for (int i = 0; i < brokerInfoList.size(); i++) {
BrokerInfo info = brokerInfoList.get(i);
if (info.getPort() == null || info.getPort().trim().length() == 0) {
continue;
}
String port = info.getPort();
String status = "";
if (brokerStauts == null || !brokerStauts.equalsIgnoreCase("ON")) {
status = "OFF";
} else {
status = info.getState() == null || info.getState().trim().equalsIgnoreCase("OFF") ? "OFF" : "ON";
}
brokerPortList.add(info.getName() + "[" + port + "/" + status + "]");
}
if (!brokerPortList.isEmpty()) {
allBrokerPorts = new String[brokerPortList.size()];
brokerPortList.toArray(allBrokerPorts);
}
}
}
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method loadBrokerInfo.
/**
* load broker information
*/
public void loadBrokerInfo() {
// if database is stop, do not get data
if (database.getRunningType() != DbRunningType.CS) {
return;
}
// broker info tasks
BrokerInfos brokerInfos = new BrokerInfos();
final CommonQueryTask<BrokerInfos> brokerInfosTask = new CommonQueryTask<BrokerInfos>(database.getServer().getServerInfo(), CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
new Thread(new Runnable() {
public void run() {
brokerInfosTask.execute();
if (!brokerInfosTask.isSuccess()) {
brokerInfosTask.finish();
return;
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
process();
}
});
}
private void process() {
asinfoLst.clear();
brokerInfoListData.clear();
BrokerInfos brokerInfos = brokerInfosTask.getResultModel();
if (null != brokerInfos) {
BrokerInfoList list = brokerInfos.getBorkerInfoList();
if (list != null && list.getBrokerInfoList() != null) {
// all broker
List<BrokerInfo> newBrokerInfoList = list.getBrokerInfoList();
for (BrokerInfo brokerInfo : newBrokerInfoList) {
BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
final GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(database.getServer().getServerInfo(), CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
statisTask.setBrokerName(brokerInfo.getName());
statisTask.execute();
brokerStatusInfos = statisTask.getResultModel();
if (brokerStatusInfos != null) {
//one broker status
List<ApplyServerInfo> applyServerInfoList = brokerStatusInfos.getAsinfo();
for (ApplyServerInfo applyServerInfo : applyServerInfoList) {
if (database.getName().equalsIgnoreCase(applyServerInfo.getAs_dbname())) {
HashMap<String, ApplyServerInfo> valueMap = new HashMap<String, ApplyServerInfo>();
valueMap.put(brokerInfo.getName(), applyServerInfo);
asinfoLst.add(valueMap);
}
}
}
statisTask.finish();
}
}
}
//set task obejct to table view
for (HashMap<String, ApplyServerInfo> brokerValueMap : asinfoLst) {
for (Entry<String, ApplyServerInfo> entry : brokerValueMap.entrySet()) {
String brokerName = entry.getKey();
ApplyServerInfo applyServerInfo = entry.getValue();
Map<String, String> brokerInfoMap = new HashMap<String, String>();
brokerInfoMap.put("0", brokerName);
brokerInfoMap.put("1", applyServerInfo.getAs_id());
brokerInfoMap.put("2", applyServerInfo.getAs_pid());
brokerInfoMap.put("3", applyServerInfo.getAs_num_query());
brokerInfoMap.put("4", applyServerInfo.getAs_long_query());
brokerInfoMap.put("5", applyServerInfo.getAs_status());
brokerInfoMap.put("6", applyServerInfo.getAs_lct());
brokerInfoListData.add(brokerInfoMap);
}
}
setBrokerInfoData();
brokerInfosTask.finish();
}
}).start();
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class ConnectHostJobExecutor method done.
/**
*
* Finish the task executor
*
* @param status IStatus
*/
private void done(final IStatus status) {
if (!hostNode.isConnecting()) {
hostNode.setConnected(false);
return;
}
if (status == Status.OK_STATUS) {
hostNode.setPort(String.valueOf(serverInfo.getHostMonPort()));
hostNode.setPassword(serverInfo.getUserPassword());
hostNode.setHostStatusInfo(haHostStatusInfo);
hostNode.setConnected(true);
if (haHostStatusInfo == null) {
haHostStatusInfo = HAUtil.getHAHostStatusInfo(serverInfo);
}
for (DatabaseNode dn : hostNode.getDbNodeList()) {
dn.setHaDatabaseStatus(HAUtil.getHADatabaseStatusInfo(dn.getDbName(), haHostStatusInfo, serverInfo));
}
for (BrokerNode brokerNode : hostNode.getBrokerNodeList()) {
BrokerInfo brokerInfo = HAUtil.getBrokerInfo(serverInfo.getBrokerInfos(), brokerNode.getBrokerName());
brokerNode.setBrokerInfo(brokerInfo);
}
} else {
hostNode.setConnected(wasConnected);
if (errorMsg != null) {
hostNode.setErrorMsg(errorMsg);
}
}
hostNode.setConnecting(false);
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class SelectBrokerPage method modifyText.
/**
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
* @param event ModifyEvent
*/
public void modifyText(ModifyEvent event) {
String brokerName = brokerNameCombo.getText();
if (brokerName.trim().length() == 0) {
addButton.setEnabled(false);
brokerStatusText.setText("");
brokerPortText.setText("");
accessModeText.setText("");
} else {
BrokerInfo brokerInfo = getBrokerInfo(brokerName);
nickNameText.setText(brokerName);
brokerPortText.setText(brokerInfo == null ? "" : brokerInfo.getPort());
brokerStatusText.setText(brokerInfo == null ? "" : brokerInfo.getState());
accessModeText.setText(brokerInfo == null || brokerInfo.getAccess_mode() == null ? "" : brokerInfo.getAccess_mode().toUpperCase(Locale.getDefault()));
addButton.setEnabled(true);
}
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class SelectBrokerPage method getBrokerInfo.
/**
*
* Get broker info
*
* @param brokerName String
* @return BrokerInfo
*/
private BrokerInfo getBrokerInfo(String brokerName) {
for (int i = 0; brokerInfoList != null && i < brokerInfoList.size(); i++) {
BrokerInfo brokerInfo = brokerInfoList.get(i);
String name = brokerInfoList.get(i).getName();
if (brokerName.equalsIgnoreCase(name)) {
return brokerInfo;
}
}
return null;
}
Aggregations