KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > fortress > Container


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.fortress;
19
20 import org.apache.avalon.framework.service.ServiceException;
21
22 /**
23  * The Container is an interface used to mark the Containers in your system.
24  *
25  * <p>It is used to functionally identify Containers. It's primary use is to
26  * assist Container developers to obtain the desired object from the Context.
27  * Most applications will not, or barely, refer to implementations of this
28  * class; rather they will interact wit a {@link ContainerManager ContainerManager}
29  * implementation. All communication from the ContainerManager to the Container is
30  * through the {@link Context Context} object.</p>
31  *
32  * <p>While plans exist to extend the Container interface to expose more of the
33  * Container's internals, we currently feel that we have insufficient use case
34  * information to determine the generic form of the container internals.</p>
35  *
36  * @author <a HREF="mailto:dev@avalon.apache.org">The Avalon Team</a>
37  * @version CVS $Revision: 1.10 $ $Date: 2004/02/28 15:16:24 $
38  * @see ContainerConstants for the contract surrounding the Container context
39  * @see <a HREF="http://avalon.apache.org/framework/guide-cop-in-avalon.html">COP In Avalon</a>
40  */

41 public interface Container
42 {
43     /**
44      * Work interface identifier.
45      *
46      * @since 1.1-dev
47      */

48     String JavaDoc ROLE = Container.class.getName();
49
50     /**
51      * This is the method that the ContainerComponentManager and Selector use
52      * to gain access to the ComponentHandlers and ComponentSelectors. The
53      * actual access of the ComponentHandler is delegated to the Container.
54      *
55      * @param key The role we intend to access a Component for.
56      * @param hint The hint that we use as a qualifier
57      * (note: if null, the default implementation is returned).
58      *
59      * @return Object a reference to the ComponentHandler or
60      * ComponentSelector for the role/hint combo.
61      *
62      * @throws ServiceException if the container cannot get the component
63      */

64     Object JavaDoc get( String JavaDoc key, Object JavaDoc hint ) throws ServiceException;
65
66     /**
67      * This is the method that the ContainerComponentManager and Selector use
68      * to gain access to the ComponentHandlers and ComponentSelectors. The
69      * actual access of the ComponentHandler is delegated to the Container.
70      *
71      * @param key The role we intend to access a Component for.
72      * @param hint The hint that we use as a qualifier
73      * (note: if null, the default implementation is returned).
74      *
75      * @return true if a reference to the role exists.
76      */

77     boolean has( String JavaDoc key, Object JavaDoc hint );
78 }
79
80
Popular Tags