Expresso 5-5-0

com.jcorporate.expresso.kernel
Interface ComponentContainer

All Known Implementing Classes:
ContainerImplBase

public interface ComponentContainer

ContainerImpl is the equivelant of a Service Provider Interface (SPI) for the Expresso component containers. By implementing your own ContinainerImpl inteface, you can have its behavior 'duplicated' throughout all the other containers. This particular behavior is specified by the ContainerFactory class.

There is a one to one relationship between a ComponentContainer and a Containable object. The ComponentContainer always wraps the Containable object and the Containable object can be retrieved via the getContainercomponent() method.

The particular ComponentContainer implementation set for each Containable object is determined by the SystemFactory. Although it does not currently have code to dynamically load other ComponentContainer implementations, it would be rather simple to do so.

Since:
Expresso 5.1
Version:
$Revision: 1.4 $ on $Date: 2003/06/03 06:12:21 $
Author:
Michael Rimov

Method Summary
 void addComponent(ExpressoComponent newComponent)
          To register the component for control by the Component Manager.
 void destroyContainer()
          Called when the container is to be destroyed
 Map getChildComponents()
          Retrieves a list of instances of all contained ExpressoComponents.
 Containable getContainerComponent()
          Return the 'wrapped' container ExpressoComponent.
 ComponentContainer getParentContainer()
          Return the parent container
 void installComponent(ExpressoComponent newComponent, InstallationOptions installOptions, InstallLog log)
          Install a component into the system.
 boolean isComponentExists(String componentName)
          Query the container to see if a particular service name is installed in the system
 ExpressoComponent locateComponent(String componentName)
          Locates an Expresso Service for use by a client.
 void removeComponent(String componentName)
          Removes a component from this container.
 void setContainerComponent(Containable newComponent)
          Sets the nested component.
 void setParentContainer(ComponentContainer newParent)
          Set the parent container of this container
 void uninstallComponent(String componentName, InstallationOptions installOptions, InstallLog log)
          Uninstalls the component.
 

Method Detail

locateComponent

public ExpressoComponent locateComponent(String componentName)
Locates an Expresso Service for use by a client.

Parameters:
componentName - the name of the service to locate.
Returns:
ExpressoService.
Throws:
IllegalArgumentException - if the service cannot be found.
IllegalStateException - if the service exists, but is not in a 'runnable' state due to some configuration error or other unforeseen issue.

isComponentExists

public boolean isComponentExists(String componentName)
Query the container to see if a particular service name is installed in the system

Parameters:
componentName - the name of the component to query for.
Returns:
true if the service is installed and running.

addComponent

public void addComponent(ExpressoComponent newComponent)
To register the component for control by the Component Manager. This will in essense transfer the control of ther service to the Component Manager. This will often be called by the Configuration Bootstrap system.

Parameters:
newComponent - the component to install

removeComponent

public void removeComponent(String componentName)
Removes a component from this container.

Parameters:
componentName - The name of the component to remove.

installComponent

public void installComponent(ExpressoComponent newComponent,
                             InstallationOptions installOptions,
                             InstallLog log)
Install a component into the system. If newComponent implements installable then it shall be installed. After that, the component is added.

Parameters:
newComponent - An instance of the component to install.
log - a Logger-like interface to a component tha records the process of the installation including any errors, etc.
installOptions - The Installation Options for the Component

uninstallComponent

public void uninstallComponent(String componentName,
                               InstallationOptions installOptions,
                               InstallLog log)
Uninstalls the component. If the component implements installable then it shall be uninstalled. After that, it shall be removed.

Parameters:
componentName - the name of the component to uninstall
log - a Logger-like interface to a component tha records the process of the installation including any errors, etc.
installOptions - The 'Uninstallation' options for the component

getChildComponents

public Map getChildComponents()
Retrieves a list of instances of all contained ExpressoComponents. Use this for iterating through the components of a current 'context'. Do not attempt to modify the map given. Either add or remove a component through the addComponent or removeComponent methods.

Returns:
Read only map of the components.

getParentContainer

public ComponentContainer getParentContainer()
Return the parent container

Returns:
ContainerImpl interface

setParentContainer

public void setParentContainer(ComponentContainer newParent)
Set the parent container of this container

Parameters:
newParent - the new Parent Container

getContainerComponent

public Containable getContainerComponent()
Return the 'wrapped' container ExpressoComponent.

Returns:
Containable

setContainerComponent

public void setContainerComponent(Containable newComponent)
Sets the nested component. This is usually called by the system factory.

Parameters:
newComponent - the component links to this component container object.

destroyContainer

public void destroyContainer()
Called when the container is to be destroyed


Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.