use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList in project cubrid-manager by CUBRID.
the class EditStatisticHostDialog method refreshDbVolData.
private void refreshDbVolData(String dbName, boolean isInitial) {
boolean isEmptyData = false;
boolean isNeedInitVolNameValue = isNewHost || !isInitial || dbVolNameValue == null;
if (StringUtil.isEmpty(dbName)) {
isEmptyData = true;
} else {
DbSpaceInfoList dbSpaceInfo = new DbSpaceInfoList();
CommonQueryTask<DbSpaceInfoList> dbSpaceInfoTask = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfo);
dbSpaceInfoTask.setDbName(dbName);
dbSpaceInfoTask.execute();
if (dbSpaceInfoTask.isSuccess()) {
dbSpaceInfo = dbSpaceInfoTask.getResultModel();
if (dbSpaceInfo.getSpaceinfo() != null && dbSpaceInfo.getSpaceinfo().size() > 0) {
List<DbSpaceInfo> spaceInfoList = dbSpaceInfo.getSpaceinfo();
itemsVolName = new String[spaceInfoList.size()];
for (int i = 0; i < spaceInfoList.size(); i++) {
itemsVolName[i] = spaceInfoList.get(i).getSpacename();
}
if (isNeedInitVolNameValue) {
dbVolNameValue = itemsVolName[0];
}
} else {
isEmptyData = true;
}
} else {
isEmptyData = true;
}
}
if (isEmptyData) {
itemsVolName = ITEMS_EMPTY;
if (isNeedInitVolNameValue) {
dbVolNameValue = VALUE_DEFAULT;
}
}
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method loadVolumnsInfo.
/**
* load volumns information
*/
public void loadVolumnsInfo() {
// if database is stop, do not get data
if (database.getRunningType() != DbRunningType.CS) {
return;
}
final DbSpaceInfoList dbSpaceInfoList = new DbSpaceInfoList();
final CommonQueryTask<DbSpaceInfoList> loadVolumnTask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfoList);
loadVolumnTask.setDbName(database.getName());
new Thread(new Runnable() {
public void run() {
loadVolumnTask.execute();
if (!loadVolumnTask.isSuccess()) {
loadVolumnTask.finish();
return;
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
process();
}
});
}
private void process() {
volumnInfoListData.clear();
DbSpaceInfoList dbSpaceInfoList = loadVolumnTask.getResultModel();
if (dbSpaceInfoList != null) {
long archiveSize = 0;
for (DbSpaceInfo dbSpaceInfo : dbSpaceInfoList.getSpaceinfo()) {
if (StringUtil.isEmpty(dbSpaceInfo.getType())) {
continue;
}
if (dbSpaceInfo.getType().equals(VolumeType.ARCHIVE_LOG.getText())) {
archiveSize += dbSpaceInfo.getTotalpage() * dbSpaceInfoList.getPagesize();
continue;
}
boolean isLogVolumn = VolumeType.ACTIVE_LOG.getText().equals(dbSpaceInfo.getType()) || VolumeType.ARCHIVE_LOG.getText().equals(dbSpaceInfo.getType());
Map<String, String> volumnMap = new HashMap<String, String>();
volumnMap.put("0", dbSpaceInfo.getSpacename());
volumnMap.put("1", dbSpaceInfo.getType());
String freeSize = getSpaceDesc(Long.valueOf(dbSpaceInfo.getFreepage()) * Long.valueOf(dbSpaceInfoList.getPagesize()));
String totalSize = getSpaceDesc(Long.valueOf(dbSpaceInfo.getTotalpage()) * Long.valueOf(dbSpaceInfoList.getPagesize()));
if (isLogVolumn) {
volumnMap.put("2", "-");
} else {
volumnMap.put("2", freeSize);
}
volumnMap.put("3", totalSize);
volumnMap.put("4", dbSpaceInfo.getDate());
volumnMap.put("5", dbSpaceInfo.getLocation());
volumnInfoListData.add(volumnMap);
}
if (archiveSize > 0) {
Map<String, String> volumnMap = new HashMap<String, String>();
volumnMap.put("0", "Total Archives");
volumnMap.put("1", "Archive log");
volumnMap.put("2", "-");
volumnMap.put("3", getSpaceDesc(archiveSize));
volumnMap.put("4", "-");
volumnMap.put("5", "-");
volumnInfoListData.add(volumnMap);
}
}
setVolumnInfoData();
loadVolumnTask.finish();
}
}).start();
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList 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