use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode in project cubrid-manager by CUBRID.
the class DatabaseMonitorPart method refreshVisuals.
/**
* Refreshes this EditPart's <i>visuals</i>. This method is called by
* {@link #refresh()}, and may also be called in response to notifications
* from the model.
*/
protected void refreshVisuals() {
DatabaseMonitorFigure dmfg = (DatabaseMonitorFigure) this.getFigure();
DatabaseNode dn = (DatabaseNode) this.getModel();
dmfg.setTitle(dn.getName());
HADatabaseStatusInfo haDatabaseStatus = dn.getHaDatabaseStatus();
String dbStatus = "";
if (haDatabaseStatus != null) {
dmfg.setCpuUsage(haDatabaseStatus.getCpuUsage());
dmfg.setMemUsage(haDatabaseStatus.getMemUsage());
dmfg.setDelay(haDatabaseStatus.getDelay());
dbStatus = DBStatusType.getShowText(haDatabaseStatus.getStatusType());
}
dmfg.setStatus(true, dn.getParent().isConnected(), dn.isConnected(), dbStatus, dn.getErrorMsg(), dn.hasNewErrorMsg());
super.refreshVisuals();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode in project cubrid-manager by CUBRID.
the class DatabaseMonitorPart method createFigure.
/**
* get a database monitor figure.
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
* @return a database figure
*/
protected IFigure createFigure() {
DatabaseMonitorFigure dbMonitorFigure = new DatabaseMonitorFigure();
DatabaseNode databaseNode = (DatabaseNode) getModel();
HostNode hostNode = databaseNode.getParent();
dbMonitorFigure.setTitle(databaseNode.getName());
dbMonitorFigure.setHostName(hostNode.getName());
String statusText = DBStatusType.getShowText(databaseNode.getDbStatusType());
dbMonitorFigure.setStatus(true, hostNode.isConnected(), databaseNode.isConnected(), statusText, databaseNode.getErrorMsg(), databaseNode.hasNewErrorMsg());
dbMonitorFigure.setHint(new StringBuffer(" ").append(databaseNode.getDbName()).append("@").append(hostNode.getIp()).append(":").append(hostNode.getPort()).append(" ").toString());
return dbMonitorFigure;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode in project cubrid-manager by CUBRID.
the class OpenApplyLogDBLogAction method run.
/**
* open apply database log
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Object[] objArr = this.getSelectedObj();
if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
setEnabled(false);
return;
}
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
HostNode hostNode = dbNode.getParent();
ServerInfo serverInfo = hostNode.getServerInfo();
CubridServer server = new CubridServer(serverInfo.getHostAddress(), serverInfo.getHostAddress(), null, null);
server.setServerInfo(serverInfo);
LogInfo logInfo = new LogInfo();
String logPath = serverInfo.getEnvInfo().getRootDir() + serverInfo.getPathSeparator() + "log" + serverInfo.getPathSeparator();
String fileName = dbNode.getDbName() + "@localhost_applylogdb_" + dbNode.getDbName() + "_" + hostNode.getHostStatusInfo().getMasterHostStatusInfo().getHostName() + ".err";
logInfo.setPath(logPath + fileName);
DefaultCubridNode dbLogInfoNode = new DefaultCubridNode(dbNode.getDbName() + ICubridNodeLoader.NODE_SEPARATOR + "apply_database_log", logInfo.getName(), "icons/navigator/log_item.png");
dbLogInfoNode.setType(CubridNodeType.LOGS_APPLY_DATABASE_LOG);
dbLogInfoNode.setModelObj(logInfo);
dbLogInfoNode.setEditorId(LogEditorPart.ID);
dbLogInfoNode.setContainer(false);
dbLogInfoNode.setServer(server);
LogViewAction action = (LogViewAction) ActionManager.getInstance().getAction(LogViewAction.ID);
action.setCubridNode(dbLogInfoNode);
action.run();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode in project cubrid-manager by CUBRID.
the class OpenCopyLogDBLogAction method isSupported.
/**
*
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
* @param obj Object
* @return is supported.
*/
public boolean isSupported(Object obj) {
if (obj instanceof DatabaseMonitorPart) {
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) obj;
DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
HostNode hostNode = dbNode.getParent();
if (hostNode != null && hostNode.getServerInfo() != null && hostNode.getServerInfo().isConnected() && (dbNode.getDbStatusType() == DBStatusType.STANDBY || dbNode.getDbStatusType() == DBStatusType.MAINTENANCE) && hostNode.getHostStatusInfo() != null && hostNode.getHostStatusInfo().getMasterHostStatusInfo() != null) {
return true;
}
}
return false;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode in project cubrid-manager by CUBRID.
the class HAUtil method mergeHostChildNode.
/**
*
* Merge the database node
*
* @param hostNode The HostNode
* @param addedHostNode The HostNode
*/
private static void mergeHostChildNode(HostNode hostNode, HostNode addedHostNode) {
//merge database node
List<DatabaseNode> dbNodeList = hostNode.getDbNodeList();
List<DatabaseNode> addedDbNodeList = addedHostNode.getCopyedDbNodeList();
for (int i = 0; i < addedDbNodeList.size(); i++) {
DatabaseNode addDbNode = addedDbNodeList.get(i);
if (dbNodeList.contains(addDbNode)) {
DatabaseNode node = dbNodeList.get(dbNodeList.indexOf(addDbNode));
node.setConnected(addDbNode.isConnected());
node.setDbPassword(addDbNode.getDbPassword());
node.setHaDatabaseStatus(addDbNode.getHaDatabaseStatus());
for (int j = 0; addDbNode.getIncomingConnections() != null && j < addDbNode.getIncomingConnections().size(); j++) {
node.addInput(addDbNode.getIncomingConnections().get(j));
}
for (int j = 0; addDbNode.getOutgoingConnections() != null && j < addDbNode.getOutgoingConnections().size(); j++) {
node.addOutput(addDbNode.getOutgoingConnections().get(j));
}
} else {
addDbNode.setParent(hostNode);
hostNode.addDbNode(addDbNode);
}
}
//merge broker node
List<BrokerNode> brokerNodeList = hostNode.getBrokerNodeList();
List<BrokerNode> addedBrokerNodeList = addedHostNode.getCopyedBrokerNodeList();
for (int i = 0; i < addedBrokerNodeList.size(); i++) {
BrokerNode addedBrokerNode = addedBrokerNodeList.get(i);
if (brokerNodeList.contains(addedBrokerNode)) {
BrokerNode node = brokerNodeList.get(brokerNodeList.indexOf(addedBrokerNode));
node.setBrokerInfo(addedBrokerNode.getBrokerInfo());
} else {
addedBrokerNode.setParent(hostNode);
hostNode.addBrokerNode(addedBrokerNode);
}
}
}
Aggregations