use of com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask in project cubrid-manager by CUBRID.
the class PropertyAction method run.
/**
* Open property dialog,view and set property
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
return;
}
final ICubridNode node = (ICubridNode) obj[0];
String type = node.getType();
if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type) || CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
TaskExecutor taskExcutor = new GetPropertyExecutor(node, getShell());
ServerInfo serverInfo = node.getServer().getServerInfo();
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
if (CubridNodeType.SERVER.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
taskExcutor.addTask(getBrokerConfParameterTask);
taskExcutor.addTask(getCMConfParameterTask);
if (CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
taskExcutor.addTask(getHAConfParameterTask);
}
}
if (CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
}
if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
taskExcutor.addTask(getBrokerConfParameterTask);
}
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
}
if (!isCancel) {
Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
dialog.open();
}
}
use of com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask in project cubrid-manager by CUBRID.
the class SettingCubridHAConfPage method loadServerData.
private void loadServerData(HAServer haServer) {
CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getCubridConfTaskRunning);
GetHAConfParameterTask getCubridConfParameterTask = new GetHAConfParameterTask(haServer.getServer().getServerInfo());
taskExcutor.addTask(getCubridConfParameterTask);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
Map<String, Map<String, String>> haConfigMap = getCubridConfParameterTask.getConfParameters();
haServer.setOrigincCubridHAParameters(haConfigMap);
haServer.setCubridHAParameters(getConfigHAWizard().cloneParameters(haConfigMap));
appendDefaultHAConfig(haServer.getCubridHAParameters());
} else {
CommonUITool.openErrorBox(Messages.errLoadCubridHAConf);
}
}
use of com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask in project cubrid-manager by CUBRID.
the class ConfigParaHelp method performGetHAConf.
/**
* Perform the task of get ha.conf
*
* @param serverInfo the CubridServer
* @return the List<String>
*/
public static List<String> performGetHAConf(ServerInfo serverInfo) {
List<String> confContent = new ArrayList<String>();
CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getHaConfTaskRunning);
GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
taskExcutor.addTask(getHAConfParameterTask);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
confContent = getHAConfParameterTask.getConfContents();
}
return confContent;
}
use of com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask in project cubrid-manager by CUBRID.
the class HaShardDemo method getHaNodeInfo.
protected NodeInfo getHaNodeInfo(ServerInfo serverInfo, String haMode) {
//"heartbeatlist"
GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
getHeartbeatNodeInfoTask.setAllDb(true);
getHeartbeatNodeInfoTask.execute();
if (!getHeartbeatNodeInfoTask.isSuccess()) {
return null;
}
String status = getHeartbeatNodeInfoTask.getCurrentHostStatus();
NodeType type = CMServiceAnalysisUtil.convertHaStatToNodeType(status);
HaNode nodeInfo = null;
if (type != NodeType.NORMAL) {
nodeInfo = new HaNode(type);
nodeInfo.buildStatus("ON");
nodeInfo.setHostStatusInfoList(getHeartbeatNodeInfoTask.getHAHostStatusList());
} else if ("on".equals(haMode)) {
nodeInfo = new HaNode(NodeType.SLAVE);
nodeInfo.buildStatus("OFF");
} else if ("replica".equals(haMode)) {
nodeInfo = new HaNode(NodeType.REPLICA);
nodeInfo.buildStatus("OFF");
}
//"getallsysparam"/"cubrid_ha.conf"
GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
getHAConfParameterTask.execute();
BrokerInfos brokerInfos = new BrokerInfos();
GetBrokerStatusInfosTask<BrokerInfos> getBrokerStatusInfosTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
getBrokerStatusInfosTask.execute();
if (!getHAConfParameterTask.isSuccess() || !getBrokerStatusInfosTask.isSuccess()) {
return null;
}
brokerInfos = getBrokerStatusInfosTask.getResultModel();
if (brokerInfos != null) {
nodeInfo.setBrokerInfoList(brokerInfos.getBorkerInfoList());
}
Map<String, Map<String, String>> haConfParas = getHAConfParameterTask.getConfParameters();
Map<String, String> haCommonConf = haConfParas.get("[common]");
// String haNodeStr = haCommonConf.get("ha_node_list").substring("cubrid@".length());
// List<String> haNodeList = Arrays.asList(haNodeStr.split(":"));
// String replicaStr = haCommonConf.get("ha_replica_list");
// List<String> replicaNodeList = Arrays.asList(replicaStr.substring("cubrid@".length()).split(":"));
String dbList = haCommonConf.get("ha_db_list");
if (dbList.indexOf(",") > -1) {
String[] dbAr = dbList.split(",");
for (String s : dbAr) {
if (s.trim().length() > 0) {
nodeInfo.addDatabase(s);
}
}
} else {
nodeInfo.addDatabase(dbList);
}
return nodeInfo;
}
use of com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask in project cubrid-manager by CUBRID.
the class CubridServerLoader method getHostStatus.
/**
* Get host status
*
* @param server - CubridServer
*/
private void getHostStatus(final CubridServer server) {
final GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(server.getServerInfo());
getHeartbeatNodeInfoTask.setAllDb(true);
getHeartbeatNodeInfoTask.execute();
if (getHeartbeatNodeInfoTask.isSuccess()) {
HAHostStatusInfo haHostStatusInfo = getHeartbeatNodeInfoTask.getHostStatusInfo(server.getServerInfo().getHostAddress());
if (haHostStatusInfo != null) {
server.getServerInfo().setHaHostStatusInfo(haHostStatusInfo);
}
} else {
LOGGER.debug("Get host status error:" + getHeartbeatNodeInfoTask.getErrorMsg());
}
final GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(server.getServerInfo());
getHAConfParameterTask.execute();
if (getHAConfParameterTask.isSuccess()) {
server.getServerInfo().setHaConfParaMap(getHAConfParameterTask.getConfParameters());
} else {
LOGGER.debug("Get host ha status error:" + getHAConfParameterTask.getErrorMsg());
}
}
Aggregations