FileDocCategorySizeDatePackage
ResourcePrincipal.javaAPI DocGlassfish v2 API4744Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

ResourcePrincipal

public class ResourcePrincipal extends PrincipalImpl
This class encapsulates the Resource Principal information needed to access the Resource.
author
Tony Ng

Fields Summary
private String
password
private static final int
NULL_HASH_CODE
private static final String
DEFAULT_USERNAME
private static final String
DEFAULT_PASSWORD
private boolean
defaultPrincipal
Constructors Summary
public ResourcePrincipal()
This constructor is used to construct a default principal. a default principal is used when username and password are not required to acquire a resource.


                                   
      
        super(DEFAULT_USERNAME);
        this.password = DEFAULT_PASSWORD;
        defaultPrincipal = true;
    
public ResourcePrincipal(String name, String password)

        super(name);
        this.password = password;
    
Methods Summary
public booleanequals(java.lang.Object o)

        if (this == o) return true;
        if (o == null) return false;
        if (o instanceof ResourcePrincipal) {
            ResourcePrincipal other = (ResourcePrincipal) o;

            // start IASRI 4676199
            // handle the default principal case
            if (isDefault()) {
                return other.isDefault();
            } else if (other.isDefault()) {
                return false;
            }
            // end IASRI 4676199

            return ((isEqual(getName(), other.getName())) &&
                    (isEqual(this.password, other.password)));
        }
        return false;
    
public java.lang.StringgetPassword()

        return password;
    
public inthashCode()

        int result = NULL_HASH_CODE;
        String name = getName();
        if (name != null) {
            result += name.hashCode();
        }
        if (password != null) {
            result += password.hashCode();
        }
        return result;
    
public booleanisDefault()

return
true if this principal is a default principal
see
ResourcePrincipal()

        return defaultPrincipal;
    
private booleanisEqual(java.lang.Object a, java.lang.Object b)

        if (a == null) {
            return (b == null);
        } else {
            return (a.equals(b));
        }