Search in sources :

Example 1 with DescribeSensorResponse

use of org.n52.shetland.ogc.sos.response.DescribeSensorResponse in project SOS by 52North.

the class AbstractNetcdfEncoder method queryProcedureDescription.

private SosProcedureDescription<?> queryProcedureDescription(String procedure) throws EncodingException {
    DescribeSensorRequest req = new DescribeSensorRequest();
    req.setService(SosConstants.SOS);
    req.setVersion(Sos2Constants.SERVICEVERSION);
    req.setProcedure(procedure);
    Set<String> pdfs = (this.procedureDescriptionFormatRepository).getAllSupportedProcedureDescriptionFormats(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
    if (pdfs.contains(SensorML20Constants.NS_SML)) {
        req.setProcedureDescriptionFormat(SensorML20Constants.NS_SML);
    } else if (pdfs.contains(SensorMLConstants.NS_SML)) {
        req.setProcedureDescriptionFormat(SensorMLConstants.NS_SML);
    } else {
        throw new EncodingException("Error getting sensor description for %s! Required procedureDescriptionFormats are not supported!", procedure);
    }
    DescribeSensorResponse resp;
    try {
        resp = getDescribeSensorHandler().getSensorDescription(req);
    } catch (OwsExceptionReport e) {
        throw new EncodingException(e, "Error getting sensor description for %s", procedure);
    }
    return resp.getProcedureDescriptions().get(0);
}
Also used : EncodingException(org.n52.svalbard.encode.exception.EncodingException) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 2 with DescribeSensorResponse

use of org.n52.shetland.ogc.sos.response.DescribeSensorResponse in project SOS by 52North.

the class EReportingPrefixedIdentifierModifier method getKeyTypes.

/**
 * Get the keys
 *
 * @return Set of keys
 */
private Set<RequestResponseModifierKey> getKeyTypes() {
    Set<String> services = Sets.newHashSet(AqdConstants.AQD);
    Set<String> versions = Sets.newHashSet(AqdConstants.VERSION);
    Map<OwsServiceRequest, OwsServiceResponse> requestResponseMap = Maps.newHashMap();
    requestResponseMap.put(new GetCapabilitiesRequest(SosConstants.SOS), new GetCapabilitiesResponse());
    requestResponseMap.put(new GetObservationRequest(), new GetObservationResponse());
    requestResponseMap.put(new GetObservationByIdRequest(), new GetObservationByIdResponse());
    requestResponseMap.put(new GetFeatureOfInterestRequest(), new GetFeatureOfInterestResponse());
    requestResponseMap.put(new DescribeSensorRequest(), new DescribeSensorResponse());
    requestResponseMap.put(new GetDataAvailabilityRequest(), new GetDataAvailabilityResponse());
    requestResponseMap.put(new GetResultTemplateRequest(), new GetResultTemplateResponse());
    requestResponseMap.put(new GetResultRequest(), new GetResultResponse());
    Set<RequestResponseModifierKey> keys = Sets.newHashSet();
    services.forEach(service -> versions.forEach(version -> requestResponseMap.forEach((request, response) -> {
        keys.add(new RequestResponseModifierKey(service, version, request));
        keys.add(new RequestResponseModifierKey(service, version, request, response));
    })));
    return keys;
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) GetObservationResponse(org.n52.shetland.ogc.sos.response.GetObservationResponse) InvalidParameterValueException(org.n52.shetland.ogc.ows.exception.InvalidParameterValueException) GetObservationByIdRequest(org.n52.shetland.ogc.sos.request.GetObservationByIdRequest) ProcessParameter(org.n52.shetland.aqd.AqdConstants.ProcessParameter) SosOffering(org.n52.shetland.ogc.sos.SosOffering) AbstractObservationResponse(org.n52.shetland.ogc.sos.response.AbstractObservationResponse) AbstractIdentifierModifier(org.n52.sos.convert.AbstractIdentifierModifier) GetCapabilitiesResponse(org.n52.shetland.ogc.ows.service.GetCapabilitiesResponse) GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) GetResultTemplateResponse(org.n52.shetland.ogc.sos.response.GetResultTemplateResponse) SosConstants(org.n52.shetland.ogc.sos.SosConstants) GetResultTemplateRequest(org.n52.shetland.ogc.sos.request.GetResultTemplateRequest) W3CHrefAttribute(org.n52.shetland.w3c.xlink.W3CHrefAttribute) Inject(javax.inject.Inject) GetResultRequest(org.n52.shetland.ogc.sos.request.GetResultRequest) AqdConstants(org.n52.shetland.aqd.AqdConstants) GetResultResponse(org.n52.shetland.ogc.sos.response.GetResultResponse) Locale(java.util.Locale) GetFeatureOfInterestRequest(org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest) Map(java.util.Map) RequestResponseModifierFacilitator(org.n52.iceland.convert.RequestResponseModifierFacilitator) GetDataAvailabilityRequest(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityRequest) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) AbstractSamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) HrefAttributeValue(org.n52.shetland.ogc.om.values.HrefAttributeValue) Collection(java.util.Collection) Set(java.util.Set) RequestResponseModifierKey(org.n52.iceland.convert.RequestResponseModifierKey) GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Maps(com.google.common.collect.Maps) OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) GetObservationByIdResponse(org.n52.shetland.ogc.sos.response.GetObservationByIdResponse) Sets(com.google.common.collect.Sets) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) EReportingPrefixedIdentifierHelper(org.n52.sos.converter.util.EReportingPrefixedIdentifierHelper) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) NamedValue(org.n52.shetland.ogc.om.NamedValue) Optional(java.util.Optional) ReferenceValue(org.n52.shetland.ogc.om.values.ReferenceValue) Collections(java.util.Collections) GetDataAvailabilityResponse(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse) GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) RequestResponseModifierKey(org.n52.iceland.convert.RequestResponseModifierKey) GetResultResponse(org.n52.shetland.ogc.sos.response.GetResultResponse) GetObservationResponse(org.n52.shetland.ogc.sos.response.GetObservationResponse) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) GetDataAvailabilityResponse(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse) GetCapabilitiesResponse(org.n52.shetland.ogc.ows.service.GetCapabilitiesResponse) GetObservationByIdResponse(org.n52.shetland.ogc.sos.response.GetObservationByIdResponse) GetResultTemplateResponse(org.n52.shetland.ogc.sos.response.GetResultTemplateResponse) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) GetResultRequest(org.n52.shetland.ogc.sos.request.GetResultRequest) GetDataAvailabilityRequest(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityRequest) GetFeatureOfInterestRequest(org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest) GetResultTemplateRequest(org.n52.shetland.ogc.sos.request.GetResultTemplateRequest) OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) GetObservationByIdRequest(org.n52.shetland.ogc.sos.request.GetObservationByIdRequest)

