|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.saml2.metadata.provider.BaseMetadataProvider org.opensaml.saml2.metadata.provider.AbstractMetadataProvider
public abstract class AbstractMetadataProvider
An abstract, base, implementation of a metadata provider.
Field Summary | |
---|---|
private boolean |
failFastInitialization
Whether problems during initialization should cause the provider to fail or go on without metadata. |
private Map<String,EntityDescriptor> |
indexedDescriptors
Cache of entity IDs to their descriptors. |
private boolean |
initialized
Whether the metadata provider has been initialized. |
private org.slf4j.Logger |
log
Class logger. |
private ParserPool |
parser
Pool of parsers used to process XML. |
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. |
void |
destroy()
Destroys the metadata provider and frees any resources current held by it. |
protected EntitiesDescriptor |
doGetEntitiesDescriptor(String name)
Gets the named EntitiesDescriptor from the metadata. |
protected EntityDescriptor |
doGetEntityDescriptor(String entityID)
Gets the identified EntityDescriptor from the metadata. |
protected abstract XMLObject |
doGetMetadata()
Gets the metadata currently held by the provider. |
protected List<RoleDescriptor> |
doGetRole(String entityID,
QName roleName)
Gets the identified roles from an EntityDescriptor. |
protected RoleDescriptor |
doGetRole(String entityID,
QName roleName,
String supportedProtocol)
Gets the role which supports the given protocol. |
protected void |
doInitialization()
Subclasses should override this method to perform any initialization logic necessary. |
protected void |
filterMetadata(XMLObject metadata)
Filters the given metadata. |
EntitiesDescriptor |
getEntitiesDescriptor(String name)
Gets a valid named EntitiesDescriptor from the metadata. |
protected EntitiesDescriptor |
getEntitiesDescriptorByName(String name,
EntitiesDescriptor rootDescriptor)
Gets the entities descriptor with the given name. |
EntityDescriptor |
getEntityDescriptor(String entityID)
Gets the valid metadata for a given entity. |
protected EntityDescriptor |
getEntityDescriptorById(String entityID,
EntitiesDescriptor descriptor)
Gets the entity descriptor with the given ID that is a descendant of the given entities descriptor. |
protected EntityDescriptor |
getEntityDescriptorById(String entityID,
XMLObject metadata)
Gets the EntityDescriptor with the given ID from the cached metadata. |
XMLObject |
getMetadata()
Gets the valid metadata tree, after the registered filter has been applied. |
ParserPool |
getParserPool()
Gets the pool of parsers to use to parse XML. |
List<RoleDescriptor> |
getRole(String entityID,
QName roleName)
Gets the valid role descriptors of a given type for a given entity. |
RoleDescriptor |
getRole(String entityID,
QName roleName,
String supportedProtocol)
Gets the valid role descriptors of a given type for a given entity that support the given protocol. |
void |
initialize()
Initializes this metadata provider. |
boolean |
isFailFastInitialization()
Gets whether problems during initialization should cause the provider to fail or go on without metadata. |
boolean |
isInitialized()
Gets whether this provider is initialized. |
protected boolean |
isValid(XMLObject descriptor)
Returns whether the given descriptor is valid. |
protected void |
releaseMetadataDOM(XMLObject metadata)
Releases the DOM representation from the metadata object. |
void |
setFailFastInitialization(boolean failFast)
Sets whether problems during initialization should cause the provider to fail or go on without metadata. |
protected void |
setInitialized(boolean isInitialized)
Sets whether this provider is initialized. |
void |
setParserPool(ParserPool pool)
Sets the pool of parsers to use to parse XML. |
protected XMLObject |
unmarshallMetadata(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 |
Field Detail |
---|
private final org.slf4j.Logger log
private boolean initialized
private boolean failFastInitialization
private Map<String,EntityDescriptor> indexedDescriptors
private ParserPool parser
Constructor Detail |
---|
public AbstractMetadataProvider()
Method Detail |
---|
public XMLObject getMetadata() throws MetadataProviderException
MetadataProviderException
- thrown if the provider can not fetch the metadata, must not be thrown simply if
there is no metadata to fetchprotected abstract XMLObject doGetMetadata() throws MetadataProviderException
MetadataProviderException
- thrown if there is a problem retrieving the metadatapublic EntitiesDescriptor getEntitiesDescriptor(String name) throws MetadataProviderException
name
- the name of the EntitiesDescriptor
MetadataProviderException
- thrown if the provider can not fetch the metadata, must not be thrown if there
is simply no EntitiesDescriptor with the given nameprotected EntitiesDescriptor doGetEntitiesDescriptor(String name) throws MetadataProviderException
name
- the name of the EntitiesDescriptor, never null
MetadataProviderException
- thrown if there is a problem searching for the EntitiesDescriptorpublic EntityDescriptor getEntityDescriptor(String entityID) throws MetadataProviderException
entityID
- the ID of the entity
MetadataProviderException
- thrown if the provider can not fetch the metadata, must not be thrown if there
is simply no EntityDescriptor with the given IDprotected EntityDescriptor doGetEntityDescriptor(String entityID) throws MetadataProviderException
entityID
- ID of the EntityDescriptor, never null
MetadataProviderException
- thrown if there is a problem searching for the EntityDescriptorpublic List<RoleDescriptor> getRole(String entityID, QName roleName) throws MetadataProviderException
entityID
- the ID of the entityroleName
- the role type
MetadataProviderException
- thrown if the provider can not fetch the metadata, must not be thrown if there
is simply no such entity with the given rolesprotected List<RoleDescriptor> doGetRole(String entityID, QName roleName) throws MetadataProviderException
entityID
- ID of the entity from which to retrieve the roles, never nullroleName
- name of the roles to search for, never null
MetadataProviderException
- thrown if there is a problem searching for the rolespublic RoleDescriptor getRole(String entityID, QName roleName, String supportedProtocol) throws MetadataProviderException
entityID
- the ID of the entityroleName
- the role typesupportedProtocol
- the protocol supported by the role
MetadataProviderException
- thrown if the provider can not fetch the metadata, must not be thrown if there
is simply no such entity with the given role supporting the given protocolprotected RoleDescriptor doGetRole(String entityID, QName roleName, String supportedProtocol) throws MetadataProviderException
entityID
- ID of the entity from which to retrieve roles, never nullroleName
- name of the role to search for, never nullsupportedProtocol
- protocol to search for, never null
MetadataProviderException
- thrown if there is a problem search for the rolespublic boolean isInitialized()
protected void setInitialized(boolean isInitialized)
isInitialized
- whether this provider is initializedpublic boolean isFailFastInitialization()
public void setFailFastInitialization(boolean failFast)
failFast
- whether problems during initialization should cause the provider to failpublic ParserPool getParserPool()
public void setParserPool(ParserPool pool)
pool
- pool of parsers to use to parse XMLpublic void initialize() throws MetadataProviderException
MetadataProviderException
- thrown if there is a problem initializing the problem and fail fast
Initialization is enabledpublic void destroy()
destroy
in class BaseMetadataProvider
protected void doInitialization() throws MetadataProviderException
MetadataProviderException
- thrown if there is a problem initializing the providerprotected void clearDescriptorIndex()
protected XMLObject unmarshallMetadata(InputStream metadataInput) throws UnmarshallingException
metadataInput
- the input reader to the metadata.
UnmarshallingException
- thrown if the metadata can no be unmarshalledprotected void filterMetadata(XMLObject metadata) throws FilterException
metadata
- the metadata to be filtered
FilterException
- thrown if there is an error filtering the metadataprotected void releaseMetadataDOM(XMLObject metadata)
metadata
- the metadata objectprotected EntityDescriptor getEntityDescriptorById(String entityID, XMLObject metadata)
entityID
- the ID of the entity to get the descriptor formetadata
- metadata associated with the entity
protected EntityDescriptor getEntityDescriptorById(String entityID, EntitiesDescriptor descriptor)
entityID
- the ID of the entity whose descriptor is to be fetcheddescriptor
- the entities descriptor
protected EntitiesDescriptor getEntitiesDescriptorByName(String name, EntitiesDescriptor rootDescriptor)
name
- name of the entities descriptorrootDescriptor
- the root descriptor to search in
protected boolean isValid(XMLObject descriptor)
descriptor
- the descriptor to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |