[961] | 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.html.guimodel; |
---|
| 16 | |
---|
| 17 | import de.ugoe.cs.autoquest.eventcore.guimodel.IFrame; |
---|
| 18 | |
---|
| 19 | /** |
---|
| 20 | * <p> |
---|
[1276] | 21 | * a GUI element representing an HTML server. This is the root element for a GUI model of |
---|
| 22 | * an HTML web site. It is identified through a host and a port. Its children are documents. |
---|
[961] | 23 | * </p> |
---|
| 24 | * |
---|
| 25 | * @author Patrick Harms |
---|
| 26 | */ |
---|
| 27 | public class HTMLServer extends HTMLGUIElement implements IFrame { |
---|
| 28 | |
---|
[1276] | 29 | /** |
---|
| 30 | * <p> |
---|
| 31 | * default serial version UID |
---|
| 32 | * </p> |
---|
| 33 | */ |
---|
[961] | 34 | private static final long serialVersionUID = 1L; |
---|
| 35 | |
---|
| 36 | /** |
---|
| 37 | * <p> |
---|
[1276] | 38 | * instantiates the server with an appropriate specification |
---|
[961] | 39 | * </p> |
---|
| 40 | * |
---|
[1276] | 41 | * @param specification the server specification |
---|
| 42 | * @param parent the parent of the server --> must always be null. Just included as |
---|
| 43 | * required by the automatic instantiation mechanism |
---|
| 44 | * |
---|
| 45 | * @throws IllegalArgumentException if the provided parent is not null |
---|
[961] | 46 | */ |
---|
| 47 | public HTMLServer(HTMLServerSpec specification, HTMLGUIElement parent) { |
---|
| 48 | super(specification, null); |
---|
| 49 | |
---|
| 50 | if (parent != null) { |
---|
| 51 | throw new IllegalArgumentException("a GUI element representing the server must not " + |
---|
| 52 | "have a parent GUI element"); |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | /* |
---|
| 57 | * (non-Javadoc) |
---|
| 58 | * |
---|
| 59 | * @see de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLGUIElement#getElementDescriptor() |
---|
| 60 | */ |
---|
| 61 | @Override |
---|
| 62 | protected String getElementDescriptor() { |
---|
| 63 | return "Server"; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * <p> |
---|
[1276] | 68 | * returns the host of the represented server |
---|
[961] | 69 | * </p> |
---|
| 70 | * |
---|
[1276] | 71 | * @return the host |
---|
[961] | 72 | */ |
---|
[1222] | 73 | public String getHost() { |
---|
[961] | 74 | return ((HTMLServerSpec) super.getSpecification()).getHost(); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * <p> |
---|
[1276] | 79 | * returns the port of the represented server |
---|
[961] | 80 | * </p> |
---|
| 81 | * |
---|
[1276] | 82 | * @return the port |
---|
[961] | 83 | */ |
---|
[1222] | 84 | public int getPort() { |
---|
[961] | 85 | return ((HTMLServerSpec) super.getSpecification()).getPort(); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | } |
---|