use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method initialize.
/**
* Init the value of editor field
*
*/
private void initialize() {
// FIXME extract to utility class
if (database == null || database.getDatabaseInfo() == null) {
return;
}
if (database.getDatabaseInfo().getDbSpaceInfoList() == null) {
return;
}
int totalSize = 0;
int freeSize = 0;
// String volumeType = "";
Map<String, String> map3 = new HashMap<String, String>();
map3.put("0", Messages.tblVolumeFolderType);
map3.put("1", volumeType);
spInfoListData.add(map3);
Map<String, String> map2 = new HashMap<String, String>();
map2.put("0", Messages.tblVolumeFolderVolumeCount);
map2.put("1", dbSpaceList.size() + " ");
spInfoListData.add(map2);
for (DbSpaceInfo dbSpaceInfo : dbSpaceList) {
totalSize += dbSpaceInfo.getTotalpage();
freeSize += dbSpaceInfo.getFreepage();
}
if (!VolumeType.ACTIVE_LOG.toString().equalsIgnoreCase(volumeType) && !VolumeType.ARCHIVE_LOG.toString().equalsIgnoreCase(volumeType)) {
Map<String, String> map4 = new HashMap<String, String>();
map4.put("0", Messages.tblVolumeFolderFreeSize);
map4.put("1", StringUtil.formatNumber(freeSize * (database.getDatabaseInfo().getDbSpaceInfoList().getPagesize() / (1048576.0f)), "#,###.##") + "M (" + StringUtil.formatNumber(freeSize, "#,###") + " pages)");
spInfoListData.add(map4);
}
Map<String, String> map5 = new HashMap<String, String>();
map5.put("0", Messages.tblVolumeFolderTotalSize);
map5.put("1", StringUtil.formatNumber(totalSize * (database.getDatabaseInfo().getDbSpaceInfoList().getPagesize() / (1048576.0f)), "#,###.##") + "M (" + StringUtil.formatNumber(totalSize, "#,###") + " pages)");
spInfoListData.add(map5);
if (CompatibleUtil.isSupportLogPageSize(database.getServer().getServerInfo()) && (VolumeType.ACTIVE_LOG.toString().equalsIgnoreCase(volumeType) || VolumeType.ARCHIVE_LOG.toString().equalsIgnoreCase(volumeType))) {
Map<String, String> map6 = new HashMap<String, String>();
map6.put("0", Messages.tblVolumeFolderLogPageSize);
map6.put("1", StringUtil.formatNumber(database.getDatabaseInfo().getDbSpaceInfoList().getLogpagesize(), "#,###") + " byte");
spInfoListData.add(map6);
} else {
Map<String, String> map6 = new HashMap<String, String>();
map6.put("0", Messages.tblVolumeFolderPageSize);
map6.put("1", StringUtil.formatNumber(database.getDatabaseInfo().getDbSpaceInfoList().getPagesize(), "#,###") + " byte");
spInfoListData.add(map6);
}
spaceNameLabel.setText(volumeFolderName);
while (!spInfoListData.isEmpty()) {
spInfoListData.remove(0);
}
if (spInfoTable != null && !spInfoTable.isDisposed()) {
spInfoTableViewer.refresh();
for (int i = 0; i < spInfoTable.getColumnCount(); i++) {
spInfoTable.getColumn(i).pack();
}
for (int i = 0; i < (spInfoTable.getItemCount() + 1) / 2; i++) {
spInfoTable.getItem(i * 2).setBackground(color);
}
}
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method getLogString.
private String getLogString(DBVolumeSpaceInfo volumeSpaceInfo, String type) {
// FIXME extract
long totalPage = 0;
List<DbSpaceInfo> dbSpaceInfoList = volumeSpaceInfo.getVolumeSpaceInfo(type);
if (dbSpaceInfoList != null) {
for (DbSpaceInfo dbSpaceInfo : dbSpaceInfoList) {
totalPage += dbSpaceInfo.getTotalpage();
}
}
return getSpaceDesc(totalPage * volumeSpaceInfo.getPageSize());
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo in project cubrid-manager by CUBRID.
the class RenameDatabaseDialog method initial.
/**
*
* Initial data
*
*/
private void initial() {
EnvInfo envInfo = database.getServer().getServerInfo().getEnvInfo();
if (envInfo != null) {
extVolumePath = envInfo.getDatabaseDir();
extVolumePath = FileUtil.changeSeparatorByOS(extVolumePath, database.getServer().getServerInfo().getServerOsInfo());
exVolumePathText.setText(extVolumePath);
}
String dir = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_EXTENDED_VOLUME_PATH + database.getId());
if (dir != null && dir.trim().length() > 0) {
extVolumePath = dir;
exVolumePathText.setText(extVolumePath);
}
if (spaceInfoList == null) {
spaceInfoList = new ArrayList<Map<String, String>>();
if (this.dbSpaceInfoList != null) {
List<DbSpaceInfo> list = this.dbSpaceInfoList.getSpaceinfo();
for (int i = 0; list != null && i < list.size(); i++) {
Map<String, String> map = new HashMap<String, String>();
DbSpaceInfo spaceInfo = list.get(i);
String type = spaceInfo.getType();
if (!VolumeType.GENERIC.getText().equals(type) && !VolumeType.DATA.getText().equals(type) && !VolumeType.INDEX.getText().equals(type) && !VolumeType.TEMP.getText().equals(type)) {
continue;
}
map.put("0", spaceInfo.getSpacename());
map.put("1", spaceInfo.getSpacename());
String location = spaceInfo.getLocation();
location = FileUtil.changeSeparatorByOS(location, database.getServer().getServerInfo().getServerOsInfo());
map.put("2", location);
map.put("3", location);
spaceInfoList.add(map);
}
}
}
volumeTableViewer.setInput(spaceInfoList);
for (int i = 0; i < volumeTable.getColumnCount(); i++) {
volumeTable.getColumn(i).pack();
}
databaseNameText.addModifyListener(this);
exVolumePathText.addModifyListener(this);
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo in project cubrid-manager by CUBRID.
the class DeleteDatabaseDialog method initial.
/**
*
* Init the value of dialog field
*
*/
private void initial() {
dbNameText.setText(database.getName());
List<Map<String, Object>> volumeTableListData = new ArrayList<Map<String, Object>>();
for (DbSpaceInfo bean : dbSpaceInfo.getSpaceinfo()) {
if (!bean.getType().equals("GENERIC") && !bean.getType().equals("DATA") && !bean.getType().equals("TEMP") && !bean.getType().equals("INDEX") && !bean.getType().equals("Active_log")) {
continue;
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("0", bean.getSpacename());
map.put("1", bean.getLocation());
map.put("2", bean.getDate());
map.put("3", bean.getType());
map.put("4", bean.getTotalpage() == 0 ? "" : (bean.getTotalpage() + ""));
map.put("5", bean.getFreepage() == 0 ? "" : (bean.getFreepage() + ""));
double mb = dbSpaceInfo.getPagesize() * bean.getTotalpage() / 1048576.0;
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
nf.setGroupingUsed(false);
String volsize = nf.format(mb) + "";
map.put("6", volsize);
volumeTableListData.add(map);
}
tableViewer.setInput(volumeTableListData);
for (int i = 0; i < volumeTable.getColumnCount(); i++) {
volumeTable.getColumn(i).pack();
}
}
use of com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo in project cubrid-manager by CUBRID.
the class DatabaseModelTest method testModelDatabaseInfo.
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testModelDatabaseInfo() {
DatabaseInfo bean = new DatabaseInfo(testDbName, serverInfo);
bean.setDbName("dbName");
assertEquals(bean.getDbName(), "dbName");
bean.setLogined(true);
assertTrue(bean.isLogined());
bean.setDbDir("dbDir");
assertEquals(bean.getDbDir(), "dbDir");
bean.setRunningType(DbRunningType.CS);
assertEquals(bean.getRunningType(), DbRunningType.CS);
DbUserInfoList dbUserInfoList = new DbUserInfoList();
bean.setDbUserInfoList(dbUserInfoList);
assertTrue(bean.getDbUserInfoList() != null);
DbUserInfo dbUserInfo = new DbUserInfo();
bean.addDbUserInfo(dbUserInfo);
bean.removeDbUserInfo(dbUserInfo);
bean.setAuthLoginedDbUserInfo(dbUserInfo);
assertEquals(bean.getAuthLoginedDbUserInfo(), dbUserInfo);
bean.setBrokerPort("brokerPort");
assertEquals(bean.getBrokerPort(), "brokerPort");
bean.setTriggerList(new ArrayList());
assertEquals(bean.getTriggerList() != null, true);
bean.setUserTableInfoList(new ArrayList());
assertEquals(bean.getUserTableInfoList() != null, true);
bean.setUserViewInfoList(new ArrayList());
assertEquals(bean.getUserViewInfoList() != null, true);
bean.setSysTableInfoList(new ArrayList());
assertEquals(bean.getSysTableInfoList() != null, true);
bean.setSysViewInfoList(new ArrayList());
assertEquals(bean.getSysViewInfoList() != null, true);
bean.setPartitionedTableMap(new HashMap());
assertEquals(bean.getPartitionedTableMap() != null, true);
bean.setBackupPlanInfoList(new ArrayList());
assertEquals(bean.getBackupPlanInfoList() != null, true);
bean.setQueryPlanInfoList(new ArrayList());
assertEquals(bean.getQueryPlanInfoList() != null, true);
bean.setDbSpaceInfoList(new DbSpaceInfoList());
assertEquals(bean.getDbSpaceInfoList() != null, true);
bean.setDbUserInfoList(new DbUserInfoList());
assertEquals(bean.getDbUserInfoList() != null, true);
bean.setSpProcedureInfoList(new ArrayList());
assertEquals(bean.getSpProcedureInfoList() != null, true);
bean.setSpFunctionInfoList(new ArrayList());
assertEquals(bean.getSpFunctionInfoList() != null, true);
bean.setSerialInfoList(new ArrayList());
assertEquals(bean.getSerialInfoList() != null, true);
bean.setServerInfo(serverInfo);
assertEquals(bean.getServerInfo() != null, true);
bean.clear();
bean.setLogined(true);
assertEquals(bean.isLogined(), true);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
bean.getClassInfoList();
bean.addPartitionedTableList("dbname", null);
bean.addBackupPlanInfo(new BackupPlanInfo());
bean.removeBackupPlanInfo(new BackupPlanInfo());
bean.removeAllBackupPlanInfo();
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.removeQueryPlanInfo(new QueryPlanInfo());
bean.removeAllQueryPlanInfo();
bean.addSpaceInfo(new DbSpaceInfo());
bean.removeSpaceInfo(new DbSpaceInfo());
bean.getSpInfoList();
bean.getSchemaInfo("tableName");
bean.putSchemaInfo(new SchemaInfo());
bean.clearSchemas();
bean.getErrorMessage();
bean.setDbUserInfoList(null);
assertEquals(bean.getDbUserInfoList(), null);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
}
Aggregations