package javax.resource.spi.security;
import java.io.Serializable;
import java.util.Arrays;
import javax.resource.spi.ManagedConnectionFactory;
public final class PasswordCredential implements Serializable
{
static final long serialVersionUID = -1770833344350711674L;
private String userName;
private char[] password;
private ManagedConnectionFactory mcf = null;
public PasswordCredential(String userName, char[] password)
{
this.userName = userName;
this.password = password;
}
public String getUserName()
{
return userName;
}
public char[] getPassword()
{
return password;
}
public ManagedConnectionFactory getManagedConnectionFactory()
{
return mcf;
}
public void setManagedConnectionFactory(ManagedConnectionFactory mcf)
{
this.mcf = mcf;
}
public boolean equals(Object other)
{
if (this == other)
return true;
if (other == null || getClass() != other.getClass())
return false;
final PasswordCredential otherCredential = (PasswordCredential) other;
return userName.equals(otherCredential.userName) && Arrays.equals(password, otherCredential.password);
}
public int hashCode()
{
return userName.hashCode();
}
}