use of org.n52.iceland.exception.ows.concrete.InvalidServiceOrVersionException in project arctic-sea by 52North.
the class SimpleBinding method getServiceOperator.
protected ServiceOperator getServiceOperator(OwsServiceRequest request) throws OwsExceptionReport {
checkServiceOperatorKeyTypes(request);
String service = request.getService();
String version = request.getVersion();
if (request instanceof GetCapabilitiesRequest) {
GetCapabilitiesRequest gcr = (GetCapabilitiesRequest) request;
if (gcr.isSetAcceptVersions()) {
return gcr.getAcceptVersions().stream().map(v -> new OwsServiceKey(service, v)).map(this::getServiceOperator).filter(Objects::nonNull).findFirst().orElseThrow(() -> new InvalidServiceOrVersionException(service, version));
} else {
Set<String> supportedVersions = serviceOperatorRepository.getSupportedVersions(service);
String newest = supportedVersions.stream().max(Comparables.version()).orElseThrow(() -> new InvalidServiceParameterException(service));
return getServiceOperator(new OwsServiceKey(service, newest));
}
} else {
return getServiceOperator(new OwsServiceKey(service, version));
}
}
Aggregations