use of org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException in project geode by apache.
the class AbstractBaseController method getValues.
protected <T> Map<Object, T> getValues(final String regionNamePath, Object... keys) {
try {
final Region<Object, T> region = getRegion(regionNamePath);
final Map<Object, T> entries = region.getAll(Arrays.asList(getKeys(regionNamePath, keys)));
for (Object key : entries.keySet()) {
entries.put(key, (T) securityService.postProcess(regionNamePath, key, entries.get(key), false));
}
return entries;
} catch (SerializationException se) {
throw new DataTypeNotSupportedException("The resource identified could not convert into the supported content characteristics (JSON)!", se);
}
}
use of org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException in project geode by apache.
the class AbstractBaseController method getValue.
protected <T> T getValue(final String regionNamePath, final Object key, boolean postProcess) {
Assert.notNull(key, "The Cache Region key to read the value for cannot be null!");
Region r = getRegion(regionNamePath);
try {
Object value = r.get(key);
if (postProcess) {
return (T) securityService.postProcess(regionNamePath, key, value, false);
} else {
return (T) value;
}
} catch (SerializationException se) {
throw new DataTypeNotSupportedException("The resource identified could not convert into the supported content characteristics (JSON)!", se);
} catch (NullPointerException npe) {
throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow null keys!", regionNamePath), npe);
} catch (IllegalArgumentException iae) {
throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow requested operation on specified key!", regionNamePath), iae);
} catch (LeaseExpiredException lee) {
throw new GemfireRestException("Server has encountered error while processing this request!", lee);
} catch (TimeoutException te) {
throw new GemfireRestException("Server has encountered timeout error while processing this request!", te);
} catch (CacheLoaderException cle) {
throw new GemfireRestException("Server has encountered CacheLoader error while processing this request!", cle);
} catch (PartitionedRegionStorageException prse) {
throw new GemfireRestException("CacheLoader could not be invoked on partitioned region!", prse);
}
}
Aggregations