Class AbstractCswSource

java.lang.Object
ddf.catalog.util.impl.DescribableImpl
ddf.catalog.util.impl.MaskableImpl
org.codice.ddf.spatial.ogc.csw.catalog.common.source.AbstractCswSource
All Implemented Interfaces:
ddf.catalog.resource.ResourceReader, ddf.catalog.service.ConfiguredService, ddf.catalog.source.ConnectedSource, ddf.catalog.source.FederatedSource, ddf.catalog.source.OAuthFederatedSource, ddf.catalog.source.RemoteSource, ddf.catalog.source.Source, ddf.catalog.util.Describable, ddf.catalog.util.Maskable, org.codice.ddf.platform.services.common.Describable
Direct Known Subclasses:
AbstractCswStore

public abstract class AbstractCswSource extends MaskableImpl implements ddf.catalog.source.OAuthFederatedSource, ddf.catalog.source.ConnectedSource, ddf.catalog.service.ConfiguredService
AbstractCswSource provides a DDF OAuthFederatedSource and ConnectedSource for CSW 2.0.2 services.
  • Field Details

    • DISABLE_CN_CHECK_PROPERTY

      public static final String DISABLE_CN_CHECK_PROPERTY
      See Also:
    • PASSWORD_PROPERTY

      protected static final String PASSWORD_PROPERTY
      See Also:
    • CSW_SERVER_ERROR

      protected static final String CSW_SERVER_ERROR
      See Also:
    • CSWURL_PROPERTY

      protected static final String CSWURL_PROPERTY
      See Also:
    • ID_PROPERTY

      protected static final String ID_PROPERTY
      See Also:
    • AUTHENTICATION_TYPE

      protected static final String AUTHENTICATION_TYPE
      See Also:
    • USERNAME_PROPERTY

      protected static final String USERNAME_PROPERTY
      See Also:
    • OAUTH_DISCOVERY_URL

      protected static final String OAUTH_DISCOVERY_URL
      See Also:
    • OAUTH_CLIENT_ID

      protected static final String OAUTH_CLIENT_ID
      See Also:
    • OAUTH_CLIENT_SECRET

      protected static final String OAUTH_CLIENT_SECRET
      See Also:
    • OAUTH_FLOW

      protected static final String OAUTH_FLOW
      See Also:
    • CERT_ALIAS_PROPERTY

      protected static final String CERT_ALIAS_PROPERTY
      See Also:
    • KEYSTORE_PATH_PROPERTY

      protected static final String KEYSTORE_PATH_PROPERTY
      See Also:
    • SSL_PROTOCOL_PROPERTY

      protected static final String SSL_PROTOCOL_PROPERTY
      See Also:
    • METACARD_MAPPINGS_PROPERTY

      protected static final String METACARD_MAPPINGS_PROPERTY
      See Also:
    • COORDINATE_ORDER_PROPERTY

      protected static final String COORDINATE_ORDER_PROPERTY
      See Also:
    • POLL_INTERVAL_PROPERTY

      protected static final String POLL_INTERVAL_PROPERTY
      See Also:
    • OUTPUT_SCHEMA_PROPERTY

      protected static final String OUTPUT_SCHEMA_PROPERTY
      See Also:
    • IS_CQL_FORCED_PROPERTY

      protected static final String IS_CQL_FORCED_PROPERTY
      See Also:
    • FORCE_SPATIAL_FILTER_PROPERTY

      protected static final String FORCE_SPATIAL_FILTER_PROPERTY
      See Also:
    • NO_FORCE_SPATIAL_FILTER

      protected static final String NO_FORCE_SPATIAL_FILTER
      See Also:
    • CONNECTION_TIMEOUT_PROPERTY

      protected static final String CONNECTION_TIMEOUT_PROPERTY
      See Also:
    • RECEIVE_TIMEOUT_PROPERTY

      protected static final String RECEIVE_TIMEOUT_PROPERTY
      See Also:
    • QUERY_TYPE_NAME_PROPERTY

      protected static final String QUERY_TYPE_NAME_PROPERTY
      See Also:
    • QUERY_TYPE_NAMESPACE_PROPERTY

      protected static final String QUERY_TYPE_NAMESPACE_PROPERTY
      See Also:
    • USE_POS_LIST_PROPERTY

      protected static final String USE_POS_LIST_PROPERTY
      See Also:
    • SECURITY_ATTRIBUTES_PROPERTY

      protected static final String SECURITY_ATTRIBUTES_PROPERTY
      See Also:
    • EVENT_SERVICE_ADDRESS

      protected static final String EVENT_SERVICE_ADDRESS
      See Also:
    • REGISTER_FOR_EVENTS

      protected static final String REGISTER_FOR_EVENTS
      See Also:
    • clientBuilderFactory

      protected final org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory
    • configurationPid

      protected String configurationPid
    • cswSourceConfiguration

      protected CswSourceConfiguration cswSourceConfiguration
    • cswFilterDelegate

      protected CswFilterDelegate cswFilterDelegate
    • cswTransformConverter

      protected com.thoughtworks.xstream.converters.Converter cswTransformConverter
    • forceSpatialFilter

      protected String forceSpatialFilter
    • availabilityPollFuture

      protected ScheduledFuture<?> availabilityPollFuture
    • securityManager

      protected ddf.security.service.SecurityManager securityManager
    • filterBuilder

      protected ddf.catalog.filter.FilterBuilder filterBuilder
    • filterAdapter

      protected ddf.catalog.filter.FilterAdapter filterAdapter
    • capabilities

      protected net.opengis.cat.csw.v_2_0_2.CapabilitiesType capabilities
    • factory

      protected org.codice.ddf.cxf.client.SecureCxfClientFactory<Csw> factory
    • subscribeClientFactory

      protected org.codice.ddf.cxf.client.SecureCxfClientFactory<CswSubscribe> subscribeClientFactory
    • getRecordsTypeProvider

      protected CswJAXBElementProvider<net.opengis.cat.csw.v_2_0_2.GetRecordsType> getRecordsTypeProvider
    • cswQueryFilterTransformerProvider

      protected ddf.catalog.transform.QueryFilterTransformerProvider cswQueryFilterTransformerProvider
    • jaxbElementClassNames

      protected List<String> jaxbElementClassNames
    • jaxbElementClassMap

      protected Map<String,String> jaxbElementClassMap
    • filterlessSubscriptionId

      protected String filterlessSubscriptionId
  • Constructor Details

    • AbstractCswSource

      public AbstractCswSource(org.osgi.framework.BundleContext context, CswSourceConfiguration cswSourceConfiguration, com.thoughtworks.xstream.converters.Converter provider, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory, ddf.security.encryption.EncryptionService encryptionService, org.codice.ddf.security.Security security, ddf.security.permission.Permissions permissions)
      Instantiates a CswSource. This constructor is for unit tests
      Parameters:
      context - The BundleContext from the OSGi Framework
      cswSourceConfiguration - the configuration of this source
      provider - transform provider to transform results
      clientBuilderFactory - client factory already configured for this source
    • AbstractCswSource

      public AbstractCswSource(ddf.security.encryption.EncryptionService encryptionService, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory, org.codice.ddf.security.Security security, ddf.security.permission.Permissions permissions)
      Instantiates a CswSource.
  • Method Details

    • init

      public void init()
      Initializes the CswSource by connecting to the Server
    • initClientFactory

      protected void initClientFactory() throws URISyntaxException
      Throws:
      URISyntaxException
    • initSubscribeClientFactory

      protected void initSubscribeClientFactory() throws URISyntaxException
      Throws:
      URISyntaxException
    • getAdditionalConsumers

      protected abstract Map<String,Consumer<Object>> getAdditionalConsumers()
    • initProviders

      protected List<Object> initProviders(com.thoughtworks.xstream.converters.Converter cswTransformProvider, CswSourceConfiguration cswSourceConfiguration)
    • refresh

      public void refresh(Map<String,Object> configuration)
      Reinitializes the CswSource when there is a configuration change. Otherwise, it checks with the server to see if any capabilities have changed.
      Parameters:
      configuration - The configuration with which to connect to the server
    • getAvailabilityCommand

      protected AvailabilityCommand getAvailabilityCommand()
    • setupAvailabilityPoll

      protected void setupAvailabilityPoll()
    • getConnectionTimeout

      public Integer getConnectionTimeout()
    • setConnectionTimeout

      public void setConnectionTimeout(Integer timeout)
    • getReceiveTimeout

      public Integer getReceiveTimeout()
    • setReceiveTimeout

      public void setReceiveTimeout(Integer timeout)
    • setContext

      public void setContext(org.osgi.framework.BundleContext context)
    • getContentTypes

      public Set<ddf.catalog.data.ContentType> getContentTypes()
      Specified by:
      getContentTypes in interface ddf.catalog.source.Source
    • getResourceReader

      public ddf.catalog.resource.ResourceReader getResourceReader()
    • setResourceReader

      public void setResourceReader(ddf.catalog.resource.ResourceReader resourceReader)
    • setOutputSchema

      public void setOutputSchema(String outputSchema)
    • setQueryTypeName

      public void setQueryTypeName(String queryTypeName)
    • setQueryTypeNamespace

      public void setQueryTypeNamespace(String queryTypeNamespace)
    • isAvailable

      public boolean isAvailable()
      Specified by:
      isAvailable in interface ddf.catalog.source.Source
    • isAvailable

      public boolean isAvailable(ddf.catalog.source.SourceMonitor sourceMonitor)
      Specified by:
      isAvailable in interface ddf.catalog.source.Source
    • query

      public ddf.catalog.operation.SourceResponse query(ddf.catalog.operation.QueryRequest queryRequest) throws ddf.catalog.source.UnsupportedQueryException
      Specified by:
      query in interface ddf.catalog.source.Source
      Throws:
      ddf.catalog.source.UnsupportedQueryException
    • query

      protected ddf.catalog.operation.SourceResponse query(ddf.catalog.operation.QueryRequest queryRequest, net.opengis.cat.csw.v_2_0_2.ElementSetType elementSetName, List<QName> elementNames, Csw csw) throws ddf.catalog.source.UnsupportedQueryException
      Throws:
      ddf.catalog.source.UnsupportedQueryException
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface ddf.catalog.util.Describable
      Specified by:
      getDescription in interface org.codice.ddf.platform.services.common.Describable
      Overrides:
      getDescription in class DescribableImpl
    • getId

      public String getId()
      Specified by:
      getId in interface ddf.catalog.util.Describable
      Specified by:
      getId in interface org.codice.ddf.platform.services.common.Describable
      Overrides:
      getId in class DescribableImpl
    • setId

      public void setId(String id)
      Overrides:
      setId in class MaskableImpl
    • maskId

      public void maskId(String newSourceId)
      Specified by:
      maskId in interface ddf.catalog.util.Maskable
      Overrides:
      maskId in class MaskableImpl
    • getOrganization

      public String getOrganization()
      Specified by:
      getOrganization in interface ddf.catalog.util.Describable
      Specified by:
      getOrganization in interface org.codice.ddf.platform.services.common.Describable
      Overrides:
      getOrganization in class DescribableImpl
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface ddf.catalog.util.Describable
      Specified by:
      getTitle in interface org.codice.ddf.platform.services.common.Describable
      Overrides:
      getTitle in class DescribableImpl
    • getVersion

      public String getVersion()
      Specified by:
      getVersion in interface ddf.catalog.util.Describable
      Specified by:
      getVersion in interface org.codice.ddf.platform.services.common.Describable
      Overrides:
      getVersion in class DescribableImpl
    • getOptions

      public Set<String> getOptions(ddf.catalog.data.Metacard arg0)
      Specified by:
      getOptions in interface ddf.catalog.resource.ResourceReader
    • getSupportedSchemes

      public Set<String> getSupportedSchemes()
      Specified by:
      getSupportedSchemes in interface ddf.catalog.resource.ResourceReader
    • retrieveResource

      public ddf.catalog.operation.ResourceResponse retrieveResource(URI resourceUri, Map<String,Serializable> requestProperties) throws IOException, ddf.catalog.resource.ResourceNotFoundException, ddf.catalog.resource.ResourceNotSupportedException
      Specified by:
      retrieveResource in interface ddf.catalog.resource.ResourceReader
      Throws:
      IOException
      ddf.catalog.resource.ResourceNotFoundException
      ddf.catalog.resource.ResourceNotSupportedException
    • setCswUrl

      public void setCswUrl(String cswUrl)
    • getAuthenticationType

      public String getAuthenticationType()
      Specified by:
      getAuthenticationType in interface ddf.catalog.source.OAuthFederatedSource
    • setAuthenticationType

      public void setAuthenticationType(String authenticationType)
    • setUsername

      public void setUsername(String username)
    • setPassword

      public void setPassword(String password)
    • getOauthDiscoveryUrl

      public String getOauthDiscoveryUrl()
      Specified by:
      getOauthDiscoveryUrl in interface ddf.catalog.source.OAuthFederatedSource
    • setOauthDiscoveryUrl

      public void setOauthDiscoveryUrl(String oauthDiscoveryUrl)
    • getOauthClientId

      public String getOauthClientId()
      Specified by:
      getOauthClientId in interface ddf.catalog.source.OAuthFederatedSource
    • setOauthClientId

      public void setOauthClientId(String oauthClientId)
    • getOauthClientSecret

      public String getOauthClientSecret()
      Specified by:
      getOauthClientSecret in interface ddf.catalog.source.OAuthFederatedSource
    • setOauthClientSecret

      public void setOauthClientSecret(String oauthClientSecret)
    • getOauthFlow

      public String getOauthFlow()
      Specified by:
      getOauthFlow in interface ddf.catalog.source.OAuthFederatedSource
    • setOauthFlow

      public void setOauthFlow(String oauthFlow)
    • setCertAlias

      public void setCertAlias(String certAlias)
    • setKeystorePath

      public void setKeystorePath(String keystorePath)
    • setSslProtocol

      public void setSslProtocol(String sslProtocol)
    • setDisableCnCheck

      public void setDisableCnCheck(Boolean disableCnCheck)
    • setCoordinateOrder

      public void setCoordinateOrder(String coordinateOrder)
    • setUsePosList

      public void setUsePosList(Boolean usePosList)
    • setIsCqlForced

      public void setIsCqlForced(Boolean isCqlForced)
    • setMetacardMappings

      public void setMetacardMappings(String[] configuredMappings)
    • setFilterAdapter

      public void setFilterAdapter(ddf.catalog.filter.FilterAdapter filterAdapter)
    • setFilterBuilder

      public void setFilterBuilder(ddf.catalog.filter.FilterBuilder filterBuilder)
    • setPollInterval

      public void setPollInterval(Integer interval)
    • getCswTransformConverter

      public com.thoughtworks.xstream.converters.Converter getCswTransformConverter()
    • setCswTransformConverter

      public void setCswTransformConverter(com.thoughtworks.xstream.converters.Converter provider)
    • getCswQueryFilterTransformerProvider

      public ddf.catalog.transform.QueryFilterTransformerProvider getCswQueryFilterTransformerProvider()
    • setCswQueryFilterTransformerProvider

      public void setCswQueryFilterTransformerProvider(ddf.catalog.transform.QueryFilterTransformerProvider cswQueryFilterTransformerProvider)
    • getForceSpatialFilter

      public String getForceSpatialFilter()
    • setForceSpatialFilter

      public void setForceSpatialFilter(String forceSpatialFilter)
    • createResults

      protected List<ddf.catalog.data.Result> createResults(CswRecordCollection cswRecordCollection)
    • getMetadataTransformerId

      protected String getMetadataTransformerId()
    • transform

      protected ddf.catalog.data.Metacard transform(ddf.catalog.data.Metacard metacard, org.codice.ddf.spatial.ogc.catalog.MetadataTransformer transformer)
      Transforms the Metacard created from the CSW Record using the transformer specified by its ID.
      Parameters:
      metacard -
      Returns:
    • lookupMetadataTransformer

      protected org.codice.ddf.spatial.ogc.catalog.MetadataTransformer lookupMetadataTransformer(String transformerId)
    • getCapabilities

      protected net.opengis.cat.csw.v_2_0_2.CapabilitiesType getCapabilities()
    • getSystemSubject

      protected ddf.security.Subject getSystemSubject()
    • configureCswSource

      public void configureCswSource()
    • setFilterDelegate

      protected void setFilterDelegate(net.opengis.ows.v_1_0_0.Operation getRecordsOp, net.opengis.filter.v_1_1_0.FilterCapabilities filterCapabilities, net.opengis.ows.v_1_0_0.DomainType outputFormatValues, net.opengis.ows.v_1_0_0.DomainType resultTypesValues, CswSourceConfiguration cswSourceConfiguration)
      Sets the FilterDelegate used by the AbstractCswSource. May be overridden in order to provide a custom ddf.catalog.filter.FilterDelegate implementation.
      Parameters:
      getRecordsOp -
      filterCapabilities -
      outputFormatValues -
      resultTypesValues -
      cswSourceConfiguration -
    • loadContentTypes

      protected void loadContentTypes()
    • getParameter

      public net.opengis.ows.v_1_0_0.DomainType getParameter(net.opengis.ows.v_1_0_0.Operation operation, String name)
    • handleWebApplicationException

      protected String handleWebApplicationException(javax.ws.rs.WebApplicationException wae)
    • handleClientException

      protected String handleClientException(Exception ce)
    • availabilityChanged

      protected void availabilityChanged(boolean isAvailable)
    • setAvailabilityTask

      public void setAvailabilityTask(AvailabilityTask availabilityTask)
    • setSecurityManager

      public void setSecurityManager(ddf.security.service.SecurityManager securityManager)
    • getConfigurationPid

      public String getConfigurationPid()
      Specified by:
      getConfigurationPid in interface ddf.catalog.service.ConfiguredService
    • setConfigurationPid

      public void setConfigurationPid(String configurationPid)
      Specified by:
      setConfigurationPid in interface ddf.catalog.service.ConfiguredService
    • getSecurityAttributes

      public Map<String,Set<String>> getSecurityAttributes()
      Specified by:
      getSecurityAttributes in interface ddf.catalog.source.Source
    • setMetacardTypes

      public void setMetacardTypes(List<ddf.catalog.data.MetacardType> types)
    • setCsw201

      public void setCsw201()
      Set the version to CSW 2.0.1. The schemas don't vary much between 2.0.2 and 2.0.1. The largest difference is the namespace itself. This method tells CXF JAX-RS to transform outgoing messages CSW namespaces to 2.0.1.
    • setRegisterForEvents

      public void setRegisterForEvents(Boolean registerForEvents)
    • setEventServiceAddress

      public void setEventServiceAddress(String eventServiceAddress)
    • addSourceMonitor

      protected void addSourceMonitor(ddf.catalog.source.SourceMonitor sourceMonitor)
    • destroy

      public void destroy(int code)
      Clean-up when shutting down the CswSource