Exemplo n.º 1
0
 private void checkForInvalidAttributes(String cacheManagerName, CacheManagerEntityV2 resource)
     throws ServiceExecutionException {
   boolean invalidAttributesFound = false;
   StringBuilder errorMessage =
       new StringBuilder("You are not allowed to update those attributes : ");
   if (resource.getName() != null && !resource.getName().equals(cacheManagerName)) {
     errorMessage.append("name ");
     invalidAttributesFound = true;
   }
   for (Map.Entry<String, Object> attribute : resource.getAttributes().entrySet()) {
     String key = attribute.getKey();
     if (!key.equals(SamplerRepoEntry.MAX_BYTES_LOCAL_DISK_STRING)
         && !key.equals(SamplerRepoEntry.MAX_BYTES_LOCAL_HEAP_STRING)) {
       errorMessage.append(key).append(" ");
       invalidAttributesFound = true;
     }
   }
   if (invalidAttributesFound) {
     errorMessage
         .append(". Only ")
         .append(SamplerRepoEntry.MAX_BYTES_LOCAL_DISK_STRING)
         .append(" and ")
         .append(SamplerRepoEntry.MAX_BYTES_LOCAL_HEAP_STRING)
         .append(" can be updated for a CacheManager.");
     throw new ServiceExecutionException(errorMessage.toString());
   }
 }