public class Container extends AbstractComponent<Scope>
Constructor and Description |
---|
Container(String aName)
Creates a new Container object.
|
Container(String aName,
Component[] aComponents,
List<ProvidedInterface> aProvided,
List<RequiredInterface> aRequired)
Constructs the container
|
Container(String aName,
Component[] aComponents,
ProvidedInterface[] aProvided,
RequiredInterface[] aRequired)
Constructs the container
|
Modifier and Type | Method and Description |
---|---|
Container |
addComponent(Component aComponent) |
void |
addContext(String aContext)
Prepends the context with a super context.
|
Container |
addProvidedInterface(ProvidedInterface aProvided) |
Container |
addRequiredInterface(RequiredInterface aRequired) |
void |
connectExternalProvided(String aExternalProvided,
String aComponent,
String aProvidedInterface) |
void |
connectExternalRequired(String aComponent,
String aRequiredInterface,
String aExternalRequiredInterface)
Explicitly connects a externally required interface to an internally
required interface.
|
void |
connectRequiredProvided(String aClientComponent,
String aRequiredInterface,
String aServerComponent,
String aProvidedInterface)
Explictly connects required and provided interfaces.
|
protected Scope |
doStart(Scope aExternalScope)
Must be implemented for initializing the subsystem.
|
protected void |
doStop(Scope aScope) |
Component |
findComponent(String aName)
Finds a component based on the non-qualified name of the component.
|
boolean |
isSealed()
Checks if the container is sealed.
|
void |
seal()
Seal the container, meaning that no further components or interfaces may
be added.
|
Scope |
start()
Utility method to start with an empty external scope.
|
void |
validate()
Validates the components together to check that there are no required
services not in the required list and no services in the provided list
that cannot be provided.
|
addInterface, findProvidedInterface, findRequiredInterface, getContext, getName, getProvidedInterfaces, getQualifiedName, getRequiredInterfaces, start, stop, toString
public Container(String aName, Component[] aComponents, List<ProvidedInterface> aProvided, List<RequiredInterface> aRequired)
aName
- Name of the containeraComponents
- Components.aProvided
- Provided services of the containeraRequired
- Required services by the container.public Container(String aName, Component[] aComponents, ProvidedInterface[] aProvided, RequiredInterface[] aRequired)
aName
- Name of the containeraComponents
- Components.aProvided
- Provided services of the containeraRequired
- Required services by the container.public Container(String aName)
public void connectRequiredProvided(String aClientComponent, String aRequiredInterface, String aServerComponent, String aProvidedInterface)
aClientComponent
- Client component, may not be null.aRequiredInterface
- Required interface. If null it means all required interfaces.aServerComponent
- Server component to connect to. If null, it means that no
server components may be connected to and the provider of the
required interface will be null.aProvidedInterface
- Provided interface. If null, it means that there is no
restriction on the name of the provided interface and that it
is automatically selected.public void connectExternalRequired(String aComponent, String aRequiredInterface, String aExternalRequiredInterface)
aComponent
- Component requiring the interface (must be non-null).aRequiredInterface
- Required interface of the component (must be non-null).aExternalRequiredInterface
- Externally required interface (must be non-null).public void connectExternalProvided(String aExternalProvided, String aComponent, String aProvidedInterface)
public Container addProvidedInterface(ProvidedInterface aProvided)
addProvidedInterface
in class AbstractComponent<Scope>
public Container addRequiredInterface(RequiredInterface aRequired)
addRequiredInterface
in class AbstractComponent<Scope>
public void addContext(String aContext)
Component
addContext
in interface Component<Scope>
addContext
in class AbstractComponent<Scope>
public void validate()
public void seal()
public boolean isSealed()
public Scope start()
protected Scope doStart(Scope aExternalScope)
AbstractComponent
AbstractComponent.addInterface(ProvidedInterface, Object, Scope)
for
each service that is started.doStart
in class AbstractComponent<Scope>
protected void doStop(Scope aScope)
doStop
in class AbstractComponent<Scope>
Copyright © 2022. All rights reserved.