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