1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package nl.toolforge.karma.core.vc;
20
21 /***
22 * @author D.A. Smedes
23 * @version $Id: AuthenticatorKey.java,v 1.3 2004/10/26 22:58:47 clutjespelberg Exp $
24 */
25 public final class AuthenticatorKey {
26
27 private String workingContext = null;
28 private String locationId = null;
29
30 /***
31 * Creates a new authenticator key. References to <code>locations.xml</code>.
32 * @param workingContext The name of the working context.
33 * @param locationId The id of the location.
34 * @throws IllegalArgumentException When the parameters are empty or null.
35 */
36 public AuthenticatorKey(String workingContext, String locationId) {
37
38 if ("".equals(workingContext) || "".equals(locationId) || workingContext == null || locationId == null) {
39 throw new IllegalArgumentException("Composite key : workingContext and locationId cannot be null or empty.");
40 }
41
42 this.workingContext = workingContext;
43 this.locationId = locationId;
44 }
45
46 public int hashCode() {
47 return workingContext.hashCode() + locationId.hashCode();
48 }
49
50 public boolean equals(Object obj) {
51
52 if (obj instanceof AuthenticatorKey) {
53 return
54 ((AuthenticatorKey) obj).workingContext.equals(workingContext) &&
55 ((AuthenticatorKey) obj).locationId.equals(locationId);
56 } else {
57 return false;
58 }
59 }
60
61 public String toString() {
62 return "[wc:" + workingContext + ", id:" + locationId + "]";
63 }
64
65 }