use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method parseDeleteSensor.
private OwsServiceRequest parseDeleteSensor(final DeleteSensorDocument xbDelSenDoc) throws DecodingException {
final DeleteSensorRequest request = new DeleteSensorRequest();
DeleteSensorType deleteSensor = xbDelSenDoc.getDeleteSensor();
request.setService(deleteSensor.getService());
request.setVersion(deleteSensor.getVersion());
request.setProcedureIdentifier(deleteSensor.getProcedure());
// extensions
request.setExtensions(parseExtensibleRequest(deleteSensor));
return request;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method parseUpdateSensorDescription.
/**
* parses the Xmlbeans UpdateSensorDescription document to a SOS request.
*
* @param xbUpSenDoc
* UpdateSensorDescription document
* @return SOS UpdateSensor request
*
* @throws DecodingException
* * if an error occurs.
*/
private OwsServiceRequest parseUpdateSensorDescription(final UpdateSensorDescriptionDocument xbUpSenDoc) throws DecodingException {
final UpdateSensorRequest request = new UpdateSensorRequest();
final UpdateSensorDescriptionType xbUpdateSensor = xbUpSenDoc.getUpdateSensorDescription();
request.setService(xbUpdateSensor.getService());
request.setVersion(xbUpdateSensor.getVersion());
request.setProcedureIdentifier(xbUpdateSensor.getProcedure());
request.setProcedureDescriptionFormat(xbUpdateSensor.getProcedureDescriptionFormat());
// extensions
request.setExtensions(parseExtensibleRequest(xbUpdateSensor));
for (final Description description : xbUpdateSensor.getDescriptionArray()) {
SensorDescriptionType sensorDescription = description.getSensorDescription();
try {
// TODO exception if valid time is set
final XmlObject xmlObject = XmlObject.Factory.parse(getNodeFromNodeList(sensorDescription.getData().getDomNode().getChildNodes()));
Decoder<?, XmlObject> decoder = getDecoder(getDecoderKey(xmlObject));
if (decoder == null) {
throw new DecodingException(UpdateSensorDescriptionParams.procedureDescriptionFormat, "The requested procedureDescritpionFormat is not supported!");
}
final Object decodedObject = decoder.decode(xmlObject);
SosProcedureDescription<?> sosProcedureDescription = null;
if (decodedObject instanceof SosProcedureDescription) {
sosProcedureDescription = (SosProcedureDescription) decodedObject;
} else if (decodedObject instanceof AbstractFeature) {
sosProcedureDescription = new SosProcedureDescription<>((AbstractFeature) decodedObject);
}
if (sosProcedureDescription != null) {
if (sensorDescription.isSetValidTime()) {
sosProcedureDescription.setValidTime(getValidTime(sensorDescription.getValidTime()));
}
}
request.addProcedureDescriptionString(sosProcedureDescription);
} catch (final XmlException xmle) {
throw new DecodingException("Error while parsing procedure description of UpdateSensor request!", xmle);
}
}
return request;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class AbstractSoapDecoder method getSOAPBodyContent.
/**
* Parses the SOAPBody content to a text representation
*
* @param message
* SOAP message
*
* @return SOAPBody content as text
*
* @throws DecodingException
* * if an error occurs.
*/
protected OwsServiceRequest getSOAPBodyContent(SOAPMessage message) throws DecodingException {
try {
Document bodyRequestDoc = message.getSOAPBody().extractContentAsDocument();
String xmlString = W3cHelper.nodeToXmlString(bodyRequestDoc.getDocumentElement());
return decodeXmlElement(XmlObject.Factory.parse(xmlString, getXmlOptions()));
} catch (SOAPException | XmlException | IOException e) {
throw new DecodingException("Error while parsing SOAPMessage body content!", e);
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class BatchRequestDecoder method getDecoder.
private Decoder<OwsServiceRequest, JsonNode> getDecoder(JsonNode n) throws DecodingException {
String service = n.path(JSONConstants.SERVICE).textValue();
String version = n.path(JSONConstants.VERSION).textValue();
String request = n.path(JSONConstants.REQUEST).textValue();
OperationDecoderKey k = new OperationDecoderKey(service, version, request, MediaTypes.APPLICATION_JSON);
Decoder<OwsServiceRequest, JsonNode> decoder = getDecoder(k);
if (decoder == null) {
// TODO other exception?
throw new NoDecoderForKeyException(k);
}
return decoder;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class RequestResponseModifierKeyTypeTest method getModifiedRequest.
private OwsServiceRequest getModifiedRequest() {
OwsServiceRequest request = new RequestImpl();
request.setService(SERVICE).setVersion(VERSION);
return request;
}
Aggregations