Search in sources :

Example 31 with OwsServiceRequest

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

the class KvpBinding method doGetOperation.

@Override
public void doGetOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
    LOGGER.debug("KVP-REQUEST: {}", req.getQueryString());
    OwsServiceRequest serviceRequest = null;
    try {
        serviceRequest = parseRequest(req);
        // add request context information
        serviceRequest.setRequestContext(getRequestContext(req));
        OwsServiceResponse response = getServiceOperator(serviceRequest).receiveRequest(serviceRequest);
        writeResponse(req, res, response);
    } catch (OwsExceptionReport oer) {
        oer.setVersion(serviceRequest != null ? serviceRequest.getVersion() : null);
        writeOwsExceptionReport(req, res, oer);
    }
}
Also used : OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Example 32 with OwsServiceRequest

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

the class SosDecoderv100 method parseGetFeatureOfInterest.

/**
 * parses the passes XmlBeans document and creates a SOS
 * getFeatureOfInterest request
 *
 * @param getFoiDoc
 *            XmlBeans document representing the getFeatureOfInterest
 *            request
 * @return Returns SOS getFeatureOfInterest request
 *
 * @throws DecodingException
 *             * if validation of the request failed
 */
private OwsServiceRequest parseGetFeatureOfInterest(GetFeatureOfInterestDocument getFoiDoc) throws DecodingException {
    GetFeatureOfInterestRequest getFoiRequest = new GetFeatureOfInterestRequest();
    GetFeatureOfInterest getFoi = getFoiDoc.getGetFeatureOfInterest();
    getFoiRequest.setService(getFoi.getService());
    getFoiRequest.setVersion(getFoi.getVersion());
    getFoiRequest.setFeatureIdentifiers(Arrays.asList(getFoi.getFeatureOfInterestIdArray()));
    getFoiRequest.setSpatialFilters(parseSpatialFilters4GetFeatureOfInterest(getFoi.getLocation()));
    return getFoiRequest;
}
Also used : GetFeatureOfInterest(net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest) GetFeatureOfInterestRequest(org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest)

Example 33 with OwsServiceRequest

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

the class SosDecoderv100 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
 */
private OwsServiceRequest parseGetCapabilities(GetCapabilitiesDocument getCapsDoc) {
    GetCapabilities getCaps = getCapsDoc.getGetCapabilities();
    GetCapabilitiesRequest request = new GetCapabilitiesRequest(getCaps.getService());
    if (getCaps.getAcceptFormats() != null && getCaps.getAcceptFormats().sizeOfOutputFormatArray() != 0) {
        request.setAcceptFormats(Arrays.asList(getCaps.getAcceptFormats().getOutputFormatArray()));
    }
    if (getCaps.getAcceptVersions() != null && getCaps.getAcceptVersions().sizeOfVersionArray() != 0) {
        request.setAcceptVersions(Arrays.asList(getCaps.getAcceptVersions().getVersionArray()));
    }
    if (getCaps.getSections() != null && getCaps.getSections().getSectionArray().length != 0) {
        request.setSections(Arrays.asList(getCaps.getSections().getSectionArray()));
    }
    return request;
}
Also used : GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) GetCapabilities(net.opengis.sos.x10.GetCapabilitiesDocument.GetCapabilities)

Example 34 with OwsServiceRequest

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

the class SosDecoderv20 method parseGetObservation.

/**
 * parses the XmlBean representing the getObservation request and creates a
 * SoSGetObservation request
 *
 * @param getObsDoc
 *            XmlBean created from the incoming request stream
 * @return Returns SosGetObservationRequest representing the request
 *
 * @throws DecodingException
 *             * If parsing the XmlBean failed
 */
private OwsServiceRequest parseGetObservation(final GetObservationDocument getObsDoc) throws DecodingException {
    final GetObservationRequest getObsRequest = new GetObservationRequest();
    final GetObservationType getObsType = getObsDoc.getGetObservation();
    // TODO: check
    getObsRequest.setService(getObsType.getService());
    getObsRequest.setVersion(getObsType.getVersion());
    getObsRequest.setOfferings(Arrays.asList(getObsType.getOfferingArray()));
    getObsRequest.setObservedProperties(Arrays.asList(getObsType.getObservedPropertyArray()));
    getObsRequest.setProcedures(Arrays.asList(getObsType.getProcedureArray()));
    getObsRequest.setTemporalFilters(parseTemporalFilters4GetObservation(getObsType.getTemporalFilterArray()));
    if (getObsType.isSetSpatialFilter()) {
        getObsRequest.setSpatialFilter(parseSpatialFilter4GetObservation(getObsType.getSpatialFilter()));
    }
    getObsRequest.setFeatureIdentifiers(Arrays.asList(getObsType.getFeatureOfInterestArray()));
    if (getObsType.isSetResponseFormat()) {
        try {
            final String responseFormat = URLDecoder.decode(getObsType.getResponseFormat(), "UTF-8");
            getObsRequest.setResponseFormat(responseFormat);
        } catch (final UnsupportedEncodingException e) {
            throw new DecodingException(e, "Error while encoding response format!");
        }
    }
    getObsRequest.setExtensions(parseExtensibleRequest(getObsType));
    return getObsRequest;
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) GetObservationType(net.opengis.sos.x20.GetObservationType) UnsupportedEncodingException(java.io.UnsupportedEncodingException) DecodingException(org.n52.svalbard.decode.exception.DecodingException) XmlString(org.apache.xmlbeans.XmlString)

Example 35 with OwsServiceRequest

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

the class SosDecoderv20 method parseGetResult.

private OwsServiceRequest parseGetResult(final GetResultDocument getResultDoc) throws DecodingException {
    final GetResultType getResult = getResultDoc.getGetResult();
    final GetResultRequest sosGetResultRequest = new GetResultRequest();
    sosGetResultRequest.setService(getResult.getService());
    sosGetResultRequest.setVersion(getResult.getVersion());
    sosGetResultRequest.setOffering(getResult.getOffering());
    sosGetResultRequest.setObservedProperty(getResult.getObservedProperty());
    sosGetResultRequest.setFeatureIdentifiers(Arrays.asList(getResult.getFeatureOfInterestArray()));
    getResult.getFeatureOfInterestArray();
    if (getResult.isSetSpatialFilter()) {
        sosGetResultRequest.setSpatialFilter(parseSpatialFilter4GetResult(getResult.getSpatialFilter()));
    }
    sosGetResultRequest.setExtensions(parseExtensibleRequest(getResult));
    sosGetResultRequest.setTemporalFilter(parseTemporalFilters4GetResult(getResult.getTemporalFilterArray()));
    return sosGetResultRequest;
}
Also used : GetResultRequest(org.n52.shetland.ogc.sos.request.GetResultRequest) GetResultType(net.opengis.sos.x20.GetResultType)

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