X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FComponent.java;h=37a9c84dbe938c9f9ee2300257016cff375f8c35;hb=001d69a3cfa9c4d949963d222c05a3134b594ddb;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..37a9c84d 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 @@ -17,21 +17,19 @@ package org.wamblee.system.core; /** * 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 +42,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. @@ -66,22 +70,17 @@ public interface Component { /** - * 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); }