Search in sources :

Example 11 with DomainType

use of org.geosdi.geoplatform.xml.ows.v100.DomainType in project ddf by codice.

the class CswFilterDelegateTest method createCswFilterDelegate.

private CswFilterDelegate createCswFilterDelegate(CswSourceConfiguration cswSourceConfiguration) {
    DomainType outputFormatValues = null;
    DomainType resultTypesValues = null;
    for (DomainType dt : getOperation().getParameter()) {
        if (dt.getName().equals(CswConstants.OUTPUT_FORMAT_PARAMETER)) {
            outputFormatValues = dt;
        } else if (dt.getName().equals(CswConstants.RESULT_TYPE_PARAMETER)) {
            resultTypesValues = dt;
        }
    }
    CswFilterDelegate cswFilterDelegate = new CswFilterDelegate(getOperation(), getMockFilterCapabilities(), outputFormatValues, resultTypesValues, cswSourceConfiguration);
    return cswFilterDelegate;
}
Also used : DomainType(net.opengis.ows.v_1_0_0.DomainType)

Example 12 with DomainType

use of org.geosdi.geoplatform.xml.ows.v100.DomainType in project ddf by codice.

the class CswFilterDelegateTest method getOperation.

private static Operation getOperation() {
    List<DomainType> getRecordsParameters = new ArrayList<>(6);
    DomainType typeName = new DomainType();
    typeName.setName(CswConstants.TYPE_NAME_PARAMETER);
    getRecordsParameters.add(typeName);
    DomainType outputSchema = new DomainType();
    outputSchema.setName(CswConstants.OUTPUT_SCHEMA_PARAMETER);
    getRecordsParameters.add(outputSchema);
    DomainType constraintLang = new DomainType();
    constraintLang.setName(CswConstants.CONSTRAINT_LANGUAGE_PARAMETER);
    getRecordsParameters.add(constraintLang);
    DomainType outputFormat = new DomainType();
    outputFormat.setName(CswConstants.OUTPUT_FORMAT_PARAMETER);
    getRecordsParameters.add(outputFormat);
    DomainType resultType = new DomainType();
    resultType.setName(CswConstants.RESULT_TYPE_PARAMETER);
    getRecordsParameters.add(resultType);
    DomainType elementSetName = new DomainType();
    elementSetName.setName(CswConstants.ELEMENT_SET_NAME_PARAMETER);
    getRecordsParameters.add(elementSetName);
    Operation getRecords = new Operation();
    getRecords.setName(CswConstants.GET_RECORDS);
    getRecords.setParameter(getRecordsParameters);
    List<Operation> operations = new ArrayList<>(1);
    operations.add(getRecords);
    return getRecords;
}
Also used : DomainType(net.opengis.ows.v_1_0_0.DomainType) ArrayList(java.util.ArrayList) Operation(net.opengis.ows.v_1_0_0.Operation)

Example 13 with DomainType

use of org.geosdi.geoplatform.xml.ows.v100.DomainType in project ddf by codice.

the class AbstractCswSource method readGetRecordsOperation.

/**
 * Parses the getRecords {@link Operation} to understand the capabilities of the
 * org.codice.ddf.spatial.ogc.csw.catalog.common.Csw Server. A sample GetRecords Operation may
 * look like this:
 *
 * <p>
 *
 * <pre>
 *   <ows:Operation name="GetRecords">
 *     <ows:DCP>
 *       <ows:HTTP>
 *         <ows:Get  xlink:href="http://www.cubewerx.com/cwcsw.cgi?" />
 *         <ows:Post xlink:href="http://www.cubewerx.com/cwcsw.cgi" />
 *       </ows:HTTP>
 *     </ows:DCP>
 *     <ows:Parameter name="TypeName">
 *       <ows:Value>csw:Record</ows:Value>
 *     </ows:Parameter>
 *     <ows:Parameter name="outputFormat">
 *       <ows:Value>application/xml</ows:Value>
 *       <ows:Value>text/html</ows:Value>
 *       <ows:Value>text/plain</ows:Value>
 *     </ows:Parameter>
 *     <ows:Parameter name="outputSchema">
 *       <ows:Value>http://www.opengis.net/cat/csw/2.0.2</ows:Value>
 *     </ows:Parameter>
 *     <ows:Parameter name="resultType">
 *       <ows:Value>hits</ows:Value>
 *       <ows:Value>results</ows:Value>
 *       <ows:Value>validate</ows:Value>
 *     </ows:Parameter>
 *     <ows:Parameter name="ElementSetName">
 *       <ows:Value>brief</ows:Value>
 *       <ows:Value>summary</ows:Value>
 *       <ows:Value>full</ows:Value>
 *     </ows:Parameter>
 *     <ows:Parameter name="CONSTRAINTLANGUAGE">
 *       <ows:Value>Filter</ows:Value>
 *     </ows:Parameter>
 *   </ows:Operation>
 * </pre>
 *
 * @param capabilitiesType The capabilities the org.codice.ddf.spatial.ogc.csw.catalog.common.Csw
 *     Server supports
 */
