KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > naming > java > javaURLContextFactory


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

17
18 package org.apache.geronimo.naming.java;
19
20 import java.util.Hashtable JavaDoc;
21 import javax.naming.Context JavaDoc;
22 import javax.naming.Name JavaDoc;
23 import javax.naming.OperationNotSupportedException JavaDoc;
24 import javax.naming.spi.ObjectFactory JavaDoc;
25
26 /**
27  * URLContextFactory for the java: JNDI namespace.
28  *
29  * @version $Rev: 126558 $ $Date: 2005-01-26 15:13:09 -0800 (Wed, 26 Jan 2005) $
30  */

31 public class javaURLContextFactory implements ObjectFactory JavaDoc {
32     /**
33      * Return a Context that is able to resolve names in the java: namespace.
34      * The root context, "java:" is always returned. This is a specific
35      * implementation of a URLContextFactory and not a general ObjectFactory.
36      * @param obj must be null
37      * @param name ignored
38      * @param nameCtx ignored
39      * @param environment ignored
40      * @return the Context for "java:"
41      * @throws javax.naming.OperationNotSupportedException if obj is not null
42      */

43     public Object JavaDoc getObjectInstance(Object JavaDoc obj, Name JavaDoc name, Context JavaDoc nameCtx, Hashtable JavaDoc environment) throws Exception JavaDoc {
44         if (obj == null) {
45             return new RootContext();
46         } else {
47             throw new OperationNotSupportedException JavaDoc();
48         }
49     }
50 }
51
Popular Tags