source: trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/SimpleSOAPEventType.java @ 1913

Last change on this file since 1913 was 1913, checked in by sherbold, 9 years ago
  • extended SimpleSOAPEventType with clientName
  • modified UMLUtils.createInteraction... to use the client name to determine the source lifeline
  • updated UMLUtilsTest to work with new service name definitions
  • Property svn:mime-type set to text/plain
File size: 4.3 KB
Line 
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
15package de.ugoe.cs.autoquest.plugin.http.eventcore;
16
17import de.ugoe.cs.autoquest.eventcore.IEventType;
18import 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 */
28public 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     * the name of the client; this is either the host/ip and port of the sender or, if a path
50     * map is available, a human readable name that may be based also on the receiver
51     * </p>
52     */
53    private final String clientName;
54
55    /**
56     * <p>
57     * Constructor. Creates a new SimpleSOAPEventType.
58     * </p>
59     *
60     */
61    public SimpleSOAPEventType(String calledMethod, String serviceName, String clientName) {
62        if (calledMethod == null) {
63            throw new IllegalArgumentException("called method must not be null");
64        }
65        if (serviceName == null) {
66            throw new IllegalArgumentException("serviceName must not be null");
67        }
68        if (clientName == null) {
69            throw new IllegalArgumentException("clientName must not be null");
70        }
71        this.calledMethod = calledMethod;
72        this.serviceName = serviceName;
73        this.clientName = clientName;
74    }
75
76    /**
77     * <p>
78     * the SOAP method called in this request
79     * </p>
80     *
81     * @return the SOAP method called in this request
82     */
83    public String getCalledMethod() {
84        return calledMethod;
85    }
86
87    /**
88     * <p>
89     * the name of the service called in this request
90     * </p>
91     *
92     * @return the name of the service called in this request
93     */
94    public String getServiceName() {
95        return serviceName;
96    }
97   
98    /**
99     * <p>
100     * the name of the client calling in this request
101     * </p>
102     *
103     * @return the name of the client calling in this request
104     */
105    public String getClientName() {
106        return clientName;
107    }
108
109    /*
110     * (non-Javadoc)
111     *
112     * @see de.ugoe.cs.autoquest.eventcore.IEventType#getName()
113     */
114    @Override
115    public String getName() {
116        return "(" + serviceName + ", " + calledMethod + ")";
117    }
118
119    /*
120     * (non-Javadoc)
121     *
122     * @see de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType#equals(java.lang.Object)
123     */
124    @Override
125    public boolean equals(Object obj) {
126        if (this == obj) {
127            return true;
128        }
129        else if (obj instanceof SimpleSOAPEventType) {
130            return HTTPUtils.equals(calledMethod, ((SimpleSOAPEventType) obj).calledMethod) &&
131                HTTPUtils.equals(serviceName, ((SimpleSOAPEventType) obj).serviceName);
132        }
133        else {
134            return false;
135        }
136    }
137
138    /*
139     * (non-Javadoc)
140     *
141     * @see de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType#hashCode()
142     */
143    @Override
144    public int hashCode() {
145        int hashCode = calledMethod.hashCode() + serviceName.hashCode();
146        return hashCode;
147    }
148   
149    /* (non-Javadoc)
150     * @see java.lang.Object#toString()
151     */
152    @Override
153    public String toString() {
154        return "SimpleSOAPEventType(" + serviceName + ", " + calledMethod + ")";
155    }
156}
Note: See TracBrowser for help on using the repository browser.