01: /**
02: * Copyright (C) 2001-2004 France Telecom R&D
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package org.objectweb.speedo.jca;
18:
19: import javax.resource.cci.ConnectionSpec;
20: import javax.resource.spi.ConnectionRequestInfo;
21:
22: /**
23: * This class represents a connection spec for a JDO Resource adapter (JCA).
24: * It contains the user and the password for a particular PersistenceManager.
25: *
26: * @author S.Chassande-Barrioz
27: */
28: public class SpeedoConnectionSpec implements ConnectionSpec,
29: ConnectionRequestInfo {
30:
31: public String user;
32: public String password;
33:
34: public SpeedoConnectionSpec(String user, String password) {
35: this .user = user;
36: this .password = password;
37: }
38:
39: public boolean equals(Object obj) {
40: if (!(obj instanceof SpeedoConnectionSpec)) {
41: return false;
42: }
43: SpeedoConnectionSpec jdocs = (SpeedoConnectionSpec) obj;
44: return (user == null ? jdocs.user == null : user
45: .equals(jdocs.user))
46: && (password == null ? jdocs.password == null
47: : password.equals(jdocs.password));
48: }
49:
50: public int hashCode() {
51: return toString().hashCode();
52: }
53:
54: public String toString() {
55: StringBuffer sb = new StringBuffer();
56: sb.append("user: ");
57: sb.append(user);
58: sb.append(" / password: ");
59: sb.append(password);
60: return sb.toString();
61: }
62: }
|