use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.
the class SensorMLDecoderV20 method parseCapabilities.
/**
* Parses the capabilities, processing and removing special insertion
* metadata
*
* @param abstractProcess
* The AbstractProcess to which capabilities and insertion
* metadata are added
* @param capabilitiesArray
* XML capabilities
*
* @throws DecodingException
* * if an error occurs
*/
private void parseCapabilities(final AbstractProcess abstractProcess, final Capabilities[] capabilitiesArray) throws DecodingException {
for (final Capabilities cs : capabilitiesArray) {
final SmlCapabilities capabilities = new SmlCapabilities(cs.getName());
if (cs.isSetCapabilityList()) {
CapabilityListType cl = cs.getCapabilityList();
if (CollectionHelper.isNotNullOrEmpty(cl.getCapabilityArray())) {
for (Capability c : cl.getCapabilityArray()) {
final SmlCapability capability = new SmlCapability(c.getName());
if (c.isSetAbstractDataComponent()) {
final Object o = decodeXmlElement(c.getAbstractDataComponent());
if (o instanceof SweAbstractDataComponent) {
capability.setAbstractDataComponent((SweAbstractDataComponent) o);
capabilities.addCapability(capability);
} else {
throw new DecodingException(XmlHelper.getLocalName(cs), "Error while parsing the capabilities of " + "the SensorML (the capabilities data record " + "is not of type DataRecordPropertyType)!");
}
} else if (c.isSetHref()) {
capability.setHref(c.getHref());
if (c.isSetTitle()) {
capability.setTitle(c.getTitle());
}
}
}
}
}
abstractProcess.addCapabilities(capabilities);
}
}
use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.
the class SosDecoderv100 method parseDescribeSensor.
/**
* parses the XmlBean representing the describeSensor request and creates a
* DescribeSensor request
*
* @param descSensorDoc
* XmlBean created from the incoming request stream
* @return Returns SosDescribeSensorRequest representing the request
*/
private OwsServiceCommunicationObject parseDescribeSensor(DescribeSensorDocument descSensorDoc) {
DescribeSensorRequest request = new DescribeSensorRequest();
DescribeSensor descSensor = descSensorDoc.getDescribeSensor();
request.setService(descSensor.getService());
request.setVersion(descSensor.getVersion());
// parse outputFormat through MediaType to ensure it's a mime type and
// eliminate whitespace variations
request.setProcedureDescriptionFormat(MediaType.normalizeString(descSensor.getOutputFormat()));
request.setProcedure(descSensor.getProcedure());
return request;
}
use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.
the class SosDecoderv20 method checkReferencedElements.
private void checkReferencedElements(final List<OmObservation> observations, final Map<String, Time> phenomenonTimes, final Map<String, TimeInstant> resultTimes, final Map<String, AbstractFeature> features) throws DecodingException {
for (final OmObservation observation : observations) {
// phenomenonTime
final Time phenomenonTime = observation.getPhenomenonTime();
if (phenomenonTime.isReferenced()) {
observation.getValue().setPhenomenonTime(phenomenonTimes.get(phenomenonTime.getGmlId()));
}
// resultTime
final TimeInstant resultTime = observation.getResultTime();
if (resultTime.isReferenced()) {
if (resultTimes.containsKey(resultTime.getGmlId())) {
observation.setResultTime(resultTimes.get(resultTime.getGmlId()));
} else if (phenomenonTimes.containsKey(resultTime.getGmlId())) {
final Time iTime = phenomenonTimes.get(resultTime.getGmlId());
if (iTime instanceof TimeInstant) {
observation.setResultTime((TimeInstant) iTime);
} else if (iTime instanceof TimePeriod) {
final TimePeriod timePeriod = (TimePeriod) iTime;
observation.setResultTime(new TimeInstant(timePeriod.getEnd()));
} else {
throw new DecodingException("observation.resultTime", "The time value type is not supported");
}
}
}
// featureOfInterest
final AbstractFeature featureOfInterest = observation.getObservationConstellation().getFeatureOfInterest();
if (featureOfInterest.isReferenced()) {
observation.getObservationConstellation().setFeatureOfInterest(features.get(featureOfInterest.getGmlId()));
}
}
}
use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.
the class GetObservationByIdResponseDocumentDecoder method decode.
@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public GetObservationByIdResponse decode(GetObservationByIdResponseDocument doc) throws DecodingException {
if (doc != null) {
GetObservationByIdResponse response = new GetObservationByIdResponse();
setService(response);
setVersions(response);
GetObservationByIdResponseType type = doc.getGetObservationByIdResponse();
response.setExtensions(parseExtensibleResponse(type));
response.setObservationCollection(ObservationStream.of(parseObservations(type)));
return response;
}
throw new UnsupportedDecoderInputException(this, doc);
}
use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.
the class GmlDecoderv321 method parsePointType.
private Geometry parsePointType(PointType xbPointType) throws DecodingException {
String geomWKT = null;
int srid = -1;
if (xbPointType.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbPointType.getSrsName());
}
if (xbPointType.getPos() != null) {
DirectPositionType xbPos = xbPointType.getPos();
if (srid == -1 && xbPos.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbPos.getSrsName());
}
String directPosition = getString4Pos(xbPos);
geomWKT = "POINT(" + directPosition + ")";
} else if (xbPointType.getCoordinates() != null) {
CoordinatesType xbCoords = xbPointType.getCoordinates();
String directPosition = getString4Coordinates(xbCoords);
geomWKT = "POINT" + directPosition;
} else {
throw new DecodingException("For geometry type 'gml:Point' only element " + "'gml:pos' and 'gml:coordinates' are allowed " + "in the feature of interest parameter!");
}
srid = setDefaultForUnsetSrid(srid);
try {
return JTSHelper.createGeometryFromWKT(geomWKT, srid);
} catch (ParseException ex) {
throw new DecodingException(ex);
}
}
Aggregations