X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FComponent.java;h=4ffeadf73b954bda01774b02839c87baea6a1c1c;hb=49ce7cb8387601982d5e6ef186ce206d38f6e3d7;hp=ff80ee693acdcba8f70443cf4bb704ba4821a2d5;hpb=e73828b054b0734ddce0ff9194fca75ed3c98b7a;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 ff80ee69..4ffeadf7 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 @@ -1,5 +1,5 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2005-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,66 +12,87 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ 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. - * + * A component represents a part of a system that requires a 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 { - - /** - * Gets the name of the subsystem. - * @return Subsystem name. - */ - String getName(); - - /** - * Prepends the context with a super context. - */ - void addContext(String aContext); - - /** - * Gets the fully qualified name of the component which includes - * the context of the component. - * This method can only be used after the component has started. - * @return Qualified name. - */ - String getQualifiedName(); +public interface Component { + /** + * Gets the name of the subsystem. + * + * @return Subsystem name. + */ + String getName(); + + /** + * Prepends the context with a super context. + * + */ + 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. This method can only be used after the component has + * started. + * + * @return Qualified name. + */ + String getQualifiedName(); + + /** + * Gets a description of the provided interfaces. + * + * @return Provided interfaces. + */ + List getProvidedInterfaces(); + + /** + * Gets a description of the required interfaces. + * + * @return Required interfaces. + */ + List getRequiredInterfaces(); - /** - * Gets a description of the provided interfaces. - * @return Provided interfaces. - */ - ProvidedInterface[] getProvidedInterfaces(); - - /** - * Gets a description of the required interfaces. - * @return Required interfaces. - */ - RequiredInterface[] getRequiredInterfaces(); + /** + * 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. + */ + Type start(Scope aScope); - - /** - * 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 - */ - ProvidedInterface[] getRunningInterfaces(); - - /** - * Stops a subsystem. - */ - void stop(); + /** + * Stops a component. + * + * @param aRuntime + * THe runtime part of the component. + */ + void stop(Type aRuntime); }