public class FilesystemMetadataProvider extends AbstractReloadingMetadataProvider
AbstractReloadingMetadataProvider.getMaxRefreshDelay()
value is used. Otherwise, the earliest refresh interval of the metadata file is checked
by looking for the earliest of all the validUntil attributes and cacheDuration attributes. If that refresh interval
is larger than the max refresh delay then AbstractReloadingMetadataProvider.getMaxRefreshDelay()
is used. If that number is smaller than the
min refresh delay then AbstractReloadingMetadataProvider.getMinRefreshDelay()
is used. Otherwise the calculated refresh delay multiplied by
AbstractReloadingMetadataProvider.getRefreshDelayFactor()
is used. By using this factor, the provider will attempt to be refresh before the
cache actually expires, allowing a some room for error and recovery. Assuming the factor is not exceedingly close to
1.0 and a min refresh delay that is not overly large, this refresh will likely occur a few times before the cache
expires.ObservableMetadataProvider.Observer
unmarshallerFactory
Constructor and Description |
---|
FilesystemMetadataProvider(File metadata)
Constructor.
|
FilesystemMetadataProvider(Timer backgroundTaskTimer,
File metadata)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys the metadata provider and frees any resources current held by it.
|
protected byte[] |
fetchMetadata()
Fetches metadata from a source.
|
protected String |
getMetadataIdentifier()
Gets an identifier which may be used to distinguish this metadata in logging statements.
|
boolean |
maintainExpiredMetadata()
Deprecated.
use
BaseMetadataProvider.requireValidMetadata() instead |
void |
setMaintainExpiredMetadata(boolean maintain)
Deprecated.
|
protected void |
setMetadataFile(File file)
Sets the file from which metadata is read.
|
protected void |
validateMetadataFile(File file)
Validate the basic properties of the specified metadata file, for example that it exists;
that it is a file; and that it is readable.
|
computeNextRefreshDelay, doGetMetadata, doInitialization, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, inputstreamToByteArray, postProcessMetadata, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadata
emitChangeEvent, getObservers
clearDescriptorIndex, doGetEntitiesDescriptor, doGetEntityDescriptor, doGetRole, doGetRole, filterMetadata, getEntitiesDescriptor, getEntitiesDescriptorByName, getEntityDescriptor, getEntityDescriptorById, getEntityDescriptorById, getMetadata, getParserPool, getRole, getRole, initialize, isFailFastInitialization, isInitialized, isValid, releaseMetadataDOM, setFailFastInitialization, setInitialized, setParserPool, unmarshallMetadata
getMetadataFilter, requireValidMetadata, setMetadataFilter, setRequireValidMetadata
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEntitiesDescriptor, getEntityDescriptor, getMetadata, getMetadataFilter, getRole, getRole, requireValidMetadata, setMetadataFilter, setRequireValidMetadata
public FilesystemMetadataProvider(File metadata) throws MetadataProviderException
metadata
- the metadata fileMetadataProviderException
- this exception is no longer thrownpublic FilesystemMetadataProvider(Timer backgroundTaskTimer, File metadata) throws MetadataProviderException
metadata
- the metadata filebackgroundTaskTimer
- timer used to refresh metadata in the backgroundMetadataProviderException
- this exception is no longer thrownprotected void setMetadataFile(File file) throws MetadataProviderException
file
- path to the metadata fileMetadataProviderException
- this exception is no longer thrownpublic boolean maintainExpiredMetadata()
BaseMetadataProvider.requireValidMetadata()
insteadpublic void setMaintainExpiredMetadata(boolean maintain)
BaseMetadataProvider.setRequireValidMetadata(boolean)
insteadmaintain
- whether cached metadata should be discarded if it expires and can not be refreshed.public void destroy()
destroy
in class AbstractReloadingMetadataProvider
protected String getMetadataIdentifier()
getMetadataIdentifier
in class AbstractReloadingMetadataProvider
protected byte[] fetchMetadata() throws MetadataProviderException
fetchMetadata
in class AbstractReloadingMetadataProvider
MetadataProviderException
- thrown if there is a problem fetching the metadataprotected void validateMetadataFile(File file) throws MetadataProviderException
file
- the file to evaluateMetadataProviderException
- if file does not pass basic properties required of a metadata fileCopyright © 1999–2014. All rights reserved.