e72dd7f0b37978da6452701d0f32f282fe894ccd
[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          * @param aRequiredServices Running services from other 
45          * subsystems that are required by this subsystem. 
46          * @return Services that are running in the subsystem. 
47          */
48         Service[] start(String aContext, Service[] aRequiredServices);
49         
50         /**
51          * Stops a subsystem. 
52          */
53         void stop(); 
54         
55         /**
56          * Gets the list of running services in the subsystem. 
57          * 
58          * This method may only be called after the
59          * {@link #initialize(String, Service[])} has been called. 
60          * @return
61          */
62         Service[] getRunningServices();
63 }