org.opensaml.saml2.metadata.provider
Class ChainingMetadataProvider

java.lang.Object
  extended by org.opensaml.saml2.metadata.provider.BaseMetadataProvider
      extended by org.opensaml.saml2.metadata.provider.ChainingMetadataProvider
All Implemented Interfaces:
MetadataProvider

public class ChainingMetadataProvider
extends BaseMetadataProvider

A metadata provider that uses registered providers, in turn, to answer queries.


Field Summary
 
Fields inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
unmarshallerFactory
 
Constructor Summary
ChainingMetadataProvider()
          Constructor.
 
Method Summary
 void addMetadataProvider(MetadataProvider newProvider)
          Adds a metadata provider to the list of registered providers.
 EntitiesDescriptor getEntitiesDescriptor(java.lang.String name)
          Gets a named EntitiesDescriptor from the metadata.
 EntityDescriptor getEntityDescriptor(java.lang.String entityID)
          Gets the metadata for a given entity if the metadata is valid.
 XMLObject getMetadata()
          Gets the metadata from every registered provider and places each within a newly created EntitiesDescriptor.
 java.util.List<MetadataProvider> getProviders()
          Gets an immutable the list of currently registered providers.
 java.util.List<RoleDescriptor> getRole(java.lang.String entityID, javax.xml.namespace.QName roleName)
          Gets the role descriptors of a given type for a given entity from valid metadata.
 RoleDescriptor getRole(java.lang.String entityID, javax.xml.namespace.QName roleName, java.lang.String supportedProtocol)
          Gets the role descriptors of a given type for a given entity that support the given protocol from valid metadata.
 void removeMetadataProvider(MetadataProvider provider)
          Removes a metadata provider from the list of registered providers.
 void setMetadataFilter(MetadataFilter newFilter)
          Sets the metadata filter applied to the metadata.
 void setProviders(java.util.List<MetadataProvider> newProviders)
          Replaces the current set of metadata providers with give collection.
 void setRequireValidMetadata(boolean requireValidMetadata)
          Sets whether the metadata returned by queries must be valid.
 
Methods inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
getMetadataFilter, requireValidMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainingMetadataProvider

public ChainingMetadataProvider()
Constructor.

Method Detail

getProviders

public java.util.List<MetadataProvider> getProviders()
Gets an immutable the list of currently registered providers.

Returns:
list of currently registered providers

setProviders

public void setProviders(java.util.List<MetadataProvider> newProviders)
                  throws MetadataProviderException
Replaces the current set of metadata providers with give collection.

Parameters:
newProviders - the metadata providers to replace the current providers with
Throws:
MetadataProviderException - thrown if there is a problem adding the metadata provider

addMetadataProvider

public void addMetadataProvider(MetadataProvider newProvider)
                         throws MetadataProviderException
Adds a metadata provider to the list of registered providers.

Parameters:
newProvider - the provider to be added
Throws:
MetadataProviderException - thrown if there is a problem adding the metadata provider

removeMetadataProvider

public void removeMetadataProvider(MetadataProvider provider)
Removes a metadata provider from the list of registered providers.

Parameters:
provider - provider to be removed

setRequireValidMetadata

public void setRequireValidMetadata(boolean requireValidMetadata)
Sets whether the metadata returned by queries must be valid.

Specified by:
setRequireValidMetadata in interface MetadataProvider
Overrides:
setRequireValidMetadata in class BaseMetadataProvider
Parameters:
requireValidMetadata - whether the metadata returned by queries must be valid

setMetadataFilter

public void setMetadataFilter(MetadataFilter newFilter)
                       throws MetadataProviderException
Sets the metadata filter applied to the metadata.

Specified by:
setMetadataFilter in interface MetadataProvider
Overrides:
setMetadataFilter in class BaseMetadataProvider
Parameters:
newFilter - the metadata filter applied to the metadata
Throws:
MetadataProviderException - thrown if the provider can not apply the filter to the metadata

getMetadata

public XMLObject getMetadata()
                      throws MetadataProviderException
Gets the metadata from every registered provider and places each within a newly created EntitiesDescriptor. Gets the entire metadata tree, after the registered filter has been applied.

Returns:
the entire metadata tree
Throws:
MetadataProviderException - thrown if the provider can not fetch the metadata

getEntitiesDescriptor

public EntitiesDescriptor getEntitiesDescriptor(java.lang.String name)
                                         throws MetadataProviderException
Gets a named EntitiesDescriptor from the metadata.

Parameters:
name - the name of the EntitiesDescriptor
Returns:
the EntitiesDescriptor or null
Throws:
MetadataProviderException - thrown if the provider can not fetch the metadata

getEntityDescriptor

public EntityDescriptor getEntityDescriptor(java.lang.String entityID)
                                     throws MetadataProviderException
Gets the metadata for a given entity if the metadata is valid.

Parameters:
entityID - the ID of the entity
Returns:
the entity's metadata or null if there is no metadata or no valid metadata
Throws:
MetadataProviderException - thrown if the provider can not fetch the metadata

getRole

public java.util.List<RoleDescriptor> getRole(java.lang.String entityID,
                                              javax.xml.namespace.QName roleName)
                                       throws MetadataProviderException
Gets the role descriptors of a given type for a given entity from valid metadata.

Parameters:
entityID - the ID of the entity
roleName - the role type
Returns:
the role descriptors
Throws:
MetadataProviderException - thrown if the provider can not fetch the metadata

getRole

public RoleDescriptor getRole(java.lang.String entityID,
                              javax.xml.namespace.QName roleName,
                              java.lang.String supportedProtocol)
                       throws MetadataProviderException
Gets the role descriptors of a given type for a given entity that support the given protocol from valid metadata.

Parameters:
entityID - the ID of the entity
roleName - the role type
supportedProtocol - the protocol supported by the role
Returns:
the role descriptors
Throws:
MetadataProviderException - thrown if the provider can not fetch the metadata