package com.jcorporate.expresso.kernel;
/* ====================================================================
* The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
*
* Copyright (c) 1995-2003 Jcorporate Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by Jcorporate Ltd.
* (http://www.jcorporate.com/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. "Jcorporate" and product names such as "Expresso" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written permission,
* please contact info@jcorporate.com.
*
* 5. Products derived from this software may not be called "Expresso",
* or other Jcorporate product names; nor may "Expresso" or other
* Jcorporate product names appear in their name, without prior
* written permission of Jcorporate Ltd.
*
* 6. No product derived from this software may compete in the same
* market space, i.e. framework, without prior written permission
* of Jcorporate Ltd. For written permission, please contact
* partners@jcorporate.com.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Jcorporate Ltd. Contributions back
* to the project(s) are encouraged when you make modifications.
* Please send them to support@jcorporate.com. For more information
* on Jcorporate Ltd. and its products, please see
* <http://www.jcorporate.com/>.
*
* Portions of this software are based upon other open source
* products and are subject to their respective licenses.
*/
import java.util.Map;
/**
* 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.
* <p>There is a one to one relationship between a <code>ComponentContainer</code>
* and a Containable object. The ComponentContainer always wraps the Containable
* object and the Containable object can be retrieved via the getContainercomponent()
* method.</p>
* <p>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.</p>
*
* @author Michael Rimov
* @since Expresso 5.1
*/
public interface ComponentContainer {
/**
* Locates an Expresso Service for use by a client.
*
* @param componentName the name of the service to locate.
* @return ExpressoService.
* @throws IllegalArgumentException if the service cannot be found.
* @throws IllegalStateException if the service exists, but is not in a
* 'runnable' state due to some configuration error or other unforeseen
* issue.
*/
public ExpressoComponent locateComponent(String componentName);
/**
* Query the container to see if a particular service name is installed
* in the system
*
* @param componentName the name of the component to query for.
* @return true if the service is installed and running.
*/
public boolean isComponentExists(String componentName);
/**
* 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.
*
* @param newComponent the component to install
*/
public void addComponent(ExpressoComponent newComponent);
/**
* Removes a component from this container.
*
* @param componentName The name of the component to remove.
*/
public void removeComponent(String componentName);
/**
* Install a component into the system. If newComponent implements <code>
* installable</code> then it shall be installed. After that, the component
* is added.
*
* @param newComponent An instance of the component to install.
* @param log a Logger-like interface to a component tha records the process
* of the installation including any errors, etc.
* @param installOptions The Installation Options for the Component
*/
public void installComponent(ExpressoComponent newComponent, InstallationOptions installOptions, InstallLog log);
/**
* Uninstalls the component. If the component implements <code>
* installable</code> then it shall be uninstalled. After that, it shall
* be removed.
*
* @param componentName the name of the component to uninstall
* @param log a Logger-like interface to a component tha records the process
* of the installation including any errors, etc.
* @param installOptions The 'Uninstallation' options for the component
*/
public void uninstallComponent(String componentName, InstallationOptions installOptions, InstallLog log);
/**
* 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.
*
* @return Read only map of the components.
*/
public Map getChildComponents();
/**
* Return the parent container
*
* @return ContainerImpl interface
*/
public ComponentContainer getParentContainer();
/**
* Set the parent container of this container
*
* @param newParent the new Parent Container
*/
public void setParentContainer(ComponentContainer newParent);
/**
* Return the 'wrapped' container ExpressoComponent.
*
* @return <code>Containable</code>
*/
public Containable getContainerComponent();
/**
* Sets the nested component. This is usually called by the system
* factory.
*
* @param newComponent the component links to this component container
* object.
*/
public void setContainerComponent(Containable newComponent);
/**
* Called when the container is to be destroyed
*/
public void destroyContainer();
}
|