public class CatalogFrameworkImpl extends DescribableImpl implements CatalogFramework
Constructor and Description |
---|
CatalogFrameworkImpl(CreateOperations createOperations,
UpdateOperations updateOperations,
DeleteOperations deleteOperations,
QueryOperations queryOperations,
ResourceOperations resourceOperations,
SourceOperations sourceOperations,
TransformOperations transformOperations)
Instantiates a new CatalogFrameworkImpl which delegates its work to surrogate operations
classes.
|
getDescription, getId, getOrganization, getTitle, getVersion, setDescription, setOrganization, setShortname, setTitle, setVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDescription, getId, getOrganization, getTitle, getVersion
public CatalogFrameworkImpl(CreateOperations createOperations, UpdateOperations updateOperations, DeleteOperations deleteOperations, QueryOperations queryOperations, ResourceOperations resourceOperations, SourceOperations sourceOperations, TransformOperations transformOperations)
createOperations
- delegate that handles create operationsupdateOperations
- delegate that handles update operationsdeleteOperations
- delegate that handles delete operationsqueryOperations
- delegate that handles query operationsresourceOperations
- delegate that handles resource operationssourceOperations
- delegate that handles source operationstransformOperations
- delegate that handles transformation operationspublic QueryOperations getQueryOperations()
public ResourceOperations getResourceOperations()
public SourceOperations getSourceOperations()
public TransformOperations getTransformOperations()
public void setFanoutEnabled(boolean fanoutEnabled)
public void setMasker(Masker masker)
Masker
masker
- the Masker
this framework will usepublic void setId(String sourceId)
setId
in class DescribableImpl
sourceId
- the sourceId to setpublic Set<String> getSourceIds()
CatalogFramework
CatalogFramework
. This set includes the local
provider and any federated sources, but not connected sources as they are hidden from external
clients.getSourceIds
in interface CatalogFramework
public SourceInfoResponse getSourceInfo(SourceInfoRequest sourceInfoRequest) throws SourceUnavailableException
CatalogFramework
Source
that is endpoint-addressable in
CatalogFramework
, including its own CatalogProvider
, based
on the contents of the SourceInfoRequest
.
The SourceInfoRequest
specifies either:
getSourceInfo
in interface CatalogFramework
sourceInfoRequest
- the SourceInfoRequest
SourceInfoResponse
SourceUnavailableException
- if the source indicated in the SourceInfoRequest
is
null
, not found, or cannot provide the requested informationpublic CreateResponse create(CreateStorageRequest createRequest) throws IngestException, SourceUnavailableException
CatalogFramework
Metacard
s in the CatalogProvider
.
Implementations of this method must:
PreIngestPlugin.process(CreateRequest)
for each registered PreIngestPlugin
in order determined by the OSGi SERVICE_RANKING
(Descending, highest first), "daisy chaining" their responses to each other.
Call CatalogProvider.create(CreateRequest)
on the registered
CatalogProvider
Call PostIngestPlugin.process(CreateResponse)
for each
registered PostIngestPlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
Call PreCreateStoragePlugin.process(CreateStorageRequest)
for each
registered PreCreateStoragePlugin
in order determined
by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses
to each other.
Call StorageProvider.create(CreateStorageRequest)
on the
registered CatalogProvider
Call PostCreateStoragePlugin.process(ddf.catalog.content.operation.CreateStorageResponse)
for each registered PostCreateStoragePlugin
in order
determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining"
their responses to each other.
create
in interface CatalogFramework
createRequest
- the CreateStorageRequest
CreateResponse
IngestException
- if an issue occurs during the updateSourceUnavailableException
- if the source being updated is unavailablepublic CreateResponse create(CreateRequest createRequest) throws IngestException, SourceUnavailableException
CatalogFramework
Metacard
s in the CatalogProvider
.
Implementations of this method must:
PreIngestPlugin.process(CreateRequest)
for each registered PreIngestPlugin
in order determined by the OSGi SERVICE_RANKING
(Descending, highest first), "daisy chaining" their responses to each other.
Call CatalogProvider.create(CreateRequest)
on the registered
CatalogProvider
Call PostIngestPlugin.process(CreateResponse)
for each
registered PostIngestPlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
create
in interface CatalogFramework
createRequest
- the CreateRequest
CreateResponse
IngestException
- if an issue occurs during the updateSourceUnavailableException
- if the source being updated is unavailablepublic UpdateResponse update(UpdateStorageRequest updateRequest) throws IngestException, SourceUnavailableException
CatalogFramework
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 UpdateRequest
will be used.
Implementations of this method must:
PreIngestPlugin.process(UpdateRequest)
for each registered PreIngestPlugin
in order determined by the OSGi SERVICE_RANKING
(Descending, highest first), "daisy chaining" their responses to each other.
Call CatalogProvider.update(UpdateRequest)
on the registered
CatalogProvider
Call PostIngestPlugin.process(UpdateResponse)
for each
registered PostIngestPlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
Call PreUpdateStoragePlugin.process(UpdateStorageRequest)
for each
registered PreUpdateStoragePlugin
in order determined
by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses
to each other.
Call StorageProvider.update(UpdateStorageRequest)
on the
registered CatalogProvider
Call PostUpdateStoragePlugin.process(ddf.catalog.content.operation.UpdateStorageResponse)
for each registered PostUpdateStoragePlugin
in order
determined by the OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining"
their responses to each other.
update
in interface CatalogFramework
updateRequest
- the UpdateStorageRequest
UpdateResponse
IngestException
- if an issue occurs during the updateSourceUnavailableException
- if the source being updated is unavailablepublic UpdateResponse update(UpdateRequest updateRequest) throws IngestException, SourceUnavailableException
CatalogFramework
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 UpdateRequest
will be used.
Implementations of this method must:
PreIngestPlugin.process(UpdateRequest)
for each registered PreIngestPlugin
in order determined by the OSGi SERVICE_RANKING
(Descending, highest first), "daisy chaining" their responses to each other.
Call CatalogProvider.update(UpdateRequest)
on the registered
CatalogProvider
Call PostIngestPlugin.process(UpdateResponse)
for each
registered PostIngestPlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
update
in interface CatalogFramework
updateRequest
- the UpdateRequest
UpdateResponse
IngestException
- if an issue occurs during the updateSourceUnavailableException
- if the source being updated is unavailablepublic DeleteResponse delete(DeleteRequest deleteRequest) throws IngestException, SourceUnavailableException
CatalogFramework
Metacard
s with Attribute
s matching a specified value.
Implementations of this method must:
PreIngestPlugin.process(DeleteRequest)
for each registered PreIngestPlugin
in order determined by the OSGi SERVICE_RANKING
(Descending, highest first), "daisy chaining" their responses to each other.
Call CatalogProvider.delete(DeleteRequest)
on the registered
CatalogProvider
Call PostIngestPlugin.process(DeleteResponse)
for each
registered PostIngestPlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
delete
in interface CatalogFramework
deleteRequest
- the DeleteRequest
DeleteResponse
IngestException
- if an issue occurs during the deletionSourceUnavailableException
- if the source being updated is unavailablepublic QueryResponse query(QueryRequest fedQueryRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException
CatalogFramework
QueryRequest
using the default FederationStrategy
Implementations of this method must:
PreQueryPlugin.process(QueryRequest)
for each registered PreQueryPlugin
in order determined by the
OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to
each other.
Call Source.query(QueryRequest)
on the registered
CatalogProvider
Call Source.query(QueryRequest)
on all registered
ConnectedSource
s
If applicable, invoke the default FederationStrategy
which will call Source.query(QueryRequest)
on all registered FederatedSource
s
Before returning, call PostQueryPlugin.process(QueryResponse)
for each registered PostQueryPlugin
in order determined by the
OSGi SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to
each other.
Return the last QueryResponse
to 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 the QueryResponse
does not need to be used, it is
highly recommended that clients use an iterable class such as ResultIterable
to retrieve and process results. If partitioning of
results is required clients may use Guavas Iterables.partition(Iterable, int)
method.
query
in interface CatalogFramework
fedQueryRequest
- the QueryRequest
QueryResponse
the resulting responseUnsupportedQueryException
- if the provided query can not be interpreted by a required
Source
SourceUnavailableException
- if a required Source
is not
availableFederationException
- if federation is requested but can not complete, usually due to the
FederationStrategy
CatalogFramework.query(QueryRequest, FederationStrategy)
public QueryResponse query(QueryRequest queryRequest, FederationStrategy strategy) throws SourceUnavailableException, UnsupportedQueryException, FederationException
CatalogFramework
QueryRequest
using the FederationStrategy
provided.
Implementations of this method must implement all of the rules defined in CatalogFramework.query(QueryRequest)
, but use the specified FederationStrategy
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 the QueryResponse
does not need to be used, it is
highly recommended that clients use an iterable class such as ResultIterable
to retrieve and process results. If partitioning of
results is required clients may use Guavas Iterables.partition(Iterable, int)
method.
query
in interface CatalogFramework
queryRequest
- the QueryRequest
strategy
- the FederationStrategy
to useQueryResponse
the resulting responseSourceUnavailableException
- if a required Source
is
unavailableUnsupportedQueryException
- if the Query
can not be
evaluated by this CatalogFramework
or any of its Source
s.FederationException
- if the QueryRequest
includes FederatedSource
s and there is either a problem connecting to a FederatedSource
or a FederatedSource
cannot
evaluate the Query
public BinaryContent transform(Metacard metacard, String transformerShortname, Map<String,Serializable> arguments) throws CatalogTransformerException
CatalogFramework
Metacard
into BinaryContent
. The transformerId is used
to uniquely identify the MetacardTransformer
desired.transform
in interface CatalogFramework
metacard
- the Metacard
to be transformedtransformerShortname
- the id of the MetacardTransformer
desired,
as registered with the OSGi Service Registry.arguments
- to be used by the the transformer, if applicableBinaryContent
the transformed Metacard
CatalogTransformerException
- if there is a problem transforming the Metacard
public BinaryContent transform(SourceResponse response, String transformerShortname, Map<String,Serializable> arguments) throws CatalogTransformerException
CatalogFramework
SourceResponse
(or QueryResponse
) into BinaryContent
. The transformerId is used to uniquely identify the QueryResponseTransformer
desired.transform
in interface CatalogFramework
response
- the SourceResponse
to be transformedtransformerShortname
- the id of the transformerarguments
- to be used by the the transformer, if applicableBinaryContent
the transformed SourceResponse
CatalogTransformerException
- if there is a problem transforming the SourceResponse
public ResourceResponse getLocalResource(ResourceRequest resourceRequest) throws IOException, ResourceNotFoundException, ResourceNotSupportedException
CatalogFramework
ResourceRequest
using available ResourceReader
s
(does not attempt to locate the resource via federation).
Implementations of this method must:
PreResourcePlugin.process(ResourceRequest)
for each registered PreResourcePlugin
in 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 (
ResourceRequest.GET_RESOURCE_BY_PRODUCT_URI
.equals(ResourceRequest.getAttributeName()
)==false
) , retrieve the matching Metacard
and get its Product java.net.URI.
Locate the ResourceReader
that supports the URI.getScheme()
of the java.net.URI on the OSGi Registry.
Call ResourceReader.retrieveResource(java.net.URI, Map)
Call PostResourcePlugin.process(ResourceResponse)
for each
registered PostResourcePlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
getLocalResource
in interface CatalogFramework
resourceRequest
- the ResourceRequest
ResourceResponse
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 this CatalogFramework
public ResourceResponse getResource(ResourceRequest resourceRequest, String resourceSiteName) throws IOException, ResourceNotFoundException, ResourceNotSupportedException
CatalogFramework
ResourceRequest
using the specified site name.
Implementations of this method must:
PreResourcePlugin.process(ResourceRequest)
for each registered PreResourcePlugin
in 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 (
ResourceRequest.GET_RESOURCE_BY_PRODUCT_URI
.equals(ResourceRequest.getAttributeName()
)==false
) , retrieve the matching Metacard
and get its Product java.net.URI.
Locate the ResourceReader
that supports the URI.getScheme()
of the java.net.URI on the OSGi Registry.
Call ResourceReader.retrieveResource(java.net.URI, Map)
Call PostResourcePlugin.process(ResourceResponse)
for each
registered PostResourcePlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
getResource
in interface CatalogFramework
resourceRequest
- the ResourceRequest
resourceSiteName
- name of the site/source to retrieve the resource fromResourceResponse
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 this CatalogFramework
public ResourceResponse getEnterpriseResource(ResourceRequest resourceRequest) throws IOException, ResourceNotFoundException, ResourceNotSupportedException
CatalogFramework
ResourceRequest
against the local CatalogProvider
and RemoteSource
s.
Implementations of this method must:
PreResourcePlugin.process(ResourceRequest)
for each registered PreResourcePlugin
in 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 (
ResourceRequest.GET_RESOURCE_BY_PRODUCT_URI
.equals(ResourceRequest.getAttributeName()
)==false
) , retrieve the matching Metacard
and get its Product java.net.URI.
Locate the ResourceReader
that supports the URI.getScheme()
of the java.net.URI on the OSGi Registry.
Call ResourceReader.retrieveResource(java.net.URI, Map)
Call PostResourcePlugin.process(ResourceResponse)
for each
registered PostResourcePlugin
in order determined by the OSGi
SERVICE_RANKING (Descending, highest first), "daisy chaining" their responses to each
other.
getEnterpriseResource
in interface CatalogFramework
resourceRequest
- the ResourceRequest
ResourceResponse
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 this CatalogFramework
@Deprecated public Map<String,Set<String>> getLocalResourceOptions(String metacardId) throws ResourceNotFoundException
CatalogFramework
Metacard
locally and retrieve arguments that can be used in the retrieval
of its associated Resource.getLocalResourceOptions
in interface CatalogFramework
metacardId
- the ID of the Metacard
ResourceNotFoundException
- if the Metacard
is not found or there is no Resource
associated with the Metacard
@Deprecated public Map<String,Set<String>> getEnterpriseResourceOptions(String metacardId) throws ResourceNotFoundException
CatalogFramework
Metacard
in the enterprise and retrieve arguments that can be used in the
retrieval of its associated ResourcegetEnterpriseResourceOptions
in interface CatalogFramework
metacardId
- the ID of the Metacard
ResourceNotFoundException
- if the Metacard
is not found or there is no Resource
associated with the Metacard
@Deprecated public Map<String,Set<String>> getResourceOptions(String metacardId, String sourceId) throws ResourceNotFoundException
CatalogFramework
Metacard
on specified Source
and retrieve
arguments that can be used in the retrieval of its associated ResourcegetResourceOptions
in interface CatalogFramework
metacardId
- the ID of the metacardsourceId
- the ID of the source to retrieve the metacard fromResourceNotFoundException
- if the Metacard
is not found or there is no Resource
associated with the Metacard
This work is licensed under a Creative Commons Attribution 4.0 International License.