Search in sources :

Example 1 with HTTP

use of net.opengis.ows.v_1_0_0.HTTP 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 2 with HTTP

use of net.opengis.ows.v_1_0_0.HTTP in project ddf by codice.

the class CswEndpoint method buildOperation.

/**
 * Creates an Operation object for the OperationsMetadata section TODO: We currently don't use the
 * constraint or metadata elements, those can be added in as desired
 *
 * @param name The name of the operation
 * @param types The request types supported (GET/POST)
 * @return The constructed Operation object
 */
private Operation buildOperation(String name, List<QName> types) {
    Operation op = new Operation();
    op.setName(name);
    ArrayList<DCP> dcpList = new ArrayList<>();
    DCP dcp = new DCP();
    HTTP http = new HTTP();
    for (QName type : types) {
        RequestMethodType rmt = new RequestMethodType();
        rmt.setHref(uri.getBaseUri().toASCIIString());
        JAXBElement<RequestMethodType> requestElement = new JAXBElement<>(type, RequestMethodType.class, rmt);
        if (type.equals(CswConstants.POST)) {
            requestElement.getValue().getConstraint().add(createDomainType(CswConstants.POST_ENCODING, CswConstants.XML));
        }
        http.getGetOrPost().add(requestElement);
    }
    dcp.setHTTP(http);
    dcpList.add(dcp);
    op.setDCP(dcpList);
    return op;
}
Also used : DCP(net.opengis.ows.v_1_0_0.DCP) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) HTTP(net.opengis.ows.v_1_0_0.HTTP) Operation(net.opengis.ows.v_1_0_0.Operation) JAXBElement(javax.xml.bind.JAXBElement) RequestMethodType(net.opengis.ows.v_1_0_0.RequestMethodType)

Aggregations

ArrayList (java.util.ArrayList)2 Operation (net.opengis.ows.v_1_0_0.Operation)2 JAXBElement (javax.xml.bind.JAXBElement)1 QName (javax.xml.namespace.QName)1 SpatialOperatorNameType (net.opengis.filter.v_1_1_0.SpatialOperatorNameType)1 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)1 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)1 DCP (net.opengis.ows.v_1_0_0.DCP)1 DomainType (net.opengis.ows.v_1_0_0.DomainType)1 HTTP (net.opengis.ows.v_1_0_0.HTTP)1 OperationsMetadata (net.opengis.ows.v_1_0_0.OperationsMetadata)1 RequestMethodType (net.opengis.ows.v_1_0_0.RequestMethodType)1