use of org.ff4j.exception.PropertyNotFoundException in project ff4j by ff4j.
the class PropertyStoreHttp method deleteProperty.
/**
* {@inheritDoc}
*/
public void deleteProperty(String name) {
Util.assertHasLength(name);
ClientResponse cRes = getStore().path(name).delete(ClientResponse.class);
if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
throw new PropertyNotFoundException(name);
}
if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
throw new PropertyAccessException("Cannot delete property, an HTTP error " + cRes.getStatus() + OCCURED);
}
}
use of org.ff4j.exception.PropertyNotFoundException in project ff4j by ff4j.
the class PropertyStoreCassandra method readProperty.
/**
* {@inheritDoc}
*/
@Override
public Property<?> readProperty(String name) {
assertPropertyExist(name);
ResultSet rs = cqlSession.execute(psReadProperty.bind(name));
Row row = rs.one();
if (null == row) {
throw new PropertyNotFoundException(name);
}
return mapPropertyRow(row);
}
use of org.ff4j.exception.PropertyNotFoundException in project ff4j by ff4j.
the class PropertyStoreHttp method deleteProperty.
/**
* {@inheritDoc}
*/
public void deleteProperty(String name) {
Util.assertHasLength(name);
Response cRes = ClientHttpUtils.invokeDeleteMethod(getStore().path(name), authorization);
if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
throw new PropertyNotFoundException(name);
}
if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
throw new PropertyAccessException("Cannot delete property, an HTTP error " + cRes.getStatus() + OCCURED);
}
}
Aggregations