atg.security
Class PersonaAdapter

java.lang.Object
  extended by atg.security.PersonaAdapter
All Implemented Interfaces:
Persona, java.io.Serializable, java.security.Principal
Direct Known Subclasses:
GenericPersona

public class PersonaAdapter
extends java.lang.Object
implements Persona, java.io.Serializable

An adapter class useful for creating implementations of the Persona interface.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
PersonaAdapter(java.lang.String pName, UserAuthority pAuthority)
          Creates a new persona with a given name and user authority.
 
Method Summary
 void addSubPersona(Persona pNewPersona)
          Adds a new sub-persona.
 boolean equals(java.lang.Object object)
          Returns true if this persona is equivalent to another.
 java.util.Collection getAccessRights()
          Does actual lookup of sub-persona information.
 java.lang.Object getAttribute(java.lang.String pAttributeName)
          Retrieves the value of a named attribute of the persona's account.
 java.lang.String getName()
          Returns a machine-readable name of the access right, useful for persisting the object.
 Persona[] getSubPersonae()
          Returns a list of sub-personae that compose this persona.
 UserAuthority getUserAuthority()
          Returns the authority that manages this persona.
 int hashCode()
          Returns the hash code of the persona's name.
 boolean hasPersona(Persona pPersona)
          Returns true if this persona matches or encompasses the indicated persona.
 boolean hasRole(java.lang.String pRoleName)
          Returns true if this persona is or has a sub-persona with the given name.
 boolean isReadOnly()
          Returns true if this Persona has been marked as read-only.
static void main(java.lang.String[] args)
           
 void removeSubPersona(Persona pOldPersona)
          Removes a sub-persona.
 void setAttribute(java.lang.String pName, java.lang.Object pValue)
          Adds a new attribute to the attribute map.
 void setAttributes(java.util.Map mNewAttributes)
          Sets the entire collection of attributes.
 void setReadOnly(boolean b)
          If set to true, this Persona becomes immutable.
 void setSubPersonae(Persona[] pNewPersonae)
          Changes the list of sub-personae that compose this persona.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

PersonaAdapter

public PersonaAdapter(java.lang.String pName,
                      UserAuthority pAuthority)
Creates a new persona with a given name and user authority.

Method Detail

isReadOnly

public boolean isReadOnly()
Returns true if this Persona has been marked as read-only.


setReadOnly

public void setReadOnly(boolean b)
If set to true, this Persona becomes immutable.


setAttribute

public void setAttribute(java.lang.String pName,
                         java.lang.Object pValue)
Adds a new attribute to the attribute map.


setAttributes

public void setAttributes(java.util.Map mNewAttributes)
Sets the entire collection of attributes. Note that this does NOT perform a copy of the attribute information or the attribute map.


toString

public java.lang.String toString()
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code of the persona's name.

Specified by:
hashCode in interface java.security.Principal
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Returns true if this persona is equivalent to another.

Specified by:
equals in interface Persona
Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object

getName

public java.lang.String getName()
Returns a machine-readable name of the access right, useful for persisting the object.

Specified by:
getName in interface Persona
Specified by:
getName in interface java.security.Principal

getUserAuthority

public UserAuthority getUserAuthority()
Returns the authority that manages this persona.

Specified by:
getUserAuthority in interface Persona

hasPersona

public boolean hasPersona(Persona pPersona)
Returns true if this persona matches or encompasses the indicated persona.

Specified by:
hasPersona in interface Persona

getSubPersonae

public Persona[] getSubPersonae()
Returns a list of sub-personae that compose this persona.

Specified by:
getSubPersonae in interface Persona

setSubPersonae

public void setSubPersonae(Persona[] pNewPersonae)
                    throws InvalidPersonaException
Changes the list of sub-personae that compose this persona.

Specified by:
setSubPersonae in interface Persona
Throws:
InvalidPersonaException

addSubPersona

public void addSubPersona(Persona pNewPersona)
                   throws InvalidPersonaException
Adds a new sub-persona.

Specified by:
addSubPersona in interface Persona
Throws:
InvalidPersonaException

removeSubPersona

public void removeSubPersona(Persona pOldPersona)
                      throws InvalidPersonaException
Removes a sub-persona.

Specified by:
removeSubPersona in interface Persona
Throws:
InvalidPersonaException

getAttribute

public java.lang.Object getAttribute(java.lang.String pAttributeName)
Retrieves the value of a named attribute of the persona's account. This is a general escape hatch for passing information between the account database and the security domain and is primarily used to allow the security domain to determine the default ACL to use when creating secured resources.

Specified by:
getAttribute in interface Persona
See Also:
SecurityDomain.createResource(java.lang.Object, java.lang.Object, atg.security.AccessControlEntry[])

hasRole

public boolean hasRole(java.lang.String pRoleName)
Returns true if this persona is or has a sub-persona with the given name.

Specified by:
hasRole in interface Persona

getAccessRights

public java.util.Collection getAccessRights()
Does actual lookup of sub-persona information.

Specified by:
getAccessRights in interface Persona

main

public static void main(java.lang.String[] args)