Package org.codice.ddf.opensearch.source
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Stringprotected Stringprotected Integerprotected booleanprotected intprotected final ddf.security.encryption.EncryptionServiceprotected org.codice.ddf.configuration.PropertyResolverprotected final ddf.catalog.filter.FilterAdapterprotected BiConsumer<List<org.jdom2.Element>, ddf.catalog.operation.SourceResponse> protected booleanprotected intprotected Stringprotected Stringprotected Stringprotected Stringprotected final OpenSearchFilterVisitorprotected final OpenSearchParserprotected Stringprotected static final Stringprotected Integerprotected Integerprotected ddf.catalog.resource.ResourceReaderprotected Stringprotected booleanprotected Stringprotected static final String -
Constructor Summary
ConstructorsConstructorDescriptionOpenSearchSource(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.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. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.codice.ddf.cxf.client.SecureCxfClientFactory<OpenSearch> createClientFactory(URI url, String username, String password) protected OpenSearchSource.SpatialSearchcreateCombinedSpatialSearch(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.voiddestroy(int code) protected org.osgi.framework.BundleSet<ddf.catalog.data.ContentType> intGet the distance tolerance value used for simplification of circular geometries.Get the URL of the endpoint.getId()booleanGet the boolean flag that indicates only local queries are being executed by this OpenSearch Source.intGet the number of vertices an approximation polygon will have when converting a multi point-radius search to a multi-polygon search.getOptions(ddf.catalog.data.Metacard metacard) booleanGet the boolean flag that determines if point-radius and polygon geometries should be converting to bounding boxes before sending.getTitle()voidinit()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.booleanbooleanisAvailable(ddf.catalog.source.SourceMonitor callback) protected ddf.catalog.transform.InputTransformerlookupTransformerReference(String namespaceUri) ddf.catalog.operation.SourceResponsequery(ddf.catalog.operation.QueryRequest queryRequest) ddf.catalog.operation.ResourceResponseretrieveResource(URI uri, Map<String, Serializable> requestProperties) voidsetAllowRedirects(Boolean allowRedirects) voidsetAuthenticationType(String authenticationType) voidsetConfigurationPid(String configurationPid) voidsetConnectionTimeout(Integer connectionTimeout) voidsetDisableCnCheck(Boolean disableCnCheck) voidsetDistanceTolerance(int distanceTolerance) Sets the distance tolerance value used for simplification of circular geometries.voidsetEndpointUrl(String endpointUrl) Set URL of the endpoint.voidsetLocalQueryOnly(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.voidsetMarkUpSet(List<String> markUpSet) voidsetNumMultiPointRadiusVertices(int numMultiPointRadiusVertices) Sets the number of vertices to use when approximating a polygon to fit to a multi point-radius search.voidsetOauthClientId(String oauthClientId) voidsetOauthClientSecret(String oauthClientSecret) voidsetOauthDiscoveryUrl(String oauthDiscoveryUrl) voidsetOauthFlow(String oauthFlow) voidsetParameters(List<String> parameters) voidsetPassword(String password) voidsetPollInterval(Integer interval) voidsetReceiveTimeout(Integer receiveTimeout) voidsetResourceReader(ddf.catalog.resource.ResourceReader reader) voidsetShortname(String shortname) Sets the shortname for this site.voidsetShouldConvertToBBox(boolean shouldConvertToBBox) Sets the boolean flag that tells the code to convert point-radius and polygon geometries to a bounding box before sending them.voidsetUsername(String username) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ddf.catalog.source.Source
getSecurityAttributes
-
Field Details
-
USERNAME_PROPERTY
- See Also:
-
PASSWORD_PROPERTY
- See Also:
-
encryptionService
protected final ddf.security.encryption.EncryptionService encryptionService -
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
-
parameters
-
markUpSet
-
authenticationType
-
username
-
password
-
oauthDiscoveryUrl
-
oauthClientId
-
oauthClientSecret
-
oauthFlow
-
resourceReader
protected ddf.catalog.resource.ResourceReader resourceReader -
openSearchParser
-
openSearchFilterVisitor
-
connectionTimeout
-
receiveTimeout
-
disableCnCheck
protected boolean disableCnCheck -
allowRedirects
protected boolean allowRedirects -
foreignMarkupBiConsumer
protected BiConsumer<List<org.jdom2.Element>,ddf.catalog.operation.SourceResponse> foreignMarkupBiConsumer -
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:
isAvailablein interfaceddf.catalog.source.Source
-
isAvailable
public boolean isAvailable(ddf.catalog.source.SourceMonitor callback) - Specified by:
isAvailablein interfaceddf.catalog.source.Source
-
query
public ddf.catalog.operation.SourceResponse query(ddf.catalog.operation.QueryRequest queryRequest) throws ddf.catalog.source.UnsupportedQueryException - Specified by:
queryin interfaceddf.catalog.source.Source- Throws:
ddf.catalog.source.UnsupportedQueryException
-
getEndpointUrl
Get the URL of the endpoint. -
setEndpointUrl
Set URL of the endpoint.- Parameters:
endpointUrl- Full url of the endpoint.
-
getDescription
- Specified by:
getDescriptionin interfaceddf.catalog.util.Describable- Specified by:
getDescriptionin interfaceorg.codice.ddf.platform.services.common.Describable
-
getOrganization
- Specified by:
getOrganizationin interfaceddf.catalog.util.Describable- Specified by:
getOrganizationin interfaceorg.codice.ddf.platform.services.common.Describable
-
getId
- Specified by:
getIdin interfaceddf.catalog.util.Describable- Specified by:
getIdin interfaceorg.codice.ddf.platform.services.common.Describable
-
setShortname
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
- Specified by:
getTitlein interfaceddf.catalog.util.Describable- Specified by:
getTitlein interfaceorg.codice.ddf.platform.services.common.Describable
-
getVersion
- Specified by:
getVersionin interfaceddf.catalog.util.Describable- Specified by:
getVersionin interfaceorg.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
-
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:
retrieveResourcein interfaceddf.catalog.resource.ResourceReader- Throws:
ddf.catalog.resource.ResourceNotFoundExceptionddf.catalog.resource.ResourceNotSupportedExceptionIOException
-
getContentTypes
- Specified by:
getContentTypesin interfaceddf.catalog.source.Source
-
getSupportedSchemes
- Specified by:
getSupportedSchemesin interfaceddf.catalog.resource.ResourceReader
-
getOptions
- Specified by:
getOptionsin interfaceddf.catalog.resource.ResourceReader
-
getConfigurationPid
- Specified by:
getConfigurationPidin interfaceddf.catalog.service.ConfiguredService
-
setConfigurationPid
- Specified by:
setConfigurationPidin interfaceddf.catalog.service.ConfiguredService
-
getMarkUpSet
-
setMarkUpSet
-
getParameters
-
setParameters
-
getAuthenticationType
- Specified by:
getAuthenticationTypein interfaceddf.catalog.source.OAuthFederatedSource
-
setAuthenticationType
-
getUsername
-
setUsername
-
getPassword
-
setPassword
-
getOauthDiscoveryUrl
- Specified by:
getOauthDiscoveryUrlin interfaceddf.catalog.source.OAuthFederatedSource
-
setOauthDiscoveryUrl
-
getOauthClientId
- Specified by:
getOauthClientIdin interfaceddf.catalog.source.OAuthFederatedSource
-
setOauthClientId
-
getOauthClientSecret
- Specified by:
getOauthClientSecretin interfaceddf.catalog.source.OAuthFederatedSource
-
setOauthClientSecret
-
getOauthFlow
- Specified by:
getOauthFlowin interfaceddf.catalog.source.OAuthFederatedSource
-
setOauthFlow
-
getDisableCnCheck
-
setDisableCnCheck
-
getAllowRedirects
-
setAllowRedirects
-
getConnectionTimeout
-
setConnectionTimeout
-
getReceiveTimeout
-
setReceiveTimeout
-
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
-