use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridLogsFolderLoader 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;
}
ServerType serverType = parent.getServer().getServerInfo().getServerType();
// add broker logs folder to logs folder
if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
String brokerLogsFolderId = parent.getId() + NODE_SEPARATOR + LOGS_BROKER_FOLDER_ID;
ICubridNode brokerLogsFolder = parent.getChild(brokerLogsFolderId);
if (brokerLogsFolder == null) {
brokerLogsFolder = new DefaultCubridNode(brokerLogsFolderId, LOGS_BROKER_FOLDER_NAME, "icons/navigator/log_broker_group.png");
brokerLogsFolder.setType(CubridNodeType.LOGS_BROKER_FOLDER);
brokerLogsFolder.setContainer(true);
ICubridNodeLoader loader = new CubridBrokerLogFolderLoader();
loader.setLevel(getLevel());
brokerLogsFolder.setLoader(loader);
parent.addChild(brokerLogsFolder);
if (getLevel() == DEFINITE_LEVEL) {
brokerLogsFolder.getChildren(monitor);
}
} else {
if (brokerLogsFolder.getLoader() != null && brokerLogsFolder.getLoader().isLoaded()) {
brokerLogsFolder.getLoader().setLoaded(false);
brokerLogsFolder.getChildren(monitor);
}
}
}
// add manager logs folder to logs folder
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
String managerLogsFolderId = parent.getId() + NODE_SEPARATOR + LOGS_MANAGER_FOLDER_ID;
ICubridNode managerLogsFolder = parent.getChild(managerLogsFolderId);
if (managerLogsFolder == null) {
managerLogsFolder = new DefaultCubridNode(managerLogsFolderId, LOGS_MANAGER_FOLDER_NAME, "icons/navigator/log_manager_group.png");
managerLogsFolder.setType(CubridNodeType.LOGS_MANAGER_FOLDER);
managerLogsFolder.setContainer(true);
parent.addChild(managerLogsFolder);
}
// add access and error log folder to manager logs folder
String[] managerLogIdArr = { ACCESS_LOG_FOLDER_ID, ERROR_LOG_FOLDER_ID };
String[] managerLogNameArr = { ACCESS_LOG_FOLDER_NAME, ERROR_LOG_FOLDER_NAME };
String[] managerLogTypeArr = { CubridNodeType.LOGS_MANAGER_ACCESS_LOG, CubridNodeType.LOGS_MANAGER_ERROR_LOG };
String[] iconsArr = { "icons/navigator/log_item.png", "icons/navigator/log_item.png" };
for (int i = 0; i < managerLogNameArr.length; i++) {
String id = parent.getId() + NODE_SEPARATOR + managerLogIdArr[i];
ICubridNode logFolder = parent.getChild(id);
if (logFolder == null) {
logFolder = new DefaultCubridNode(id, managerLogNameArr[i], iconsArr[i]);
logFolder.setType(managerLogTypeArr[i]);
logFolder.setEditorId(LogEditorPart.ID);
logFolder.setContainer(false);
managerLogsFolder.addChild(logFolder);
}
}
//add database server log folder
String serverLogsFolderId = parent.getId() + NODE_SEPARATOR + LOGS_SERVER_FOLDER_ID;
ICubridNode serverLogsFolder = parent.getChild(serverLogsFolderId);
if (serverLogsFolder == null) {
serverLogsFolder = new DefaultCubridNode(serverLogsFolderId, LOGS_SERVER_FOLDER_NAME, "icons/navigator/log_db_group.png");
serverLogsFolder.setType(CubridNodeType.LOGS_SERVER_FOLDER);
serverLogsFolder.setContainer(true);
ICubridNodeLoader loader = new CubridDatabaseLogFolderLoader();
loader.setLevel(getLevel());
serverLogsFolder.setLoader(loader);
parent.addChild(serverLogsFolder);
if (getLevel() == DEFINITE_LEVEL) {
serverLogsFolder.getChildren(monitor);
}
} else {
if (serverLogsFolder.getLoader() != null && serverLogsFolder.getLoader().isLoaded()) {
serverLogsFolder.getLoader().setLoaded(false);
serverLogsFolder.getChildren(monitor);
}
}
}
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 CubridStatusMonitorFolderLoader 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;
}
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;
}
}
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 CubridDbUsersFolderLoader 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;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (database.getRunningType() == DbRunningType.STANDALONE) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
DbUserInfoList dbUserInfoList = new DbUserInfoList();
final CommonQueryTask<DbUserInfoList> task = new CommonQueryTask<DbUserInfoList>(parent.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbUserInfoList, database.getDatabaseInfo().getCharSet());
task.setDbName(database.getLabel());
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
dbUserInfoList = task.getResultModel();
DbUserInfo latestDLoginedbUserInfo = databaseInfo.getAuthLoginedDbUserInfo();
List<DbUserInfo> dbUserList = dbUserInfoList == null ? null : dbUserInfoList.getUserList();
formatUserList(dbUserList);
for (int i = 0; dbUserList != null && dbUserList.size() > i; i++) {
DbUserInfo dbUserInfo = dbUserList.get(i);
if (dbUserInfo.getName().equals(latestDLoginedbUserInfo.getName())) {
dbUserInfo.setDbaAuthority(latestDLoginedbUserInfo.isDbaAuthority());
// databaseInfo.setAuthLoginedDbUserInfo(dbUserInfo);
}
String id = parent.getId() + NODE_SEPARATOR + dbUserInfo.getName();
ICubridNode dbUserInfoNode = new DefaultSchemaNode(id, dbUserInfo.getName(), "icons/navigator/user_item.png");
dbUserInfoNode.setType(CubridNodeType.USER);
dbUserInfoNode.setModelObj(dbUserInfo);
dbUserInfoNode.setContainer(false);
dbUserInfoNode.setEditorId(UserEditor.ID);
parent.addChild(dbUserInfoNode);
}
databaseInfo.setDbUserInfoList(dbUserInfoList);
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 CubridShardFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent
* the parent node
* @param monitor
* the IProgressMonitor object
*/
public void load(final ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
// add sql log folder
String sqlLogFolderId = parent.getId() + NODE_SEPARATOR + SQL_LOG_FOLDER_ID;
ICubridNode sqlLogFolder = parent.getChild(sqlLogFolderId);
if (sqlLogFolder == null) {
sqlLogFolder = new DefaultCubridNode(sqlLogFolderId, SQL_LOG_FOLDER_NAME, "icons/navigator/folder.png");
sqlLogFolder.setType(CubridNodeType.BROKER_SQL_LOG_FOLDER);
sqlLogFolder.setContainer(true);
parent.addChild(sqlLogFolder);
}
// add the children of sql log folder
ServerInfo serverInfo = parent.getServer().getServerInfo();
BrokerLogInfos brokerLogInfos = new BrokerLogInfos();
final CommonQueryTask<BrokerLogInfos> task = new CommonQueryTask<BrokerLogInfos>(serverInfo, CommonSendMsg.getGetBrokerLogFileInfoMSGItems(), brokerLogInfos);
task.setBroker(parent.getName());
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
sqlLogFolder.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
sqlLogFolder.removeAllChild();
brokerLogInfos = task.getResultModel();
List<LogInfo> logInfoList = brokerLogInfos == null ? null : brokerLogInfos.getBrokerLogInfoList().getLogFileInfoList();
if (logInfoList != null && !logInfoList.isEmpty()) {
for (LogInfo logInfo : logInfoList) {
String id = sqlLogFolder.getId() + NODE_SEPARATOR + logInfo.getName();
ICubridNode logInfoNode = new DefaultCubridNode(id, logInfo.getName(), "icons/navigator/sqllog_item.png");
logInfoNode.setContainer(false);
logInfoNode.setEditorId(LogEditorPart.ID);
logInfoNode.setModelObj(logInfo);
if (LogType.SCRIPT.getText().toLowerCase().equals(logInfo.getType())) {
logInfoNode.setType(CubridNodeType.BROKER_SQL_LOG);
sqlLogFolder.addChild(logInfoNode);
}
}
}
Collections.sort(sqlLogFolder.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 CQBDbConnectionLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(final ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = (CubridDatabase) parent;
database.getDatabaseInfo().clear();
if (!database.isLogined()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
// add tables folder
addTableFolder(monitor, database);
// add views folder
addViewFolder(monitor, database);
// add serials folder
addSerialFolder(monitor, database);
//add users folder
addUserFolder(monitor, database);
// add triggers folder
addTriggerFolder(monitor, database);
// add stored procedure folder
addProcedureFolder(monitor, database);
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
Aggregations