Search in sources :

Example 16 with DbSpaceInfo

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();
}
Also used : HashMap(java.util.HashMap) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) DbSpaceInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 17 with DbSpaceInfo

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);
    }
}
Also used : ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) DbSpaceInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo) GridData(org.eclipse.swt.layout.GridData) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

DbSpaceInfo (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo)17 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)7 HashMap (java.util.HashMap)7 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)4 Map (java.util.Map)4 ArrayList (java.util.ArrayList)3 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)2 Point (org.eclipse.swt.graphics.Point)2 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 ITask (com.cubrid.common.core.task.ITask)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 CommonTaskJobExec (com.cubrid.common.ui.spi.progress.CommonTaskJobExec)1 ITaskExecutorInterceptor (com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor)1 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)1 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)1 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)1