use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoListNew in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method loadData.
/**
* load the editor data
*
* @return boolean
*/
public boolean loadData() {
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
@SuppressWarnings("unchecked")
@Override
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
final DbSpaceInfoList model = ((CommonQueryTask<? extends DbSpaceInfoList>) t).getResultModel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
database.getDatabaseInfo().setDbSpaceInfoList(model);
if (scrolledComp == null || scrolledComp.isDisposed()) {
return;
}
initialize();
paintComp();
scrolledComp.setContent(parentComp);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
CommonQueryTask<? extends DbSpaceInfoList> task = DbSpaceInfoList.useOld(database.getServer().getServerInfo().getEnvInfo()) ? new CommonQueryTask<DbSpaceInfoListOld>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld()) : new CommonQueryTask<DbSpaceInfoListNew>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
task.setDbName(database.getName());
taskJobExecutor.addTask(task);
String serverName = database.getServer().getName();
String dbName = database.getName();
String jobName = Messages.viewVolumeInfoJobName + " - " + volumeFolderName + "@" + dbName + "@" + serverName;
taskJobExecutor.schedule(jobName, null, false, Job.LONG);
return true;
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoListNew in project cubrid-manager by CUBRID.
the class VolumeInformationEditor method loadData.
/**
* load the data
*
* @return boolean
*/
public boolean loadData() {
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
@SuppressWarnings("unchecked")
@Override
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
final DbSpaceInfoList model = ((CommonQueryTask<? extends DbSpaceInfoList>) t).getResultModel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
database.getDatabaseInfo().setDbSpaceInfoList(model);
if (scrolledComp == null || scrolledComp.isDisposed()) {
return;
}
initial();
paintComp();
scrolledComp.setContent(parentComp);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(800);
scrolledComp.setMinWidth(800);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
CommonQueryTask<? extends DbSpaceInfoList> task = DbSpaceInfoList.useOld(database.getServer().getServerInfo().getEnvInfo()) ? new CommonQueryTask<DbSpaceInfoListOld>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld()) : new CommonQueryTask<DbSpaceInfoListNew>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
task.setDbName(database.getName());
taskJobExecutor.addTask(task);
String jobName = Messages.viewVolumeInfoJobName + " - " + dbSpaceInfo.getSpacename() + "@" + database.getName() + "@" + database.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.LONG);
return true;
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoListNew in project cubrid-manager by CUBRID.
the class CubridDbSpaceFolderLoader 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();
HashMap<String, FolderInformationContainer> foldersInformation;
HashMap<String, ICubridNode> foldersHashMap = new HashMap<String, ICubridNode>();
DatabaseInfo databaseInfo = database.getDatabaseInfo();
CommonQueryTask<? extends DbSpaceInfoList> task;
DbSpaceInfoList dbSpaceInfoList;
if (DbSpaceInfoList.useOld(database.getDatabaseInfo().getServerInfo().getEnvInfo())) {
foldersInformation = foldersInformationOldFormat;
task = new CommonQueryTask<DbSpaceInfoListOld>(parent.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld());
} else {
foldersInformation = foldersInformationNewFormat;
task = new CommonQueryTask<DbSpaceInfoListNew>(parent.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
}
for (Map.Entry<String, FolderInformationContainer> entry : foldersInformation.entrySet()) {
String key = entry.getKey();
FolderInformationContainer value = entry.getValue();
ICubridNode folder = addFolder(parent, key, value.volumeFolderName, value.volumeFolder, value.type);
foldersHashMap.put(value.volumeType, folder);
}
ICubridNode logFolder = addFolder(parent, LOG_VOLUME_FOLDER_ID, LOG_VOLUME_FOLDER_NAME, CubridNodeType.LOG_VOLUEM_FOLDER, null);
foldersHashMap.put(VolumeType.ACTIVE_LOG.getText(), addFolder(logFolder, ACTIVE_LOG_FOLDER_ID, ACTIVE_LOG_FOLDER_NAME, CubridNodeType.ACTIVE_LOG_FOLDER, CubridNodeType.ACTIVE_LOG));
foldersHashMap.put(VolumeType.ARCHIVE_LOG.getText(), addFolder(logFolder, ARCHIVE_LOG_FOLDER_ID, ARCHIVE_LOG_FOLDER_NAME, CubridNodeType.ARCHIVE_LOG_FOLDER, CubridNodeType.ARCHIVE_LOG));
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) {
for (ICubridNode folder : foldersHashMap.values()) {
folder.removeAllChild();
}
Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(null, errorMsg);
}
});
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
for (ICubridNode folder : foldersHashMap.values()) {
folder.removeAllChild();
}
dbSpaceInfoList = task.getResultModel();
List<DbSpaceInfo> spaceInfoList = dbSpaceInfoList == null ? null : dbSpaceInfoList.getSpaceinfo();
for (int i = 0; spaceInfoList != null && i < spaceInfoList.size(); i++) {
DbSpaceInfo spaceInfo = spaceInfoList.get(i);
ICubridNode volumeNode = new DefaultSchemaNode("", spaceInfo.getShortVolumeName(), "");
volumeNode.setContainer(false);
volumeNode.setModelObj(spaceInfo);
volumeNode.setEditorId(VolumeInformationEditor.ID);
String key = null;
String type = spaceInfo.getType();
if (spaceInfo.getPurpose() != null) {
key = type + "_" + spaceInfo.getPurpose();
} else {
key = type;
}
if (type == null) {
continue;
}
ICubridNode folder = foldersHashMap.get(key);
if (folder != null) {
String id = folder.getId() + NODE_SEPARATOR + spaceInfo.getShortVolumeName();
volumeNode.setId(id);
volumeNode.setType(folder.getType());
volumeNode.setIconPath("icons/navigator/volume_item.png");
folder.addChild(volumeNode);
}
}
if (spaceInfoList != null && !spaceInfoList.isEmpty()) {
for (ICubridNode folder : foldersHashMap.values()) {
Collections.sort(folder.getChildren());
}
}
databaseInfo.setDbSpaceInfoList(dbSpaceInfoList);
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoListNew in project cubrid-manager by CUBRID.
the class DatabaseStatusEditor method loadData.
/**
*
* Load data
*
* @return <code>true</code> whether it is successful;<code>false</code>
* otherwise
*/
public boolean loadData() {
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
@SuppressWarnings("unchecked")
@Override
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
final DbSpaceInfoList dbSpaceInfoList = ((CommonQueryTask<? extends DbSpaceInfoList>) t).getResultModel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
database.getDatabaseInfo().setDbSpaceInfoList(dbSpaceInfoList);
if (scrolledComp == null || scrolledComp.isDisposed()) {
return;
}
initial();
paintComp();
scrolledComp.setContent(parentComp);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
CommonQueryTask<? extends DbSpaceInfoList> task = DbSpaceInfoList.useOld(database.getServer().getServerInfo().getEnvInfo()) ? new CommonQueryTask<DbSpaceInfoListOld>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListOld()) : new CommonQueryTask<DbSpaceInfoListNew>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoListNew());
task.setDbName(database.getName());
taskJobExecutor.addTask(task);
String serverName = database.getServer().getName();
String dbName = database.getName();
String jobName = Messages.viewDbStatusJobName + " - " + dbName + "@" + serverName;
taskJobExecutor.schedule(jobName, null, false, Job.SHORT);
return true;
}
Aggregations