Interface CatalogFramework
- All Superinterfaces:
Describable,org.codice.ddf.platform.services.common.Describable
CatalogFramework functions as the routing mechanism between all catalog components.
It decouples clients from service implementations and provides integration points for Catalog
Plugins.
General, high-level flow:
-
An endpoint will invoke the active
- all
ConnectedSources - specified
FederatedSources
CatalogFramework, typically via an OSGi
dependency injection framework such as Blueprint
For the query, create, delete, update methods, the CatalogFramework calls all "Pre" Catalog Plugins (either PreQueryPlugin or PreIngestPlugin),
The active/requested FederationStrategy is invoked, which in turn calls:
-
The active
CatalogProvider
PostQueryPlugin or PostIngestPlugin),
The appropriate Response is returned to the calling
endpoint.
Also includes convenience methods endpoints can use to invoke MetacardTransformers and QueryResponseTransformers.
-
Method Summary
Modifier and TypeMethodDescriptioncreate(CreateStorageRequest createRequest) This code is experimental.create(CreateRequest createRequest) CreatesMetacards in theCatalogProvider.delete(DeleteRequest deleteRequest) getEnterpriseResource(ResourceRequest request) getEnterpriseResourceOptions(String metacardId) Deprecated.will be removed in the next releasegetLocalResource(ResourceRequest request) Evaluate aResourceRequestusing availableResourceReaders (does not attempt to locate the resource via federation).getLocalResourceOptions(String metacardId) Deprecated.Will be removed in the next release.getResource(ResourceRequest request, String resourceSiteName) Evaluate aResourceRequestusing the specified site name.getResourceOptions(String metacardId, String sourceId) Deprecated.Will be removed in the next release.Return the set of source IDs known to theCatalogFramework.getSourceInfo(SourceInfoRequest sourceInfoRequest) Returns information for eachSourcethat is endpoint-addressable inCatalogFramework, including its ownCatalogProvider, based on the contents of theSourceInfoRequest.query(QueryRequest query) Evaluates aQueryRequestusing the defaultFederationStrategyquery(QueryRequest queryRequest, FederationStrategy strategy) Evaluates and executes aQueryRequestusing theFederationStrategyprovided.Transforms the providedMetacardintoBinaryContent.transform(SourceResponse response, String transformerId, Map<String, Serializable> requestProperties) update(UpdateStorageRequest updateRequest) This code is experimental.update(UpdateRequest updateRequest) Updates a list of Metacards.Methods inherited from interface ddf.catalog.util.Describable
getDescription, getId, getOrganization, getTitle, getVersion
-
Method Details
-
create
CreateResponse create(CreateStorageRequest createRequest) throws IngestException, SourceUnavailableException This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library. CreatesMetacards in theCatalogProvider.Implementations of this method must:
-
Before evaluation, call
PreIngestPlugin.process(CreateRequest)for each registeredPreIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallCatalogProvider.create(CreateRequest)on the registeredCatalogProviderCallPostIngestPlugin.process(CreateResponse)for each registeredPostIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallPreCreateStoragePlugin.process(CreateStorageRequest)for each registeredPreCreateStoragePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallStorageProvider.create(CreateStorageRequest)on the registeredCatalogProviderCallPostCreateStoragePlugin.process(ddf.catalog.content.operation.CreateStorageResponse)for each registeredPostCreateStoragePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
createRequest- theCreateStorageRequest- Returns:
CreateResponse- Throws:
IngestException- if an issue occurs during the updateSourceUnavailableException- if the source being updated is unavailable
-
create
CreateResponse create(CreateRequest createRequest) throws IngestException, SourceUnavailableException CreatesMetacards in theCatalogProvider.Implementations of this method must:
-
Before evaluation, call
PreIngestPlugin.process(CreateRequest)for each registeredPreIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallCatalogProvider.create(CreateRequest)on the registeredCatalogProviderCallPostIngestPlugin.process(CreateResponse)for each registeredPostIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
createRequest- theCreateRequest- Returns:
CreateResponse- Throws:
IngestException- if an issue occurs during the updateSourceUnavailableException- if the source being updated is unavailable
-
delete
DeleteResponse delete(DeleteRequest deleteRequest) throws IngestException, SourceUnavailableException DeletesMetacards withAttributes matching a specified value.Implementations of this method must:
-
Before evaluation, call
PreIngestPlugin.process(DeleteRequest)for each registeredPreIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallCatalogProvider.delete(DeleteRequest)on the registeredCatalogProviderCallPostIngestPlugin.process(DeleteResponse)for each registeredPostIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
deleteRequest- theDeleteRequest- Returns:
DeleteResponse- Throws:
IngestException- if an issue occurs during the deletionSourceUnavailableException- if the source being updated is unavailable
-
getEnterpriseResource
ResourceResponse getEnterpriseResource(ResourceRequest request) throws IOException, ResourceNotFoundException, ResourceNotSupportedException Evaluate aResourceRequestagainst the localCatalogProviderandRemoteSources.Implementations of this method must:
-
Before evaluation, call
PreResourcePlugin.process(ResourceRequest)for each registeredPreResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. If not provided with a java.net.URI () , retrieve the matchingResourceRequest.GET_RESOURCE_BY_PRODUCT_URI.equals(ResourceRequest.getAttributeName())==falseMetacardand get its Product java.net.URI. Locate theResourceReaderthat supports theURI.getScheme()of the java.net.URI on the OSGi Registry. CallResourceReader.retrieveResource(java.net.URI, Map)CallPostResourcePlugin.process(ResourceResponse)for each registeredPostResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
request- theResourceRequest- Returns:
ResourceResponse- Throws:
IOException- if there was a problem communicating with the system containing the resourceResourceNotFoundException- if the requested resource was not foundResourceNotSupportedException- if the scheme used in the associated java.net.URI is not supported by thisCatalogFramework
-
getEnterpriseResourceOptions
@Deprecated Map<String,Set<String>> getEnterpriseResourceOptions(String metacardId) throws ResourceNotFoundException Deprecated.will be removed in the next releaseSearch for aMetacardin the enterprise and retrieve arguments that can be used in the retrieval of its associated Resource- Parameters:
metacardId- the ID of theMetacard- Returns:
- Map of supported options with argument name for using those options
- Throws:
ResourceNotFoundException- if theMetacardis not found or there is no Resource associated with theMetacard
-
getLocalResource
ResourceResponse getLocalResource(ResourceRequest request) throws IOException, ResourceNotFoundException, ResourceNotSupportedException Evaluate aResourceRequestusing availableResourceReaders (does not attempt to locate the resource via federation).Implementations of this method must:
-
Before evaluation, call
PreResourcePlugin.process(ResourceRequest)for each registeredPreResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. If not provided with a java.net.URI () , retrieve the matchingResourceRequest.GET_RESOURCE_BY_PRODUCT_URI.equals(ResourceRequest.getAttributeName())==falseMetacardand get its Product java.net.URI. Locate theResourceReaderthat supports theURI.getScheme()of the java.net.URI on the OSGi Registry. CallResourceReader.retrieveResource(java.net.URI, Map)CallPostResourcePlugin.process(ResourceResponse)for each registeredPostResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
request- theResourceRequest- Returns:
ResourceResponse- Throws:
IOException- if there was a problem communicating with the system containing the resourceResourceNotFoundException- if the requested resource was not foundResourceNotSupportedException- if the scheme used in the associated java.net.URI is not supported by thisCatalogFramework
-
getLocalResourceOptions
@Deprecated Map<String,Set<String>> getLocalResourceOptions(String metacardId) throws ResourceNotFoundException Deprecated.Will be removed in the next release.Search for aMetacardlocally and retrieve arguments that can be used in the retrieval of its associated Resource.- Parameters:
metacardId- the ID of theMetacard- Returns:
- Map of supported options with argument name for using those options
- Throws:
ResourceNotFoundException- if theMetacardis not found or there is no Resource associated with theMetacard
-
getResource
ResourceResponse getResource(ResourceRequest request, String resourceSiteName) throws IOException, ResourceNotFoundException, ResourceNotSupportedException Evaluate aResourceRequestusing the specified site name.Implementations of this method must:
-
Before evaluation, call
PreResourcePlugin.process(ResourceRequest)for each registeredPreResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. If not provided with a java.net.URI () , retrieve the matchingResourceRequest.GET_RESOURCE_BY_PRODUCT_URI.equals(ResourceRequest.getAttributeName())==falseMetacardand get its Product java.net.URI. Locate theResourceReaderthat supports theURI.getScheme()of the java.net.URI on the OSGi Registry. CallResourceReader.retrieveResource(java.net.URI, Map)CallPostResourcePlugin.process(ResourceResponse)for each registeredPostResourcePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
request- theResourceRequestresourceSiteName- name of the site/source to retrieve the resource from- Returns:
ResourceResponse- Throws:
IOException- if there was a problem communicating with the system containing the resourceResourceNotFoundException- if the requested resource was not foundResourceNotSupportedException- if the scheme used in the associated java.net.URI is not supported by thisCatalogFramework
-
getResourceOptions
@Deprecated Map<String,Set<String>> getResourceOptions(String metacardId, String sourceId) throws ResourceNotFoundException Deprecated.Will be removed in the next release.Search for aMetacardon specifiedSourceand retrieve arguments that can be used in the retrieval of its associated Resource- Parameters:
metacardId- the ID of the metacardsourceId- the ID of the source to retrieve the metacard from- Returns:
- Map of supported options with argument name for using those options
- Throws:
ResourceNotFoundException- if theMetacardis not found or there is no Resource associated with theMetacard
-
getSourceIds
Return the set of source IDs known to theCatalogFramework. This set includes the local provider and any federated sources, but not connected sources as they are hidden from external clients.- Returns:
- Set of source IDs
-
getSourceInfo
SourceInfoResponse getSourceInfo(SourceInfoRequest sourceInfoRequest) throws SourceUnavailableException Returns information for eachSourcethat is endpoint-addressable inCatalogFramework, including its ownCatalogProvider, based on the contents of theSourceInfoRequest.The
SourceInfoRequestspecifies either:- an enterprise source search, which includes the catalog provider and all federated and connected sources
- a list of requested source IDs, which are all federated sources
- the catalog provider only
- Parameters:
sourceInfoRequest- theSourceInfoRequest- Returns:
SourceInfoResponse- Throws:
SourceUnavailableException- if the source indicated in theSourceInfoRequestisnull, not found, or cannot provide the requested information
-
query
QueryResponse query(QueryRequest query) throws UnsupportedQueryException, SourceUnavailableException, FederationException Evaluates aQueryRequestusing the defaultFederationStrategyImplementations of this method must:
-
Before evaluation, call
PreQueryPlugin.process(QueryRequest)for each registeredPreQueryPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallSource.query(QueryRequest)on the registeredCatalogProviderCallSource.query(QueryRequest)on all registeredConnectedSources If applicable, invoke the defaultFederationStrategywhich will callSource.query(QueryRequest)on all registeredFederatedSources Before returning, callPostQueryPlugin.process(QueryResponse)for each registeredPostQueryPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. Return the lastQueryResponseto the caller.Important: Implementations are free to limit the number of results returned regardless of the page size requested in the
QueryRequest. For that reason, clients should not assume that the number of results returned matches the page size requested and write their paging code accordingly. If theQueryResponsedoes not need to be used, it is highly recommended that clients use an iterable class such asto retrieve and process results. If partitioning of results is required clients may use Guavasinvalid reference
ddf.catalog.util.impl.ResultIterablemethod.invalid reference
com.google.common.collect.Iterables#partition(Iterable, int)- Parameters:
query- theQueryRequest- Returns:
QueryResponsethe resulting response- Throws:
UnsupportedQueryException- if the provided query can not be interpreted by a requiredSourceSourceUnavailableException- if a requiredSourceis not availableFederationException- if federation is requested but can not complete, usually due to theFederationStrategy- See Also:
-
query
QueryResponse query(QueryRequest queryRequest, FederationStrategy strategy) throws SourceUnavailableException, UnsupportedQueryException, FederationException Evaluates and executes aQueryRequestusing theFederationStrategyprovided.
Implementations of this method must implement all of the rules defined in
query(QueryRequest), but use the specifiedFederationStrategyImportant: Implementations are free to limit the number of results returned regardless of the page size requested in the
QueryRequest. For that reason, clients should not assume that the number of results returned matches the page size requested and write their paging code accordingly. If theQueryResponsedoes not need to be used, it is highly recommended that clients use an iterable class such asto retrieve and process results. If partitioning of results is required clients may use Guavasinvalid reference
ddf.catalog.util.impl.ResultIterablemethod.invalid reference
com.google.common.collect.Iterables#partition(Iterable, int)- Parameters:
queryRequest- theQueryRequeststrategy- theFederationStrategyto use- Returns:
QueryResponsethe resulting response- Throws:
SourceUnavailableException- if a requiredSourceis unavailableUnsupportedQueryException- if theQuerycan not be evaluated by thisCatalogFrameworkor any of itsSources.FederationException- if theQueryRequestincludesFederatedSources and there is either a problem connecting to aFederatedSourceor aFederatedSourcecannot evaluate theQuery
-
transform
BinaryContent transform(Metacard metacard, String transformerId, Map<String, Serializable> requestProperties) throws CatalogTransformerExceptionTransforms the providedMetacardintoBinaryContent. The transformerId is used to uniquely identify theMetacardTransformerdesired.- Parameters:
metacard- theMetacardto be transformedtransformerId- the id of theMetacardTransformerdesired, as registered with the OSGi Service Registry.requestProperties- to be used by the the transformer, if applicable- Returns:
BinaryContentthe transformedMetacard- Throws:
CatalogTransformerException- if there is a problem transforming theMetacard
-
transform
BinaryContent transform(SourceResponse response, String transformerId, Map<String, Serializable> requestProperties) throws CatalogTransformerExceptionTransforms the providedSourceResponse(orQueryResponse) intoBinaryContent. The transformerId is used to uniquely identify theQueryResponseTransformerdesired.- Parameters:
response- theSourceResponseto be transformedtransformerId- the id of the transformerrequestProperties- to be used by the the transformer, if applicable- Returns:
BinaryContentthe transformedSourceResponse- Throws:
CatalogTransformerException- if there is a problem transforming theSourceResponse
-
update
UpdateResponse update(UpdateStorageRequest updateRequest) throws IngestException, SourceUnavailableException This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library. Updates a list of Metacards. Metacards that are not in the Catalog will not be created.If a Metacard in the list to be updated does not have its ID attribute set, then the associated ID for that Metacard in the
UpdateRequestwill be used.Implementations of this method must:
-
Before evaluation, call
PreIngestPlugin.process(UpdateRequest)for each registeredPreIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallCatalogProvider.update(UpdateRequest)on the registeredCatalogProviderCallPostIngestPlugin.process(UpdateResponse)for each registeredPostIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallPreUpdateStoragePlugin.process(UpdateStorageRequest)for each registeredPreUpdateStoragePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallStorageProvider.update(UpdateStorageRequest)on the registeredCatalogProviderCallPostUpdateStoragePlugin.process(ddf.catalog.content.operation.UpdateStorageResponse)for each registeredPostUpdateStoragePluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
updateRequest- theUpdateStorageRequest- Returns:
UpdateResponse- Throws:
IngestException- if an issue occurs during the updateSourceUnavailableException- if the source being updated is unavailable
-
update
UpdateResponse update(UpdateRequest updateRequest) throws IngestException, SourceUnavailableException Updates a list of Metacards. Metacards that are not in the Catalog will not be created.If a Metacard in the list to be updated does not have its ID attribute set, then the associated ID for that Metacard in the
UpdateRequestwill be used.Implementations of this method must:
-
Before evaluation, call
PreIngestPlugin.process(UpdateRequest)for each registeredPreIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other. CallCatalogProvider.update(UpdateRequest)on the registeredCatalogProviderCallPostIngestPlugin.process(UpdateResponse)for each registeredPostIngestPluginin order determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each other.- Parameters:
updateRequest- theUpdateRequest- Returns:
UpdateResponse- Throws:
IngestException- if an issue occurs during the updateSourceUnavailableException- if the source being updated is unavailable
-