001: package com.jcorporate.expresso.kernel;
002:
003: /* ====================================================================
004: * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
005: *
006: * Copyright (c) 1995-2003 Jcorporate Ltd. All rights reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by Jcorporate Ltd.
023: * (http://www.jcorporate.com/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. "Jcorporate" and product names such as "Expresso" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written permission,
030: * please contact info@jcorporate.com.
031: *
032: * 5. Products derived from this software may not be called "Expresso",
033: * or other Jcorporate product names; nor may "Expresso" or other
034: * Jcorporate product names appear in their name, without prior
035: * written permission of Jcorporate Ltd.
036: *
037: * 6. No product derived from this software may compete in the same
038: * market space, i.e. framework, without prior written permission
039: * of Jcorporate Ltd. For written permission, please contact
040: * partners@jcorporate.com.
041: *
042: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
043: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
044: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
045: * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
046: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
047: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
048: * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
049: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
050: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
051: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
052: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
053: * SUCH DAMAGE.
054: * ====================================================================
055: *
056: * This software consists of voluntary contributions made by many
057: * individuals on behalf of the Jcorporate Ltd. Contributions back
058: * to the project(s) are encouraged when you make modifications.
059: * Please send them to support@jcorporate.com. For more information
060: * on Jcorporate Ltd. and its products, please see
061: * <http://www.jcorporate.com/>.
062: *
063: * Portions of this software are based upon other open source
064: * products and are subject to their respective licenses.
065: */
066:
067: import java.util.Map;
068:
069: /**
070: * ContainerImpl is the equivelant of a Service Provider Interface (SPI) for
071: * the Expresso component containers. By implementing your own ContinainerImpl
072: * inteface, you can have its behavior 'duplicated' throughout all the other
073: * containers. This particular behavior is specified by the ContainerFactory
074: * class.
075: * <p>There is a one to one relationship between a <code>ComponentContainer</code>
076: * and a Containable object. The ComponentContainer always wraps the Containable
077: * object and the Containable object can be retrieved via the getContainercomponent()
078: * method.</p>
079: * <p>The particular ComponentContainer implementation set for each Containable
080: * object is determined by the SystemFactory. Although it does not currently
081: * have code to dynamically load other ComponentContainer implementations, it
082: * would be rather simple to do so.</p>
083: *
084: * @author Michael Rimov
085: * @since Expresso 5.1
086: */
087: public interface ComponentContainer {
088: /**
089: * Locates an Expresso Service for use by a client.
090: *
091: * @param componentName the name of the service to locate.
092: * @return ExpressoService.
093: * @throws IllegalArgumentException if the service cannot be found.
094: * @throws IllegalStateException if the service exists, but is not in a
095: * 'runnable' state due to some configuration error or other unforeseen
096: * issue.
097: */
098: public ExpressoComponent locateComponent(String componentName);
099:
100: /**
101: * Query the container to see if a particular service name is installed
102: * in the system
103: *
104: * @param componentName the name of the component to query for.
105: * @return true if the service is installed and running.
106: */
107: public boolean isComponentExists(String componentName);
108:
109: /**
110: * To register the component for control by the Component Manager. This will
111: * in essense transfer the control of ther service to the Component Manager.
112: * This will often be called by the Configuration Bootstrap system.
113: *
114: * @param newComponent the component to install
115: */
116: public void addComponent(ExpressoComponent newComponent);
117:
118: /**
119: * Removes a component from this container.
120: *
121: * @param componentName The name of the component to remove.
122: */
123: public void removeComponent(String componentName);
124:
125: /**
126: * Install a component into the system. If newComponent implements <code>
127: * installable</code> then it shall be installed. After that, the component
128: * is added.
129: *
130: * @param newComponent An instance of the component to install.
131: * @param log a Logger-like interface to a component tha records the process
132: * of the installation including any errors, etc.
133: * @param installOptions The Installation Options for the Component
134: */
135: public void installComponent(ExpressoComponent newComponent,
136: InstallationOptions installOptions, InstallLog log);
137:
138: /**
139: * Uninstalls the component. If the component implements <code>
140: * installable</code> then it shall be uninstalled. After that, it shall
141: * be removed.
142: *
143: * @param componentName the name of the component to uninstall
144: * @param log a Logger-like interface to a component tha records the process
145: * of the installation including any errors, etc.
146: * @param installOptions The 'Uninstallation' options for the component
147: */
148: public void uninstallComponent(String componentName,
149: InstallationOptions installOptions, InstallLog log);
150:
151: /**
152: * Retrieves a list of instances of all contained ExpressoComponents. Use
153: * this for iterating through the components of a current 'context'. Do not
154: * attempt to modify the map given. Either add or remove a component through
155: * the addComponent or removeComponent methods.
156: *
157: * @return Read only map of the components.
158: */
159: public Map getChildComponents();
160:
161: /**
162: * Return the parent container
163: *
164: * @return ContainerImpl interface
165: */
166: public ComponentContainer getParentContainer();
167:
168: /**
169: * Set the parent container of this container
170: *
171: * @param newParent the new Parent Container
172: */
173: public void setParentContainer(ComponentContainer newParent);
174:
175: /**
176: * Return the 'wrapped' container ExpressoComponent.
177: *
178: * @return <code>Containable</code>
179: */
180: public Containable getContainerComponent();
181:
182: /**
183: * Sets the nested component. This is usually called by the system
184: * factory.
185: *
186: * @param newComponent the component links to this component container
187: * object.
188: */
189: public void setContainerComponent(Containable newComponent);
190:
191: /**
192: * Called when the container is to be destroyed
193: */
194: public void destroyContainer();
195: }
|