KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > naming > burlap > BurlapContextImpl


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.naming.burlap;
30
31 import com.caucho.log.Log;
32 import com.caucho.naming.AbstractModel;
33 import com.caucho.naming.ContextImpl;
34 import com.caucho.util.L10N;
35
36 import javax.naming.NamingException JavaDoc;
37 import java.util.Hashtable JavaDoc;
38 import java.util.logging.Logger JavaDoc;
39
40 /**
41  * Burlap implementation of the JNDI <code>Context</code>.
42  * The actual storage of the persistent data is in
43  * the <code>AbstractModel</code>.
44  */

45 public class BurlapContextImpl extends ContextImpl {
46   protected static final Logger JavaDoc dbg = Log.open(BurlapContextImpl.class);
47   protected static final L10N L = new L10N(BurlapContextImpl.class);
48
49   /**
50    * Creates a <code>ContextImpl</code>.
51    *
52    * @param model The underlying storage node.
53    * @param env The client's JNDI environment.
54    */

55   public BurlapContextImpl(AbstractModel model, Hashtable JavaDoc env)
56   {
57     super(model, env);
58   }
59
60   /**
61    * Creates a <code>ContextImpl</code>.
62    *
63    * @param name JNDI name, used for error messages, etc.
64    * @param model The underlying storage node.
65    * @param env The client's JNDI environment.
66    */

67   public BurlapContextImpl(String JavaDoc name, AbstractModel model, Hashtable JavaDoc env)
68   {
69     super(name, model, env);
70   }
71
72   /**
73    * Creates a new instance of the <code>ContextImpl</code>. Subclasses will
74    * override this method to return a new instance of the subclass.
75    *
76    * @param name the JNDI name for the new context
77    * @param model the underlying storage node
78    * @param env the client's JNDI environment.
79    *
80    * @return a new instance of the implementing class.
81    */

82   protected ContextImpl create(String JavaDoc name, AbstractModel model, Hashtable JavaDoc env)
83   {
84     return new BurlapContextImpl(name, model, env);
85   }
86
87   /**
88    * Parses the head of the name.
89    */

90   protected String JavaDoc parseFirst(String JavaDoc name)
91     throws NamingException JavaDoc
92   {
93     return name;
94   }
95     
96   /**
97    * Parses the tail of the name.
98    */

99   protected String JavaDoc parseRest(String JavaDoc name)
100     throws NamingException JavaDoc
101   {
102     return null;
103   }
104
105   /**
106    * Returns a string value.
107    */

108   public String JavaDoc toString()
109   {
110     return "BurlapContextImpl[" + getName() + "]";
111   }
112 }
113
Popular Tags