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.htmlmonitor; |
---|
16 | |
---|
17 | /** |
---|
18 | * <p> |
---|
19 | * convenience interface for all components making up the HTML monitor. All components implement |
---|
20 | * this interface to ensure homogeneity throughout them. A component must first be initialized |
---|
21 | * ({@link #init()}), then started ({@link #start()}) and finally stopped ({@link #stop()}). |
---|
22 | * </p> |
---|
23 | * |
---|
24 | * @author Patrick Harms |
---|
25 | */ |
---|
26 | interface HtmlMonitorComponent { |
---|
27 | |
---|
28 | /** |
---|
29 | * initializes a component, i.e. it does everything needed to prepare starting the component |
---|
30 | * |
---|
31 | * @throws IllegalStateException thrown if the method was already called before but |
---|
32 | * {@link #stop()} wasn't called yet |
---|
33 | * @throws HtmlMonitorException thrown if the initialization fails, e.g. because needed infos |
---|
34 | * are missing |
---|
35 | */ |
---|
36 | void init() throws IllegalStateException, HtmlMonitorException; |
---|
37 | |
---|
38 | /** |
---|
39 | * starts a component |
---|
40 | * |
---|
41 | * @throws IllegalStateException thrown if {@link #init()} wasn't called yet of if the component |
---|
42 | * is already started through a preceding call to this method |
---|
43 | * @throws HtmlMonitorException thrown if the startup fails, e.g. because needed infos |
---|
44 | * are missing |
---|
45 | */ |
---|
46 | void start() throws IllegalStateException, HtmlMonitorException; |
---|
47 | |
---|
48 | /** |
---|
49 | * stops a component and cleans up any derivate. In the following, {@link #init()} must be |
---|
50 | * callable again. If the component is not initialized or started, nothing must happen. If the |
---|
51 | * component is initialized but not started, the initialization is revoked. |
---|
52 | */ |
---|
53 | void stop(); |
---|
54 | } |
---|