Search in sources :

Example 1 with GetCapabilitiesDocument

use of net.opengis.sos.x20.GetCapabilitiesDocument in project arctic-sea by 52North.

the class SosDecoderv20 method parseGetCapabilities.

/**
 * parses the XmlBean representing the getCapabilities request and creates a
 * SosGetCapabilities request
 *
 * @param getCapsDoc
 *            XmlBean created from the incoming request stream
 * @return Returns SosGetCapabilitiesRequest representing the request
 *
 * @throws DecodingException
 *             * If parsing the XmlBean failed
 */
private OwsServiceRequest parseGetCapabilities(final GetCapabilitiesDocument getCapsDoc) throws DecodingException {
    final GetCapabilitiesType getCapsType = getCapsDoc.getGetCapabilities2();
    final GetCapabilitiesRequest request = new GetCapabilitiesRequest(getCapsType.getService());
    if (getCapsType.getAcceptFormats() != null && getCapsType.getAcceptFormats().sizeOfOutputFormatArray() != 0) {
        request.setAcceptFormats(Arrays.asList(getCapsType.getAcceptFormats().getOutputFormatArray()));
    }
    if (getCapsType.getAcceptVersions() != null && getCapsType.getAcceptVersions().sizeOfVersionArray() != 0) {
        request.setAcceptVersions(Arrays.asList(getCapsType.getAcceptVersions().getVersionArray()));
    }
    if (getCapsType.getSections() != null && getCapsType.getSections().getSectionArray().length != 0) {
        request.setSections(Arrays.asList(getCapsType.getSections().getSectionArray()));
    }
    if (getCapsType.getExtensionArray() != null && getCapsType.getExtensionArray().length > 0) {
        request.setExtensions(parseExtensibleRequestExtension(getCapsType.getExtensionArray()));
    }
    return request;
}
Also used : GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) GetCapabilitiesType(net.opengis.sos.x20.GetCapabilitiesType)

Example 2 with GetCapabilitiesDocument

use of net.opengis.sos.x20.GetCapabilitiesDocument in project arctic-sea by 52North.

the class GetCapabilitiesV1RequestEncoder method create.

@Override
protected XmlObject create(GetCapabilitiesRequest request) throws EncodingException {
    GetCapabilitiesDocument doc = GetCapabilitiesDocument.Factory.newInstance(getXmlOptions());
    GetCapabilitiesDocument.GetCapabilities gc = doc.addNewGetCapabilities();
    addService(gc, request);
    addAcceptVersions(gc, request);
    addSections(gc, request);
    return doc;
}
Also used : GetCapabilitiesDocument(net.opengis.sos.x10.GetCapabilitiesDocument)

Example 3 with GetCapabilitiesDocument

use of net.opengis.sos.x20.GetCapabilitiesDocument in project arctic-sea by 52North.

the class GetCapabilitiesRequestEncoder method create.

@Override
protected XmlObject create(GetCapabilitiesRequest request) throws EncodingException {
    GetCapabilitiesDocument doc = GetCapabilitiesDocument.Factory.newInstance(getXmlOptions());
    GetCapabilitiesType gct = doc.addNewGetCapabilities2();
    addService(gct, request);
    addAcceptVersion(gct, request);
    addSections(gct, request);
    return doc;
}
Also used : GetCapabilitiesType(net.opengis.sos.x20.GetCapabilitiesType) GetCapabilitiesDocument(net.opengis.sos.x20.GetCapabilitiesDocument)

Example 4 with GetCapabilitiesDocument

use of net.opengis.sos.x20.GetCapabilitiesDocument in project arctic-sea by 52North.

the class SosDecoderv100 method decode.

@Override
public OwsServiceCommunicationObject decode(XmlObject xmlObject) throws DecodingException {
    OwsServiceCommunicationObject request = null;
    LOGGER.debug("REQUESTTYPE:" + xmlObject.getClass());
    /*
         * Add O&M 1.0.0 namespace to GetObservation document. XmlBeans removes
         * the namespace from the document because there are no om:... elements
         * in the document. But the validation fails if the <resultModel>
         * element is set with e.g. om:Measurement.
         */
    if (xmlObject instanceof GetObservationDocument) {
        XmlCursor cursor = xmlObject.newCursor();
        cursor.toFirstChild();
        cursor.insertNamespace(OmConstants.NS_OM_PREFIX, OmConstants.NS_OM);
        cursor.dispose();
    }
    // validate document
    XmlHelper.validateDocument(xmlObject);
    if (xmlObject instanceof GetCapabilitiesDocument) {
        // getCapabilities request
        GetCapabilitiesDocument getCapsDoc = (GetCapabilitiesDocument) xmlObject;
        request = parseGetCapabilities(getCapsDoc);
    } else if (xmlObject instanceof DescribeSensorDocument) {
        // DescribeSensor request (still SOS 1.0 NS_URI
        DescribeSensorDocument descSensorDoc = (DescribeSensorDocument) xmlObject;
        request = parseDescribeSensor(descSensorDoc);
    } else if (xmlObject instanceof GetObservationDocument) {
        // getObservation request
        GetObservationDocument getObsDoc = (GetObservationDocument) xmlObject;
        request = parseGetObservation(getObsDoc);
    } else if (xmlObject instanceof GetFeatureOfInterestDocument) {
        // getFeatureOfInterest request
        GetFeatureOfInterestDocument getFoiDoc = (GetFeatureOfInterestDocument) xmlObject;
        request = parseGetFeatureOfInterest(getFoiDoc);
    } else if (xmlObject instanceof GetObservationByIdDocument) {
        // getObservationById request
        GetObservationByIdDocument getObsByIdDoc = (GetObservationByIdDocument) xmlObject;
        request = parseGetObservationById(getObsByIdDoc);
    } else {
        throw new UnsupportedDecoderXmlInputException(this, xmlObject);
    }
    return request;
}
Also used : OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) GetObservationDocument(net.opengis.sos.x10.GetObservationDocument) DescribeSensorDocument(net.opengis.sos.x10.DescribeSensorDocument) GetFeatureOfInterestDocument(net.opengis.sos.x10.GetFeatureOfInterestDocument) GetObservationByIdDocument(net.opengis.sos.x10.GetObservationByIdDocument) UnsupportedDecoderXmlInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException) GetCapabilitiesDocument(net.opengis.sos.x10.GetCapabilitiesDocument) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

GetCapabilitiesDocument (net.opengis.sos.x10.GetCapabilitiesDocument)2 GetCapabilitiesType (net.opengis.sos.x20.GetCapabilitiesType)2 DescribeSensorDocument (net.opengis.sos.x10.DescribeSensorDocument)1 GetFeatureOfInterestDocument (net.opengis.sos.x10.GetFeatureOfInterestDocument)1 GetObservationByIdDocument (net.opengis.sos.x10.GetObservationByIdDocument)1 GetObservationDocument (net.opengis.sos.x10.GetObservationDocument)1 GetCapabilitiesDocument (net.opengis.sos.x20.GetCapabilitiesDocument)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)1 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)1 UnsupportedDecoderXmlInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException)1