org.apache.avalon.excalibur.naming
Class AbstractLocalContext

java.lang.Object
  |
  +--org.apache.avalon.excalibur.naming.AbstractContext
        |
        +--org.apache.avalon.excalibur.naming.AbstractLocalContext
All Implemented Interfaces:
javax.naming.Context
Direct Known Subclasses:
MemoryContext

public abstract class AbstractLocalContext
extends AbstractContext

Abstract local JNDI Context that can be inherited from to provide a particular type of Context. These contexts are assumed to be on the same machine.

Version:
$Revision: 1.2 $
Author:
Peter Donald

Field Summary
protected  Namespace m_namespace
           
protected  javax.naming.Context m_parent
           
 
Fields inherited from class org.apache.avalon.excalibur.naming.AbstractContext
m_environment
 
Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
 
Constructor Summary
AbstractLocalContext(Namespace namespace, java.util.Hashtable environment, javax.naming.Context parent)
           
 
Method Summary
protected  void bind(javax.naming.Name name, java.lang.Object object, boolean rebind)
          Helper method to bind
protected  void checkUnbindContext(javax.naming.Name name, java.lang.Object entry)
           
protected abstract  javax.naming.Context cloneContext()
           
 void close()
          Release resources associated with context.
 javax.naming.Context createSubcontext(javax.naming.Name name)
          Create a Subcontext.
 void destroySubcontext(javax.naming.Name name)
           
protected abstract  void doLocalBind(javax.naming.Name name, java.lang.Object object)
           
protected abstract  javax.naming.NamingEnumeration doLocalList()
           
protected abstract  javax.naming.NamingEnumeration doLocalListBindings()
           
protected abstract  java.lang.Object doLocalLookup(javax.naming.Name name)
          Actually lookup raw entry in local context.
protected abstract  void doLocalUnbind(javax.naming.Name name)
          Actually unbind raw entry in local context.
 java.lang.String getNameInNamespace()
           
protected  javax.naming.NameParser getNameParser()
           
protected  boolean isDestroyableContext(java.lang.Object object)
           
 javax.naming.NamingEnumeration list(javax.naming.Name name)
          Enumerates the names bound in the named context.
 javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
          Enumerates the names bound in the named context, along with the objects bound to them.
protected  java.lang.Object localLookup(javax.naming.Name name)
          Lookup entry in local context.
 java.lang.Object lookup(javax.naming.Name name)
          Get the object named.
protected  javax.naming.Context lookupSubContext(javax.naming.Name name)
          Lookup a sub-context of current context.
protected abstract  javax.naming.Context newContext()
           
 void unbind(javax.naming.Name name)
          Unbind a object from a name.
 
Methods inherited from class org.apache.avalon.excalibur.naming.AbstractContext
addToEnvironment, bind, bind, composeName, composeName, createSubcontext, destroySubcontext, getEnvironment, getLeafName, getNameParser, getNameParser, getPathName, isSelf, list, listBindings, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_parent

protected javax.naming.Context m_parent

m_namespace

protected Namespace m_namespace
Constructor Detail

AbstractLocalContext

public AbstractLocalContext(Namespace namespace,
                            java.util.Hashtable environment,
                            javax.naming.Context parent)
Method Detail

isDestroyableContext

protected boolean isDestroyableContext(java.lang.Object object)
                                throws javax.naming.NamingException

newContext

protected abstract javax.naming.Context newContext()
                                            throws javax.naming.NamingException

cloneContext

protected abstract javax.naming.Context cloneContext()
                                              throws javax.naming.NamingException

bind

protected void bind(javax.naming.Name name,
                    java.lang.Object object,
                    boolean rebind)
             throws javax.naming.NamingException
Helper method to bind
Overrides:
bind in class AbstractContext

doLocalBind

protected abstract void doLocalBind(javax.naming.Name name,
                                    java.lang.Object object)
                             throws javax.naming.NamingException

close

public void close()
Description copied from class: AbstractContext
Release resources associated with context.
Overrides:
close in class AbstractContext

createSubcontext

public javax.naming.Context createSubcontext(javax.naming.Name name)
                                      throws javax.naming.NamingException
Create a Subcontext.
Parameters:
name - the name of subcontext
Returns:
the created context
Throws:
javax.naming.NamingException - if an error occurs (ie context exists, badly formated name etc)

destroySubcontext

public void destroySubcontext(javax.naming.Name name)
                       throws javax.naming.NamingException

checkUnbindContext

protected void checkUnbindContext(javax.naming.Name name,
                                  java.lang.Object entry)
                           throws javax.naming.NamingException

getNameInNamespace

public java.lang.String getNameInNamespace()
                                    throws javax.naming.NamingException

getNameParser

protected javax.naming.NameParser getNameParser()
                                         throws javax.naming.NamingException
Overrides:
getNameParser in class AbstractContext

list

public javax.naming.NamingEnumeration list(javax.naming.Name name)
                                    throws javax.naming.NamingException
Enumerates the names bound in the named context.
Parameters:
name - the name of the context
Returns:
the enumeration
Throws:
javax.naming.NamingException - if an error occurs

doLocalList

protected abstract javax.naming.NamingEnumeration doLocalList()
                                                       throws javax.naming.NamingException

doLocalListBindings

protected abstract javax.naming.NamingEnumeration doLocalListBindings()
                                                               throws javax.naming.NamingException

listBindings

public javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
                                            throws javax.naming.NamingException
Enumerates the names bound in the named context, along with the objects bound to them.
Parameters:
name - the name of the context
Returns:
the enumeration
Throws:
javax.naming.NamingException - if an error occurs

lookup

public java.lang.Object lookup(javax.naming.Name name)
                        throws javax.naming.NamingException
Get the object named.
Parameters:
name - the name
Returns:
the object
Throws:
javax.naming.NamingException - if an error occurs (ie object name is inavlid or unbound)

localLookup

protected java.lang.Object localLookup(javax.naming.Name name)
                                throws javax.naming.NamingException
Lookup entry in local context.
Parameters:
name - the name in local context (size() == 1)
Returns:
the bound object
Throws:
javax.naming.NamingException - if an error occurs

doLocalLookup

protected abstract java.lang.Object doLocalLookup(javax.naming.Name name)
                                           throws javax.naming.NamingException
Actually lookup raw entry in local context. When overidding this it is not neccesary to resolve references etc.
Parameters:
name - the name in local context (size() == 1)
Returns:
the bound object
Throws:
javax.naming.NamingException - if an error occurs

lookupSubContext

protected javax.naming.Context lookupSubContext(javax.naming.Name name)
                                         throws javax.naming.NamingException
Lookup a sub-context of current context. Note that name must have 1 or more elements.
Parameters:
name - the name of subcontext
Returns:
the sub-Context
Throws:
javax.naming.NamingException - if an error occurs (like named entry is not a Context)

unbind

public void unbind(javax.naming.Name name)
            throws javax.naming.NamingException
Unbind a object from a name.
Parameters:
name - the name
Throws:
javax.naming.NamingException - if an error occurs

doLocalUnbind

protected abstract void doLocalUnbind(javax.naming.Name name)
                               throws javax.naming.NamingException
Actually unbind raw entry in local context.
Parameters:
name - the name in local context (size() == 1)
Throws:
javax.naming.NamingException - if an error occurs


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.