org.opensaml.saml2.metadata.provider
Class AbstractMetadataProvider

java.lang.Object
  extended by org.opensaml.saml2.metadata.provider.BaseMetadataProvider
      extended by org.opensaml.saml2.metadata.provider.AbstractMetadataProvider
All Implemented Interfaces:
MetadataProvider
Direct Known Subclasses:
AbstractObservableMetadataProvider

public abstract class AbstractMetadataProvider
extends BaseMetadataProvider

An abstract, base, implementation of a metadata provider.


Field Summary
 
Fields inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
unmarshallerFactory
 
Constructor Summary
AbstractMetadataProvider()
          Constructor.
 
Method Summary
protected  void clearDescriptorIndex()
          Clears the entity ID to entity descriptor index.
protected  void filterMetadata(org.opensaml.xml.XMLObject metadata)
          Filters the given metadata.
 EntitiesDescriptor getEntitiesDescriptor(java.lang.String name)
          Gets a named EntitiesDescriptor from the metadata.
protected  EntitiesDescriptor getEntitiesDescriptorByName(java.lang.String name, EntitiesDescriptor rootDescriptor)
          Gets the entities descriptor with the given name.
 EntityDescriptor getEntityDescriptor(java.lang.String entityID)
          Gets the metadata for a given entity if the metadata is valid.
protected  EntityDescriptor getEntityDescriptorById(java.lang.String entityID, EntitiesDescriptor descriptor)
          Gets the entity descriptor with the given ID that is a descedant of the given entities descriptor.
protected  EntityDescriptor getEntityDescriptorById(java.lang.String entityID, org.opensaml.xml.XMLObject metadata)
          Gets the EntityDescriptor with the given ID from the cached metadata.
 org.opensaml.xml.parse.ParserPool getParserPool()
          Gets the pool of parsers to use to parse XML.
 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.
protected  boolean isValid(org.opensaml.xml.XMLObject descriptor)
          Returns whether the given descriptor is valid.
protected  void releaseMetadataDOM(org.opensaml.xml.XMLObject metadata)
          Releases the DOM representation from the metadata object.
 void setParserPool(org.opensaml.xml.parse.ParserPool pool)
          Sets the pool of parsers to use to parse XML.
protected  org.opensaml.xml.XMLObject unmarshallMetadata(java.io.InputStream metadataInput)
          Unmarshalls the metadata from the given stream.
 
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
getMetadata
 

Constructor Detail

AbstractMetadataProvider

public AbstractMetadataProvider()
Constructor.

Method Detail

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

getParserPool

public org.opensaml.xml.parse.ParserPool getParserPool()
Gets the pool of parsers to use to parse XML.

Returns:
pool of parsers to use to parse XML

setParserPool

public void setParserPool(org.opensaml.xml.parse.ParserPool pool)
Sets the pool of parsers to use to parse XML.

Parameters:
pool - pool of parsers to use to parse XML

clearDescriptorIndex

protected void clearDescriptorIndex()
Clears the entity ID to entity descriptor index.


unmarshallMetadata

protected org.opensaml.xml.XMLObject unmarshallMetadata(java.io.InputStream metadataInput)
                                                 throws org.opensaml.xml.io.UnmarshallingException
Unmarshalls the metadata from the given stream. The stream is closed by this method and the returned metadata released its DOM representation.

Parameters:
metadataInput - the input reader to the metadata.
Returns:
the unmarshalled metadata
Throws:
org.opensaml.xml.io.UnmarshallingException - thrown if the metadata can no be unmarshalled

filterMetadata

protected void filterMetadata(org.opensaml.xml.XMLObject metadata)
                       throws FilterException
Filters the given metadata.

Parameters:
metadata - the metadata to be filtered
Throws:
FilterException - thrown if there is an error filtering the metadata

releaseMetadataDOM

protected void releaseMetadataDOM(org.opensaml.xml.XMLObject metadata)
Releases the DOM representation from the metadata object.

Parameters:
metadata - the metadata object

getEntityDescriptorById

protected EntityDescriptor getEntityDescriptorById(java.lang.String entityID,
                                                   org.opensaml.xml.XMLObject metadata)
Gets the EntityDescriptor with the given ID from the cached metadata.

Parameters:
entityID - the ID of the entity to get the descriptor for
metadata - metadata associated with the entity
Returns:
the EntityDescriptor

getEntityDescriptorById

protected EntityDescriptor getEntityDescriptorById(java.lang.String entityID,
                                                   EntitiesDescriptor descriptor)
Gets the entity descriptor with the given ID that is a descedant of the given entities descriptor.

Parameters:
entityID - the ID of the entity whose descriptor is to be fetched
descriptor - the entities descriptor
Returns:
the entity descriptor

getEntitiesDescriptorByName

protected EntitiesDescriptor getEntitiesDescriptorByName(java.lang.String name,
                                                         EntitiesDescriptor rootDescriptor)
Gets the entities descriptor with the given name.

Parameters:
name - name of the entities descriptor
rootDescriptor - the root descriptor to search in
Returns:
the EntitiesDescriptor with the given name

isValid

protected boolean isValid(org.opensaml.xml.XMLObject descriptor)
Returns whether the given descriptor is valid. If valid metadata is not required this method always returns true.

Parameters:
descriptor - the descriptor to check
Returns:
true if valid metadata is not required or the given descriptor is valid, false otherwise


Copyright © 2006-2011 Internet2. All Rights Reserved.