org.edg.security.authorization.repository
Class Map

java.lang.Object
  |
  +--org.edg.security.authorization.repository.Map
All Implemented Interfaces:
AttributeRepository, AttributeRepositoryCreator

public class Map
extends java.lang.Object
implements AttributeRepository, AttributeRepositoryCreator

A Map-based AttributeRepository implementation. Example configuration:

 <repository type="map">
     <map ...>
         <!-- map configuration -->
     </map>
 </repository>
 

Version:
$Id: Map.java,v 1.10 2003/04/10 12:21:09 gianluca Exp $
Author:
Olle Mulmo
See Also:
AttributeRepository, AttributeMapFactory, Insert 'the right' copyright

Field Summary
protected  AttributeMap myMap
           
 
Constructor Summary
Map()
           
 
Method Summary
 AttributeRepository create(AttributeRepositoryFactory factory, org.w3c.dom.Element config)
          Creates and initializes an attribute repository according to the specified configuration.
 boolean evalAttributeBinding(java.lang.String identity, java.lang.String attribute)
          Method evalAttributeBinding.
 java.util.List findAllAttributesFor(java.lang.String identity)
          Method findAllAttributesFor.
 java.lang.String findFirstAttributeFor(java.lang.String identity)
          Method findFirstAttributeFor.
 void terminate()
          Terminate all Timer objects responsible for refreshing the content of the AttributeRepository.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myMap

protected AttributeMap myMap
Constructor Detail

Map

public Map()
Method Detail

create

public AttributeRepository create(AttributeRepositoryFactory factory,
                                  org.w3c.dom.Element config)
                           throws java.lang.Exception
Description copied from interface: AttributeRepositoryCreator
Creates and initializes an attribute repository according to the specified configuration.

Specified by:
create in interface AttributeRepositoryCreator
Parameters:
factory - The factory to which this repository belongs
config - The XML snippet with the required configuration
Returns:
AttributeRepository The initialized instance
Throws:
java.lang.Exception - in case of an error
See Also:
AttributeRepositoryCreator.create(AttributeRepositoryFactory,Element)

findAllAttributesFor

public java.util.List findAllAttributesFor(java.lang.String identity)
Description copied from interface: AttributeRepository
Method findAllAttributesFor. Returns all attributes associated with the given identity. If no attributes can be associated, an empty list is returned.

Specified by:
findAllAttributesFor in interface AttributeRepository
Parameters:
identity - The subject in question.
Returns:
List of attributes.
See Also:
AttributeRepository.findAllAttributesFor(String)

findFirstAttributeFor

public java.lang.String findFirstAttributeFor(java.lang.String identity)
Description copied from interface: AttributeRepository
Method findFirstAttributeFor. Returns the first attribute associated with the given identity. This is equivalent to
List l = findAllAttributesFor(identity); return l.isEmpty() ? null : (String) l.get(0); but can be implemented in a more efficient manner.

Specified by:
findFirstAttributeFor in interface AttributeRepository
Parameters:
identity - The subject in question.
Returns:
String The first attribute found associated with the user, or null
See Also:
AttributeRepository.findFirstAttributeFor(String)

evalAttributeBinding

public boolean evalAttributeBinding(java.lang.String identity,
                                    java.lang.String attribute)
Description copied from interface: AttributeRepository
Method evalAttributeBinding. Evalutates if the attribute can be associated with the given identity. The result of this method is equivalent to
findAllAttributesFor(identity).contains(attribute)

Specified by:
evalAttributeBinding in interface AttributeRepository
Parameters:
identity - The subject in question.
attribute - The attribute asked for
Returns:
boolean If the subject can be associated with the attribute or not
See Also:
AttributeRepository.evalAttributeBinding(String, String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

terminate

public void terminate()
Description copied from interface: AttributeRepository
Terminate all Timer objects responsible for refreshing the content of the AttributeRepository.

Specified by:
terminate in interface AttributeRepository
See Also:
AttributeRepository.terminate()