org.apache.avalon.excalibur.naming
Class AbstractURLContext

java.lang.Object
  |
  +--org.apache.avalon.excalibur.naming.AbstractContext
        |
        +--org.apache.avalon.excalibur.naming.AbstractURLContext
All Implemented Interfaces:
javax.naming.Context, javax.naming.NameParser

public abstract class AbstractURLContext
extends AbstractContext
implements javax.naming.NameParser

Abstract JNDI Context that can be inherited from to provide a particular type of Context.

Version:
$Revision: 1.2 $
Author:
Peter Donald

Field Summary
protected  java.lang.String m_scheme
           
 
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
AbstractURLContext(java.lang.String scheme, java.util.Hashtable environment)
           
 
Method Summary
protected  void bind(javax.naming.Name name, java.lang.Object object, boolean rebind)
          Helper method to bind
 javax.naming.Context createSubcontext(javax.naming.Name name)
          Create a Subcontext.
 void destroySubcontext(javax.naming.Name name)
           
protected  javax.naming.spi.ResolveResult getBaseURLContext(javax.naming.Name name, java.util.Hashtable environment)
           
protected  int getEndIndexOfURLPart(java.lang.String name, int index)
          Find end index of url part in string.
 java.lang.String getNameInNamespace()
           
protected  javax.naming.NameParser getNameParser()
           
 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.
 java.lang.Object lookup(javax.naming.Name name)
          Get the object named.
protected abstract  javax.naming.Context newContext(java.lang.String urlPart)
          Return a new instance of the base context for a URL.
 javax.naming.Name parse(java.lang.String name)
           
 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, close, 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_scheme

protected final java.lang.String m_scheme
Constructor Detail

AbstractURLContext

public AbstractURLContext(java.lang.String scheme,
                          java.util.Hashtable environment)
Method Detail

parse

public javax.naming.Name parse(java.lang.String name)
                        throws javax.naming.NamingException
Specified by:
parse in interface javax.naming.NameParser

getNameParser

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

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

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

getNameInNamespace

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

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

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)

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

getBaseURLContext

protected javax.naming.spi.ResolveResult getBaseURLContext(javax.naming.Name name,
                                                           java.util.Hashtable environment)
                                                    throws javax.naming.NamingException

getEndIndexOfURLPart

protected int getEndIndexOfURLPart(java.lang.String name,
                                   int index)
                            throws javax.naming.NamingException
Find end index of url part in string. Default implementation looks for //.../[name-part] ///[name-part] //... (no name part) [name-part]
Parameters:
name - the name
index - the index where "scheme:" ends
Returns:
the index where url ends
Throws:
javax.naming.NamingException - if an error occurs

newContext

protected abstract javax.naming.Context newContext(java.lang.String urlPart)
                                            throws javax.naming.NamingException
Return a new instance of the base context for a URL. This must be implemented in particular URLContext.
Parameters:
urlPart - the part of url string not including "scheme:"
Returns:
a base URLContext for urlPart
Throws:
javax.naming.NamingException - if an error occurs


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