org.opensaml.saml2.metadata.provider
Class FileBackedHTTPMetadataProvider
java.lang.Object
org.opensaml.saml2.metadata.provider.BaseMetadataProvider
org.opensaml.saml2.metadata.provider.AbstractMetadataProvider
org.opensaml.saml2.metadata.provider.AbstractObservableMetadataProvider
org.opensaml.saml2.metadata.provider.HTTPMetadataProvider
org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider
- All Implemented Interfaces:
- MetadataProvider, ObservableMetadataProvider
public class FileBackedHTTPMetadataProvider
- extends HTTPMetadataProvider
A URL metadata provider that caches a copy of the retrieved metadata to disk so that, in the event that the metadata
may not be pulled from the URL it may be pulled from disk using the last fetched data. If the backing file does not
already exist it will be created.
It is the responsibility of the caller to re-initialize, via HTTPMetadataProvider.initialize()
, if any properties of this
provider are changed.
Method Summary |
protected org.opensaml.xml.XMLObject |
fetchMetadata()
Fetches the metadata from the remote server or from the local filesystem if it can not be retrieved remotely. |
protected org.opensaml.xml.XMLObject |
getLocalMetadata()
Reads filtered metadata from the backup file. |
protected void |
writeMetadataToFile(org.opensaml.xml.XMLObject metadata)
Writes the currently cached metadata to file. |
Methods inherited from class org.opensaml.saml2.metadata.provider.HTTPMetadataProvider |
cacheMetadata, getMaxCacheDuration, getMetadata, getMetadataURI, getRequestTimeout, initialize, maintainExpiredMetadata, refreshMetadata, setBasicCredentials, setMaintainExpiredMetadata, setMaxCacheDuration, setSocketFactory |
Methods inherited from class org.opensaml.saml2.metadata.provider.AbstractMetadataProvider |
clearDescriptorIndex, filterMetadata, getEntitiesDescriptor, getEntitiesDescriptorByName, getEntityDescriptor, getEntityDescriptorById, getEntityDescriptorById, getParserPool, getRole, getRole, isValid, releaseMetadataDOM, setParserPool, unmarshallMetadata |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileBackedHTTPMetadataProvider
public FileBackedHTTPMetadataProvider(java.lang.String metadataURL,
int requestTimeout,
java.lang.String backingFilePath)
throws MetadataProviderException
- Constructor.
- Parameters:
metadataURL
- the URL to fetch the metadatarequestTimeout
- the time, in milliseconds, to wait for the metadata server to respondbackingFilePath
- the file that will keep a backup copy of the metadata,
- Throws:
MetadataProviderException
- thrown if the URL is not a valid URL, the metadata can not be retrieved from
the URL, the given file can not be created or written to
fetchMetadata
protected org.opensaml.xml.XMLObject fetchMetadata()
throws java.io.IOException,
org.opensaml.xml.io.UnmarshallingException
- Fetches the metadata from the remote server or from the local filesystem if it can not be retrieved remotely.
- Overrides:
fetchMetadata
in class HTTPMetadataProvider
- Returns:
- the unmarshalled metadata
- Throws:
java.io.IOException
- thrown if the metadata can not be fetched from the remote server or local filesystems
org.opensaml.xml.io.UnmarshallingException
- thrown if the metadata can not be unmarshalled
getLocalMetadata
protected org.opensaml.xml.XMLObject getLocalMetadata()
throws java.io.IOException,
org.opensaml.xml.io.UnmarshallingException
- Reads filtered metadata from the backup file.
- Returns:
- cached copy of the metadata read from disk
- Throws:
java.io.IOException
- thrown if the metadata can not be read from disk
org.opensaml.xml.io.UnmarshallingException
- thrown if the metadata, read from disk, can not be unmarshalled
writeMetadataToFile
protected void writeMetadataToFile(org.opensaml.xml.XMLObject metadata)
throws MetadataProviderException
- Writes the currently cached metadata to file.
- Parameters:
metadata
- metadata to write to disk
- Throws:
MetadataProviderException
- thrown if metadata can not be written to disk
Copyright © 2006-2011 Internet2. All Rights Reserved.