use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CQBConnectionChangingObserver method afterDelete.
/**
* Delete a connection.
*
* @param initiator IJDBCInfoChangedSubject who triggered the event.
* @param delCon IJDBCConnecInfo
*/
public void afterDelete(IJDBCInfoChangedSubject initiator, IJDBCConnecInfo delCon) {
if (CQBDBNodePersistManager.getInstance().equals(initiator)) {
return;
}
//If not a CUBRID connection
if (delCon.getDbType() != 1) {
return;
}
CubridDatabase database = CQBDatabaseFactory.getDatabaseJDBCConnectInfo(delCon);
if (database != null) {
/*Remove in CQB*/
CQBConnectionUtils.processConnectionDeleted(database);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(database, CubridNodeChangedEventType.DATABASE_LOGOUT));
refreshNavigationTree(null);
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridSystemMonitorFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
ServerInfo serverInfo = parent.getServer().getServerInfo();
ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
String hostSystemId = parent.getId() + NODE_SEPARATOR + HOST_SYSTEM_ID;
ICubridNode hostSystemNode = new DefaultCubridNode(hostSystemId, Messages.msgHostSystemMonitorName, "icons/navigator/status_item.png");
hostSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
hostSystemNode.setViewId(HostSystemMonitorViewPart.ID);
hostSystemNode.setContainer(false);
parent.addChild(hostSystemNode);
if (CompatibleUtil.isSupportDBSystemMonitor(serverInfo)) {
String dbSystemId = parent.getId() + NODE_SEPARATOR + DB_SYSTEM_ID;
ICubridNode dbSystemNode = new DefaultCubridNode(dbSystemId, Messages.msgDbSystemMonitorName, "icons/navigator/status_item.png");
dbSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
dbSystemNode.setViewId(DbSystemMonitorViewPart.ID);
dbSystemNode.setContainer(false);
parent.addChild(dbSystemNode);
}
}
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class MonitorStatisticPersistManager method removeMonitorStatistic.
/**
* Remove MonitorStatistic node according to <i>hostId</i>. If <i>hostId</i>
* is null, will check all the MonitorStatistic node belong to Dashboard
* tab.
*
* @param node
* @param hostId
*/
public void removeMonitorStatistic(MonitorStatistic node, String hostId) {
if (node == null) {
return;
}
synchronized (this) {
if (hostId == null) {
hostId = HOST_ID_FOR_MULTI_HOST;
}
List<MonitorStatistic> monitorStatisticList = monitorStatisticMap.get(hostId);
if (monitorStatisticList != null) {
monitorStatisticList.remove(node);
saveStatistic();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(node, CubridNodeChangedEventType.NODE_REMOVE));
}
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class MonitorStatisticPersistManager method addMonitorStatistic.
/**
*
* Add MonitorStatistic node according to <i>hostId</i>. If <i>hostId</i> is
* not null, will add a single host node for the specified host, else add a
* multi-host node for Dashboard tab.
*
* @param node MonitorStatistic
* @param hostId Host node id
*/
public void addMonitorStatistic(MonitorStatistic node, String hostId) {
if (node == null) {
return;
}
synchronized (this) {
if (hostId == null) {
hostId = HOST_ID_FOR_MULTI_HOST;
}
List<MonitorStatistic> monitorStatisticList = monitorStatisticMap.get(hostId);
if (monitorStatisticList == null) {
monitorStatisticList = new ArrayList<MonitorStatistic>();
}
monitorStatisticList.add(node);
//TODO:
monitorStatisticMap.put(hostId, monitorStatisticList);
saveStatistic();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(node, CubridNodeChangedEventType.NODE_ADD));
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridMonitorFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
ServerInfo serverInfo = parent.getServer().getServerInfo();
ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
//add status node
if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(serverInfo)) {
String brokerStatusId = parent.getId() + NODE_SEPARATOR + BROKER_STATUS_ID;
ICubridNode brokerStatusNode = new DefaultCubridNode(brokerStatusId, Messages.msgBrokerStatusMonitorName, "icons/navigator/status_item.png");
brokerStatusNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
brokerStatusNode.setViewId(BrokerStatusMonitorViewPart.ID);
brokerStatusNode.setContainer(false);
parent.addChild(brokerStatusNode);
String dbStatusId = parent.getId() + NODE_SEPARATOR + DB_STATUS_ID;
ICubridNode dbStautsNode = new DefaultCubridNode(dbStatusId, Messages.msgDbStatusMonitorName, "icons/navigator/status_item.png");
dbStautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
dbStautsNode.setViewId(DbStatusDumpMonitorViewPart.ID);
dbStautsNode.setContainer(false);
parent.addChild(dbStautsNode);
createTempStatusNode(parent);
} else {
if (!loadStatusTempInfoTask(parent, monitor, serverInfo)) {
return;
}
}
//add system node
if (CompatibleUtil.isSupportSystemMonitor(serverInfo)) {
String hostSystemId = parent.getId() + NODE_SEPARATOR + HOST_SYSTEM_ID;
ICubridNode hostSystemNode = new DefaultCubridNode(hostSystemId, Messages.msgHostSystemMonitorName, "icons/navigator/status_item.png");
hostSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
hostSystemNode.setViewId(HostSystemMonitorViewPart.ID);
hostSystemNode.setContainer(false);
parent.addChild(hostSystemNode);
if (CompatibleUtil.isSupportDBSystemMonitor(serverInfo)) {
String dbSystemId = parent.getId() + NODE_SEPARATOR + DB_SYSTEM_ID;
ICubridNode dbSystemNode = new DefaultCubridNode(dbSystemId, Messages.msgDbSystemMonitorName, "icons/navigator/status_item.png");
dbSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
dbSystemNode.setViewId(DbSystemMonitorViewPart.ID);
dbSystemNode.setContainer(false);
parent.addChild(dbSystemNode);
}
}
//add monitor statistic node
if (CompatibleUtil.isSupportMonitorStatistic(serverInfo)) {
List<MonitorStatistic> childList = MonitorStatisticPersistManager.getInstance().getMonitorStatisticListByHostId(serverInfo.getServerName());
for (MonitorStatistic node : childList) {
if (node == null) {
continue;
}
parent.addChild(node);
}
}
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
Aggregations