1
// ========================================================================
2
// $Id: InitialContextFactory.java 1327 2006-11-27 18:40:14Z janb $
3
// Copyright 1999-2006 Mort Bay Consulting Pty. Ltd.
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
// http://www.apache.org/licenses/LICENSE-2.0
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 implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
16
package org.mortbay.naming;
19
import java.util.Hashtable;
20
import java.util.Properties;
22
import javax.naming.CompoundName;
23
import javax.naming.Context;
24
import javax.naming.Name;
25
import javax.naming.NameParser;
26
import javax.naming.NamingException;
28
import org.mortbay.log.Log;
29
import org.mortbay.naming.local.localContextRoot;
32
/*------------------------------------------------*/
34
* InitialContextFactory.java
36
* Factory for the default InitialContext.
37
* Created: Tue Jul 1 19:08:08 2003
39
* @author <a href="mailto:janb@mortbay.com">Jan Bartel</a>
42
public class InitialContextFactory implements javax.naming.spi.InitialContextFactory
44
public static class DefaultParser implements NameParser
46
static Properties syntax = new Properties();
49
syntax.put("jndi.syntax.direction", "left_to_right");
50
syntax.put("jndi.syntax.separator", "/");
51
syntax.put("jndi.syntax.ignorecase", "false");
53
public Name parse (String name)
54
throws NamingException
56
return new CompoundName (name, syntax);
62
/*------------------------------------------------*/
64
* Get Context that has access to default Namespace.
65
* This method won't be called if a name URL beginning
66
* with java: is passed to an InitialContext.
68
* @see org.mortbay.naming.java.javaURLContextFactory
69
* @param env a <code>Hashtable</code> value
70
* @return a <code>Context</code> value
72
public Context getInitialContext(Hashtable env)
74
Log.debug("InitialContextFactory.getInitialContext()");
76
Context ctx = new localContextRoot(env);
77
if(Log.isDebugEnabled())Log.debug("Created initial context delegate for local namespace:"+ctx);