1 45 package org.openejb.resource.jdbc; 46 47 import javax.resource.spi.ConnectionRequestInfo ; 48 49 public class JdbcConnectionRequestInfo implements ConnectionRequestInfo { 50 51 private String userName; 52 private String password; 53 private String jdbcDriver; 54 private String jdbcUrl; 55 private int hashCode; 56 57 public JdbcConnectionRequestInfo(String userName, String password, String jdbcDriver, String jdbcUrl){ 58 this.userName = userName; 59 this.password = password; 60 this.jdbcDriver = jdbcDriver; 61 this.jdbcUrl = jdbcUrl; 62 } 63 protected String getUserName(){ 64 return userName; 65 } 66 protected String getPassword(){ 67 return password; 68 } 69 protected String getJdbcDriver(){ 70 return jdbcDriver; 71 } 72 protected String getJdbcUrl(){ 73 return jdbcUrl; 74 } 75 public boolean equals(java.lang.Object other){ 76 if(other instanceof JdbcConnectionRequestInfo && 77 ((JdbcConnectionRequestInfo)other).getUserName().equals(userName) && 78 ((JdbcConnectionRequestInfo)other).getPassword().equals(password) && 79 ((JdbcConnectionRequestInfo)other).getJdbcDriver().equals(jdbcDriver) && 80 ((JdbcConnectionRequestInfo)other).getJdbcUrl().equals(jdbcUrl) ) 81 return true; 82 else 83 return false; 84 } 85 public int hashCode(){ 86 if(hashCode != 0) return hashCode; 87 hashCode = jdbcDriver.hashCode()^jdbcUrl.hashCode()^userName.hashCode()^password.hashCode(); 88 return hashCode; 89 } 90 91 } | Popular Tags |