@Test public void testAccount() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session).withCache(cache); final Quota.Space quota = new SDSQuotaFeature(session, nodeid).get(); assertNotNull(quota.available); assertNotNull(quota.used); }
@Override public Space get() throws BackgroundException { try { final Path home = new DefaultHomeFinderService(session).find(); if(!home.isRoot()) { final Node node = new NodesApi(session.getClient()).requestNode( Long.parseLong(nodeid.getFileid(home, new DisabledListProgressListener())), StringUtils.EMPTY, null); if(null == node.getQuota()) { log.warn(String.format("No quota set for node %s", home)); } else { return new Space(node.getSize(), node.getQuota() - node.getSize()); } } final CustomerData info = new UserApi(session.getClient()).requestCustomerInfo(StringUtils.EMPTY); return new Space(info.getSpaceUsed(), info.getSpaceLimit() - info.getSpaceUsed()); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))); } }
SDSQuotaFeature implements Quota { @Override public Space get() throws BackgroundException { try { final Path home = new DefaultHomeFinderService(session).find(); if(!home.isRoot()) { final Node node = new NodesApi(session.getClient()).requestNode( Long.parseLong(nodeid.getFileid(home, new DisabledListProgressListener())), StringUtils.EMPTY, null); if(null == node.getQuota()) { log.warn(String.format("No quota set for node %s", home)); } else { return new Space(node.getSize(), node.getQuota() - node.getSize()); } } final CustomerData info = new UserApi(session.getClient()).requestCustomerInfo(StringUtils.EMPTY); return new Space(info.getSpaceUsed(), info.getSpaceLimit() - info.getSpaceUsed()); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))); } } }
SDSQuotaFeature implements Quota { @Override public Space get() throws BackgroundException { try { final Path home = new DefaultHomeFinderService(session).find(); if(!home.isRoot()) { final Node node = new NodesApi(session.getClient()).requestNode( Long.parseLong(nodeid.getFileid(home, new DisabledListProgressListener())), StringUtils.EMPTY, null); if(null == node.getQuota()) { log.warn(String.format("No quota set for node %s", home)); } else { return new Space(node.getSize(), node.getQuota() - node.getSize()); } } final CustomerData info = new UserApi(session.getClient()).requestCustomerInfo(StringUtils.EMPTY); return new Space(info.getSpaceUsed(), info.getSpaceLimit() - info.getSpaceUsed()); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))); } } SDSQuotaFeature(final SDSSession session, final SDSNodeIdProvider nodeid); }
SDSQuotaFeature implements Quota { @Override public Space get() throws BackgroundException { try { final Path home = new DefaultHomeFinderService(session).find(); if(!home.isRoot()) { final Node node = new NodesApi(session.getClient()).requestNode( Long.parseLong(nodeid.getFileid(home, new DisabledListProgressListener())), StringUtils.EMPTY, null); if(null == node.getQuota()) { log.warn(String.format("No quota set for node %s", home)); } else { return new Space(node.getSize(), node.getQuota() - node.getSize()); } } final CustomerData info = new UserApi(session.getClient()).requestCustomerInfo(StringUtils.EMPTY); return new Space(info.getSpaceUsed(), info.getSpaceLimit() - info.getSpaceUsed()); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))); } } SDSQuotaFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override Space get(); }
SDSQuotaFeature implements Quota { @Override public Space get() throws BackgroundException { try { final Path home = new DefaultHomeFinderService(session).find(); if(!home.isRoot()) { final Node node = new NodesApi(session.getClient()).requestNode( Long.parseLong(nodeid.getFileid(home, new DisabledListProgressListener())), StringUtils.EMPTY, null); if(null == node.getQuota()) { log.warn(String.format("No quota set for node %s", home)); } else { return new Space(node.getSize(), node.getQuota() - node.getSize()); } } final CustomerData info = new UserApi(session.getClient()).requestCustomerInfo(StringUtils.EMPTY); return new Space(info.getSpaceUsed(), info.getSpaceLimit() - info.getSpaceUsed()); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to read attributes of {0}", e, new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))); } } SDSQuotaFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override Space get();  }