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;
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations