use of com.cubrid.cubridmanager.core.logs.model.DbLogInfos in project cubrid-manager by CUBRID.
the class CubridDatabaseLogLoader 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() || parent == null) {
return;
}
String dbName = parent.getLabel();
ServerInfo serverInfo = parent.getServer().getServerInfo();
DbLogInfos dbLogInfos = new DbLogInfos();
final CommonQueryTask<DbLogInfos> task = new CommonQueryTask<DbLogInfos>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), dbLogInfos);
task.setDbName(dbName);
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();
dbLogInfos = task.getResultModel();
DbLogInfoList dbLogInfoList = dbLogInfos == null ? null : dbLogInfos.getDbLogInfoList();
List<LogInfo> logInfoList = dbLogInfoList == null ? null : dbLogInfoList.getDbLogInfoList();
if (logInfoList != null) {
for (LogInfo dbLogInfo : logInfoList) {
String id = parent.getId() + NODE_SEPARATOR + dbLogInfo.getName();
CubridDbLogNode dbLogInfoNode = new CubridDbLogNode(id, dbLogInfo.getName(), "icons/navigator/log_item.png");
dbLogInfoNode.setType(CubridNodeType.LOGS_SERVER_DATABASE_LOG);
dbLogInfoNode.setModelObj(dbLogInfo);
dbLogInfoNode.setEditorId(LogEditorPart.ID);
dbLogInfoNode.setContainer(false);
parent.addChild(dbLogInfoNode);
}
}
if (dbLogInfos != null && serverInfo.getLogInfoManager() != null) {
serverInfo.getLogInfoManager().addDbLogInfos(dbLogInfos);
}
if (parent.getChildren() != null && !parent.getChildren().isEmpty()) {
Collections.sort(parent.getChildren());
}
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfos in project cubrid-manager by CUBRID.
the class ManagerLogInfoListTest method testModelDbLogInfos.
public void testModelDbLogInfos() {
DbLogInfos bean = new DbLogInfos();
bean.setDbname("dbname");
assertEquals(bean.getDbname(), "dbname");
bean.getTaskName();
bean.getDbLogInfoList();
assertEquals(LogType.SCRIPT.getText(), "SCRIPT");
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfos in project cubrid-manager by CUBRID.
the class LogsModelTest method testModelLogInfoManager.
public void testModelLogInfoManager() {
LogInfoManager bean = new LogInfoManager();
DbLogInfos dbLogInfos = new DbLogInfos();
dbLogInfos.setDbname("dbname");
bean.addDbLogInfos(dbLogInfos);
bean.getDbLogInfo("dbname", "path");
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfos in project cubrid-manager by CUBRID.
the class DatabaseLogListDialog method initial.
/**
*
* Initial the value of dialog field
*
*/
private void initial() {
DbLogInfos dbLogInfos = new DbLogInfos();
final CommonQueryTask<DbLogInfos> task = new CommonQueryTask<DbLogInfos>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), dbLogInfos);
task.setDbName(dbName);
CommonTaskJobExec jobExecutor = new CommonTaskJobExec(this) {
/**
* Close the dialog
*/
protected void closeDialog() {
//empty
}
/**
* Set the dialog visible or invisible.
*
* @param flag whether it is visible
*/
protected void setDialogVisible(boolean flag) {
//empty
}
};
jobExecutor.addTask(task);
JobFamily jobFamily = new JobFamily();
String serverName = serverInfo.getServerName();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
jobExecutor.schedule(Messages.jobGetLogList, jobFamily, false, Job.SHORT);
}
Aggregations