01: package org.objectweb.celtix.bus.handlers;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.ws.handler.PortInfo;
05:
06: public class PortInfoImpl implements PortInfo {
07:
08: private final QName portName;
09: private final QName serviceName;
10: private final String bindingId;
11:
12: public PortInfoImpl(QName sname, QName pname, String bid) {
13: checkNullArgument(sname, "service name");
14: checkNullArgument(pname, "port name");
15: portName = pname;
16: serviceName = sname;
17: bindingId = bid;
18: }
19:
20: public QName getServiceName() {
21: return serviceName;
22: }
23:
24: public QName getPortName() {
25: return portName;
26: }
27:
28: public String getBindingID() {
29: return bindingId;
30: }
31:
32: public boolean equals(Object o) {
33: if (o == this ) {
34: return true;
35: }
36:
37: if (!(o instanceof PortInfoImpl)) {
38: return false;
39: }
40: PortInfoImpl rhs = (PortInfoImpl) o;
41:
42: boolean bindingIdsEqual = false;
43: if (bindingId == null && rhs.getBindingID() == null) {
44: bindingIdsEqual = true;
45: } else if (bindingId == null && rhs.getBindingID() != null) {
46: bindingIdsEqual = false;
47: } else {
48: bindingIdsEqual = bindingId.equals(rhs.getBindingID());
49: }
50: return serviceName.equals(rhs.getServiceName())
51: && portName.equals(rhs.getPortName())
52: && bindingIdsEqual;
53: }
54:
55: public int hashCode() {
56:
57: int ret = 17;
58: ret = 37 * ret + serviceName.hashCode();
59: ret = 37 * ret + portName.hashCode();
60: if (bindingId != null) {
61: ret = 37 * ret + bindingId.hashCode();
62: }
63: return ret;
64: }
65:
66: private void checkNullArgument(Object arg, String name) {
67: if (arg == null) {
68: throw new IllegalArgumentException(name
69: + " must not be null");
70: }
71: }
72:
73: }
|