Search in sources :

Example 16 with OwsServiceRequest

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

the class SosDecoderv20 method parseGetObservationById.

private OwsServiceRequest parseGetObservationById(final GetObservationByIdDocument getObsByIdDoc) throws DecodingException {
    final GetObservationByIdRequest getObsByIdRequest = new GetObservationByIdRequest();
    final GetObservationByIdType getObsByIdType = getObsByIdDoc.getGetObservationById();
    getObsByIdRequest.setService(getObsByIdType.getService());
    getObsByIdRequest.setVersion(getObsByIdType.getVersion());
    getObsByIdRequest.setObservationIdentifier(Arrays.asList(getObsByIdType.getObservationArray()));
    getObsByIdRequest.setExtensions(parseExtensibleRequest(getObsByIdType));
    return getObsByIdRequest;
}
Also used : GetObservationByIdType(net.opengis.sos.x20.GetObservationByIdType) GetObservationByIdRequest(org.n52.shetland.ogc.sos.request.GetObservationByIdRequest)

Example 17 with OwsServiceRequest

use of org.n52.shetland.ogc.ows.service.OwsServiceRequest 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 18 with OwsServiceRequest

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

the class SwesDecoderv20 method parseDescribeSensor.

/**
 * parses the passes XmlBeans document and creates a SOS describeSensor
 * request
 *
 * @param xbDescSenDoc
 *            XmlBeans document representing the describeSensor request
 * @return Returns SOS describeSensor request
 *
 * @throws DecodingException
 *             * if validation of the request failed
 */
private OwsServiceRequest parseDescribeSensor(final DescribeSensorDocument xbDescSenDoc) throws DecodingException {
    final DescribeSensorRequest descSensorRequest = new DescribeSensorRequest();
    final DescribeSensorType xbDescSensor = xbDescSenDoc.getDescribeSensor();
    descSensorRequest.setService(xbDescSensor.getService());
    descSensorRequest.setVersion(xbDescSensor.getVersion());
    descSensorRequest.setProcedure(xbDescSensor.getProcedure());
    descSensorRequest.setProcedureDescriptionFormat(xbDescSensor.getProcedureDescriptionFormat());
    if (xbDescSensor.isSetValidTime()) {
        descSensorRequest.setValidTime(getValidTime(xbDescSensor.getValidTime()));
    }
    // extensions
    descSensorRequest.setExtensions(parseExtensibleRequest(xbDescSensor));
    return descSensorRequest;
}
Also used : DescribeSensorType(net.opengis.swes.x20.DescribeSensorType) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 19 with OwsServiceRequest

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

the class SwesDecoderv20 method decode.

@Override
public OwsServiceRequest decode(XmlObject xmlObject) throws DecodingException {
    LOGGER.debug("REQUESTTYPE:" + xmlObject.getClass());
    XmlHelper.validateDocument(xmlObject);
    if (xmlObject instanceof DescribeSensorDocument) {
        return parseDescribeSensor((DescribeSensorDocument) xmlObject);
    } else if (xmlObject instanceof InsertSensorDocument) {
        return parseInsertSensor((InsertSensorDocument) xmlObject);
    } else if (xmlObject instanceof UpdateSensorDescriptionDocument) {
        return parseUpdateSensorDescription((UpdateSensorDescriptionDocument) xmlObject);
    } else if (xmlObject instanceof DeleteSensorDocument) {
        return parseDeleteSensor((DeleteSensorDocument) xmlObject);
    } else {
        throw new UnsupportedDecoderXmlInputException(this, xmlObject);
    }
}
Also used : InsertSensorDocument(net.opengis.swes.x20.InsertSensorDocument) DeleteSensorDocument(net.opengis.swes.x20.DeleteSensorDocument) DescribeSensorDocument(net.opengis.swes.x20.DescribeSensorDocument) UnsupportedDecoderXmlInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException) UpdateSensorDescriptionDocument(net.opengis.swes.x20.UpdateSensorDescriptionDocument)

Example 20 with OwsServiceRequest

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

the class SwesDecoderv20 method parseInsertSensor.

private OwsServiceRequest parseInsertSensor(final InsertSensorDocument xbInsSensDoc) throws DecodingException {
    final InsertSensorRequest request = new InsertSensorRequest();
    final InsertSensorType xbInsertSensor = xbInsSensDoc.getInsertSensor();
    request.setService(xbInsertSensor.getService());
    request.setVersion(xbInsertSensor.getVersion());
    // format
    request.setProcedureDescriptionFormat(xbInsertSensor.getProcedureDescriptionFormat());
    // observable properties
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getObservablePropertyArray())) {
        request.setObservableProperty(Arrays.asList(xbInsertSensor.getObservablePropertyArray()));
    }
    // related features
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getRelatedFeatureArray())) {
        request.setRelatedFeature(parseRelatedFeature(xbInsertSensor.getRelatedFeatureArray()));
    }
    // metadata
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getMetadataArray())) {
        request.setMetadata(parseMetadata(xbInsertSensor.getMetadataArray()));
    }
    // extensions
    request.setExtensions(parseExtensibleRequest(xbInsertSensor));
    try {
        final XmlObject xbProcedureDescription = XmlObject.Factory.parse(getNodeFromNodeList(xbInsertSensor.getProcedureDescription().getDomNode().getChildNodes()));
        checkFormatWithNamespace(xbInsertSensor.getProcedureDescriptionFormat(), XmlHelper.getNamespace(xbProcedureDescription));
        final Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(xbInsertSensor.getProcedureDescriptionFormat(), xbProcedureDescription.getClass()));
        if (decoder != null) {
            final Object decodedProcedureDescription = decoder.decode(xbProcedureDescription);
            if (decodedProcedureDescription instanceof SosProcedureDescription) {
                request.setProcedureDescription((SosProcedureDescription) decodedProcedureDescription);
            } else if (decodedProcedureDescription instanceof AbstractFeature) {
                request.setProcedureDescription(new SosProcedureDescription<>((AbstractFeature) decodedProcedureDescription));
            }
        }
    } catch (final XmlException xmle) {
        throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
    }
    return request;
}
Also used : XmlException(org.apache.xmlbeans.XmlException) InsertSensorType(net.opengis.swes.x20.InsertSensorType) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject) OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) XmlObject(org.apache.xmlbeans.XmlObject) DecodingException(org.n52.svalbard.decode.exception.DecodingException) InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest)

Aggregations

OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)12 DecodingException (org.n52.svalbard.decode.exception.DecodingException)10 XmlObject (org.apache.xmlbeans.XmlObject)7 OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)6 XmlException (org.apache.xmlbeans.XmlException)5 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)5 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)4 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)4 IOException (java.io.IOException)3 OwsDecodingException (org.n52.iceland.coding.decode.OwsDecodingException)3 InvalidServiceParameterException (org.n52.iceland.exception.ows.concrete.InvalidServiceParameterException)3 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)3 OperationDecoderKey (org.n52.svalbard.decode.OperationDecoderKey)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 LinkedList (java.util.LinkedList)2 Set (java.util.Set)2 GetFeatureOfInterest (net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest)2 GetResultTemplateType (net.opengis.sos.x20.GetResultTemplateType)2 Test (org.junit.Test)2 VersionNotSupportedException (org.n52.iceland.exception.ows.concrete.VersionNotSupportedException)2