org.mockcentral.server
Class MockCentralTestingContext

java.lang.Object
  extended by javax.naming.InitialContext
      extended by org.mockcentral.server.MockCentralTestingContext
All Implemented Interfaces:
javax.naming.Context

public class MockCentralTestingContext
extends javax.naming.InitialContext

A lightweight extension of the javax.naming.InitialContext class, using a HashMap to bind lookup names to proxy Objects for the application.

Author:
David Hutchinson

Field Summary
 
Fields inherited from class javax.naming.InitialContext
defaultInitCtx, gotDefault, myProps
 
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
MockCentralTestingContext()
          Creates a new instance.
 
Method Summary
 void bind(java.lang.String name, java.lang.Object object)
          Puts the supplied Object into the map of bound objects keyed to the supplied name.
 java.lang.Object lookup(java.lang.String name)
          Returns the Object stored in the map of bound Objects under the supplied name.
 void reset()
          Clears the map of bound Objects.
 
Methods inherited from class javax.naming.InitialContext
addToEnvironment, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, doLookup, doLookup, getDefaultInitCtx, getEnvironment, getNameInNamespace, getNameParser, getNameParser, getURLOrDefaultInitCtx, getURLOrDefaultInitCtx, init, list, list, listBindings, listBindings, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockCentralTestingContext

public MockCentralTestingContext()
                          throws javax.naming.NamingException
Creates a new instance.

Throws:
javax.naming.NamingException - per the superclass Constructor.
Method Detail

bind

public void bind(java.lang.String name,
                 java.lang.Object object)
          throws javax.naming.NamingException
Puts the supplied Object into the map of bound objects keyed to the supplied name.

Specified by:
bind in interface javax.naming.Context
Overrides:
bind in class javax.naming.InitialContext
Parameters:
name - the key under which to store the Object.
object - the Object to store.
Throws:
javax.naming.NamingException - per the interface method signature.

lookup

public java.lang.Object lookup(java.lang.String name)
Returns the Object stored in the map of bound Objects under the supplied name.

Specified by:
lookup in interface javax.naming.Context
Overrides:
lookup in class javax.naming.InitialContext
Parameters:
name - the key to use to get the Object from the map.
Returns:
the Object stored in the map of bound Objects under the supplied name.

reset

public void reset()
Clears the map of bound Objects.