Class TransientNamingContext
java.lang.Object
org.omg.PortableServer.Servant
org.omg.CosNaming.NamingContextExtPOA
com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl
com.sun.corba.se.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.
-
Field Summary
FieldsFields inherited from class com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl
debug, nsPOA, orb -
Constructor Summary
ConstructorsConstructorDescriptionTransientNamingContext(ORB orb, Object initial, POA nsPOA) Constructs a new TransientNamingContext object. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidBind(NameComponent n, Object obj, BindingType bt) Binds the object to the name component as the specified binding type.final voidDestroy()Destroys this NamingContext by disconnecting from the ORB.final booleanIsEmpty()Return whether this NamingContext contains any bindings.final voidList(int how_many, BindingListHolder bl, BindingIteratorHolder bi) List the contents of this NamingContext.final NamingContextCreate a new NamingContext.final ObjectResolve(NameComponent n, BindingTypeHolder bth) Resolves the supplied name to an object reference and returns the type of the resolved binding.final ObjectDeletes the binding with the supplied name.Methods inherited from class com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl
bind, bind_context, bind_new_context, destroy, doBind, doResolve, doUnbind, getNSPOA, list, nameToString, new_context, rebind, rebind_context, resolve, resolve_str, resolveFirstAsContext, to_name, to_string, to_url, unbindMethods inherited from class org.omg.CosNaming.NamingContextExtPOA
_all_interfaces, _invoke, _this, _thisMethods 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_objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore
getNSPOA
-
Field Details
-
localRoot
The local root naming context.
-
-
Constructor Details
-
TransientNamingContext
Constructs a new TransientNamingContext object.- Parameters:
orb- an orb object.initial- the initial naming context.- Throws:
Exception- a Java exception thrown of the base class cannot initialize.
-
-
Method Details
-
Bind
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:
Bindin 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.
-
Resolve
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:
Resolvein 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.
-
Unbind
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:
Unbindin 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.
-
List
public final void List(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:
Listin 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.
-
NewContext
Create a new NamingContext. It creates a new TransientNamingContext object, passing it the orb object.- Specified by:
NewContextin 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.
-
Destroy
Destroys this NamingContext by disconnecting from the ORB.- Specified by:
Destroyin interfaceNamingContextDataStore- Throws:
SystemException- One of a fixed set of CORBA system exceptions.
-
IsEmpty
public final boolean IsEmpty()Return whether this NamingContext contains any bindings. It forwards this request to the hash table.- Specified by:
IsEmptyin interfaceNamingContextDataStore- Returns:
- true if this NamingContext contains no bindings.
-