Example 3 with DescribeSensorResponse

use of org.n52.shetland.ogc.sos.response.DescribeSensorResponse in project SOS by 52North.

the class CoordinateTransformator method getKeyTypes.

/**
 * Get the keys
 *
 * @return Set of keys
 */
private static Set<RequestResponseModifierKey> getKeyTypes() {
    ImmutableMap.Builder<OwsServiceRequest, OwsServiceResponse> mapBuilder = ImmutableMap.builder();
    ImmutableSet.Builder<RequestResponseModifierKey> keysBuilder = ImmutableSet.builder();
    mapBuilder.put(new GetCapabilitiesRequest(SosConstants.SOS), new GetCapabilitiesResponse());
    mapBuilder.put(new GetObservationRequest(), new GetObservationResponse());
    mapBuilder.put(new GetObservationByIdRequest(), new GetObservationByIdResponse());
    mapBuilder.put(new GetFeatureOfInterestRequest(), new GetFeatureOfInterestResponse());
    mapBuilder.put(new InsertObservationRequest(), new InsertObservationResponse());
    mapBuilder.put(new InsertResultTemplateRequest(), new InsertResultTemplateResponse());
    mapBuilder.put(new GetResultRequest(), new GetResultResponse());
    mapBuilder.put(new DescribeSensorRequest(), new DescribeSensorResponse());
    List<String> services = Arrays.asList(SosConstants.SOS);
    List<String> versions = Arrays.asList(Sos1Constants.SERVICEVERSION, Sos2Constants.SERVICEVERSION);
    mapBuilder.build().forEach((request, response) -> {
        services.forEach(service -> {
            versions.forEach(version -> {
                keysBuilder.add(new RequestResponseModifierKey(service, version, request), new RequestResponseModifierKey(service, version, request, response));
            });
        });
    });
    return keysBuilder.build();
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) RequestResponseModifierKey(org.n52.iceland.convert.RequestResponseModifierKey) GetObservationResponse(org.n52.shetland.ogc.sos.response.GetObservationResponse) GetCapabilitiesResponse(org.n52.shetland.ogc.ows.service.GetCapabilitiesResponse) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) GetResultRequest(org.n52.shetland.ogc.sos.request.GetResultRequest) ImmutableSet(com.google.common.collect.ImmutableSet) GetFeatureOfInterestRequest(org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest) InsertObservationResponse(org.n52.shetland.ogc.sos.response.InsertObservationResponse) GetObservationByIdRequest(org.n52.shetland.ogc.sos.request.GetObservationByIdRequest) GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) InsertResultTemplateResponse(org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse) GetResultResponse(org.n52.shetland.ogc.sos.response.GetResultResponse) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) GetObservationByIdResponse(org.n52.shetland.ogc.sos.response.GetObservationByIdResponse) ImmutableMap(com.google.common.collect.ImmutableMap) InsertObservationRequest(org.n52.shetland.ogc.sos.request.InsertObservationRequest) OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)

