/** 초기 데이터를 로드합니다. */ private void initData() { collectionList.clear(); try { DB mongoDB = MongoDBConnection.connection(userDB); for (String col : mongoDB.getCollectionNames()) { CommandResult commandResult = mongoDB.getCollection(col).getStats(); // logger.debug(commandResult); MongoDBCollectionInfoDTO info = new MongoDBCollectionInfoDTO(); info.setName(col); try { info.setCount(commandResult.getInt("count")); // $NON-NLS-1$ info.setSize(commandResult.getInt("size")); // $NON-NLS-1$ info.setStorage(commandResult.getInt("storageSize")); // $NON-NLS-1$ info.setIndex(commandResult.getInt("totalIndexSize")); // $NON-NLS-1$ info.setAvgObj(commandResult.getDouble("avgObjSize")); // $NON-NLS-1$ info.setPadding(commandResult.getInt("paddingFactor")); // $NON-NLS-1$ } catch (Exception e) { logger.error("collection info error [" + col + "]", e); // $NON-NLS-1$ //$NON-NLS-2$ } collectionList.add(info); } treeViewerCollections.setInput(collectionList); // summary 정보를 표시합니다. double dblSize = 0, dblStorage = 0, dblIndex = 0; for (MongoDBCollectionInfoDTO info : collectionList) { dblSize += info.getSize(); dblStorage += info.getStorage(); dblIndex += info.getIndex(); } lblCollection.setText(collectionList.size() + " Collections"); // $NON-NLS-1$ lblSizes.setText("Size " + NumberFormatUtils.kbMbFormat(dblSize)); // $NON-NLS-1$ lblStorages.setText("Storage " + NumberFormatUtils.kbMbFormat(dblStorage)); // $NON-NLS-1$ lblIndex.setText("Index " + NumberFormatUtils.kbMbFormat(dblIndex)); // $NON-NLS-1$ } catch (Exception e) { logger.error("mongodb collection infomtion init", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", "MongoDB Information", errStatus); // $NON-NLS-1$ //$NON-NLS-2$ } }