Search in sources :

Example 6 with OwsServiceResponse

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

the class SosDecoderv20 method parseGetResultTemplateResponse.

private OwsServiceResponse parseGetResultTemplateResponse(final GetResultTemplateResponseDocument getResultTemplateResponseDoc) throws DecodingException {
    final GetResultTemplateResponse sosGetResultTemplateResponse = new GetResultTemplateResponse();
    final GetResultTemplateResponseType getResultTemplateResponse = getResultTemplateResponseDoc.getGetResultTemplateResponse();
    final SosResultEncoding resultEncoding = parseResultEncoding(getResultTemplateResponse.getResultEncoding().getAbstractEncoding());
    final SosResultStructure resultStructure = parseResultStructure(getResultTemplateResponse.getResultStructure().getAbstractDataComponent());
    sosGetResultTemplateResponse.setResultEncoding(resultEncoding);
    sosGetResultTemplateResponse.setResultStructure(resultStructure);
    return sosGetResultTemplateResponse;
}
Also used : GetResultTemplateResponseType(net.opengis.sos.x20.GetResultTemplateResponseType) GetResultTemplateResponse(org.n52.shetland.ogc.sos.response.GetResultTemplateResponse) SosResultEncoding(org.n52.shetland.ogc.sos.SosResultEncoding) SosResultStructure(org.n52.shetland.ogc.sos.SosResultStructure)

Example 7 with OwsServiceResponse

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

the class AbstractAqdResponseEncoder method getEncoder.

/**
 * Get the {@link Encoder} for the {@link OwsServiceResponse} and the
 * requested contentType
 *
 * @param asr
 *            {@link OwsServiceResponse} to get {@link Encoder} for
 * @return {@link Encoder} for the {@link OwsServiceResponse}
 */
protected Encoder<Object, OwsServiceResponse> getEncoder(OwsServiceResponse asr) {
    OperationResponseEncoderKey key = new OperationResponseEncoderKey(new OwsOperationKey(asr), getContentType());
    Encoder<Object, OwsServiceResponse> encoder = getEncoder(key);
    if (encoder == null) {
        throw new RuntimeException(new NoEncoderForKeyException(key));
    }
    return encoder;
}
Also used : NoEncoderForKeyException(org.n52.svalbard.encode.exception.NoEncoderForKeyException) XmlObject(org.apache.xmlbeans.XmlObject) OwsOperationKey(org.n52.shetland.ogc.ows.service.OwsOperationKey) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse)

Example 8 with OwsServiceResponse

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

the class AbstractXmlResponseEncoder method create.

/**
 * Override this method in concrete response encoder if streaming is supported for this operations.
 *
 * @param response       Implementation of {@link OwsServiceResponse}
 * @param outputStream   {@link OutputStream} to write
 * @param encodingValues {@link EncodingValues} with additional indicators for encoding
 *
 * @throws EncodingException If an error occurs during encoding/writing to stream
 */
protected void create(T response, OutputStream outputStream, EncodingContext encodingValues) throws EncodingException {
    try {
        XmlOptions xmlOptions;
        if (encodingValues.has(StreamingEncoderFlags.EMBEDDED)) {
            xmlOptions = new XmlOptions(getXmlOptions());
            xmlOptions.setSaveNoXmlDecl();
        } else {
            xmlOptions = getXmlOptions();
        }
        XmlObject xmlObject = create(response);
        setSchemaLocations(xmlObject);
        xmlObject.save(outputStream, xmlOptions);
    } catch (IOException ioe) {
        throw new EncodingException("Error while writing element to stream!", ioe);
    }
}
Also used : EncodingException(org.n52.svalbard.encode.exception.EncodingException) XmlOptions(org.apache.xmlbeans.XmlOptions) XmlObject(org.apache.xmlbeans.XmlObject) IOException(java.io.IOException)

Example 9 with OwsServiceResponse

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

the class RequestResponseModifierKeyTypeTest method getModifiedResponse.

private OwsServiceResponse getModifiedResponse() {
    OwsServiceResponse response = new ResponseImpl();
    response.setService(SERVICE).setVersion(VERSION);
    return response;
}
Also used : OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse)

Example 10 with OwsServiceResponse

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

the class GenericServiceOperator method receiveRequest.

/**
 * {@inheritDoc}
 *
 * @throws OperationNotSupportedException if no matching
 *                                        {@link RequestOperator} could be
 *                                        found or if the operator returned
 *                                        a {@code null}-response.
 */
@Override
public OwsServiceResponse receiveRequest(OwsServiceRequest request) throws OwsExceptionReport {
    String operationName = request.getOperationName();
    RequestOperator operator = this.requestOperatorRepository.getRequestOperator(this.key, operationName);
    if (operator == null) {
        throw new OperationNotSupportedException(operationName);
    }
    OwsServiceResponse response = operator.receiveRequest(request);
    if (response == null) {
        throw new OperationNotSupportedException(operationName);
    }
    return response;
}
Also used : OperationNotSupportedException(org.n52.shetland.ogc.ows.exception.OperationNotSupportedException) RequestOperator(org.n52.iceland.request.operator.RequestOperator) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse)

Aggregations

OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)11 XmlObject (org.apache.xmlbeans.XmlObject)5 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)4 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)4 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)4 NoEncoderForKeyException (org.n52.svalbard.encode.exception.NoEncoderForKeyException)3 OperationNotSupportedException (org.n52.shetland.ogc.ows.exception.OperationNotSupportedException)2 OperationResponseEncoderKey (org.n52.svalbard.encode.OperationResponseEncoderKey)2 EncodingException (org.n52.svalbard.encode.exception.EncodingException)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 GetResultResponseType (net.opengis.sos.x20.GetResultResponseType)1 GetResultTemplateResponseType (net.opengis.sos.x20.GetResultTemplateResponseType)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 XmlString (org.apache.xmlbeans.XmlString)1 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)1 RequestResponseModifier (org.n52.iceland.convert.RequestResponseModifier)1 RequestEvent (org.n52.iceland.event.events.RequestEvent)1 ResponseEvent (org.n52.iceland.event.events.ResponseEvent)1 RequestOperator (org.n52.iceland.request.operator.RequestOperator)1