1 23 24 package com.sun.enterprise.connectors.authentication; 25 26 import com.sun.logging.LogDomains; 27 28 import java.util.logging.*; 29 import java.io.Serializable ; 30 31 32 38 39 public class PrincipalAuthKey implements Serializable { 40 41 private String rarName_ = null; 42 private String poolName_ = null; 43 private String principalName_ = null; 44 private String userGroup_ = null; 45 46 static Logger _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER); 47 48 57 58 public PrincipalAuthKey(String rarName,String poolName, 59 String principalName,String userGroupName){ 60 rarName_ = rarName; 61 poolName_ = poolName; 62 principalName_ = principalName; 63 userGroup_ = userGroupName; 64 _logger.log(Level.FINE,"Constructor: PrincipalAuthKey"); 65 } 66 67 71 72 public int hashCode() { 73 return (rarName_+poolName_+principalName_+userGroup_).hashCode(); 74 } 75 76 79 80 private boolean isEqual(String in, String out) { 81 if(in == null && out == null) { 82 return true; 83 } 84 if(in == null || out == null) { 85 return false; 86 } 87 return (out.equals(in)); 88 } 89 90 98 99 public boolean equals(Object other) { 100 if( other == null || !(other instanceof PrincipalAuthKey)) { 101 if ( _logger.isLoggable(Level.FINE) ) { 102 String msg = "equals method PrincipalAuthKey: parameter not "; 103 String msg1= "PrincipalAuthKey. Equals fails"; 104 _logger.log(Level.FINE,msg+msg1); 105 } 106 return false; 107 } 108 PrincipalAuthKey otherkey = (PrincipalAuthKey)other; 109 110 if(isEqual(this.rarName_,otherkey.rarName_) && 111 isEqual(this.poolName_,otherkey.poolName_) && 112 isEqual(this.principalName_,otherkey.principalName_) && 113 isEqual(this.userGroup_,otherkey.userGroup_)) { 114 _logger.log(Level.FINE,"equal method of PrincipalAuthKey succeeds"); 115 return true; 116 } else { 117 _logger.log(Level.FINE,"equals method of PrincipalAuthKey fails"); 118 return false; 119 } 120 } 121 } 122 | Popular Tags |