use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo 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.DbSpaceInfo in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method paintComp1.
/**
* paint the composite
*
*/
public void paintComp1() {
for (DbSpaceInfo dbSpaceInfo : dbSpaceList) {
JFreeChart chart = createChart(createDataset(dbSpaceInfo), dbSpaceInfo);
final ChartComposite frame = new ChartComposite(chartComp, SWT.NONE, chart, false, true, false, true, true);
GridData gdDescGroup = new GridData();
gdDescGroup.widthHint = 350;
gdDescGroup.heightHint = 250;
frame.setLayoutData(gdDescGroup);
}
}
Aggregations