OpenSAML-J 2.4.1-redhat-3

org.opensaml.saml2.metadata.provider
Class FileBackedHTTPMetadataProvider

java.lang.Object
  extended by org.opensaml.saml2.metadata.provider.BaseMetadataProvider
      extended by org.opensaml.saml2.metadata.provider.AbstractMetadataProvider
          extended by org.opensaml.saml2.metadata.provider.AbstractObservableMetadataProvider
              extended by org.opensaml.saml2.metadata.provider.AbstractReloadingMetadataProvider
                  extended by org.opensaml.saml2.metadata.provider.HTTPMetadataProvider
                      extended by 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 AbstractMetadataProvider.initialize(), if any properties of this provider are changed.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opensaml.saml2.metadata.provider.ObservableMetadataProvider
ObservableMetadataProvider.Observer
 
Field Summary
 
Fields inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
unmarshallerFactory
 
Constructor Summary
FileBackedHTTPMetadataProvider(String metadataURL, int requestTimeout, String backupFilePath)
          Deprecated. 
FileBackedHTTPMetadataProvider(Timer backgroundTaskTimer, org.apache.commons.httpclient.HttpClient client, String metadataURL, String backupFilePath)
          Constructor.
 
Method Summary
protected  byte[] fetchMetadata()
          Gets the metadata document from the remote server.
protected  void postProcessMetadata(byte[] metadataBytes, Document metadataDom, org.opensaml.xml.XMLObject metadata)
          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.
 
Methods inherited from class org.opensaml.saml2.metadata.provider.HTTPMetadataProvider
buildGetMethod, getMaxCacheDuration, getMetadataBytesFromResponse, getMetadataIdentifier, getMetadataURI, getRequestTimeout, maintainExpiredMetadata, processConditionalRetrievalHeaders, setBasicCredentials, setMaintainExpiredMetadata, setMaxCacheDuration, setSocketFactory
 
Methods inherited from class org.opensaml.saml2.metadata.provider.AbstractReloadingMetadataProvider
computeNextRefreshDelay, doGetMetadata, doInitialization, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, inputstreamToByteArray, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadata
 
Methods inherited from class org.opensaml.saml2.metadata.provider.AbstractObservableMetadataProvider
emitChangeEvent, getObservers
 
Methods inherited from class org.opensaml.saml2.metadata.provider.AbstractMetadataProvider
clearDescriptorIndex, doGetEntitiesDescriptor, doGetEntityDescriptor, doGetRole, doGetRole, filterMetadata, getEntitiesDescriptor, getEntitiesDescriptorByName, getEntityDescriptor, getEntityDescriptorById, getEntityDescriptorById, getMetadata, getParserPool, getRole, getRole, initialize, isFailFastInitialization, isInitialized, isValid, releaseMetadataDOM, setFailFastInitialization, setInitialized, setParserPool, unmarshallMetadata
 
Methods inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
getMetadataFilter, requireValidMetadata, setMetadataFilter, setRequireValidMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensaml.saml2.metadata.provider.MetadataProvider
getEntitiesDescriptor, getEntityDescriptor, getMetadata, getMetadataFilter, getRole, getRole, requireValidMetadata, setMetadataFilter, setRequireValidMetadata
 

Constructor Detail

FileBackedHTTPMetadataProvider

@Deprecated
public FileBackedHTTPMetadataProvider(String metadataURL,
                                                 int requestTimeout,
                                                 String backupFilePath)
                               throws MetadataProviderException
Deprecated. 

Constructor.

Parameters:
metadataURL - the URL to fetch the metadata
requestTimeout - the time, in milliseconds, to wait for the metadata server to respond
backupFilePath - 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

FileBackedHTTPMetadataProvider

public FileBackedHTTPMetadataProvider(Timer backgroundTaskTimer,
                                      org.apache.commons.httpclient.HttpClient client,
                                      String metadataURL,
                                      String backupFilePath)
                               throws MetadataProviderException
Constructor.

Parameters:
client - HTTP client used to fetch remove metadata
backgroundTaskTimer - timer used to schedule background metadata refresh tasks
metadataURL - the URL to fetch the metadata
backupFilePath - 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
Method Detail

setBackupFile

protected void setBackupFile(String backupFilePath)
                      throws MetadataProviderException
Sets the file used to backup metadata. The given file path is checked to see if it is a read/writable file if it exists or if can be created if it does not exist.

Parameters:
backupFilePath - path to the backup file
Throws:
MetadataProviderException - thrown if the backup file is not read/writable or creatable

fetchMetadata

protected byte[] fetchMetadata()
                        throws MetadataProviderException
Gets the metadata document from the remote server.

Overrides:
fetchMetadata in class HTTPMetadataProvider
Returns:
the metadata from remote server, or null if the metadata document has not changed since the last retrieval
Throws:
MetadataProviderException - thrown if there is a problem retrieving the metadata from the remote server

postProcessMetadata

protected void postProcessMetadata(byte[] metadataBytes,
                                   Document metadataDom,
                                   org.opensaml.xml.XMLObject metadata)
                            throws MetadataProviderException
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. Any exception thrown by this hook will cause the retrieved metadata to be discarded. The default implementation of this method is a no-op

Overrides:
postProcessMetadata in class AbstractReloadingMetadataProvider
Parameters:
metadataBytes - raw metadata bytes retrieved via AbstractReloadingMetadataProvider.fetchMetadata()
metadataDom - metadata after it has been parsed in to a DOM document
metadata - metadata after it has been run through all registered filters and its DOM released
Throws:
MetadataProviderException - thrown if there is a problem with the provided data

OpenSAML-J 2.4.1-redhat-3

Copyright © 2006-2012 Internet2. All Rights Reserved.