Example 4 with DescribeSensorResponse

use of org.n52.shetland.ogc.sos.response.DescribeSensorResponse in project arctic-sea by 52North.

the class DescribeSensorResponseSwesDocumentDecoder method decode.

@Override
public DescribeSensorResponse decode(XmlObject objectToDecode) throws DecodingException {
    if (objectToDecode instanceof DescribeSensorResponseDocument) {
        DescribeSensorResponse response = new DescribeSensorResponse();
        DescribeSensorResponseDocument dsrd = (DescribeSensorResponseDocument) objectToDecode;
        DescribeSensorResponseType dsrt = dsrd.getDescribeSensorResponse();
        response.setOutputFormat(dsrt.getProcedureDescriptionFormat());
        for (Description description : dsrt.getDescriptionArray()) {
            SensorDescriptionType sdt = description.getSensorDescription();
            // }
            try {
                final XmlObject xbProcedureDescription = XmlObject.Factory.parse(getNodeFromNodeList(sdt.getData().getDomNode().getChildNodes()));
                checkFormatWithNamespace(dsrt.getProcedureDescriptionFormat(), XmlHelper.getNamespace(xbProcedureDescription));
                final Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(dsrt.getProcedureDescriptionFormat(), xbProcedureDescription.getClass()));
                if (decoder != null) {
                    final Object decodedProcedureDescription = decoder.decode(xbProcedureDescription);
                    if (decodedProcedureDescription instanceof SosProcedureDescription) {
                        response.addSensorDescription((SosProcedureDescription) decodedProcedureDescription);
                    } else if (decodedProcedureDescription instanceof AbstractFeature) {
                        response.addSensorDescription(new SosProcedureDescription<>((AbstractFeature) decodedProcedureDescription));
                    }
                }
            } catch (final XmlException xmle) {
                throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
            }
        }
        return response;
    }
    throw new UnsupportedDecoderInputException(this, objectToDecode);
}
Also used : SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) Description(net.opengis.swes.x20.DescribeSensorResponseType.Description) DescribeSensorResponseType(net.opengis.swes.x20.DescribeSensorResponseType) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) DecodingException(org.n52.svalbard.decode.exception.DecodingException) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) DescribeSensorResponseDocument(net.opengis.swes.x20.DescribeSensorResponseDocument) XmlException(org.apache.xmlbeans.XmlException) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) XmlObject(org.apache.xmlbeans.XmlObject) XmlObject(org.apache.xmlbeans.XmlObject) SensorDescriptionType(net.opengis.swes.x20.SensorDescriptionType)

Example 5 with DescribeSensorResponse

use of org.n52.shetland.ogc.sos.response.DescribeSensorResponse in project arctic-sea by 52North.

the class DescribeSensorResponseSwesDocumentDecoderTest method should_parse.

@Test
public void should_parse() throws DecodingException, XmlException, IOException {
    XmlObject xml = decode("/DescribeSensorResponseSML101.xml");
    DecoderKey decoderKey = CodingHelper.getDecoderKey(xml);
    Decoder<DescribeSensorResponse, XmlObject> decoder = decoderRepository.getDecoder(decoderKey);
    DescribeSensorResponse response = decoder.decode(xml);
    Assertions.assertEquals(SensorMLConstants.NS_SML, response.getOutputFormat());
    Assertions.assertEquals(1, response.getProcedureDescriptions().size());
}
Also used : DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.jupiter.api.Test)

Aggregations

DescribeSensorResponse (org.n52.shetland.ogc.sos.response.DescribeSensorResponse)10 DescribeSensorRequest (org.n52.shetland.ogc.sos.request.DescribeSensorRequest)6 RequestResponseModifierKey (org.n52.iceland.convert.RequestResponseModifierKey)4 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)4 GetCapabilitiesResponse (org.n52.shetland.ogc.ows.service.GetCapabilitiesResponse)4 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)4 OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)4 GetFeatureOfInterestRequest (org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest)4 GetObservationByIdRequest (org.n52.shetland.ogc.sos.request.GetObservationByIdRequest)4 GetObservationRequest (org.n52.shetland.ogc.sos.request.GetObservationRequest)4 GetResultRequest (org.n52.shetland.ogc.sos.request.GetResultRequest)4 GetFeatureOfInterestResponse (org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse)4 GetObservationByIdResponse (org.n52.shetland.ogc.sos.response.GetObservationByIdResponse)4 GetObservationResponse (org.n52.shetland.ogc.sos.response.GetObservationResponse)4 GetResultResponse (org.n52.shetland.ogc.sos.response.GetResultResponse)4 Maps (com.google.common.collect.Maps)2 Sets (com.google.common.collect.Sets)2 Collections (java.util.Collections)2 Locale (java.util.Locale)2 Map (java.util.Map)2