Search in sources :

Example 41 with OwsExceptionReport

use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.

the class ComparisonFilterTest method testCopyOf_like.

@Test
public void testCopyOf_like() throws OwsExceptionReport {
    ComparisonFilter original = new ComparisonFilter(FilterConstants.ComparisonOperator.PropertyIsLike, "vr", "val", "up", "escape");
    original.setMatchCase(false);
    original.setSingleChar("single");
    original.setWildCard("wild");
    ComparisonFilter copy = original.copy();
    Assert.assertThat(copy.getEscapeString(), is(original.getEscapeString()));
    Assert.assertThat(copy.getSingleChar(), is(original.getSingleChar()));
    Assert.assertThat(copy.getValue(), is(original.getValue()));
    Assert.assertThat(copy.getValueReference(), is(original.getValueReference()));
    Assert.assertThat(copy.getValueUpper(), is(original.getValueUpper()));
    Assert.assertThat(copy.getWildCard(), is(original.getWildCard()));
    Assert.assertThat(copy, is(not(original)));
    Assert.assertThat("copy is not equal to original, equal to is not implemented", not(copy.equals(original)));
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Test(org.junit.Test)

Example 42 with OwsExceptionReport

use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.

the class AbstractGetCapabilitiesHandler method createCapabilities.

private OwsCapabilities createCapabilities(GetCapabilitiesRequest request, String service, String version) throws OwsExceptionReport {
    Set<CapabilitiesSection> sections = getRequestedSections(request);
    Locale requestedLocale = getRequestedLocale(request);
    String updateSequence = null;
    OwsServiceIdentification serviceIdentification = null;
    if (sections.contains(CapabilitiesSection.ServiceIdentification)) {
        serviceIdentification = getServiceIdentification(service, requestedLocale);
    }
    OwsServiceProvider serviceProvider = null;
    if (sections.contains(CapabilitiesSection.ServiceProvider)) {
        serviceProvider = getServiceProvider(service, requestedLocale);
    }
    OwsOperationsMetadata operationsMetadata = null;
    if (sections.contains(CapabilitiesSection.OperationsMetadata)) {
        operationsMetadata = getOperations(service, version);
    }
    Set<String> languages = null;
    if (sections.contains(CapabilitiesSection.Languages)) {
        languages = getLanguages();
    }
    T contents = null;
    if (sections.contains(CapabilitiesSection.Contents)) {
        contents = createContents(service, version);
    }
    Collection<OwsCapabilitiesExtension> extensions = getExtensions(request, service, version);
    OwsCapabilities capabilities = new OwsCapabilities(service, version, updateSequence, serviceIdentification, serviceProvider, operationsMetadata, languages, extensions);
    return createCapabilities(capabilities, contents);
}
Also used : Locale(java.util.Locale) OwsCapabilitiesExtension(org.n52.shetland.ogc.ows.OwsCapabilitiesExtension) CapabilitiesSection(org.n52.shetland.ogc.ows.OWSConstants.CapabilitiesSection) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) OwsServiceProvider(org.n52.shetland.ogc.ows.OwsServiceProvider) OwsCapabilities(org.n52.shetland.ogc.ows.OwsCapabilities) OwsServiceIdentification(org.n52.shetland.ogc.ows.OwsServiceIdentification)

Example 43 with OwsExceptionReport

use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.

the class AbstractGetCapabilitiesHandler method getOperations.

private OwsOperationsMetadata getOperations(String service, String version) throws OwsExceptionReport {
    Collection<OwsDomain> parameters = getCommonParameters(service);
    Collection<OwsDomain> constraints = null;
    Collection<OwsOperation> operations = new LinkedList<>();
    OwsOperationMetadataExtension extension = getOperationsMetadataExtension(service, version);
    for (RequestOperatorKey operatorKey : requestOperatorRepository.getActiveRequestOperatorKeys(new OwsServiceKey(service, version))) {
        Optional.ofNullable(requestOperatorRepository.getRequestOperator(operatorKey).getOperationMetadata(service, version)).ifPresent(operations::add);
    }
    return new OwsOperationsMetadata(operations, parameters, constraints, extension);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) RequestOperatorKey(org.n52.iceland.request.operator.RequestOperatorKey) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) OwsOperation(org.n52.shetland.ogc.ows.OwsOperation) OwsServiceKey(org.n52.shetland.ogc.ows.service.OwsServiceKey) OwsOperationMetadataExtension(org.n52.shetland.ogc.ows.OwsOperationMetadataExtension) LinkedList(java.util.LinkedList)

Example 44 with OwsExceptionReport

use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.

the class GenericServiceOperator method receiveRequest.

/**
 * {@inheritDoc}
 *
 * @throws OperationNotSupportedException if no matching
 *                                        {@link RequestOperator} could be
 *                                        found or if the operator returned
 *                                        a {@code null}-response.
 */
@Override
public OwsServiceResponse receiveRequest(OwsServiceRequest request) throws OwsExceptionReport {
    String operationName = request.getOperationName();
    RequestOperator operator = this.requestOperatorRepository.getRequestOperator(this.key, operationName);
    if (operator == null) {
        throw new OperationNotSupportedException(operationName);
    }
    OwsServiceResponse response = operator.receiveRequest(request);
    if (response == null) {
        throw new OperationNotSupportedException(operationName);
    }
    return response;
}
Also used : OperationNotSupportedException(org.n52.shetland.ogc.ows.exception.OperationNotSupportedException) RequestOperator(org.n52.iceland.request.operator.RequestOperator) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse)

Example 45 with OwsExceptionReport

use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.

the class GenericRequestOperator method receiveRequest.

@Override
public OwsServiceResponse receiveRequest(final OwsServiceRequest abstractRequest) throws OwsExceptionReport {
    this.eventBus.submit(new RequestEvent(abstractRequest));
    if (requestType.isAssignableFrom(abstractRequest.getClass())) {
        Q request = requestType.cast(abstractRequest);
        checkForModifierAndProcess(request);
        this.validator.validate(request);
        A response = receive(request);
        this.eventBus.submit(new ResponseEvent(response));
        checkForModifierAndProcess(request, response);
        return response;
    } else {
        throw new OperationNotSupportedException(abstractRequest.getOperationName());
    }
}
Also used : OperationNotSupportedException(org.n52.shetland.ogc.ows.exception.OperationNotSupportedException) RequestEvent(org.n52.iceland.event.events.RequestEvent) ResponseEvent(org.n52.iceland.event.events.ResponseEvent)

Aggregations

OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)27 EncodingException (org.n52.svalbard.encode.exception.EncodingException)14 Test (org.junit.Test)12 OmObservation (org.n52.shetland.ogc.om.OmObservation)9 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)8 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)8 DecodingException (org.n52.svalbard.decode.exception.DecodingException)8 XmlObject (org.apache.xmlbeans.XmlObject)7 OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)7 IOException (java.io.IOException)6 DateTime (org.joda.time.DateTime)6 ObservationStream (org.n52.shetland.ogc.om.ObservationStream)6 OwsDecodingException (org.n52.iceland.coding.decode.OwsDecodingException)5 EReportingHeader (org.n52.shetland.aqd.EReportingHeader)5 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)5 LinkedList (java.util.LinkedList)4 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)4 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)4 CodedException (org.n52.shetland.ogc.ows.exception.CodedException)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3