Search in sources :

Example 1 with Extension

use of org.n52.shetland.ogc.ows.extension.Extension in project series-rest-api by 52North.

the class ParameterController method getExtras.

@Override
public Map<String, Object> getExtras(String resourceId, String locale, MultiValueMap<String, String> query) {
    RequestUtils.overrideQueryLocaleWhenSet(locale, query);
    IoParameters map = QueryParameters.createFromQuery(query);
    LOGGER.debug("getExtras() with id '{}' and query '{}'", resourceId, map);
    Map<String, Object> extras = new HashMap<>();
    for (MetadataExtension<T> extension : metadataExtensions) {
        T from = parameterService.getParameter(resourceId, map);
        final Map<String, Object> furtherExtras = extension.getExtras(from, map);
        Collection<String> overridableKeys = checkForOverridingData(extras, furtherExtras);
        if (!overridableKeys.isEmpty()) {
            String[] keys = overridableKeys.toArray(new String[0]);
            LOGGER.warn("Metadata extension overrides existing extra data: {}", Arrays.toString(keys));
        }
        extras.putAll(furtherExtras);
    }
    return extras;
}
Also used : HashMap(java.util.HashMap) IoParameters(org.n52.io.request.IoParameters)

Example 2 with Extension

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

the class AbstractCapabilitiesBaseTypeDecoder method parseOperationMetadata.

private OwsOperationsMetadata parseOperationMetadata(OperationsMetadata operationsMetadata) {
    if (operationsMetadata == null) {
        return null;
    }
    List<OwsOperation> operations = parseOperations(operationsMetadata.getOperationArray());
    List<OwsDomain> parameters = parseDomains(operationsMetadata.getParameterArray());
    List<OwsDomain> constraints = parseDomains(operationsMetadata.getConstraintArray());
    OwsOperationMetadataExtension extension = parseOperationsMetadataExtension(operationsMetadata.getExtendedCapabilities());
    return new OwsOperationsMetadata(operations, parameters, constraints, extension);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) OwsOperation(org.n52.shetland.ogc.ows.OwsOperation) OwsOperationMetadataExtension(org.n52.shetland.ogc.ows.OwsOperationMetadataExtension)

Example 3 with Extension

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

the class CapabilitiesTypeDecoder method parseOfferingExtension.

private Extensions parseOfferingExtension(ObservationOfferingType obsOff) throws DecodingException {
    Extensions extensions = new Extensions();
    for (XmlObject xmlObject : obsOff.getExtensionArray()) {
        try {
            Extension<?> extension = (Extension) decodeXmlElement(xmlObject);
            extensions.addExtension(extension);
        } catch (DecodingException ex) {
            LOGGER.warn(ex.getLocalizedMessage());
        }
    }
    return extensions;
}
Also used : Extension(org.n52.shetland.ogc.ows.extension.Extension) XmlObject(org.apache.xmlbeans.XmlObject) DecodingException(org.n52.svalbard.decode.exception.DecodingException) Extensions(org.n52.shetland.ogc.ows.extension.Extensions)

Example 4 with Extension

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

the class AbstractOmV20XmlStreamWriter method writeMetadata.

/**
 * Write extension information
 *
 * @param map
 *            Map with values
 * @param element
 *            element name
 * @throws XMLStreamException
 *             If an error occurs when writing to stream
 * @throws EncodingException
 *             If an error occurs when creating elements to be written
 */
protected void writeMetadata(Map<String, NamedValue<?>> map, QName element) throws XMLStreamException, EncodingException {
    for (Entry<String, NamedValue<?>> entry : map.entrySet()) {
        Object o = getEncoder(OmConstants.NS_OM_2, entry.getValue()).encode(entry.getValue(), EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT));
        if (o != null && o instanceof XmlObject) {
            start(GetDataAvailabilityConstants.GDA_EXTENSION);
            attr("name", entry.getKey());
            rawText(((XmlObject) o).xmlText(getXmlOptions()));
            end(GetDataAvailabilityConstants.GDA_EXTENSION);
        }
    }
}
Also used : NamedValue(org.n52.shetland.ogc.om.NamedValue) XmlObject(org.apache.xmlbeans.XmlObject) XmlObject(org.apache.xmlbeans.XmlObject)

Example 5 with Extension

use of org.n52.shetland.ogc.ows.extension.Extension 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)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)4 Test (org.junit.Test)2 OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)2 OwsOperation (org.n52.shetland.ogc.ows.OwsOperation)2 OwsOperationMetadataExtension (org.n52.shetland.ogc.ows.OwsOperationMetadataExtension)2 OwsOperationsMetadata (org.n52.shetland.ogc.ows.OwsOperationsMetadata)2 SwesExtension (org.n52.shetland.ogc.swes.SwesExtension)2 DecodingException (org.n52.svalbard.decode.exception.DecodingException)2 TRUE (java.lang.Boolean.TRUE)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 GetObservationDocument (net.opengis.sos.x20.GetObservationDocument)1 InsertResultTemplateDocument (net.opengis.sos.x20.InsertResultTemplateDocument)1 BooleanPropertyType (net.opengis.swe.x20.BooleanPropertyType)1 BooleanType (net.opengis.swe.x20.BooleanType)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 Matchers.is (org.hamcrest.Matchers.is)1 IsInstanceOf.instanceOf (org.hamcrest.core.IsInstanceOf.instanceOf)1