public class FileBackedHTTPMetadataResolver extends HTTPMetadataResolver
AbstractInitializableComponent.initialize()
, if any properties of this
provider are changed.AbstractBatchMetadataResolver.BatchEntityBackingStore
AbstractMetadataResolver.EntityBackingStore
Constructor and Description |
---|
FileBackedHTTPMetadataResolver(org.apache.http.client.HttpClient client,
String metadataURL,
String backupFilePath)
Constructor.
|
FileBackedHTTPMetadataResolver(Timer backgroundTaskTimer,
org.apache.http.client.HttpClient client,
String metadataURL,
String backupFilePath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doDestroy()
Performs component specific destruction logic.
|
protected byte[] |
fetchMetadata()
Gets the metadata document from the remote server.
|
protected void |
initMetadataResolver()
Subclasses should override this method to perform any initialization logic necessary.
|
protected void |
postProcessMetadata(byte[] metadataBytes,
Document metadataDom,
XMLObject originalMetadata,
XMLObject filteredMetadata)
Post-processing hook called after new metadata has been unmarshalled, filtered, and the DOM released (from the
XMLObject ) but before the metadata is saved off. |
protected void |
setBackupFile(String backupFilePath)
Sets the file used to backup metadata.
|
protected void |
validateBackupFile(File backupFile)
Validate the basic properties of the specified metadata backup file, for example that it
exists and/or can be created; that it is not a directory; and that it is readable and writable.
|
buildHttpClientContext, buildHttpGet, checkTLSCredentialTrusted, getMetadataBytesFromResponse, getMetadataIdentifier, getMetadataURI, processConditionalRetrievalHeaders, setBasicCredentials, setBasicCredentialsWithScope, setTLSTrustEngine
computeNextRefreshDelay, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, inputstreamToByteArray, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setCacheSourceMetadata, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadata
createNewBackingStore, getBackingStore, getCachedFilteredMetadata, getCachedOriginalMetadata, isCacheSourceMetadata, iterator, preProcessNewMetadata, resolve
doInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupEntityID, lookupIndexedEntityID, preProcessEntitiesDescriptor, preProcessEntityDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadata
setId
getId
destroy, initialize, isDestroyed, isInitialized
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadata
resolve, resolveSingle
getId
forEach, spliterator
public FileBackedHTTPMetadataResolver(org.apache.http.client.HttpClient client, String metadataURL, String backupFilePath) throws ResolverException
client
- HTTP client used to fetch remote metadatametadataURL
- the URL to fetch the metadatabackupFilePath
- the file that will keep a backup copy of the metadata,ResolverException
- thrown if the URL is not a valid URL, the metadata can not be retrieved from
the URLpublic FileBackedHTTPMetadataResolver(Timer backgroundTaskTimer, org.apache.http.client.HttpClient client, String metadataURL, String backupFilePath) throws ResolverException
client
- HTTP client used to fetch remote metadatabackgroundTaskTimer
- timer used to schedule background metadata refresh tasksmetadataURL
- the URL to fetch the metadatabackupFilePath
- the file that will keep a backup copy of the metadata,ResolverException
- thrown if the URL is not a valid URL, the metadata can not be retrieved from
the URLprotected void doDestroy()
doDestroy
in class HTTPMetadataResolver
protected void initMetadataResolver() throws ComponentInitializationException
initMetadataResolver
in class AbstractReloadingMetadataResolver
ComponentInitializationException
- thrown if there is a problem initializing the providerprotected void setBackupFile(String backupFilePath) throws ResolverException
backupFilePath
- path to the backup fileResolverException
- thrown if the backup file is not read/writable or creatableprotected void validateBackupFile(File backupFile) throws ResolverException
backupFile
- the file to evaluateResolverException
- if file does not pass basic properties required of a metadata backup fileprotected byte[] fetchMetadata() throws ResolverException
fetchMetadata
in class HTTPMetadataResolver
ResolverException
- thrown if there is a problem retrieving the metadata from the remote serverprotected void postProcessMetadata(byte[] metadataBytes, Document metadataDom, XMLObject originalMetadata, XMLObject filteredMetadata) throws ResolverException
XMLObject
) but before the metadata is saved off. Any exception thrown by this hook will cause the
retrieved metadata to be discarded.
The default implementation of this method is a no-oppostProcessMetadata
in class AbstractReloadingMetadataResolver
metadataBytes
- original raw metadata bytes retrieved via AbstractReloadingMetadataResolver.fetchMetadata()
metadataDom
- original metadata after it has been parsed in to a DOM documentoriginalMetadata
- original metadata prior to being filtered, with its DOM releasedfilteredMetadata
- metadata after it has been run through all registered filters and its DOM releasedResolverException
- thrown if there is a problem with the provided dataCopyright © 2016 JBoss by Red Hat. All rights reserved.