1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.plugin.http.eventcore;
|
---|
16 |
|
---|
17 | import de.ugoe.cs.autoquest.eventcore.IEventType;
|
---|
18 | import de.ugoe.cs.autoquest.plugin.http.HTTPUtils;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * <p>
|
---|
22 | * A simplified SOAP event type that only contains the name of the called method and the name of the
|
---|
23 | * service.
|
---|
24 | * </p>
|
---|
25 | *
|
---|
26 | * @author Steffen Herbold
|
---|
27 | */
|
---|
28 | public class SimpleSOAPEventType implements IEventType {
|
---|
29 |
|
---|
30 | /** */
|
---|
31 | private static final long serialVersionUID = 1L;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * <p>
|
---|
35 | * the SOAP method called in this request
|
---|
36 | * </p>
|
---|
37 | */
|
---|
38 | private final String calledMethod;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * <p>
|
---|
42 | * the name of the service; this is either the path or, if a path map is available
|
---|
43 | * </p>
|
---|
44 | */
|
---|
45 | private final String serviceName;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * <p>
|
---|
49 | * Constructor. Creates a new SimpleSOAPEventType.
|
---|
50 | * </p>
|
---|
51 | *
|
---|
52 | */
|
---|
53 | public SimpleSOAPEventType(String calledMethod, String serviceName) {
|
---|
54 | if (calledMethod == null) {
|
---|
55 | throw new IllegalArgumentException("called method must not be null");
|
---|
56 | }
|
---|
57 | if (serviceName == null) {
|
---|
58 | throw new IllegalArgumentException("serviceName must not be null");
|
---|
59 | }
|
---|
60 | this.calledMethod = calledMethod;
|
---|
61 | this.serviceName = serviceName;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * <p>
|
---|
66 | * the SOAP method called in this request
|
---|
67 | * </p>
|
---|
68 | *
|
---|
69 | * @return the SOAP method called in this request
|
---|
70 | */
|
---|
71 | public String getCalledMethod() {
|
---|
72 | return calledMethod;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * <p>
|
---|
77 | * the name of the service called in this request
|
---|
78 | * </p>
|
---|
79 | *
|
---|
80 | * @return the name of the service called in this request
|
---|
81 | */
|
---|
82 | public String getServiceName() {
|
---|
83 | return serviceName;
|
---|
84 | }
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * (non-Javadoc)
|
---|
88 | *
|
---|
89 | * @see de.ugoe.cs.autoquest.eventcore.IEventType#getName()
|
---|
90 | */
|
---|
91 | @Override
|
---|
92 | public String getName() {
|
---|
93 | return "(" + serviceName + ", " + calledMethod + ")";
|
---|
94 | }
|
---|
95 |
|
---|
96 | /*
|
---|
97 | * (non-Javadoc)
|
---|
98 | *
|
---|
99 | * @see de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType#equals(java.lang.Object)
|
---|
100 | */
|
---|
101 | @Override
|
---|
102 | public boolean equals(Object obj) {
|
---|
103 | if (this == obj) {
|
---|
104 | return true;
|
---|
105 | }
|
---|
106 | else if (obj instanceof SimpleSOAPEventType) {
|
---|
107 | return HTTPUtils.equals(calledMethod, ((SimpleSOAPEventType) obj).calledMethod) &&
|
---|
108 | HTTPUtils.equals(serviceName, ((SimpleSOAPEventType) obj).serviceName);
|
---|
109 | }
|
---|
110 | else {
|
---|
111 | return false;
|
---|
112 | }
|
---|
113 | }
|
---|
114 |
|
---|
115 | /*
|
---|
116 | * (non-Javadoc)
|
---|
117 | *
|
---|
118 | * @see de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType#hashCode()
|
---|
119 | */
|
---|
120 | @Override
|
---|
121 | public int hashCode() {
|
---|
122 | int hashCode = calledMethod.hashCode() + serviceName.hashCode();
|
---|
123 | return hashCode;
|
---|
124 | }
|
---|
125 |
|
---|
126 | /* (non-Javadoc)
|
---|
127 | * @see java.lang.Object#toString()
|
---|
128 | */
|
---|
129 | @Override
|
---|
130 | public String toString() {
|
---|
131 | return "SimpleSOAPEventType(" + serviceName + ", " + calledMethod + ")";
|
---|
132 | }
|
---|
133 | }
|
---|