use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask 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;
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class CubridStatusMonitorFolderLoader 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();
openErrorBox(errorMsg);
setLoaded(true);
return false;
}
if (monitor.isCanceled()) {
setLoaded(true);
return false;
}
parent.removeAllChild();
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;
}
use of com.cubrid.cubridmanager.core.common.task.CommonQueryTask 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.cubridmanager.core.common.task.CommonQueryTask 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.cubridmanager.core.common.task.CommonQueryTask in project cubrid-manager by CUBRID.
the class GetLockInfoTaskTest method testSendMessage.
public void testSendMessage() {
CommonQueryTask<DatabaseLockInfo> task = new CommonQueryTask<DatabaseLockInfo>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DatabaseLockInfo());
task.setDbName("111ddd");
task.setUsingSpecialDelimiter(false);
task.execute();
DatabaseLockInfo bean = task.getResultModel();
// task.get
assertEquals(null, task.getErrorMsg());
System.out.println(task.getErrorMsg());
// test children
System.out.println("------------the result of task:dbspaceinfo in JSON-----------------");
System.out.println(JsonObjectUtil.object2json(bean));
System.out.println("-------------------------------------------------------------------");
}
Aggregations