001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.naming.hessian;
030:
031: import com.caucho.log.Log;
032: import com.caucho.naming.AbstractModel;
033: import com.caucho.naming.ContextImpl;
034: import com.caucho.util.L10N;
035:
036: import javax.naming.NamingException;
037: import java.util.Hashtable;
038: import java.util.logging.Logger;
039:
040: /**
041: * Hessian implementation of the JNDI <code>Context</code>.
042: * The actual storage of the persistent data is in
043: * the <code>AbstractModel</code>.
044: */
045: public class HessianContextImpl extends ContextImpl {
046: protected static final Logger dbg = Log
047: .open(HessianContextImpl.class);
048: protected static final L10N L = new L10N(HessianContextImpl.class);
049:
050: /**
051: * Creates a <code>ContextImpl</code>.
052: *
053: * @param model The underlying storage node.
054: * @param env The client's JNDI environment.
055: */
056: public HessianContextImpl(AbstractModel model, Hashtable env) {
057: super (model, env);
058: }
059:
060: /**
061: * Creates a <code>ContextImpl</code>.
062: *
063: * @param name JNDI name, used for error messages, etc.
064: * @param model The underlying storage node.
065: * @param env The client's JNDI environment.
066: */
067: public HessianContextImpl(String name, AbstractModel model,
068: Hashtable env) {
069: super (name, model, env);
070: }
071:
072: /**
073: * Creates a new instance of the <code>ContextImpl</code>. Subclasses will
074: * override this method to return a new instance of the subclass.
075: *
076: * @param name the JNDI name for the new context
077: * @param model the underlying storage node
078: * @param env the client's JNDI environment.
079: *
080: * @return a new instance of the implementing class.
081: */
082: protected ContextImpl create(String name, AbstractModel model,
083: Hashtable env) {
084: return new HessianContextImpl(name, model, env);
085: }
086:
087: /**
088: * Parses the head of the name.
089: */
090: protected String parseFirst(String name) throws NamingException {
091: return name;
092: }
093:
094: /**
095: * Parses the tail of the name.
096: */
097: protected String parseRest(String name) throws NamingException {
098: return null;
099: }
100:
101: /**
102: * Returns a string value.
103: */
104: public String toString() {
105: return "HessianContextImpl[" + getName() + "]";
106: }
107: }
|