private void updateStateInfo() { EntityWrapper<StorageStatsInfo> db = StorageController.getEntityWrapper(); try { StorageStatsInfo storageStats = db.getUnique(new StorageStatsInfo(StorageProperties.NAME)); storageStats.setNumberOfVolumes(numberOfVolumes); storageStats.setTotalSpaceUsed(totalSpaceUsed); } catch (EucalyptusCloudException ex) { StorageStatsInfo walrusStats = new StorageStatsInfo(StorageProperties.NAME, numberOfVolumes, totalSpaceUsed); db.add(walrusStats); } db.commit(); }
private static List<Address> getStoredAddresses(String cluster) { EntityWrapper<Address> db = new EntityWrapper<Address>(); Address clusterAddr = new Address(); clusterAddr.setCluster(cluster); List<Address> addrList = Lists.newArrayList(); try { addrList = db.query(clusterAddr); db.commit(); } catch (Exception e1) { db.rollback(); } return addrList; }