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