KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > naming > ContainerNaming


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: ContainerNaming.java,v 1.7 2005/06/06 11:20:35 benoitf Exp $
22  */

23 package org.objectweb.jonas_lib.naming;
24
25 import javax.naming.Context JavaDoc;
26 import javax.naming.NamingException JavaDoc;
27 import java.util.Hashtable JavaDoc;
28 import javax.naming.InitialContext JavaDoc;
29
30 /**
31  * Provide naming services for Web and EJB containers. Containers use this
32  * interface for binding the environment entries, remote object references,
33  * resource factories and for managing the naming context of the current
34  * thread.
35  *
36  * @author Lutris
37   */

38 public interface ContainerNaming {
39
40     /**
41      * Create context for application and component environments.
42      * Called by Web Container for each Web Application (as defined in
43      * web.xml). Called by EJB Container for each ejb component (as defined
44      * in ejb-jar.xml). The returned context provides an independent
45      * namespace for each components environment values, and resources.
46      *
47      * @param namespace Subcontext name(s) to create under Server Root.
48      * Usually consists of application name + component name.
49      * <pre>
50      * Examples:
51      * "App1/WebWar1" for Web Application
52      * "App1/EJBJar1/EJBName" for ejb in Enterprise Application.
53      * </pre>
54      * @return Naming context for component environment
55      * @throws NamingException If exception encountered creating namespace.
56      *
57      */

58     Context JavaDoc createEnvironmentContext(String JavaDoc namespace) throws NamingException JavaDoc;
59
60     /**
61      * Create immutable context for application and component environments.
62      * Called by Web Container for each Web Application (as defined in
63      * web.xml). Called by EJB Container for each ejb component (as defined
64      * in ejb-jar.xml). The returned context provides an independent
65      * namespace for each components environment values, and resources. This
66      * context must exist in the underlying name service. It must be
67      * previously created by an earlier deployment.
68      *
69      * @param namespace Subcontext name(s) to create under Server Root.
70      * Usually consists of application name + component name.
71      * <pre>
72      * Examples:
73      * "App1/WebWar1" for Web Application
74      * "App1/EJBJar1/EJBName" for ejb in Enterprise Application.
75      * </pre>
76      * @return Naming context for component environment
77      * @throws NamingException If context namespace does not exist.
78      *
79      */

80     Context JavaDoc createImmutableEnvironmentContext(String JavaDoc namespace)
81         throws NamingException JavaDoc;
82
83     /**
84      * Return the Context associated with the current thread.
85      *
86      * @return Context for current thread.
87      * @throws NamingException If context namespace does not exist.
88      */

89     Context JavaDoc getComponentContext() throws NamingException JavaDoc;
90
91     /**
92      * Aassociate this Context with the current thread.
93      * This method should be called in preinvoke/postinvoke
94      * and when we build the bean environment.
95      *
96      * @param ctx Context to associate with the current thread.
97      * @return Previous context setting for current thread.
98      */

99     Context JavaDoc setComponentContext(Context JavaDoc ctx);
100
101     /**
102      * Set back the context with the given value.
103      * Don't return the previous context, use setComponentContext() method for this.
104      * @param ctx the context to associate to the current thread.
105      */

106     void resetComponentContext(Context JavaDoc ctx);
107
108     /**
109      * Associate the specified CompNamingContext with the given classloader.
110      * @param ctx the context to associate to the classloader.
111      * @param cl the classloader which is bind to the context.
112      */

113     void setComponentContext(Context JavaDoc ctx, ClassLoader JavaDoc cl);
114
115     /**
116      * Set the context used by client container (per JVM instead of per thread)
117      * @param ctx the context to set
118      */

119     void setClientContainerComponentContext(Context JavaDoc ctx);
120
121     /**
122      * Return the CompNamingContext associated with the given classloader.
123      * @param cl the classloader which is bind to the context.
124      * @return the CompNamingContext associated with the given classloader.
125      */

126     Context JavaDoc getComponentContext(ClassLoader JavaDoc cl);
127
128     /**
129      * Remove the CompNamingContext associated with the given classloader.
130      * @param cl the classloader which is bind to the context.
131      */

132     void unSetComponentContext(ClassLoader JavaDoc cl);
133
134     /**
135      * Gets the initial context
136      * @return the initial context
137      */

138     InitialContext JavaDoc getInitialContext();
139
140     /**
141      * @return the environment associated to this initial context
142      */

143     Hashtable JavaDoc getEnv();
144 }
145
Popular Tags