Search in sources :

Example 1 with SosCapabilities

use of org.n52.shetland.ogc.sos.SosCapabilities in project arctic-sea by 52North.

the class GetCapabilitiesResponseEncoder method encodeResponse.

@Override
protected void encodeResponse(ObjectNode json, GetCapabilitiesResponse t) throws EncodingException {
    SosCapabilities caps = (SosCapabilities) t.getCapabilities();
    encodeOptional(json, JSONConstants.UPDATE_SEQUENCE, caps.getUpdateSequence(), nodeFactory()::textNode);
    encodeOptional(json, JSONConstants.SERVICE_IDENTIFICATION, caps.getServiceIdentification(), this::encodeServiceIdentification);
    encodeOptional(json, JSONConstants.SERVICE_PROVIDER, caps.getServiceProvider(), this::encodeServiceProvider);
    encodeOptional(json, JSONConstants.OPERATION_METADATA, caps.getOperationsMetadata(), this::encodeOperationMetadata);
    encodeOptionalChecked(json, JSONConstants.CONTENTS, caps.getContents(), this::encodeContents);
    encodeExtensions(json, caps);
    encodeOptional(json, JSONConstants.FILTER_CAPABILITIES, caps.getFilterCapabilities(), this::encodeFilterCapabilities);
}
Also used : SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities)

Example 2 with SosCapabilities

use of org.n52.shetland.ogc.sos.SosCapabilities in project arctic-sea by 52North.

the class CapabilitiesDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public SosCapabilities decode(Capabilities c) throws DecodingException {
    if (c != null) {
        OwsCapabilities owsCapabilities = parseCapabilitiesBaseType(SosConstants.SOS, c);
        FilterCapabilities filterCapabilities = parseFilterCapabilities(c.getFilterCapabilities());
        Collection<SosObservationOffering> contents = parseContents(c.getContents());
        return new SosCapabilities(owsCapabilities, filterCapabilities, contents);
    }
    throw new UnsupportedDecoderInputException(this, c);
}
Also used : FilterCapabilities(org.n52.shetland.ogc.filter.FilterCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) OwsCapabilities(org.n52.shetland.ogc.ows.OwsCapabilities) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 3 with SosCapabilities

use of org.n52.shetland.ogc.sos.SosCapabilities in project arctic-sea by 52North.

the class CapabilitiesTypeDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public SosCapabilities decode(CapabilitiesType ct) throws DecodingException {
    if (ct != null) {
        OwsCapabilities owsCapabilities = parseCapabilitiesBaseType(SosConstants.SOS, ct);
        FilterCapabilities filterCapabilities = parseFilterCapabilities(ct.getFilterCapabilities());
        Collection<SosObservationOffering> contents = parseContents(ct.getContents());
        return new SosCapabilities(owsCapabilities, filterCapabilities, contents);
    }
    throw new UnsupportedDecoderInputException(this, ct);
}
Also used : FilterCapabilities(org.n52.shetland.ogc.filter.FilterCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) OwsCapabilities(org.n52.shetland.ogc.ows.OwsCapabilities) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 4 with SosCapabilities

use of org.n52.shetland.ogc.sos.SosCapabilities in project arctic-sea by 52North.

the class GetCapabilitiesResponseEncoder method create.

@Override
protected XmlObject create(GetCapabilitiesResponse response) throws EncodingException {
    CapabilitiesDocument doc = CapabilitiesDocument.Factory.newInstance(getXmlOptions());
    CapabilitiesType xbCaps = doc.addNewCapabilities();
    if (response.isStatic()) {
        String xml = response.getXmlString();
        LOGGER.trace("Response is static. XML-String:\n{}\n", xml);
        try {
            doc.set(XmlObject.Factory.parse(xml));
            return doc;
        } catch (XmlException ex) {
            throw new EncodingException("Error encoding static capabilities", ex);
        }
    }
    // set version.
    if (response.getCapabilities().getVersion() != null) {
        xbCaps.setVersion(response.getCapabilities().getVersion());
    } else {
        xbCaps.setVersion(response.getVersion());
    }
    encodeServiceIdentification(response.getCapabilities(), xbCaps);
    encodeServiceProvider(response.getCapabilities(), xbCaps);
    encodeOperationsMetadata(response.getCapabilities(), xbCaps);
    if (response.getCapabilities() instanceof SosCapabilities) {
        SosCapabilities caps = (SosCapabilities) response.getCapabilities();
        encodeFilterCapabilities(caps, xbCaps);
        encodeContents(caps, xbCaps, response.getVersion());
        encodeExtensions(caps, xbCaps);
    }
    return doc;
}
Also used : EncodingException(org.n52.svalbard.encode.exception.EncodingException) CapabilitiesType(net.opengis.sos.x20.CapabilitiesType) InsertionCapabilitiesType(net.opengis.sos.x20.InsertionCapabilitiesType) XmlException(org.apache.xmlbeans.XmlException) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) CapabilitiesDocument(net.opengis.sos.x20.CapabilitiesDocument) InsertionCapabilitiesDocument(net.opengis.sos.x20.InsertionCapabilitiesDocument)