private void readGetRecordsOperation(CapabilitiesType capabilitiesType) {
    OperationsMetadata operationsMetadata = capabilitiesType.getOperationsMetadata();
    if (null == operationsMetadata) {
        LOGGER.info("{}: CSW Source contains no operations", cswSourceConfiguration.getId());
        return;
    }
    description = capabilitiesType.getServiceIdentification().getAbstract();
    Operation getRecordsOp = getOperation(operationsMetadata, CswConstants.GET_RECORDS);
    if (null == getRecordsOp) {
        LOGGER.info("{}: CSW Source contains no getRecords Operation", cswSourceConfiguration.getId());
        return;
    }
    this.supportedOutputSchemas = getParameter(getRecordsOp, CswConstants.OUTPUT_SCHEMA_PARAMETER);
    DomainType constraintLanguage = getParameter(getRecordsOp, CswConstants.CONSTRAINT_LANGUAGE_PARAMETER);
    if (null != constraintLanguage) {
        DomainType outputFormatValues = getParameter(getRecordsOp, CswConstants.OUTPUT_FORMAT_PARAMETER);
        DomainType resultTypesValues = getParameter(getRecordsOp, CswConstants.RESULT_TYPE_PARAMETER);
        readSetDetailLevels(getParameter(getRecordsOp, CswConstants.ELEMENT_SET_NAME_PARAMETER));
        List<String> constraints = new ArrayList<>();
        for (String s : constraintLanguage.getValue()) {
            constraints.add(s.toLowerCase());
        }
        if (constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_CQL.toLowerCase()) && !constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_FILTER.toLowerCase())) {
            isConstraintCql = true;
        } else {
            isConstraintCql = false;
        }
        setFilterDelegate(getRecordsOp, capabilitiesType.getFilterCapabilities(), outputFormatValues, resultTypesValues, cswSourceConfiguration);
        if (!NO_FORCE_SPATIAL_FILTER.equals(forceSpatialFilter)) {
            SpatialOperatorType sot = new SpatialOperatorType();
            SpatialOperatorNameType sont = SpatialOperatorNameType.fromValue(forceSpatialFilter);
            sot.setName(sont);
            sot.setGeometryOperands(cswFilterDelegate.getGeoOpsForSpatialOp(sont));
            SpatialOperatorsType spatialOperators = new SpatialOperatorsType();
            spatialOperators.setSpatialOperator(Arrays.asList(sot));
            cswFilterDelegate.setSpatialOps(spatialOperators);
        }
    }
}
Also used : OperationsMetadata(net.opengis.ows.v_1_0_0.OperationsMetadata) DomainType(net.opengis.ows.v_1_0_0.DomainType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ArrayList(java.util.ArrayList) Operation(net.opengis.ows.v_1_0_0.Operation) SpatialOperatorNameType(net.opengis.filter.v_1_1_0.SpatialOperatorNameType)

Example 14 with DomainType

use of org.geosdi.geoplatform.xml.ows.v100.DomainType in project arctic-sea by 52North.

the class OwsEncoderv110 method encodeOwsPossibleValues.

private void encodeOwsPossibleValues(OwsPossibleValues possibleValues, DomainType xdomain) {
    if (possibleValues.isAnyValue()) {
        xdomain.addNewAnyValue();
    } else if (possibleValues.isNoValues()) {
        xdomain.addNewNoValues();
    } else if (possibleValues.isValuesReference()) {
        OwsValuesReference vr = possibleValues.asValuesReference();
        ValuesReference xvr = xdomain.addNewValuesReference();
        xvr.setReference(vr.getReference().toString());
        xvr.setStringValue(vr.getValue());
    } else if (possibleValues.isAllowedValues()) {
        OwsAllowedValues av = possibleValues.asAllowedValues();
        AllowedValues xav = xdomain.addNewAllowedValues();
        av.getRestrictions().forEach(restriction -> {
            if (restriction.isRange()) {
                OwsRange range = restriction.asRange();
                RangeType xrange = xav.addNewRange();
                range.getLowerBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMinimumValue().setStringValue(v));
                range.getUpperBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMaximumValue().setStringValue(v));
                range.getSpacing().map(OwsValue::getValue).ifPresent(v -> xrange.addNewSpacing().setStringValue(v));
                xrange.setRangeClosure(Collections.singletonList(range.getType()));
            } else if (restriction.isValue()) {
                xav.addNewValue().setStringValue(restriction.asValue().getValue());
            }
        });
    }
}
Also used : SortedSet(java.util.SortedSet) OwsPossibleValues(org.n52.shetland.ogc.ows.OwsPossibleValues) CodedException(org.n52.shetland.ogc.ows.exception.CodedException) LoggerFactory(org.slf4j.LoggerFactory) SectionsType(net.opengis.ows.x11.SectionsType) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsServiceProvider(org.n52.shetland.ogc.ows.OwsServiceProvider) Show(org.n52.shetland.w3c.xlink.Show) LocalizedString(org.n52.janmayen.i18n.LocalizedString) Map(java.util.Map) KeywordsType(net.opengis.ows.x11.KeywordsType) ActuateType(org.w3.x1999.xlink.ActuateType) RequestMethodType(net.opengis.ows.x11.RequestMethodType) URI(java.net.URI) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) ServiceIdentification(net.opengis.ows.x11.ServiceIdentificationDocument.ServiceIdentification) OwsValue(org.n52.shetland.ogc.ows.OwsValue) OWSConstants(org.n52.shetland.ogc.ows.OWSConstants) EncodingException(org.n52.svalbard.encode.exception.EncodingException) MetadataType(net.opengis.ows.x11.MetadataType) N52XmlHelper(org.n52.svalbard.util.N52XmlHelper) HTTP(net.opengis.ows.x11.HTTPDocument.HTTP) Actuate(org.n52.shetland.w3c.xlink.Actuate) ResponsiblePartySubsetType(net.opengis.ows.x11.ResponsiblePartySubsetType) Set(java.util.Set) Setting(org.n52.faroe.annotation.Setting) ValuesReference(net.opengis.ows.x11.ValuesReferenceDocument.ValuesReference) LocaleHelper(org.n52.janmayen.i18n.LocaleHelper) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) ExceptionReport(net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport) HTTPMethods(org.n52.janmayen.http.HTTPMethods) Sets(com.google.common.collect.Sets) DomainType(net.opengis.ows.x11.DomainType) LanguageStringType(net.opengis.ows.x11.LanguageStringType) OwsEncoderSettings(org.n52.svalbard.OwsEncoderSettings) List(java.util.List) DCP(net.opengis.ows.x11.DCPDocument.DCP) OnlineResourceType(net.opengis.ows.x11.OnlineResourceType) Stream(java.util.stream.Stream) ExceptionReportDocument(net.opengis.ows.x11.ExceptionReportDocument) SchemaLocation(org.n52.shetland.w3c.SchemaLocation) CodeType(net.opengis.ows.x11.CodeType) TelephoneType(net.opengis.ows.x11.TelephoneType) OwsResponsibleParty(org.n52.shetland.ogc.ows.OwsResponsibleParty) CollectionHelper(org.n52.shetland.util.CollectionHelper) AddressType(net.opengis.ows.x11.AddressType) OperationsMetadata(net.opengis.ows.x11.OperationsMetadataDocument.OperationsMetadata) Optional(java.util.Optional) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) OwsAddress(org.n52.shetland.ogc.ows.OwsAddress) Joiner(com.google.common.base.Joiner) MultilingualString(org.n52.janmayen.i18n.MultilingualString) MediaTypes(org.n52.janmayen.http.MediaTypes) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ServiceProvider(net.opengis.ows.x11.ServiceProviderDocument.ServiceProvider) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) OwsDCP(org.n52.shetland.ogc.ows.OwsDCP) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) RangeType(net.opengis.ows.x11.RangeType) OwsAcceptVersions(org.n52.shetland.ogc.ows.OwsAcceptVersions) OwsExceptionCode(org.n52.shetland.ogc.ows.exception.OwsExceptionCode) Collectors.mapping(java.util.stream.Collectors.mapping) ExceptionType(net.opengis.ows.x11.ExceptionType) OwsDomainMetadata(org.n52.shetland.ogc.ows.OwsDomainMetadata) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) XmlObject(org.apache.xmlbeans.XmlObject) AllowedValues(net.opengis.ows.x11.AllowedValuesDocument.AllowedValues) DomainMetadataType(net.opengis.ows.x11.DomainMetadataType) PrintStream(java.io.PrintStream) OwsOperationMetadataExtension(org.n52.shetland.ogc.ows.OwsOperationMetadataExtension) OwsRange(org.n52.shetland.ogc.ows.OwsRange) Logger(org.slf4j.Logger) AcceptVersionsType(net.opengis.ows.x11.AcceptVersionsType) OwsOnlineResource(org.n52.shetland.ogc.ows.OwsOnlineResource) OwsPhone(org.n52.shetland.ogc.ows.OwsPhone) OwsKeyword(org.n52.shetland.ogc.ows.OwsKeyword) OwsCode(org.n52.shetland.ogc.ows.OwsCode) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) ShowType(org.w3.x1999.xlink.ShowType) ExceptionDocument(net.opengis.ows.x11.ExceptionDocument) Collectors.toList(java.util.stream.Collectors.toList) OwsContact(org.n52.shetland.ogc.ows.OwsContact) OwsLanguageString(org.n52.shetland.ogc.ows.OwsLanguageString) OwsHttp(org.n52.shetland.ogc.ows.OwsHttp) Configurable(org.n52.faroe.annotation.Configurable) CodingHelper(org.n52.svalbard.util.CodingHelper) OwsSections(org.n52.shetland.ogc.ows.OwsSections) OwsServiceIdentification(org.n52.shetland.ogc.ows.OwsServiceIdentification) ContactType(net.opengis.ows.x11.ContactType) OwsOperation(org.n52.shetland.ogc.ows.OwsOperation) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) Operation(net.opengis.ows.x11.OperationDocument.Operation) Collections(java.util.Collections) OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsRange(org.n52.shetland.ogc.ows.OwsRange) RangeType(net.opengis.ows.x11.RangeType) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) AllowedValues(net.opengis.ows.x11.AllowedValuesDocument.AllowedValues) ValuesReference(net.opengis.ows.x11.ValuesReferenceDocument.ValuesReference) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Example 15 with DomainType

