Search in sources :

Example 1 with GetCapabilitiesRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.

the class AbstractCswSource method getCapabilities.

protected CapabilitiesType getCapabilities() {
    CapabilitiesType caps = null;
    Subject subject = getSystemSubject();
    Csw csw = factory.getClientForSubject(subject);
    try {
        LOGGER.debug("Doing getCapabilities() call for CSW");
        GetCapabilitiesRequest request = new GetCapabilitiesRequest(CswConstants.CSW);
        request.setAcceptVersions(CswConstants.VERSION_2_0_2 + "," + CswConstants.VERSION_2_0_1);
        caps = csw.getCapabilities(request);
    } catch (CswException cswe) {
        LOGGER.info(CSW_SERVER_ERROR + " Received HTTP code '{}' from server for source with id='{}'. Set Logging to DEBUG for details.", cswe.getHttpStatus(), cswSourceConfiguration.getId());
        LOGGER.debug(CSW_SERVER_ERROR, cswe);
    } catch (WebApplicationException wae) {
        LOGGER.debug(handleWebApplicationException(wae), wae);
    } catch (Exception ce) {
        handleClientException(ce);
    }
    return caps;
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) WebApplicationException(javax.ws.rs.WebApplicationException) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) Csw(org.codice.ddf.spatial.ogc.csw.catalog.common.Csw) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Subject(ddf.security.Subject) SSLHandshakeException(javax.net.ssl.SSLHandshakeException) ResourceNotFoundException(ddf.catalog.resource.ResourceNotFoundException) WebApplicationException(javax.ws.rs.WebApplicationException) ConnectException(java.net.ConnectException) IOException(java.io.IOException) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) JAXBException(javax.xml.bind.JAXBException) CatalogTransformerException(ddf.catalog.transform.CatalogTransformerException) ResourceNotSupportedException(ddf.catalog.resource.ResourceNotSupportedException)

Example 2 with GetCapabilitiesRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.

the class TestCswEndpoint method testCapabilitiesRequestOperationsMetadata.

@Test
public void testCapabilitiesRequestOperationsMetadata() {
    // Should only return the OperationsMetadata section
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections(CswEndpoint.OPERATIONS_METADATA);
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gcr);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    verifyFilterCapabilities(ct);
    assertThat(ct.getServiceIdentification(), nullValue());
    assertThat(ct.getServiceProvider(), nullValue());
    verifyOperationsMetadata(ct);
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 3 with GetCapabilitiesRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.

the class TestCswEndpoint method testCapabilitiesRequestBadSection.

@Test
public void testCapabilitiesRequestBadSection() {
    // Shouldn't return any sections
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections("bad");
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gcr);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    assertThat(ct.getOperationsMetadata(), nullValue());
    assertThat(ct.getServiceIdentification(), nullValue());
    assertThat(ct.getServiceProvider(), nullValue());
    verifyFilterCapabilities(ct);
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 4 with GetCapabilitiesRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.

the class TestCswEndpoint method testCapabilitiesRequestServiceIdentification.

@Test
public void testCapabilitiesRequestServiceIdentification() {
    // Should only return the ServiceIdentification section
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections(CswEndpoint.SERVICE_IDENTIFICATION);
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gcr);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    assertThat(ct.getOperationsMetadata(), nullValue());
    verifyFilterCapabilities(ct);
    assertThat(ct.getServiceProvider(), nullValue());
    verifyServiceIdentification(ct);
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 5 with GetCapabilitiesRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.

the class TestCswEndpoint method createDefaultGetCapabilitiesRequest.

/**
     * Creates default GetCapabilities GET request, with no sections specified
     *
     * @return Vanilla GetCapabilitiesRequest object
     */
private GetCapabilitiesRequest createDefaultGetCapabilitiesRequest() {
    GetCapabilitiesRequest gcr = new GetCapabilitiesRequest();
    gcr.setService(CswConstants.CSW);
    gcr.setAcceptVersions(CswConstants.VERSION_2_0_2);
    gcr.setRequest(CswConstants.GET_CAPABILITIES);
    return gcr;
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)

Aggregations

GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)11 CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)10 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)10 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)10 Test (org.junit.Test)9 ResourceNotFoundException (ddf.catalog.resource.ResourceNotFoundException)1 ResourceNotSupportedException (ddf.catalog.resource.ResourceNotSupportedException)1 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 Subject (ddf.security.Subject)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 JAXBException (javax.xml.bind.JAXBException)1 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)1 DomainType (net.opengis.ows.v_1_0_0.DomainType)1 Operation (net.opengis.ows.v_1_0_0.Operation)1 Csw (org.codice.ddf.spatial.ogc.csw.catalog.common.Csw)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1