Search in sources :

Example 1 with OwsRequestMethod

use of org.n52.shetland.ogc.ows.OwsRequestMethod in project arctic-sea by 52North.

the class AbstractOperationHandler method getRequestMethodsForServiceURL.

private Stream<OwsRequestMethod> getRequestMethodsForServiceURL(OwsOperationKey operation) {
    Map<String, Set<OwsValue>> mediaTypesByMethod = new HashMap<>(HTTPMethods.METHODS.size());
    this.bindingRepository.getBindings().values().stream().forEach(binding -> HTTPMethods.METHODS.stream().filter(isMethodSupported(binding, operation)).forEach(method -> mediaTypesByMethod.computeIfAbsent(method, Functions.forSupplier(HashSet::new)).addAll(getMediaTypes(binding))));
    return mediaTypesByMethod.entrySet().stream().map(e -> new OwsRequestMethod(this.serviceURL, e.getKey(), createContentTypeDomains(e.getValue())));
}
Also used : Binding(org.n52.iceland.binding.Binding) HTTPException(org.n52.iceland.exception.HTTPException) ConfigurationError(org.n52.faroe.ConfigurationError) HashMap(java.util.HashMap) OwsDCP(org.n52.shetland.ogc.ows.OwsDCP) MediaType(org.n52.janmayen.http.MediaType) I18NSettings(org.n52.iceland.i18n.I18NSettings) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) HashSet(java.util.HashSet) Inject(javax.inject.Inject) BindingRepository(org.n52.iceland.binding.BindingRepository) Locale(java.util.Locale) Map(java.util.Map) Validation(org.n52.faroe.Validation) URI(java.net.URI) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) Functions(org.n52.janmayen.function.Functions) OwsValue(org.n52.shetland.ogc.ows.OwsValue) Collectors.toSet(java.util.stream.Collectors.toSet) MediaTypeBindingKey(org.n52.iceland.binding.MediaTypeBindingKey) OwsOperationKey(org.n52.shetland.ogc.ows.service.OwsOperationKey) Predicate(java.util.function.Predicate) Set(java.util.Set) Setting(org.n52.faroe.annotation.Setting) LocaleHelper(org.n52.janmayen.i18n.LocaleHelper) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) HTTPMethods(org.n52.janmayen.http.HTTPMethods) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) Objects(java.util.Objects) Stream(java.util.stream.Stream) OwsHttp(org.n52.shetland.ogc.ows.OwsHttp) HTTPHeaders(org.n52.janmayen.http.HTTPHeaders) Optional(java.util.Optional) Configurable(org.n52.faroe.annotation.Configurable) PathBindingKey(org.n52.iceland.binding.PathBindingKey) ServiceSettings(org.n52.iceland.service.ServiceSettings) OwsOperation(org.n52.shetland.ogc.ows.OwsOperation) Collections(java.util.Collections) OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) HashSet(java.util.HashSet) Collectors.toSet(java.util.stream.Collectors.toSet) Set(java.util.Set) HashMap(java.util.HashMap) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) HashSet(java.util.HashSet)

Example 2 with OwsRequestMethod

use of org.n52.shetland.ogc.ows.OwsRequestMethod in project arctic-sea by 52North.

the class OwsEncoderv110 method encodeOwsDCP.

private void encodeOwsDCP(OwsDCP dcp, DCP xdcp) {
    if (dcp.isHTTP()) {
        HTTP xhttp = xdcp.addNewHTTP();
        OwsHttp http = dcp.asHTTP();
        SortedSet<OwsRequestMethod> requestMethods = http.getRequestMethods();
        requestMethods.forEach(method -> {
            RequestMethodType xmethod;
            switch(method.getHttpMethod()) {
                case HTTPMethods.GET:
                    xmethod = xhttp.addNewGet();
                    break;
                case HTTPMethods.POST:
                    xmethod = xhttp.addNewPost();
                    break;
                default:
                    return;
            }
            encodeOnlineResource(method, xmethod);
            method.getConstraints().forEach(x -> encodeOwsDomain(x, xmethod.addNewConstraint()));
        });
    }
}
Also used : OwsHttp(org.n52.shetland.ogc.ows.OwsHttp) HTTP(net.opengis.ows.x11.HTTPDocument.HTTP) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) RequestMethodType(net.opengis.ows.x11.RequestMethodType)

Example 3 with OwsRequestMethod

use of org.n52.shetland.ogc.ows.OwsRequestMethod in project arctic-sea by 52North.

the class AbstractCapabilitiesBaseTypeDecoder method parseRequestMethod.

private OwsRequestMethod parseRequestMethod(String httpMethod, RequestMethodType method) {
    if (method == null) {
        return null;
    }
    URI href = Optional.ofNullable(method.getHref()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI role = Optional.ofNullable(method.getRole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI arcrole = Optional.ofNullable(method.getArcrole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    Show show = Optional.ofNullable(method.getShow()).map(Object::toString).map(Show::valueOf).orElse(null);
    Actuate actuate = Optional.ofNullable(method.getActuate()).map(Object::toString).map(Actuate::valueOf).orElse(null);
    String title = method.getTitle();
    List<OwsDomain> constraints = parseDomains(method.getConstraintArray());
    return new OwsRequestMethod(href, constraints, httpMethod, role, arcrole, title, show, actuate);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) Actuate(org.n52.shetland.w3c.xlink.Actuate) Show(org.n52.shetland.w3c.xlink.Show) XmlObject(org.apache.xmlbeans.XmlObject) LocalizedString(org.n52.janmayen.i18n.LocalizedString) MultilingualString(org.n52.janmayen.i18n.MultilingualString) OwsLanguageString(org.n52.shetland.ogc.ows.OwsLanguageString) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) URI(java.net.URI) Strings(com.google.common.base.Strings)

Aggregations

OwsRequestMethod (org.n52.shetland.ogc.ows.OwsRequestMethod)3 URI (java.net.URI)2 OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)2 OwsHttp (org.n52.shetland.ogc.ows.OwsHttp)2 Strings (com.google.common.base.Strings)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Predicate (java.util.function.Predicate)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Stream (java.util.stream.Stream)1 Inject (javax.inject.Inject)1 HTTP (net.opengis.ows.x11.HTTPDocument.HTTP)1 RequestMethodType (net.opengis.ows.x11.RequestMethodType)1 XmlObject (org.apache.xmlbeans.XmlObject)1