use of org.geosdi.geoplatform.xml.ows.v100.DomainType in project geo-platform by geosdi.

the class CatalogCapabilitiesTest method testGetCapabilitiesWithConnector.

@Test
public void testGetCapabilitiesWithConnector() throws Exception {
    URL url = new URL("http://catalog.geosdi.org/geonetwork/srv/eng/csw");
    GPCatalogConnectorStore serverConnector = newConnector().withServerUrl(url).build();
    CatalogGetCapabilitiesRequest<CapabilitiesType> request = serverConnector.createGetCapabilitiesRequest();
    CapabilitiesType response = request.getResponse();
    logger.info("CSW GET_CAPABILITIES VERSION @@@@@@@@@@@@@@@@@@@@@@@ {}", response.getVersion());
    List<Operation> operationList = response.getOperationsMetadata().getOperation();
    for (Operation operation : operationList) {
        String operationName = operation.getName();
        if ("GetRecordById".equals(operationName)) {
            List<DomainType> parameterList = operation.getParameter();
            for (DomainType parameter : parameterList) {
                String parameterName = parameter.getName();
                if ("outputSchema".equals(parameterName)) {
                    List<String> valueList = parameter.getValue();
                    logger.info("########################### outputSchema\n");
                    for (String value : valueList) {
                        logger.info("*** {}", value);
                    }
                }
            }
        }
    }
}
Also used : DomainType(org.geosdi.geoplatform.xml.ows.v100.DomainType) CapabilitiesType(org.geosdi.geoplatform.xml.csw.v202.CapabilitiesType) Operation(org.geosdi.geoplatform.xml.ows.v100.Operation) URL(java.net.URL) Test(org.junit.Test)

Aggregations

DomainType (net.opengis.ows.v_1_0_0.DomainType)21 ArrayList (java.util.ArrayList)13 Operation (net.opengis.ows.v_1_0_0.Operation)13 Test (org.junit.Test)9 CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)5 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)5 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)5 OperationsMetadata (net.opengis.ows.v_1_0_0.OperationsMetadata)5 DomainType (net.opengis.ows.v_1_1_0.DomainType)5 ValueType (net.opengis.ows.v_1_1_0.ValueType)5 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)4 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)4 SortByImpl (ddf.catalog.filter.impl.SortByImpl)2 QueryImpl (ddf.catalog.operation.impl.QueryImpl)2 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)2 Joiner (com.google.common.base.Joiner)1 Sets (com.google.common.collect.Sets)1 Metacard (ddf.catalog.data.Metacard)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1