use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class RemoveAllManagerLogAction method run.
/**
* Remove all manager logs
*/
public void run() {
if (!CommonUITool.openConfirmBox(Messages.warningRemoveManagerLog)) {
return;
}
Object[] selected = this.getSelectedObj();
String sendStr;
if (((DefaultCubridNode) selected[0]).getId().indexOf("Access log") >= 0) {
sendStr = "deleteaccesslog";
} else {
sendStr = "deleteerrorlog";
}
DelManagerLogTask delAllLogTask = new DelManagerLogTask(((DefaultCubridNode) selected[0]).getServer().getServerInfo(), sendStr);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.removeLogTaskName);
taskExecutor.addTask(delAllLogTask);
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (taskExecutor.isSuccess()) {
refreshLogEditor((ICubridNode) selected[0]);
CommonUITool.openInformationBox(Messages.msgSuccess, Messages.msgDeleteAllLog);
}
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class LogPropertyAction method run.
/**
* Open dialog
*/
public void run() {
Object[] selected = getSelectedObj();
DefaultCubridNode node = (DefaultCubridNode) selected[0];
LogInfo logInfo = (LogInfo) ((DefaultCubridNode) selected[0]).getAdapter(LogInfo.class);
LogPropertyDialog logPropertyDialog = new LogPropertyDialog(getShell());
logPropertyDialog.setLogInfo(logInfo, node);
logPropertyDialog.create();
logPropertyDialog.getShell().setSize(580, 330);
logPropertyDialog.open();
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode 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.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class CubridMonitorFolderLoader method createTempStatusNode.
/**
* Create temp status node
*
* @param parent the parent node
*/
private void createTempStatusNode(ICubridNode parent) {
CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
ServerInfo serverInfo = parent.getServer().getServerInfo();
String[] keys = QueryOptions.getAllStatusMonitorKey(serverInfo);
for (String key : keys) {
StatusMonInstanceData data = instance.loadSetting(key);
instance.addData(key, data);
}
Map<String, StatusMonInstanceData> map = instance.getDataMap();
for (Map.Entry<String, StatusMonInstanceData> entry : map.entrySet()) {
String key = entry.getKey();
String prefix = QueryOptions.getPrefix(serverInfo);
if (!key.startsWith(prefix)) {
continue;
}
String label = key.substring(key.lastIndexOf(".") + 1);
StatusMonInstanceData monInstaceData = entry.getValue();
String statusId = parent.getId() + NODE_SEPARATOR + label;
ICubridNode stautsNode = new DefaultCubridNode(statusId, label, "icons/navigator/status_item.png");
stautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
stautsNode.setModelObj(monInstaceData);
String viewId = "";
switch(monInstaceData.getMonitorType()) {
case BROKER:
viewId = BrokerStatusMonitorViewPart.ID;
break;
case DATABASE:
viewId = DbStatusDumpMonitorViewPart.ID;
break;
default:
}
if ("".equals(viewId)) {
return;
}
stautsNode.setViewId(viewId);
stautsNode.setContainer(false);
parent.addChild(stautsNode);
}
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class CubridMonitorFolderLoader method loadStatusTempInfoTask.
/**
* load sub node by the task of getStatusTemplateInfos
*
* @param parent the parent node
* @param monitor the instance of IProgressMonitor
* @param serverInfo the instance of serverInfo
* @return boolean false if error occur, true if succeed
*/
private boolean loadStatusTempInfoTask(ICubridNode parent, final IProgressMonitor monitor, ServerInfo serverInfo) {
StatusTemplateInfos statusTemplateInfos = new StatusTemplateInfos();
final CommonQueryTask<StatusTemplateInfos> task = new CommonQueryTask<StatusTemplateInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), statusTemplateInfos);
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
//parent.removeAllChild();
removeAllStatusTemp(parent);
openErrorBox(errorMsg);
setLoaded(true);
return false;
}
if (monitor.isCanceled()) {
setLoaded(true);
return false;
}
//parent.removeAllChild();
removeAllStatusTemp(parent);
statusTemplateInfos = task.getResultModel();
if (statusTemplateInfos != null) {
List<StatusTemplateInfo> list = statusTemplateInfos.getStatusTemplateInfoList().getStatusTemplateInfoList();
if (list != null) {
for (StatusTemplateInfo statusTemplateInfo : list) {
String id = parent.getId() + NODE_SEPARATOR + statusTemplateInfo.getName();
ICubridNode logInfoNode = new DefaultCubridNode(id, statusTemplateInfo.getName(), "icons/navigator/status_item.png");
logInfoNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
logInfoNode.setModelObj(statusTemplateInfo);
logInfoNode.setViewId(StatusMonitorViewPart.ID);
logInfoNode.setContainer(false);
parent.addChild(logInfoNode);
}
}
}
return true;
}
Aggregations