use of org.n52.iceland.binding.PathBindingKey in project arctic-sea by 52North.
the class JsonActivationDao method setBindingStatus.
@Override
public void setBindingStatus(BindingKey key, boolean active) {
writeLock().lock();
try {
ObjectNode node = getConfiguration().with(JsonConstants.ACTIVATION).with(JsonConstants.BINDINGS);
if (key instanceof PathBindingKey) {
node = node.with(JsonConstants.BY_PATH);
} else if (key instanceof MediaTypeBindingKey) {
node = node.with(JsonConstants.BY_MEDIA_TYPE);
}
node.put(key.getKeyAsString(), active);
} finally {
writeLock().unlock();
}
configuration().scheduleWrite();
}
use of org.n52.iceland.binding.PathBindingKey in project arctic-sea by 52North.
the class JsonActivationDao method getBindingKeys.
@Override
public Set<BindingKey> getBindingKeys() {
readLock().lock();
try {
JsonNode node = getConfiguration().path(JsonConstants.ACTIVATION).path(JsonConstants.BINDINGS);
Set<BindingKey> keys = new HashSet<>(node.size());
node.path(JsonConstants.BY_PATH).fieldNames().forEachRemaining(k -> keys.add(new PathBindingKey(k)));
node.path(JsonConstants.BY_MEDIA_TYPE).fieldNames().forEachRemaining(k -> keys.add(new MediaTypeBindingKey(MediaType.parse(k))));
return keys;
} finally {
readLock().unlock();
}
}
Aggregations