Search in sources :

Example 1 with DescribeSensorRequest

use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.

the class DescribeSensorRequestDecoder method decodeRequest.

@Override
protected DescribeSensorRequest decodeRequest(JsonNode node) {
    DescribeSensorRequest req = new DescribeSensorRequest();
    req.setProcedure(node.path(JSONConstants.PROCEDURE).textValue());
    req.setProcedureDescriptionFormat(node.path(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT).textValue());
    if (node.has(JSONConstants.VALID_TIME)) {
        req.setValidTime(parseTime(node.path(JSONConstants.VALID_TIME)));
    }
    return req;
}
Also used : DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 2 with DescribeSensorRequest

use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest 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;
}
Also used : DescribeSensorType(net.opengis.swes.x20.DescribeSensorType) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 3 with DescribeSensorRequest

use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.

the class DescribeSensorV2RequestEncoderTest method shouldThrowExceptionIfServiceIsMissing.

@Test
public void shouldThrowExceptionIfServiceIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + DescribeSensorV2RequestEncoder.class.getSimpleName() + " can not encode 'missing service'"));
    new DescribeSensorV2RequestEncoder().create(new DescribeSensorRequest());
}
Also used : DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) Test(org.junit.Test)

Example 4 with DescribeSensorRequest

use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest 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;
}
Also used : DescribeSensor(net.opengis.sos.x10.DescribeSensorDocument.DescribeSensor) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 5 with DescribeSensorRequest

use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.

the class DescribeSensorV2RequestEncoderTest method shouldThrowExceptionIfVersionIsMissing.

@Test
public void shouldThrowExceptionIfVersionIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + DescribeSensorV2RequestEncoder.class.getSimpleName() + " can not encode 'missing version'"));
    new DescribeSensorV2RequestEncoder().create(new DescribeSensorRequest("service", ""));
}
Also used : DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) Test(org.junit.Test)

Aggregations

DescribeSensorRequest (org.n52.shetland.ogc.sos.request.DescribeSensorRequest)5 Test (org.junit.Test)2 DescribeSensor (net.opengis.sos.x10.DescribeSensorDocument.DescribeSensor)1 DescribeSensorType (net.opengis.swes.x20.DescribeSensorType)1