babb9e025edbd7ce2e15bdeb114e576451b19aaf
[utils] / system / general / src / main / java / org / wamblee / system / SubSystem.java
1 package org.wamblee.system;
2
3 /**
4  * A sub system represents a part of a system that required a 
5  * number of services and provides a number of services. 
6  */
7 public interface SubSystem {
8         
9         /**
10          * Gets the name of the subsystem.
11          * @return Subsystem name. 
12          */
13         String getName();
14
15         /**
16          * Gets a description of the provided interfaces. 
17          * @return Provided interfaces. 
18          */
19         ServiceDescriptor[] getProvidedServices();
20         
21         /**
22          * Gets a description of the required interfaces. 
23          * @return Required interfaces. 
24          */
25         ServiceDescriptor[] getRequiredServices();
26
27         
28         /**
29          * Initialises the subsytem by starting all the services that
30          * it described as provided. 
31          * @param aContext Unique name for the subsystem. 
32          * @param aRegistry Registry of service to which the subsystem must register the services it
33          *   creates. 
34          * @param aRequiredServices Running services from other 
35          * subsystems that are required by this subsystem. 
36          * @return Services that are running in the subsystem. 
37          */
38         Service[] start(String aContext, ServiceRegistry aRegistry, Service[] aRequiredServices);
39         
40         /**
41          * Gets the list of running services in the subsystem. 
42          * 
43          * This method may only be called after the
44          * {@link #initialize(String, Service[])} has been called. 
45          * @return
46          */
47         Service[] getRunningServices();
48 }