use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SosDecoderv20 method parseGetObservationById.
private OwsServiceRequest parseGetObservationById(final GetObservationByIdDocument getObsByIdDoc) throws DecodingException {
final GetObservationByIdRequest getObsByIdRequest = new GetObservationByIdRequest();
final GetObservationByIdType getObsByIdType = getObsByIdDoc.getGetObservationById();
getObsByIdRequest.setService(getObsByIdType.getService());
getObsByIdRequest.setVersion(getObsByIdType.getVersion());
getObsByIdRequest.setObservationIdentifier(Arrays.asList(getObsByIdType.getObservationArray()));
getObsByIdRequest.setExtensions(parseExtensibleRequest(getObsByIdType));
return getObsByIdRequest;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SosDecoderv20 method parseGetCapabilities.
/**
* parses the XmlBean representing the getCapabilities request and creates a
* SosGetCapabilities request
*
* @param getCapsDoc
* XmlBean created from the incoming request stream
* @return Returns SosGetCapabilitiesRequest representing the request
*
* @throws DecodingException
* * If parsing the XmlBean failed
*/
private OwsServiceRequest parseGetCapabilities(final GetCapabilitiesDocument getCapsDoc) throws DecodingException {
final GetCapabilitiesType getCapsType = getCapsDoc.getGetCapabilities2();
final GetCapabilitiesRequest request = new GetCapabilitiesRequest(getCapsType.getService());
if (getCapsType.getAcceptFormats() != null && getCapsType.getAcceptFormats().sizeOfOutputFormatArray() != 0) {
request.setAcceptFormats(Arrays.asList(getCapsType.getAcceptFormats().getOutputFormatArray()));
}
if (getCapsType.getAcceptVersions() != null && getCapsType.getAcceptVersions().sizeOfVersionArray() != 0) {
request.setAcceptVersions(Arrays.asList(getCapsType.getAcceptVersions().getVersionArray()));
}
if (getCapsType.getSections() != null && getCapsType.getSections().getSectionArray().length != 0) {
request.setSections(Arrays.asList(getCapsType.getSections().getSectionArray()));
}
if (getCapsType.getExtensionArray() != null && getCapsType.getExtensionArray().length > 0) {
request.setExtensions(parseExtensibleRequestExtension(getCapsType.getExtensionArray()));
}
return request;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method parseDescribeSensor.
/**
* parses the passes XmlBeans document and creates a SOS describeSensor
* request
*
* @param xbDescSenDoc
* XmlBeans document representing the describeSensor request
* @return Returns SOS describeSensor request
*
* @throws DecodingException
* * if validation of the request failed
*/
private OwsServiceRequest parseDescribeSensor(final DescribeSensorDocument xbDescSenDoc) throws DecodingException {
final DescribeSensorRequest descSensorRequest = new DescribeSensorRequest();
final DescribeSensorType xbDescSensor = xbDescSenDoc.getDescribeSensor();
descSensorRequest.setService(xbDescSensor.getService());
descSensorRequest.setVersion(xbDescSensor.getVersion());
descSensorRequest.setProcedure(xbDescSensor.getProcedure());
descSensorRequest.setProcedureDescriptionFormat(xbDescSensor.getProcedureDescriptionFormat());
if (xbDescSensor.isSetValidTime()) {
descSensorRequest.setValidTime(getValidTime(xbDescSensor.getValidTime()));
}
// extensions
descSensorRequest.setExtensions(parseExtensibleRequest(xbDescSensor));
return descSensorRequest;
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method decode.
@Override
public OwsServiceRequest decode(XmlObject xmlObject) throws DecodingException {
LOGGER.debug("REQUESTTYPE:" + xmlObject.getClass());
XmlHelper.validateDocument(xmlObject);
if (xmlObject instanceof DescribeSensorDocument) {
return parseDescribeSensor((DescribeSensorDocument) xmlObject);
} else if (xmlObject instanceof InsertSensorDocument) {
return parseInsertSensor((InsertSensorDocument) xmlObject);
} else if (xmlObject instanceof UpdateSensorDescriptionDocument) {
return parseUpdateSensorDescription((UpdateSensorDescriptionDocument) xmlObject);
} else if (xmlObject instanceof DeleteSensorDocument) {
return parseDeleteSensor((DeleteSensorDocument) xmlObject);
} else {
throw new UnsupportedDecoderXmlInputException(this, xmlObject);
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method parseInsertSensor.
private OwsServiceRequest parseInsertSensor(final InsertSensorDocument xbInsSensDoc) throws DecodingException {
final InsertSensorRequest request = new InsertSensorRequest();
final InsertSensorType xbInsertSensor = xbInsSensDoc.getInsertSensor();
request.setService(xbInsertSensor.getService());
request.setVersion(xbInsertSensor.getVersion());
// format
request.setProcedureDescriptionFormat(xbInsertSensor.getProcedureDescriptionFormat());
// observable properties
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getObservablePropertyArray())) {
request.setObservableProperty(Arrays.asList(xbInsertSensor.getObservablePropertyArray()));
}
// related features
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getRelatedFeatureArray())) {
request.setRelatedFeature(parseRelatedFeature(xbInsertSensor.getRelatedFeatureArray()));
}
// metadata
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getMetadataArray())) {
request.setMetadata(parseMetadata(xbInsertSensor.getMetadataArray()));
}
// extensions
request.setExtensions(parseExtensibleRequest(xbInsertSensor));
try {
final XmlObject xbProcedureDescription = XmlObject.Factory.parse(getNodeFromNodeList(xbInsertSensor.getProcedureDescription().getDomNode().getChildNodes()));
checkFormatWithNamespace(xbInsertSensor.getProcedureDescriptionFormat(), XmlHelper.getNamespace(xbProcedureDescription));
final Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(xbInsertSensor.getProcedureDescriptionFormat(), xbProcedureDescription.getClass()));
if (decoder != null) {
final Object decodedProcedureDescription = decoder.decode(xbProcedureDescription);
if (decodedProcedureDescription instanceof SosProcedureDescription) {
request.setProcedureDescription((SosProcedureDescription) decodedProcedureDescription);
} else if (decodedProcedureDescription instanceof AbstractFeature) {
request.setProcedureDescription(new SosProcedureDescription<>((AbstractFeature) decodedProcedureDescription));
}
}
} catch (final XmlException xmle) {
throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
}
return request;
}
Aggregations