KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jcorporate > expresso > kernel > ComponentContainer


1 package com.jcorporate.expresso.kernel;
2
3 /* ====================================================================
4  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
5  *
6  * Copyright (c) 1995-2003 Jcorporate Ltd. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by Jcorporate Ltd.
23  * (http://www.jcorporate.com/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. "Jcorporate" and product names such as "Expresso" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written permission,
30  * please contact info@jcorporate.com.
31  *
32  * 5. Products derived from this software may not be called "Expresso",
33  * or other Jcorporate product names; nor may "Expresso" or other
34  * Jcorporate product names appear in their name, without prior
35  * written permission of Jcorporate Ltd.
36  *
37  * 6. No product derived from this software may compete in the same
38  * market space, i.e. framework, without prior written permission
39  * of Jcorporate Ltd. For written permission, please contact
40  * partners@jcorporate.com.
41  *
42  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
43  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45  * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
46  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
47  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
48  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
49  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
52  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53  * SUCH DAMAGE.
54  * ====================================================================
55  *
56  * This software consists of voluntary contributions made by many
57  * individuals on behalf of the Jcorporate Ltd. Contributions back
58  * to the project(s) are encouraged when you make modifications.
59  * Please send them to support@jcorporate.com. For more information
60  * on Jcorporate Ltd. and its products, please see
61  * <http://www.jcorporate.com/>.
62  *
63  * Portions of this software are based upon other open source
64  * products and are subject to their respective licenses.
65  */

66
67 import java.util.Map JavaDoc;
68
69 /**
70  * ContainerImpl is the equivelant of a Service Provider Interface (SPI) for
71  * the Expresso component containers. By implementing your own ContinainerImpl
72  * inteface, you can have its behavior 'duplicated' throughout all the other
73  * containers. This particular behavior is specified by the ContainerFactory
74  * class.
75  * <p>There is a one to one relationship between a <code>ComponentContainer</code>
76  * and a Containable object. The ComponentContainer always wraps the Containable
77  * object and the Containable object can be retrieved via the getContainercomponent()
78  * method.</p>
79  * <p>The particular ComponentContainer implementation set for each Containable
80  * object is determined by the SystemFactory. Although it does not currently
81  * have code to dynamically load other ComponentContainer implementations, it
82  * would be rather simple to do so.</p>
83  *
84  * @author Michael Rimov
85  * @since Expresso 5.1
86  */

87 public interface ComponentContainer {
88     /**
89      * Locates an Expresso Service for use by a client.
90      *
91      * @param componentName the name of the service to locate.
92      * @return ExpressoService.
93      * @throws IllegalArgumentException if the service cannot be found.
94      * @throws IllegalStateException if the service exists, but is not in a
95      * 'runnable' state due to some configuration error or other unforeseen
96      * issue.
97      */

98     public ExpressoComponent locateComponent(String JavaDoc componentName);
99
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 JavaDoc componentName);
108
109
110     /**
111      * To register the component for control by the Component Manager. This will
112      * in essense transfer the control of ther service to the Component Manager.
113      * This will often be called by the Configuration Bootstrap system.
114      *
115      * @param newComponent the component to install
116      */

117     public void addComponent(ExpressoComponent newComponent);
118
119     /**
120      * Removes a component from this container.
121      *
122      * @param componentName The name of the component to remove.
123      */

124     public void removeComponent(String JavaDoc componentName);
125
126
127     /**
128      * Install a component into the system. If newComponent implements <code>
129      * installable</code> then it shall be installed. After that, the component
130      * is added.
131      *
132      * @param newComponent An instance of the component to install.
133      * @param log a Logger-like interface to a component tha records the process
134      * of the installation including any errors, etc.
135      * @param installOptions The Installation Options for the Component
136      */

137     public void installComponent(ExpressoComponent newComponent, InstallationOptions installOptions, InstallLog log);
138
139
140     /**
141      * Uninstalls the component. If the component implements <code>
142      * installable</code> then it shall be uninstalled. After that, it shall
143      * be removed.
144      *
145      * @param componentName the name of the component to uninstall
146      * @param log a Logger-like interface to a component tha records the process
147      * of the installation including any errors, etc.
148      * @param installOptions The 'Uninstallation' options for the component
149      */

150     public void uninstallComponent(String JavaDoc componentName, InstallationOptions installOptions, InstallLog log);
151
152     /**
153      * Retrieves a list of instances of all contained ExpressoComponents. Use
154      * this for iterating through the components of a current 'context'. Do not
155      * attempt to modify the map given. Either add or remove a component through
156      * the addComponent or removeComponent methods.
157      *
158      * @return Read only map of the components.
159      */

160     public Map JavaDoc getChildComponents();
161
162     /**
163      * Return the parent container
164      *
165      * @return ContainerImpl interface
166      */

167     public ComponentContainer getParentContainer();
168
169     /**
170      * Set the parent container of this container
171      *
172      * @param newParent the new Parent Container
173      */

174     public void setParentContainer(ComponentContainer newParent);
175
176     /**
177      * Return the 'wrapped' container ExpressoComponent.
178      *
179      * @return <code>Containable</code>
180      */

181     public Containable getContainerComponent();
182
183     /**
184      * Sets the nested component. This is usually called by the system
185      * factory.
186      *
187      * @param newComponent the component links to this component container
188      * object.
189      */

190     public void setContainerComponent(Containable newComponent);
191
192
193     /**
194      * Called when the container is to be destroyed
195      */

196     public void destroyContainer();
197 }
Popular Tags