/** {@inheritDoc} */ @Override public void updateCacheManager(UriInfo info, CacheManagerEntity resource) { LOG.info(String.format("Invoking updateCacheManager: %s", info.getRequestUri())); validator.validate(info); String cacheManagerName = info.getPathSegments().get(1).getMatrixParameters().getFirst("names"); try { cacheMgrSvc.updateCacheManager(cacheManagerName, resource); } catch (ServiceExecutionException e) { LOG.error("Failed to update cache manager.", e.getCause()); throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST).entity(e.getCause().getMessage()).build()); } }
/** {@inheritDoc} */ public Collection<CacheManagerEntity> getCacheManagers(UriInfo info) { LOG.info(String.format("Invoking getCacheManagers: %s", info.getRequestUri())); validator.validateSafe(info); String names = info.getPathSegments().get(1).getMatrixParameters().getFirst("names"); Set<String> cmNames = names == null ? null : new HashSet<String>(Arrays.asList(names.split(","))); MultivaluedMap<String, String> qParams = info.getQueryParameters(); List<String> attrs = qParams.get(ATTR_QUERY_KEY); Set<String> cmAttrs = attrs == null || attrs.isEmpty() ? null : new HashSet<String>(attrs); try { return entityResourceFactory.createCacheManagerEntities(cmNames, cmAttrs); } catch (ServiceExecutionException e) { LOG.error("Failed to get cache managers.", e.getCause()); throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST).entity(e.getCause().getMessage()).build()); } }