org.edg.security.authorization.repository
Class And

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

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

Attribute repository that operates on the junction of a set of underlying repositories. Example configuration:

 <repository type="and">
     <repository>
         ...
     </repository>
     <repository>
         ...
     </repository>
     ...
 </repository>
 
Insert 'the right' copyright

Version:
$Id: And.java,v 1.10 2003/04/10 12:21:09 gianluca Exp $
Author:
Olle Mulmo

Field Summary
protected  java.util.List myReps
           
 
Constructor Summary
And()
           
 
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

myReps

protected java.util.List myReps
Constructor Detail

And

public And()
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:
the conjunction of attributes from the specified repositories
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()