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 BrokerNode method setBrokerInfo.
/**
* Set broker info.
*
* @param brokerInfo BrokerInfo
*/
public void setBrokerInfo(BrokerInfo brokerInfo) {
BrokerInfo old = this.brokerInfo;
this.brokerInfo = brokerInfo;
this.firePropertyChange(PROP_BROKER_STATUS, old, brokerInfo);
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class BrokerMonitorPart method setMode2View.
/**
* Set model's value to view.
*
* @param figure BrokerMonitorFigure
* @param broker BrokerNode
*/
private void setMode2View(BrokerMonitorFigure figure, BrokerNode broker) {
HostNode hostNode = broker.getParent();
figure.setTitle(broker.getName());
figure.setHostName(hostNode.getName());
String brokerStatus = BrokerMonitorFigure.STATUS_UNKNOWN;
String accessMode = OnOffType.OFF.getText();
BrokerInfo brokerInfo = broker.getBrokerInfo();
if (brokerInfo != null) {
brokerStatus = brokerInfo.getState();
accessMode = brokerInfo.getAccess_mode();
}
figure.setStatus(true, hostNode.isConnected(), brokerStatus, accessMode, broker.getErrorMsg(), broker.hasNewErrorMsg());
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class BrokerMonitorPartHelper method performUpdate.
/**
* Perform the update data
*
* @param dataChangedEvent the given event including newest data
*/
public void performUpdate(DataChangedEvent dataChangedEvent) {
if (!brokerNode.getParent().isConnected()) {
brokerNode.setBrokerInfo(null);
brokerNode.setBrokerDiagData(null);
brokerNode.setBrokerStatusInfos(null);
return;
}
String brokerName = brokerNode.getBrokerName();
BrokerInfo brokerInfo = HAUtil.getBrokerInfo(dataChangedEvent.getBrokerInfosMap().get(brokerName), brokerName);
brokerNode.setBrokerInfo(brokerInfo);
brokerNode.setBrokerDiagData(dataChangedEvent.getBrokerDiagDataMap().get(brokerName));
brokerNode.setBrokerStatusInfos(dataChangedEvent.getBrokerStatusInfosMap().get(brokerName));
}
use of com.cubrid.cubridmanager.core.broker.model.BrokerInfo in project cubrid-manager by CUBRID.
the class CubridBrokerFolderLoader method checkBrokerExist.
/**
*
* Check broker whether exist
*
* @param parent the parent node
* @param monitor the IProgressMonitor
* @return <code>0</code> exist;<code>1</code> has error;<code>2</code>
* canceled;<code>3</code> no exist;
*/
private int checkBrokerExist(final ICubridNode parent, final IProgressMonitor monitor) {
ServerInfo serverInfo = parent.getServer().getServerInfo();
BrokerInfos brokerInfos = new BrokerInfos();
final CommonQueryTask<BrokerInfos> getBrokersTask = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), brokerInfos);
monitorCancel(monitor, new ITask[] { getBrokersTask });
getBrokersTask.execute();
final String msg = getBrokersTask.getErrorMsg();
if (!monitor.isCanceled() && msg != null && msg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(msg);
setLoaded(true);
return 1;
}
if (monitor.isCanceled()) {
setLoaded(true);
return 2;
}
CubridBroker broker = (CubridBroker) parent;
String brokerName = broker.getLabel();
brokerInfos = getBrokersTask.getResultModel();
boolean isExist = false;
List<BrokerInfo> brokerInfoList = (brokerInfos == null || brokerInfos.getBorkerInfoList() == null) ? null : brokerInfos.getBorkerInfoList().getBrokerInfoList();
for (int i = 0; brokerInfoList != null && i < brokerInfoList.size(); i++) {
BrokerInfo brokerInfo = brokerInfoList.get(i);
if (brokerInfo.getName().equalsIgnoreCase(brokerName)) {
broker.setRunning(brokerInfo.getState() == null ? false : brokerInfo.getState().equalsIgnoreCase("ON"));
isExist = true;
}
}
return isExist ? 0 : 3;
}
Aggregations