edu.stanford.rt.credential
Class CredentialStore

java.lang.Object
  |
  +--edu.stanford.rt.credential.RTContext
        |
        +--edu.stanford.rt.credential.CredentialStore

public class CredentialStore
extends RTContext

Author:
Ninghui Li, Sandra Qiu
This class stores all the CredentialDomain, and RoleDefinition index information.

A special principal is stored in the credential store to ....


Field Summary
private  java.util.HashMap credentialDomains
          A map of CredentialDomain objects.
private  java.util.HashMap indexByIssuer
          Role definitions indexed by issuer.
private  java.util.HashMap indexByIssuerAndRoleDeclaration
          Role definitions indexed by issuer and role declaration.
private  java.util.HashSet roleDefinitions
          A set of RoleDefinition objects, including all roles defined in the Credential included in this CredentialStore.
private  Principal specialPrincipal
           
 
Fields inherited from class edu.stanford.rt.credential.RTContext
 
Constructor Summary
CredentialStore(RTParser rtParser)
          Constructor for CredentialStore.
 
Method Summary
 void addCredentialDomain(HashID id, CredentialDomain credentialDomain)
          Method addCredentialDomain.
private  void addIndexByIssuer(RoleDefinition roleDefinition)
          Method addIndexByIssuer.
private  void addIndexByIssuerAndRoleDeclaration(RoleDefinition roleDefinition)
          Method addIndexByIssuerAndRoleDeclaration.
private  void addRoleDefinition(RoleDefinition roleDefinition)
          Adds a new role definition to the roleDefinitions.
 CredentialDomain getCredentialDomain(HashID id)
          Method getCredentialDomain.
 CredentialDomain getCredentialDomain(java.lang.String id)
          Method getCredentialDomain.
 java.util.ArrayList getIndexByIssuer(Principal issuer)
          Method getIndexByIssuer.
 java.util.ArrayList getIndexByIssuerAndRoleDeclaration(IssuerAndRoleDeclaration issuerAndRoleDeclaration)
          Method getIndexByIssuerAndRoleDeclaration.
 Principal getSpecialPrincipal()
          Returns the specialPrincipal.
 java.util.Iterator roleDefinitionIterator()
          Method roleDefinitionIterator.
 void setSpecialPrincipal(Principal specialPrincipal)
          Sets the specialPrincipal.
 java.lang.String toString(java.lang.String indent)
           
 
Methods inherited from class edu.stanford.rt.credential.RTContext
addApplicationDomain, addPrincipal, getApplicationDomain, getApplicationDomain, getPrincipal, getSystemDomain, hasDomainWithID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specialPrincipal

private Principal specialPrincipal

credentialDomains

private java.util.HashMap credentialDomains
A map of CredentialDomain objects. A CredentialDomain contains all the info about a Credential.
Key: HashID
Value: CredentialDomain


roleDefinitions

private java.util.HashSet roleDefinitions
A set of RoleDefinition objects, including all roles defined in the Credential included in this CredentialStore.


indexByIssuer

private java.util.HashMap indexByIssuer
Role definitions indexed by issuer.
Key: Principal: the issuer
Value: an ArrayList of RoleDefinition.


indexByIssuerAndRoleDeclaration

private java.util.HashMap indexByIssuerAndRoleDeclaration
Role definitions indexed by issuer and role declaration. The issuer is the issuer of the credential and the role declaration is the one corresponding to the head role term in the role definition.
Key: IssuerAndRoleDeclaration
Value: an ArrayList of RoleDefinition

Constructor Detail

CredentialStore

public CredentialStore(RTParser rtParser)
                throws java.lang.Exception
Constructor for CredentialStore.

Method Detail

getSpecialPrincipal

public Principal getSpecialPrincipal()
Returns the specialPrincipal.

Returns:
Principal

setSpecialPrincipal

public void setSpecialPrincipal(Principal specialPrincipal)
Sets the specialPrincipal.

Parameters:
specialPrincipal - The specialPrincipal to set

getCredentialDomain

public CredentialDomain getCredentialDomain(HashID id)
Method getCredentialDomain.

Parameters:
id -
Returns:
CredentialDomain

getCredentialDomain

public CredentialDomain getCredentialDomain(java.lang.String id)
Method getCredentialDomain.

Parameters:
id -
Returns:
CredentialDomain

roleDefinitionIterator

public java.util.Iterator roleDefinitionIterator()
Method roleDefinitionIterator. returns an Iterator for the set of role definitions.

Returns:
Iterator

getIndexByIssuer

public java.util.ArrayList getIndexByIssuer(Principal issuer)
Method getIndexByIssuer. returns a list of role definitions by the given issuer.

Parameters:
issuer -
Returns:
ArrayList

getIndexByIssuerAndRoleDeclaration

public java.util.ArrayList getIndexByIssuerAndRoleDeclaration(IssuerAndRoleDeclaration issuerAndRoleDeclaration)
Method getIndexByIssuerAndRoleDeclaration.

Parameters:
issuerAndRoleDeclaration -
Returns:
ArrayList

addCredentialDomain

public void addCredentialDomain(HashID id,
                                CredentialDomain credentialDomain)
                         throws DomainSpecException
Method addCredentialDomain.

Parameters:
id -
credentialDomain -
Throws:
DomainSpecException

addRoleDefinition

private void addRoleDefinition(RoleDefinition roleDefinition)
                        throws DomainSpecException
Adds a new role definition to the roleDefinitions.

Parameters:
roleDefinition - The roleDefinition to set
DomainSpecException

addIndexByIssuer

private void addIndexByIssuer(RoleDefinition roleDefinition)
Method addIndexByIssuer.

Parameters:
roleDefinition -

addIndexByIssuerAndRoleDeclaration

private void addIndexByIssuerAndRoleDeclaration(RoleDefinition roleDefinition)
Method addIndexByIssuerAndRoleDeclaration.

Parameters:
roleDefinition -

toString

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