Example 5 with SosCapabilities

use of org.n52.shetland.ogc.sos.SosCapabilities in project arctic-sea by 52North.

the class SosV1GetCapabilitiesResponseEncoder method create.

@Override
protected XmlObject create(GetCapabilitiesResponse response) throws EncodingException {
    CapabilitiesDocument xbCapsDoc = CapabilitiesDocument.Factory.newInstance(getXmlOptions());
    // cursor for getting prefixes
    Capabilities xbCaps = xbCapsDoc.addNewCapabilities();
    // set version.
    xbCaps.setVersion(response.getVersion());
    SosCapabilities sosCapabilities = (SosCapabilities) response.getCapabilities();
    if (sosCapabilities.getServiceIdentification().isPresent()) {
        xbCaps.addNewServiceIdentification().set(encodeObjectToXml(OWSConstants.NS_OWS, sosCapabilities.getServiceIdentification().get()));
    }
    if (sosCapabilities.getServiceProvider().isPresent()) {
        xbCaps.addNewServiceProvider().set(encodeObjectToXml(OWSConstants.NS_OWS, sosCapabilities.getServiceProvider().get()));
    }
    if (sosCapabilities.getOperationsMetadata().isPresent()) {
        xbCaps.addNewOperationsMetadata().set(encodeObjectToXml(OWSConstants.NS_OWS, sosCapabilities.getOperationsMetadata().get()));
    }
    if (sosCapabilities.getFilterCapabilities().isPresent()) {
        setFilterCapabilities(xbCaps.addNewFilterCapabilities(), sosCapabilities.getFilterCapabilities().get());
    }
    if (sosCapabilities.getContents().isPresent()) {
        setContents(xbCaps.addNewContents(), sosCapabilities.getContents().get(), response.getVersion());
    }
    N52XmlHelper.setSchemaLocationsToDocument(xbCapsDoc, Sets.newHashSet(N52XmlHelper.getSchemaLocationForSOS100()));
    return xbCapsDoc;
}
Also used : Capabilities(net.opengis.sos.x10.CapabilitiesDocument.Capabilities) FilterCapabilities(net.opengis.sos.x10.FilterCapabilitiesDocument.FilterCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) CapabilitiesDocument(net.opengis.sos.x10.CapabilitiesDocument)

Aggregations

SosCapabilities (org.n52.shetland.ogc.sos.SosCapabilities)5 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 FilterCapabilities (org.n52.shetland.ogc.filter.FilterCapabilities)2 OwsCapabilities (org.n52.shetland.ogc.ows.OwsCapabilities)2 SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)2 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)2 CapabilitiesDocument (net.opengis.sos.x10.CapabilitiesDocument)1 Capabilities (net.opengis.sos.x10.CapabilitiesDocument.Capabilities)1 FilterCapabilities (net.opengis.sos.x10.FilterCapabilitiesDocument.FilterCapabilities)1 CapabilitiesDocument (net.opengis.sos.x20.CapabilitiesDocument)1 CapabilitiesType (net.opengis.sos.x20.CapabilitiesType)1 InsertionCapabilitiesDocument (net.opengis.sos.x20.InsertionCapabilitiesDocument)1 InsertionCapabilitiesType (net.opengis.sos.x20.InsertionCapabilitiesType)1 XmlException (org.apache.xmlbeans.XmlException)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1