org.jnp.server
Class NamingServer

java.lang.Object
  extended by org.jnp.server.NamingServer
All Implemented Interfaces:
Serializable, Remote, Naming, NamingEvents
Direct Known Subclasses:
SingletonNamingServer

public class NamingServer
extends Object
implements Naming, NamingEvents, Serializable

The in memory JNDI naming server implementation class.

Version:
$Revision: 80569 $
Author:
Rickard Oberg, patriot1burke, Scott.Stark@jboss.org
See Also:
Serialized Form

Field Summary
protected  NamingServer parent
           
protected  NamingParser parser
           
protected  Name prefix
           
protected  Map<String,Binding> table
           
 
Constructor Summary
NamingServer()
           
NamingServer(Name prefix, NamingServer parent)
           
NamingServer(Name prefix, NamingServer parent, EventMgr eventMgr)
           
NamingServer(Name prefix, NamingServer parent, EventMgr eventMgr, SecurityManager secMgr)
           
 
Method Summary
 void addNamingListener(EventContext context, Name target, int scope, NamingListener l)
          Adds a listener for receiving naming events fired when the object(s) identified by a target and scope changes.
 void bind(Name name, Object obj, String className)
           
protected  NamingServer createNamingServer(Name prefix, NamingServer parent)
          Create sub naming.
 Context createSubcontext(Name name)
           
protected  Map<String,Binding> createTable()
           
protected  void fireEvent(Name fullName, Binding oldb, Binding newb, int type, String changeInfo)
           
 Naming getRoot()
           
 Collection<NameClassPair> list(Name name)
           
 Collection<Binding> listBindings(Name name)
           
 Object lookup(Name name)
           
 void rebind(Name name, Object obj, String className)
           
 void removeNamingListener(NamingListener l)
          Removes a listener from receiving naming events
 boolean targetMustExist()
          We don't need targets to exist?
 void unbind(Name name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected Map<String,Binding> table

prefix

protected Name prefix

parser

protected NamingParser parser

parent

protected NamingServer parent
Constructor Detail

NamingServer

public NamingServer()
             throws NamingException
Throws:
NamingException

NamingServer

public NamingServer(Name prefix,
                    NamingServer parent)
             throws NamingException
Throws:
NamingException

NamingServer

public NamingServer(Name prefix,
                    NamingServer parent,
                    EventMgr eventMgr)
             throws NamingException
Throws:
NamingException

NamingServer

public NamingServer(Name prefix,
                    NamingServer parent,
                    EventMgr eventMgr,
                    SecurityManager secMgr)
             throws NamingException
Throws:
NamingException
Method Detail

addNamingListener

public void addNamingListener(EventContext context,
                              Name target,
                              int scope,
                              NamingListener l)
                       throws NamingException
Description copied from interface: NamingEvents
Adds a listener for receiving naming events fired when the object(s) identified by a target and scope changes.

Specified by:
addNamingListener in interface NamingEvents
Parameters:
context - - the non-null EventContext the listener is registering with
target - A non-null name to be resolved relative to this context.
scope - One of OBJECT_SCOPE, ONELEVEL_SCOPE, or SUBTREE_SCOPE.
l - The non-null listener.
Throws:
NamingException - If a problem was encountered while adding the listener.
See Also:
NamingEvents.removeNamingListener(javax.naming.event.NamingListener)

removeNamingListener

public void removeNamingListener(NamingListener l)
                          throws NamingException
Description copied from interface: NamingEvents
Removes a listener from receiving naming events

Specified by:
removeNamingListener in interface NamingEvents
Parameters:
l - non-null listener.
Throws:
NamingException - If a problem was encountered while removing the listener.
See Also:
NamingEvents.addNamingListener(javax.naming.event.EventContext, javax.naming.Name, int, javax.naming.event.NamingListener)

targetMustExist

public boolean targetMustExist()
                        throws NamingException
We don't need targets to exist?

Specified by:
targetMustExist in interface NamingEvents
Returns:
false
Throws:
NamingException

bind

public void bind(Name name,
                 Object obj,
                 String className)
          throws NamingException
Specified by:
bind in interface Naming
Throws:
NamingException

rebind

public void rebind(Name name,
                   Object obj,
                   String className)
            throws NamingException
Specified by:
rebind in interface Naming
Throws:
NamingException

unbind

public void unbind(Name name)
            throws NamingException
Specified by:
unbind in interface Naming
Throws:
NamingException

lookup

public Object lookup(Name name)
              throws NamingException
Specified by:
lookup in interface Naming
Throws:
NamingException

list

public Collection<NameClassPair> list(Name name)
                               throws NamingException
Specified by:
list in interface Naming
Throws:
NamingException

listBindings

public Collection<Binding> listBindings(Name name)
                                 throws NamingException
Specified by:
listBindings in interface Naming
Throws:
NamingException

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException
Specified by:
createSubcontext in interface Naming
Throws:
NamingException

getRoot

public Naming getRoot()

createTable

protected Map<String,Binding> createTable()

createNamingServer

protected NamingServer createNamingServer(Name prefix,
                                          NamingServer parent)
                                   throws NamingException
Create sub naming.

Parameters:
prefix - the prefix
parent - the parent naming server
Returns:
new sub instance
Throws:
NamingException - for any error

fireEvent

protected void fireEvent(Name fullName,
                         Binding oldb,
                         Binding newb,
                         int type,
                         String changeInfo)
                  throws NamingException
Throws:
NamingException


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.