OpenSAML-J 2.4.1-redhat-3

org.opensaml.saml2.metadata.provider
Class FilesystemMetadataProvider

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.FilesystemMetadataProvider
All Implemented Interfaces:
MetadataProvider, ObservableMetadataProvider

public class FilesystemMetadataProvider
extends AbstractReloadingMetadataProvider

A metadata provider that pulls metadata from a file on the local filesystem. This metadata provider periodically checks to see if the read metadata file has changed. The delay between each refresh interval is calculated as follows. If no validUntil or cacheDuration is present then the 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.


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
FilesystemMetadataProvider(File metadata)
          Constructor.
FilesystemMetadataProvider(Timer backgroundTaskTimer, File metadata)
          Constructor.
 
Method Summary
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. use BaseMetadataProvider.setRequireValidMetadata(boolean) instead
protected  void setMetadataFile(File file)
          Sets the file from which metadata is read.
 
Methods inherited from class org.opensaml.saml2.metadata.provider.AbstractReloadingMetadataProvider
computeNextRefreshDelay, doGetMetadata, doInitialization, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, inputstreamToByteArray, postProcessMetadata, 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

FilesystemMetadataProvider

public FilesystemMetadataProvider(File metadata)
                           throws MetadataProviderException
Constructor.

Parameters:
metadata - the metadata file
Throws:
MetadataProviderException - thrown if the given file path is null, does not exist, does not represent a file, or if the metadata can not be parsed

FilesystemMetadataProvider

public FilesystemMetadataProvider(Timer backgroundTaskTimer,
                                  File metadata)
                           throws MetadataProviderException
Constructor.

Parameters:
metadata - the metadata file
backgroundTaskTimer - timer used to refresh metadata in the background
Throws:
MetadataProviderException - thrown if the given file path is null, does not exist, does not represent a file, or if the metadata can not be parsed
Method Detail

setMetadataFile

protected void setMetadataFile(File file)
                        throws MetadataProviderException
Sets the file from which metadata is read. The given file path is checked to see if it exists, is a file, and is readable.

Parameters:
file - path to the metadata file
Throws:
MetadataProviderException - thrown if the file does not exist or is not a readable file

maintainExpiredMetadata

public boolean maintainExpiredMetadata()
Deprecated. use BaseMetadataProvider.requireValidMetadata() instead

Gets whether cached metadata should be discarded if it expires and can not be refreshed.

Returns:
whether cached metadata should be discarded if it expires and can not be refreshed.

setMaintainExpiredMetadata

public void setMaintainExpiredMetadata(boolean maintain)
Deprecated. use BaseMetadataProvider.setRequireValidMetadata(boolean) instead

Sets whether cached metadata should be discarded if it expires and can not be refreshed.

Parameters:
maintain - whether cached metadata should be discarded if it expires and can not be refreshed.

getMetadataIdentifier

protected String getMetadataIdentifier()
Gets an identifier which may be used to distinguish this metadata in logging statements.

Specified by:
getMetadataIdentifier in class AbstractReloadingMetadataProvider
Returns:
identifier which may be used to distinguish this metadata in logging statements

fetchMetadata

protected byte[] fetchMetadata()
                        throws MetadataProviderException
Fetches metadata from a source.

Specified by:
fetchMetadata in class AbstractReloadingMetadataProvider
Returns:
the fetched metadata, or null if the metadata is known not to have changed since the last retrieval
Throws:
MetadataProviderException - thrown if there is a problem fetching the metadata

OpenSAML-J 2.4.1-redhat-3

Copyright © 2006-2012 Internet2. All Rights Reserved.