X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FComponent.java;h=9506bb1f32c3fc874b9460cad4ac6e0757c0e6b3;hb=32a8562695029cf13d915bc7941a61fe07ff0005;hp=b36fe56b221163c91d31f22ccf715bf71d9fd27c;hpb=8a6ee427cf3de42d9dd9d8fea09ee9fd059ee53e;p=utils diff --git a/system/general/src/main/java/org/wamblee/system/core/Component.java b/system/general/src/main/java/org/wamblee/system/core/Component.java index b36fe56b..9506bb1f 100644 --- a/system/general/src/main/java/org/wamblee/system/core/Component.java +++ b/system/general/src/main/java/org/wamblee/system/core/Component.java @@ -15,23 +15,23 @@ */ package org.wamblee.system.core; +import java.util.List; + /** * A component represents a part of a system that requires a - * number of interfaces and provides a number of interfaces. + * number of interfaces and provides a number of interfaces. + * + * The component interface provides the meta-data for a component. + * After calling {@link #start(Scope)}, an actual runtime representation of the + * component can be created which is independent of this component. + * As a special case, the runtime representation may be identical to the + * component instance but in general it is not. This allows a component to be + * used as a factory for creating objects. + * * * @author Erik Brakkee */ -public interface Component { - - enum Status { - NOT_STARTED, RUNNING, STOPPED - } - - /** - * Gets the status of the component. - * @return Status. - */ - Status getStatus(); +public interface Component { /** * Gets the name of the subsystem. @@ -44,6 +44,12 @@ public interface Component { */ void addContext(String aContext); + /** + * Getst the context. + * @return Context or null if not set. + */ + String getContext(); + /** * Gets the fully qualified name of the component which includes * the context of the component. @@ -56,32 +62,27 @@ public interface Component { * Gets a description of the provided interfaces. * @return Provided interfaces. */ - ProvidedInterface[] getProvidedInterfaces(); + List getProvidedInterfaces(); /** * Gets a description of the required interfaces. * @return Required interfaces. */ - RequiredInterface[] getRequiredInterfaces(); + List getRequiredInterfaces(); /** - * Initialises the subsytem by starting all the services that - * it described as provided. - */ - void start(); - - /** - * 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 + * Initialises the subsystem by starting all the services that + * it described as provided. + * @param aScope Scope with external interface implementations that are available. The component + * must publish its runtime and its provided interfaces in this scope. + * @return Gets an object representing the runtime of the component. */ - ProvidedInterface[] getRunningInterfaces(); + Type start(Scope aScope); /** - * Stops a subsystem. + * Stops a component. + * @param aRuntime THe runtime part of the component. */ - void stop(); + void stop(Type aRuntime); }