FileDocCategorySizeDatePackage
PrincipalAuthKey.javaAPI DocGlassfish v2 API5051Fri May 04 22:34:24 BST 2007com.sun.enterprise.connectors.authentication

PrincipalAuthKey

public class PrincipalAuthKey extends Object implements Serializable
This class represents the key for security Maps. This is used as key in storing the backend principals as value in the security map in ConnectorRegistry
author
Srikanth P

Fields Summary
private String
rarName_
private String
poolName_
private String
principalName_
private String
userGroup_
static Logger
_logger
Constructors Summary
public PrincipalAuthKey(String rarName, String poolName, String principalName, String userGroupName)
Constructor

param
rarName Name of the rar
param
poolName Nmae of the pool
param
principalName Name of the principal to which security mapping is to be done.
param
userGroupName Name of the userGroup to which security mapping is to be done.


                                                                                              

       
                          
        rarName_ = rarName;
        poolName_ = poolName;
        principalName_ = principalName;
        userGroup_ = userGroupName;
        _logger.log(Level.FINE,"Constructor: PrincipalAuthKey");
    
Methods Summary
public booleanequals(java.lang.Object other)
Checks for equality. Overloaded equals() from Object class. Used when comparing strings for equality.

param
other Object to compare
return
true if the objects are equal false if not so.

        if( other == null || !(other instanceof PrincipalAuthKey)) {
            if ( _logger.isLoggable(Level.FINE) ) {
                String msg = "equals method PrincipalAuthKey: parameter not ";
                String msg1= "PrincipalAuthKey. Equals fails";
                _logger.log(Level.FINE,msg+msg1);
            }
	    return false;
        }
        PrincipalAuthKey otherkey = (PrincipalAuthKey)other;

        if(isEqual(this.rarName_,otherkey.rarName_)   && 
                 isEqual(this.poolName_,otherkey.poolName_) && 
                 isEqual(this.principalName_,otherkey.principalName_) &&
                 isEqual(this.userGroup_,otherkey.userGroup_)) {
            _logger.log(Level.FINE,"equal method of PrincipalAuthKey succeeds"); 
            return true;
        } else {
            _logger.log(Level.FINE,"equals method of PrincipalAuthKey fails"); 
            return false;
        }
    
public inthashCode()
Generates Hashcode . Overloaded method from "Object" class.

return
hashCode

        return (rarName_+poolName_+principalName_+userGroup_).hashCode();
    
private booleanisEqual(java.lang.String in, java.lang.String out)
Checks whether two strings are equal including the null string cases.

        if(in == null && out == null) {
            return true;
        }
        if(in == null || out == null) {
            return false;
        }
        return (out.equals(in));