Class OpenSearchSource

java.lang.Object
org.codice.ddf.opensearch.source.OpenSearchSource
All Implemented Interfaces:
ddf.catalog.resource.ResourceReader, ddf.catalog.service.ConfiguredService, ddf.catalog.source.FederatedSource, ddf.catalog.source.OAuthFederatedSource, ddf.catalog.source.RemoteSource, ddf.catalog.source.Source, ddf.catalog.util.Describable, org.codice.ddf.platform.services.common.Describable

public class OpenSearchSource extends Object implements ddf.catalog.source.OAuthFederatedSource, ddf.catalog.service.ConfiguredService
Federated site that talks via OpenSearch to the DDF platform. Communication is usually performed via https which requires a keystore and trust store to be provided.
  • Field Details

    • USERNAME_PROPERTY

      protected static final String USERNAME_PROPERTY
      See Also:
    • PASSWORD_PROPERTY

      protected static final String PASSWORD_PROPERTY
      See Also:
    • encryptionService

      protected final ddf.security.encryption.EncryptionService encryptionService
    • shortname

      protected String shortname
    • localQueryOnly

      protected boolean localQueryOnly
    • shouldConvertToBBox

      protected boolean shouldConvertToBBox
    • numMultiPointRadiusVertices

      protected int numMultiPointRadiusVertices
    • distanceTolerance

      protected int distanceTolerance
    • endpointUrl

      protected org.codice.ddf.configuration.PropertyResolver endpointUrl
    • filterAdapter

      protected final ddf.catalog.filter.FilterAdapter filterAdapter
    • configurationPid

      protected String configurationPid
    • parameters

      protected List<String> parameters
    • markUpSet

      protected Set<String> markUpSet
    • authenticationType

      protected String authenticationType
    • username

      protected String username
    • password

      protected String password
    • oauthDiscoveryUrl

      protected String oauthDiscoveryUrl
    • oauthClientId

      protected String oauthClientId
    • oauthClientSecret

      protected String oauthClientSecret
    • oauthFlow

      protected String oauthFlow
    • resourceReader

      protected ddf.catalog.resource.ResourceReader resourceReader
    • openSearchParser

      protected final OpenSearchParser openSearchParser
    • openSearchFilterVisitor

      protected final OpenSearchFilterVisitor openSearchFilterVisitor
    • connectionTimeout

      protected Integer connectionTimeout
    • receiveTimeout

      protected Integer receiveTimeout
    • disableCnCheck

      protected boolean disableCnCheck
    • allowRedirects

      protected boolean allowRedirects
    • foreignMarkupBiConsumer

      protected BiConsumer<List<org.jdom2.Element>,ddf.catalog.operation.SourceResponse> foreignMarkupBiConsumer
    • pollInterval

      protected Integer pollInterval
  • Constructor Details

    • OpenSearchSource

      public OpenSearchSource(ddf.catalog.filter.FilterAdapter filterAdapter, OpenSearchParser openSearchParser, OpenSearchFilterVisitor openSearchFilterVisitor, ddf.security.encryption.EncryptionService encryptionService, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory)
      Creates an OpenSearch Site instance. Sets an initial default endpointUrl that can be overwritten using the setter methods.
    • OpenSearchSource

      public OpenSearchSource(ddf.catalog.filter.FilterAdapter filterAdapter, OpenSearchParser openSearchParser, OpenSearchFilterVisitor openSearchFilterVisitor, ddf.security.encryption.EncryptionService encryptionService, BiConsumer<List<org.jdom2.Element>,ddf.catalog.operation.SourceResponse> foreignMarkupBiConsumer, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory)
      Creates an OpenSearch Site instance. Sets an initial default endpointUrl that can be overwritten using the setter methods.
  • Method Details

    • init

      public void init()
      Called when this OpenSearch Source is created, but after all of the setter methods have been called for each property specified in the metatype.xml file.
    • destroy

      public void destroy(int code)
    • createClientFactory

      protected org.codice.ddf.cxf.client.SecureCxfClientFactory<OpenSearch> createClientFactory(URI url, String username, String password)
    • isAvailable

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

      public boolean isAvailable(ddf.catalog.source.SourceMonitor callback)
      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
    • getEndpointUrl

      public String getEndpointUrl()
      Get the URL of the endpoint.
    • setEndpointUrl

      public void setEndpointUrl(String endpointUrl)
      Set URL of the endpoint.
      Parameters:
      endpointUrl - Full url of the endpoint.
    • 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
    • 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
    • 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
    • setShortname

      public void setShortname(String shortname)
      Sets the shortname for this site. This shortname is used to identify the site when performing federated queries.
      Parameters:
      shortname - Name of this site.
    • 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
    • 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
    • lookupTransformerReference

      @Nullable protected ddf.catalog.transform.InputTransformer lookupTransformerReference(String namespaceUri) throws org.osgi.framework.InvalidSyntaxException
      Throws:
      org.osgi.framework.InvalidSyntaxException
    • getBundle

      protected org.osgi.framework.Bundle getBundle()
    • getLocalQueryOnly

      public boolean getLocalQueryOnly()
      Get the boolean flag that indicates only local queries are being executed by this OpenSearch Source.
      Returns:
      true indicates only local queries, false indicates enterprise query
    • setLocalQueryOnly

      public void setLocalQueryOnly(boolean localQueryOnly)
      Sets the boolean flag that indicates all queries executed should be to its local source only, i.e., no federated or enterprise queries.
      Parameters:
      localQueryOnly - true indicates only local queries, false indicates enterprise query
    • getShouldConvertToBBox

      public boolean getShouldConvertToBBox()
      Get the boolean flag that determines if point-radius and polygon geometries should be converting to bounding boxes before sending.
    • setShouldConvertToBBox

      public void setShouldConvertToBBox(boolean shouldConvertToBBox)
      Sets the boolean flag that tells the code to convert point-radius and polygon geometries to a bounding box before sending them.
    • getNumMultiPointRadiusVertices

      public int getNumMultiPointRadiusVertices()
      Get the number of vertices an approximation polygon will have when converting a multi point-radius search to a multi-polygon search.
    • setNumMultiPointRadiusVertices

      public void setNumMultiPointRadiusVertices(int numMultiPointRadiusVertices)
      Sets the number of vertices to use when approximating a polygon to fit to a multi point-radius search.
    • getDistanceTolerance

      public int getDistanceTolerance()
      Get the distance tolerance value used for simplification of circular geometries.
    • setDistanceTolerance

      public void setDistanceTolerance(int distanceTolerance)
      Sets the distance tolerance value used for simplification of circular geometries.
    • setPollInterval

      public void setPollInterval(Integer interval)
    • retrieveResource

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

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

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

      public Set<String> getOptions(ddf.catalog.data.Metacard metacard)
      Specified by:
      getOptions in interface ddf.catalog.resource.ResourceReader
    • 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
    • getMarkUpSet

      public List<String> getMarkUpSet()
    • setMarkUpSet

      public void setMarkUpSet(List<String> markUpSet)
    • getParameters

      public List<String> getParameters()
    • setParameters

      public void setParameters(List<String> parameters)
    • getAuthenticationType

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

      public void setAuthenticationType(String authenticationType)
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)
    • getPassword

      public String getPassword()
    • 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)
    • getDisableCnCheck

      public Boolean getDisableCnCheck()
    • setDisableCnCheck

      public void setDisableCnCheck(Boolean disableCnCheck)
    • getAllowRedirects

      public Boolean getAllowRedirects()
    • setAllowRedirects

      public void setAllowRedirects(Boolean allowRedirects)
    • getConnectionTimeout

      public Integer getConnectionTimeout()
    • setConnectionTimeout

      public void setConnectionTimeout(Integer connectionTimeout)
    • getReceiveTimeout

      public Integer getReceiveTimeout()
    • setReceiveTimeout

      public void setReceiveTimeout(Integer receiveTimeout)
    • setResourceReader

      public void setResourceReader(ddf.catalog.resource.ResourceReader reader)
    • createCombinedSpatialSearch

      @Nullable protected OpenSearchSource.SpatialSearch createCombinedSpatialSearch(Queue<PointRadius> pointRadiusSearches, Queue<org.locationtech.jts.geom.Geometry> geometrySearches, int numMultiPointRadiusVertices, int distanceTolerance)
      Method to combine spatial searches into either geometry collection or a bounding box. OpenSearch endpoints and the query framework allow for multiple spatial query parameters. This method has been refactored out and is protected so that downstream projects may try to implement another algorithm (e.g. best-effort) to combine searches.
      Returns:
      null if there is no search specified, or a with one search that is the combination of all of the spatial criteria