com.metamatrix.platform.security.api
Class BasicMetaMatrixPrincipal

java.lang.Object
  extended by com.metamatrix.platform.security.api.BasicMetaMatrixPrincipal
All Implemented Interfaces:
MetaMatrixPrincipal, java.io.Serializable, java.lang.Cloneable, java.security.Principal

public class BasicMetaMatrixPrincipal
extends java.lang.Object
implements MetaMatrixPrincipal, java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.metamatrix.platform.security.api.MetaMatrixPrincipal
NAME_LEN_LIMIT, TYPE_ADMIN, TYPE_GROUP, TYPE_LABEL_ADMIN, TYPE_LABEL_GROUP, TYPE_LABEL_USER, TYPE_NAMES, TYPE_USER
 
Constructor Summary
protected BasicMetaMatrixPrincipal(BasicMetaMatrixPrincipal obj)
          Copy CTOR.
  BasicMetaMatrixPrincipal(java.lang.String name, int type)
          Create a minimal BasicMetaMatrixPrincipal.
  BasicMetaMatrixPrincipal(java.lang.String name, int type, java.util.Set groupNames)
          Create a BasicMetaMatrixPrincipal with all attributes required for display in the MetaMatrix Console.
 
Method Summary
 java.lang.Object clone()
          Return a cloned instance of this object.
 boolean equals(java.lang.Object par1)
           
 java.util.Set getGroupNames()
          Returns the Principal for each group that this principal is a member of.
 MetaMatrixPrincipalName getMetaMatrixPrincipalName()
          Get the MetaMatrixPrincipalName for this principal.
 java.lang.String getName()
          Returns the name of this principal.
 int getType()
          Get the type of principal
 java.lang.String getTypeLabel()
          Get the String form for the type of principal
 int hashCode()
           
static MetaMatrixPrincipal merge(MetaMatrixPrincipal p1, MetaMatrixPrincipal p2)
          Merge all of the attributes of the input principal into the target principal.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicMetaMatrixPrincipal

public BasicMetaMatrixPrincipal(java.lang.String name,
                                int type,
                                java.util.Set groupNames)
Create a BasicMetaMatrixPrincipal with all attributes required for display in the MetaMatrix Console.

Parameters:
name - the name of the principal.
type - the principal type (user or group) see MetaMatrixPrincipal.
groupNames - the memberships to which this principal belongs (explicitly).
properties - the properties that will be displayed in the Console (location, phone #, etc) for this principal. NOTE: these properties may be null.

BasicMetaMatrixPrincipal

public BasicMetaMatrixPrincipal(java.lang.String name,
                                int type)
Create a minimal BasicMetaMatrixPrincipal.

NOTE: For this object to be displayed properly in the MetaMatrix Console, it's group memberships must be added after creation. This is currently not exposed.

Parameters:
name - the name of the principal.
type - the principal type (user or group) see MetaMatrixPrincipal.

BasicMetaMatrixPrincipal

protected BasicMetaMatrixPrincipal(BasicMetaMatrixPrincipal obj)
Copy CTOR.

Parameters:
obj - the object to copy
Method Detail

getMetaMatrixPrincipalName

public MetaMatrixPrincipalName getMetaMatrixPrincipalName()
Get the MetaMatrixPrincipalName for this principal.

Specified by:
getMetaMatrixPrincipalName in interface MetaMatrixPrincipal
Returns:
the MetaMatrixPrincipalName for this principal.
See Also:
MetaMatrixPrincipaName.

getGroupNames

public java.util.Set getGroupNames()
Returns the Principal for each group that this principal is a member of.

Specified by:
getGroupNames in interface MetaMatrixPrincipal

equals

public boolean equals(java.lang.Object par1)
Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object

getType

public int getType()
Get the type of principal

Specified by:
getType in interface MetaMatrixPrincipal
Returns:
the type for this principal

getTypeLabel

public java.lang.String getTypeLabel()
Get the String form for the type of principal

Specified by:
getTypeLabel in interface MetaMatrixPrincipal
Returns:
the type for this principal as a String

getName

public java.lang.String getName()
Returns the name of this principal.

Specified by:
getName in interface java.security.Principal
Returns:
the name of this principal (never null)

hashCode

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

toString

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

clone

public java.lang.Object clone()
Return a cloned instance of this object.

Specified by:
clone in interface MetaMatrixPrincipal
Overrides:
clone in class java.lang.Object
Returns:
the object that is the clone of this instance.

merge

public static MetaMatrixPrincipal merge(MetaMatrixPrincipal p1,
                                        MetaMatrixPrincipal p2)
                                 throws InvalidSessionException
Merge all of the attributes of the input principal into the target principal. This method returns a new instance that is the merged result.

Parameters:
p1 - the first principal that is to be merged
p2 - the second principal that is to be merged
Returns:
the new MetaMatrixPrincipal instance that is the result of the merge.
Throws:
InvalidMetaMatrixSessionException - if the two input MetaMatrixPrincipal instances do not have the same username.
java.lang.IllegalArgumentException - if either of the two input principals are null.
InvalidSessionException


Copyright © 2009. All Rights Reserved.