some major refactoring.
[utils] / system / general / src / main / java / org / wamblee / system / Component.java
1 package org.wamblee.system;
2
3 /**
4  * A component represents a part of a system that requires a 
5  * number of interfaces and provides a number of interfaces. 
6  *
7  * @author Erik Brakkee
8  */
9 public interface Component {
10         
11         enum Status { 
12                 NOT_STARTED, RUNNING, STOPPED
13         }
14         
15         /**
16          * Gets the status of the component. 
17          * @return Status. 
18          */
19         Status getStatus();
20         
21         /**
22          * Gets the name of the subsystem.
23          * @return Subsystem name. 
24          */
25         String getName();
26
27         /**
28          * Gets a description of the provided interfaces. 
29          * @return Provided interfaces. 
30          */
31         ProvidedInterface[] getProvidedServices();
32         
33         /**
34          * Gets a description of the required interfaces. 
35          * @return Required interfaces. 
36          */
37         RequiredInterface[] getRequiredServices();
38
39         
40         /**
41          * Initialises the subsytem by starting all the services that
42          * it described as provided. 
43          * @param aContext Unique name for the subsystem.  
44          */
45         void start(String aContext);
46         
47         /**
48          * Stops a subsystem. 
49          */
50         void stop(); 
51         
52         /**
53          * Gets the list of running services in the subsystem. 
54          * 
55          * This method may only be called after the
56          * {@link #initialize(String, Service[])} has been called. 
57          * @return
58          */
59         ProvidedInterface[] getRunningServices();
60 }