package org.wamblee.system; /** * A component represents a part of a system that requires a * number of interfaces and provides a number of interfaces. * * @author Erik Brakkee */ public interface Component { enum Status { NOT_STARTED, RUNNING, STOPPED } /** * Gets the status of the component. * @return Status. */ Status getStatus(); /** * Gets the name of the subsystem. * @return Subsystem name. */ String getName(); /** * Gets a description of the provided interfaces. * @return Provided interfaces. */ ProvidedInterfaceDescriptor[] getProvidedServices(); /** * Gets a description of the required interfaces. * @return Required interfaces. */ RequiredInterfaceDescriptor[] getRequiredServices(); /** * Initialises the subsytem by starting all the services that * it described as provided. * @param aContext Unique name for the subsystem. * @param aRequiredServices Running services from other * subsystems that are required by this subsystem. * @return Services that are running in the subsystem. */ Service[] start(String aContext, Service[] aRequiredServices); /** * Stops a subsystem. */ void stop(); /** * Gets the list of running services in the subsystem. * * This method may only be called after the * {@link #initialize(String, Service[])} has been called. * @return */ Service[] getRunningServices(); }