public class FsResourceManager extends Object implements ResourceManager
Constructor and Description |
---|
FsResourceManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
create(URI normalizedURI)
Create the resource that is identified by the given
normalizedURI . |
boolean |
delete(URI normalizedURI)
Delete or remove the resource that is identified by the given
normalizedURI . |
boolean |
exists(URI normalizedURI)
Does the resource that is identified by the given
normalizedURI exist in the resource store. |
boolean |
keep(URI normalizedURI)
Keep the resource that is identified by the given
normalizedURI . |
boolean |
keepOnly(Set<URI> normalizedURIs)
Clean up the managed store.
|
void |
setPathFinder(PathFinder pathFinder)
Sets the current pathFinder on this ResourceManager.
|
boolean |
update(URI normalizedURI)
Update the resource that is identified by the given
normalizedURI . |
VerificationStatus |
verifyHash(URI normalizedURI,
String algorithm,
String hash)
Verify the
hash of the resource that is identified by the given normalizedURI ,
computed with the indicated algorithm . |
VerificationStatus |
verifyLastModified(URI normalizedURI,
ZonedDateTime lastModified)
Verify the last modified date of the resource that is identified by the given
normalizedURI . |
VerificationStatus |
verifySize(URI normalizedURI,
long size)
Verify the size in bytes of the resource that is identified by the given
normalizedURI . |
FsResourceManager |
withHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient) |
FsResourceManager |
withResourceReader(ResourceReader resourceReader) |
public void setPathFinder(PathFinder pathFinder)
ResourceManager
PathFinder.getCapabilityListUri()
.
A ResourceManager should rely on the fact that each call to this method signifies the
synchronisation of a new set of resources.setPathFinder
in interface ResourceManager
pathFinder
- the pathFinder for the current set of resourcespublic FsResourceManager withHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
public FsResourceManager withResourceReader(ResourceReader resourceReader)
public boolean exists(@Nonnull URI normalizedURI)
ResourceManager
normalizedURI
exist in the resource store.exists
in interface ResourceManager
normalizedURI
- identifies the resourcetrue
if the indicated resource exists, false
otherwisepublic VerificationStatus verifyHash(@Nonnull URI normalizedURI, @Nonnull String algorithm, @Nonnull String hash)
ResourceManager
hash
of the resource that is identified by the given normalizedURI
,
computed with the indicated algorithm
.verifyHash
in interface ResourceManager
normalizedURI
- identifies the resourcealgorithm
- indicates algorithm for hash computationhash
- hash to verifypublic VerificationStatus verifyLastModified(@Nonnull URI normalizedURI, @Nonnull ZonedDateTime lastModified)
ResourceManager
normalizedURI
.verifyLastModified
in interface ResourceManager
normalizedURI
- identifies the resourcelastModified
- dateTime to verifypublic VerificationStatus verifySize(@Nonnull URI normalizedURI, long size)
ResourceManager
normalizedURI
.verifySize
in interface ResourceManager
normalizedURI
- identifies the resourcesize
- size in bytes of the remote resourcepublic boolean keepOnly(@Nonnull Set<URI> normalizedURIs)
ResourceManager
normalizedURIs
should be kept in the managed store, others should be removed or deleted.
This call enables the ResourceManager to clean up if the Source issues a new ResourceList. The ResourceManager
should only remove resources that are not listed. The ResourceManager will be enabled
to ResourceManager.create(URI)
and/or ResourceManager.update(URI)
resources that are indicated
in the set but are not yet in the managed store.keepOnly
in interface ResourceManager
normalizedURIs
- identify the resources that should be kept in the managed store.true
if the operation succeeded, false
otherwisepublic boolean keep(@Nonnull URI normalizedURI)
ResourceManager
normalizedURI
. The resource is present
and verified to be up-to-date. So the ResourceManager is not expected to handle the indicated resource,
but may, of course, take any action it deems appropriate.keep
in interface ResourceManager
normalizedURI
- identifies the resourcetrue
if the operation succeeded, false
otherwisepublic boolean create(@Nonnull URI normalizedURI)
ResourceManager
normalizedURI
. The resource was not present.create
in interface ResourceManager
normalizedURI
- identifies the resourcetrue
if the operation succeeded, false
otherwisepublic boolean update(@Nonnull URI normalizedURI)
ResourceManager
normalizedURI
. The resource was present but
was not up-to-date.update
in interface ResourceManager
normalizedURI
- identifies the resourcetrue
if the operation succeeded, false
otherwisepublic boolean delete(@Nonnull URI normalizedURI)
ResourceManager
normalizedURI
. The resource
was present but was purged from the set of resources.delete
in interface ResourceManager
normalizedURI
- identifies the resourcetrue
if the operation succeeded, false
otherwiseCopyright © 2017. All rights reserved.