use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class SensorMLDecoderV20 method parseComponents.
private List<SmlComponent> parseComponents(ComponentListPropertyType components) throws DecodingException {
final List<SmlComponent> sosSmlComponents = Lists.newLinkedList();
if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) {
for (final Component component : components.getComponentList().getComponentArray()) {
if (component.isSetAbstractProcess() || component.isSetHref() || component.isSetTitle()) {
final SmlComponent sosSmlcomponent = new SmlComponent(component.getName());
AbstractSensorML abstractProcess;
if (component.isSetAbstractProcess()) {
abstractProcess = parse(component.getAbstractProcess());
} else {
if (component.isSetTitle()) {
sosSmlcomponent.setTitle(component.getTitle());
}
if (component.isSetHref()) {
sosSmlcomponent.setHref(component.getHref());
}
abstractProcess = new AbstractProcess();
if (sosSmlcomponent.isSetTitle()) {
abstractProcess.setIdentifier(sosSmlcomponent.getTitle());
} else if (!sosSmlcomponent.isSetTitle() && sosSmlcomponent.isSetHref()) {
abstractProcess.setIdentifier(sosSmlcomponent.getHref());
}
}
sosSmlcomponent.setProcess(abstractProcess);
sosSmlComponents.add(sosSmlcomponent);
}
}
}
return sosSmlComponents;
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class Soap11Decoder method createFault.
@Override
protected SoapRequest createFault(DecodingException de) {
SoapFault fault = new SoapFault();
fault.setFaultCode(QN_CLIENT);
fault.setLocale(Locale.ENGLISH);
fault.setFaultReason(de.getMessage());
SoapRequest r = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, SOAPConstants.SOAP_1_1_PROTOCOL);
r.setSoapFault(fault);
return r;
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class Soap12Decoder method createFault.
@Override
protected SoapRequest createFault(DecodingException de) {
SoapFault fault = new SoapFault();
fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
fault.setLocale(Locale.ENGLISH);
fault.setFaultReason(de.getMessage());
SoapRequest r = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, SOAPConstants.SOAP_1_2_PROTOCOL);
r.setSoapFault(fault);
return r;
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class Soap12Decoder method getBodyContent.
private OwsServiceRequest getBodyContent(EnvelopeDocument doc) throws DecodingException {
Body body = doc.getEnvelope().getBody();
try {
Node domNode = body.getDomNode();
if (domNode.hasChildNodes()) {
NodeList childNodes = domNode.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
XmlObject content = XmlObject.Factory.parse(node);
// fix problem with invalid prefix in xsi:type value for
// om:result, e.g. OM_SWEArrayObservation or
// gml:ReferenceType
Map<?, ?> namespaces = XmlHelper.getNamespaces(doc.getEnvelope());
fixNamespaceForXsiType(content, namespaces);
XmlHelper.fixNamespaceForXsiType(content, SweConstants.QN_DATA_ARRAY_PROPERTY_TYPE_SWE_200);
return decodeXmlElement(content);
}
}
}
return decodeXmlElement(body);
} catch (XmlException xmle) {
throw new DecodingException("Error while parsing SOAP body element!", xmle);
}
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class SosDecoderv100 method parseGetObservation.
/**
* parses the XmlBean representing the getObservation request and creates a
* SoSGetObservation request
*
* @param getObsDoc
* XmlBean created from the incoming request stream
* @return Returns SosGetObservationRequest representing the request
*
* @throws DecodingException
* * If parsing the XmlBean failed
*/
private OwsServiceRequest parseGetObservation(GetObservationDocument getObsDoc) throws DecodingException {
GetObservationRequest getObsRequest = new GetObservationRequest();
GetObservation getObs = getObsDoc.getGetObservation();
getObsRequest.setService(getObs.getService());
getObsRequest.setVersion(getObs.getVersion());
getObsRequest.setOfferings(Arrays.asList(getObs.getOffering()));
getObsRequest.setObservedProperties(Arrays.asList(getObs.getObservedPropertyArray()));
getObsRequest.setProcedures(Arrays.asList(getObs.getProcedureArray()));
getObsRequest.setTemporalFilters(parseTemporalFilters4GetObservation(getObs.getEventTimeArray()));
getObsRequest.setSrsName(getObs.getSrsName());
if (getObs.isSetFeatureOfInterest()) {
FeatureOfInterest featureOfInterest = getObs.getFeatureOfInterest();
if (featureOfInterest.isSetSpatialOps()) {
Object filter = decodeXmlElement(featureOfInterest.getSpatialOps());
if (filter instanceof SpatialFilter) {
getObsRequest.setSpatialFilter((SpatialFilter) filter);
}
} else if (featureOfInterest.getObjectIDArray() != null) {
Set<String> featureIdentifiers = Sets.newHashSet();
for (String string : featureOfInterest.getObjectIDArray()) {
featureIdentifiers.add(string);
}
getObsRequest.setFeatureIdentifiers(Lists.newArrayList(featureIdentifiers));
}
}
// TODO implement result filtering
if (getObs.isSetResult()) {
throw new NotYetSupportedDecodingException("Result filtering");
}
// return error message
if (getObs.isSetResponseFormat()) {
getObsRequest.setResponseFormat(decodeResponseFormat(getObs.getResponseFormat()));
} else {
getObsRequest.setResponseFormat(OmConstants.CONTENT_TYPE_OM.toString());
}
if (getObs.isSetResultModel()) {
getObsRequest.setResultModel(OMHelper.getObservationTypeFor(getObs.getResultModel()));
}
return getObsRequest;
}
Aggregations