Class TransientNamingContext
java.lang.Object
org.omg.PortableServer.Servant
org.omg.CosNaming.NamingContextExtPOA
com.sun.corba.ee.impl.naming.cosnaming.NamingContextImpl
com.sun.corba.ee.impl.naming.cosnaming.TransientNamingContext
- All Implemented Interfaces:
NamingContextDataStore
,InvokeHandler
,NamingContextExtOperations
,NamingContextOperations
Class TransientNamingContext implements the methods defined
by NamingContextDataStore, and extends the NamingContextImpl class to
provide a servant implementation of CosNaming::NamingContext.
The TransientNamingContext uses a hash table
to store the mappings between bindings and object references and the
hash table is not persistent; thereby the name "transient".
This class should not be used directly; instead, the class
TransientNameService should be instantiated.
The keys in the hash table are InternalBindingKey objects, containing a single NameComponent and implementing the proper functions, i.e., equals() and hashCode() in an efficient manner. The values in the hash table are InternalBindingValues and store a org.omg.CosNaming::Binding and the object reference associated with the binding. For iteration, TransientBindingIterator objects are created, which are passed a cloned copy of the hashtable. Since elements are inserted and deleted and never modified, this provides stable iterators at the cost of cloning the hash table.
To create and destroy object references, the TransientNamingContext uses the orb.connect() and orb.disconnect() methods.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<InternalBindingKey, InternalBindingValue> The local root naming context.private NamingSystemException
Fields inherited from class com.sun.corba.ee.impl.naming.cosnaming.NamingContextImpl
nsPOA, orb
-
Constructor Summary
ConstructorsConstructorDescriptionTransientNamingContext
(ORB orb, Object initial, POA nsPOA) Constructs a new TransientNamingContext object. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
bindImpl
(NameComponent n, Object obj, BindingType bt) Binds the object to the name component as the specified binding type.final void
Destroys this NamingContext by disconnecting from the ORB.private String
A Utility Method For Logging..final boolean
Return whether this NamingContext contains any bindings.final void
listImpl
(int how_many, BindingListHolder bl, BindingIteratorHolder bi) List the contents of this NamingContext.final NamingContext
Create a new NamingContext.final Object
Resolves the supplied name to an object reference and returns the type of the resolved binding.final Object
Deletes the binding with the supplied name.Methods inherited from class com.sun.corba.ee.impl.naming.cosnaming.NamingContextImpl
bind, bind_context, bind_new_context, destroy, doBind, doResolve, doUnbind, getNSPOA, list, new_context, rebind, rebind_context, resolve, resolve_str, resolveFirstAsContext, to_name, to_string, to_url, unbind
Methods inherited from class org.omg.CosNaming.NamingContextExtPOA
_all_interfaces, _invoke, _this, _this
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sun.corba.ee.impl.naming.cosnaming.NamingContextDataStore
getNSPOA
-
Field Details
-
wrapper
-
bindingMap
-
localRoot
The local root naming context.
-
-
Constructor Details
-
TransientNamingContext
Constructs a new TransientNamingContext object.- Parameters:
orb
- an orb object.initial
- the initial naming context.nsPOA
- the POA- Throws:
Exception
- a Java exception thrown of the base class cannot initialize.
-
-
Method Details
-
bindImpl
Binds the object to the name component as the specified binding type. It creates a InternalBindingKey object and a InternalBindingValue object and inserts them in the hash table.- Specified by:
bindImpl
in interfaceNamingContextDataStore
- Parameters:
n
- A single org.omg.CosNaming::NameComponent under which the object will be bound.obj
- An object reference to be bound under the supplied name.bt
- The type of the binding (i.e., as object or as context).- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
resolveImpl
Resolves the supplied name to an object reference and returns the type of the resolved binding. It creates a InternalBindingKey and uses the key for looking up in the hash table. If nothing is found an exception is thrown, otherwise the object reference is returned and the binding type set.- Specified by:
resolveImpl
in interfaceNamingContextDataStore
- Parameters:
n
- a NameComponent which is the name to be resolved.bth
- the BindingType as an out parameter.- Returns:
- the object reference bound under the supplied name, null if not found.
- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
unbindImpl
Deletes the binding with the supplied name. It creates a InternalBindingKey and uses it to remove the value associated with the key. If nothing is found an exception is thrown, otherwise the element is removed from the hash table.- Specified by:
unbindImpl
in interfaceNamingContextDataStore
- Parameters:
n
- a NameComponent which is the name to unbind- Returns:
- the object reference bound to the name, or null if not found.
- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
listImpl
public final void listImpl(int how_many, BindingListHolder bl, BindingIteratorHolder bi) throws SystemException List the contents of this NamingContext. It creates a new TransientBindingIterator object and passes it a clone of the hash table and an orb object. It then uses the newly created object to return the required number of bindings.- Specified by:
listImpl
in interfaceNamingContextDataStore
- Parameters:
how_many
- The number of requested bindings in the BindingList.bl
- The BindingList as an out parameter.bi
- The BindingIterator as an out parameter.- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
newContextImpl
Create a new NamingContext. It creates a new TransientNamingContext object, passing it the orb object.- Specified by:
newContextImpl
in interfaceNamingContextDataStore
- Returns:
- an object reference for a new NamingContext object implemented by this Name Server.
- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
destroyImpl
Destroys this NamingContext by disconnecting from the ORB.- Specified by:
destroyImpl
in interfaceNamingContextDataStore
- Throws:
SystemException
- One of a fixed set of CORBA system exceptions.
-
getName
A Utility Method For Logging.. -
isEmptyImpl
public final boolean isEmptyImpl()Return whether this NamingContext contains any bindings. It forwards this request to the hash table.- Specified by:
isEmptyImpl
in interfaceNamingContextDataStore
- Returns:
- true if this NamingContext contains no bindings.
-