Class NamingContextImpl
java.lang.Object
org.omg.PortableServer.Servant
org.omg.CosNaming.NamingContextExtPOA
com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl
- All Implemented Interfaces:
NamingContextDataStore,Serializable,InvokeHandler,NamingContextExtOperations,NamingContextOperations
public class NamingContextImpl
extends NamingContextExtPOA
implements NamingContextDataStore, Serializable
Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and
NamingContextExt interface.
The operations bind(), rebind(), bind_context() and rebind_context() are all really implemented by doBind(). resolve() is really implemented by doResolve(), unbind() by doUnbind(). list(), new_context() and destroy() uses the NamingContextDataStore interface directly. All the doX() methods are public static. They synchronize on the NamingContextDataStore object.
None of the methods here are Synchronized because These methods will be invoked from Super class's doBind( ), doResolve( ) which are already Synchronized.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNamingContextImpl(ORB orb, String objKey, NameService theNameService, ServantManagerImpl theServantManagerImpl) Create a naming context servant. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(NameComponent[] n, Object obj) Bind an object under a name in this NamingContext.voidBind(NameComponent n, Object obj, BindingType bt) Implements all flavors of binding( bind and bindcontext) This method will be called from the superclass's doBind( ) method which takes care of all the conditions before calling this method.voidbind_context(NameComponent[] n, NamingContext nc) Bind a NamingContext under a name in this NamingContext.Create a new NamingContext, bind it in this Naming Context and return its object reference.voiddestroy()Destroy this NamingContext object.voidDestroy()Destroys the NamingContext.static ObjectdoResolve(NamingContextDataStore impl, NameComponent[] n) Implements resolving names in this NamingContext.static voiddoUnbind(NamingContextDataStore impl, NameComponent[] n) Implements unbinding bound names in this NamingContext.getNSPOA()booleanIsEmpty()This is a Debugging Methodvoidlist(int how_many, BindingListHolder bl, BindingIteratorHolder bi) List the contents of this NamingContest.voidList(int how_many, BindingListHolder bl, BindingIteratorHolder bi) List the contents of this NamingContext.static StringnameToString(NameComponent[] name) Create a NamingContext object and return its object reference.Create a NamingContext object and return its object reference.voidThis is a Debugging Methodvoidrebind(NameComponent[] n, Object obj) Bind an object under a name in this NamingContext.voidrebind_context(NameComponent[] n, NamingContext nc) Bind a NamingContext under a name in this NamingContext.resolve(NameComponent[] n) Resolve a name in this NamingContext and return the object reference bound to the name.Resolve(NameComponent n, BindingTypeHolder bth) This method resolves the NamingContext or Object Reference for one level The doResolve( ) method calls Resolve( ) recursively to resolve n level Names.resolve_str(String sn) This operation resolves the Stringified name into the object reference.protected static NamingContextImplements resolving a NameComponent in this context and narrowing it to CosNaming::NamingContext.voidvoidsetRootNameService(NameService theNameService) voidsetServantManagerImpl(ServantManagerImpl theServantManagerImpl) This operation converts a Stringified Name into an equivalent array of Name Components.to_string(NameComponent[] n) This operation creates a stringified name from the array of Name components.This operation creates a URL based "iiopname://" format name from the Stringified Name of the object.voidunbind(NameComponent[] n) Remove a binding from this NamingContext.This method Unbinds the NamingContext or Object Reference for one level The doUnbind( ) method from superclass calls Unbind() to recursively Unbind using compound Names.Methods 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_object
-
Constructor Details
-
NamingContextImpl
public NamingContextImpl(ORB orb, String objKey, NameService theNameService, ServantManagerImpl theServantManagerImpl) throws Exception Create a naming context servant. Runs the super constructor.- Parameters:
orb- an ORB object.objKey- as StringTheNameService- as NameServiceTheServantManagerImpl- as ServantManagerImpl- Throws:
Exception- a Java exception.
-
-
Method Details
-
setRootNameService
-
setORB
-
setServantManagerImpl
-
getNSPOA
- Specified by:
getNSPOAin interfaceNamingContextDataStore
-
bind
public void bind(NameComponent[] n, Object obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound Bind an object under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be resolved in this NamingContext and the object bound in resulting NamingContext. An exception is thrown if a binding with the supplied name already exists. If the object to be bound is a NamingContext it will not participate in a recursive resolve.- Specified by:
bindin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name under which the object will be bound.obj- the object reference to be bound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).AlreadyBound- The supplied name is already bound.SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
doBind(com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore,org.omg.CosNaming.NameComponent[],org.omg.CORBA.Object,boolean,org.omg.CosNaming.BindingType)
-
bind_context
public void bind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName, AlreadyBound Bind a NamingContext under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be resolved in this NamingContext and the object bound in resulting NamingContext. An exception is thrown if a binding with the supplied name already exists. The NamingContext will participate in recursive resolving.- Specified by:
bind_contextin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name under which the object will be bound.obj- the NamingContect object reference to be bound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).AlreadyBound- An object is already bound under the supplied name.SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
doBind(com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore,org.omg.CosNaming.NameComponent[],org.omg.CORBA.Object,boolean,org.omg.CosNaming.BindingType)
-
rebind
Bind an object under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be resolved in this NamingContext and the object bound in resulting NamingContext. If a binding under the supplied name already exists it will be unbound first. If the object to be bound is a NamingContext it will not participate in a recursive resolve.- Specified by:
rebindin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name under which the object will be bound.obj- the object reference to be bound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
doBind(com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore,org.omg.CosNaming.NameComponent[],org.omg.CORBA.Object,boolean,org.omg.CosNaming.BindingType)
-
rebind_context
public void rebind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName Bind a NamingContext under a name in this NamingContext. If the name contains multiple (n) components, the first n-1 components will be resolved in this NamingContext and the object bound in resulting NamingContext. If a binding under the supplied name already exists it will be unbound first. The NamingContext will participate in recursive resolving.- Specified by:
rebind_contextin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name under which the object will be bound.obj- the object reference to be bound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
doBind(com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore,org.omg.CosNaming.NameComponent[],org.omg.CORBA.Object,boolean,org.omg.CosNaming.BindingType)
-
resolve
Resolve a name in this NamingContext and return the object reference bound to the name. If the name contains multiple (n) components, the first component will be resolved in this NamingContext and the remaining components resolved in the resulting NamingContext, provided that the NamingContext bound to the first component of the name was bound with bind_context().- Specified by:
resolvein interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name to be resolved.- Returns:
- the object reference bound under the supplied name.
- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
unbind
Remove a binding from this NamingContext. If the name contains multiple (n) components, the first n-1 components will be resolved from this NamingContext and the final component unbound in the resulting NamingContext.- Specified by:
unbindin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name to be unbound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
list
List the contents of this NamingContest. A sequence of bindings is returned (a BindingList) containing up to the number of requested bindings, and a BindingIterator object reference is returned for iterating over the remaining bindings.- Specified by:
listin interfaceNamingContextOperations- 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.- See Also:
-
BindingListHolderBindingIteratorImpl
-
new_context
Create a NamingContext object and return its object reference.- Specified by:
new_contextin interfaceNamingContextOperations- 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.
-
bind_new_context
public NamingContext bind_new_context(NameComponent[] n) throws NotFound, AlreadyBound, CannotProceed, InvalidName Create a new NamingContext, bind it in this Naming Context and return its object reference. This is equivalent to using new_context() followed by bind_context() with the supplied name and the object reference for the newly created NamingContext.- Specified by:
bind_new_contextin interfaceNamingContextOperations- Parameters:
n- a sequence of NameComponents which is the name to be unbound.- Returns:
- an object reference for a new NamingContext object implemented by this Name Server, bound to the supplied name.
- Throws:
AlreadyBound- An object is already bound under the supplied name.NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
destroy
Destroy this NamingContext object. If this NamingContext contains no bindings, the NamingContext is deleted.- Specified by:
destroyin interfaceNamingContextOperations- Throws:
NotEmpty- This NamingContext is not empty (i.e., contains bindings).SystemException- One of a fixed set of CORBA system exceptions.
-
doResolve
public static Object doResolve(NamingContextDataStore impl, NameComponent[] n) throws NotFound, CannotProceed, InvalidName Implements resolving names in this NamingContext. The first component of the supplied name is resolved in this NamingContext by calling Resolve(). If there are no more components in the name, the resulting object reference is returned. Otherwise, the resulting object reference must have been bound as a context and be narrowable to a NamingContext. If this is the case, the remaining components of the name is resolved in the resulting NamingContext. This method is static for maximal reuse - even for extended naming context implementations where the recursive semantics still apply.- Parameters:
impl- an implementation of NamingContextDataStoren- a sequence of NameComponents which is the name to be resolved.- Returns:
- the object reference bound under the supplied name.
- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the first component of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
doUnbind
public static void doUnbind(NamingContextDataStore impl, NameComponent[] n) throws NotFound, CannotProceed, InvalidName Implements unbinding bound names in this NamingContext. If the name contains only one component, the name is unbound in this NamingContext using Unbind(). Otherwise, the first component of the name is resolved in this NamingContext and unbind passed to the resulting NamingContext. This method is static for maximal reuse - even for extended naming context implementations where the recursive semantics still apply.- Parameters:
impl- an implementation of NamingContextDataStoren- a sequence of NameComponents which is the name to be unbound.- Throws:
NotFound- A name with multiple components was supplied, but the first component could not be resolved.CannotProceed- Could not proceed in resolving the n-1 components of the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
resolveFirstAsContext
protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl, NameComponent[] n) throws NotFound Implements resolving a NameComponent in this context and narrowing it to CosNaming::NamingContext. It will throw appropriate exceptions if not found or not narrowable.- Parameters:
impl- an implementation of NamingContextDataStoren- a NameComponents which is the name to be found.- Throws:
NotFound- The first component could not be resolved.CannotProceed- Could not proceed in resolving the first component of the supplied name.SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
nameToString
-
Bind
Implements all flavors of binding( bind and bindcontext) This method will be called from the superclass's doBind( ) method which takes care of all the conditions before calling this method. i.e., It checks whether the Name is already Bounded, Then in the case of rebind it calls Unbind first. This method does one level binding only, To have n-level binding with compound names, doBind( ) calls this method recursively.- Specified by:
Bindin interfaceNamingContextDataStore- Parameters:
n- a sequence of NameComponents which is the name under which the object will be bound.obj- the object reference to be bound.bt- Type of binding (as object or as context).- Throws:
NotFound- raised if the NameComoponent list is invalidCannotProceed- Could not proceed in resolving the Name from the given NameComponentAlreadyBound- An object is already bound under the supplied name.SystemException- One of a fixed set of CORBA system exceptions- See Also:
-
Resolve
This method resolves the NamingContext or Object Reference for one level The doResolve( ) method calls Resolve( ) recursively to resolve n level Names.- Specified by:
Resolvein interfaceNamingContextDataStore- Parameters:
n- a sequence of NameComponents which is the name to be resolved.bt- Type of binding (as object or as context).- Returns:
- the object reference bound under the supplied name.
- Throws:
NotFound- Neither a NamingContext or a Corba Object reference not found under this NameCannotProceed- Could not proceed in resolving the the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
Unbind
This method Unbinds the NamingContext or Object Reference for one level The doUnbind( ) method from superclass calls Unbind() to recursively Unbind using compound Names.- Specified by:
Unbindin interfaceNamingContextDataStore- Parameters:
n- a sequence of NameComponents which is the name to be resolved.- Returns:
- the object reference bound under the supplied name.
- Throws:
NotFound- Neither a NamingContext or a Corba Object reference not found under this NameCannotProceed- Could not proceed in resolving the the supplied name.InvalidName- The supplied name is invalid (i.e., has length less than 1).SystemException- One of a fixed set of CORBA system exceptions.- See Also:
-
List
public void List(int how_many, BindingListHolder bl, BindingIteratorHolder bi) throws SystemException List the contents of this NamingContext. It creates a new PersistentBindingIterator 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 NamingContext object and return its object reference.- 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 the NamingContext.- Specified by:
Destroyin interfaceNamingContextDataStore- Throws:
SystemException- One of a fixed set of CORBA system exceptions.
-
to_string
This operation creates a stringified name from the array of Name components.- Specified by:
to_stringin interfaceNamingContextExtOperations- Parameters:
n- Name of the object- Throws:
org.omg.CosNaming.NamingContextExtPackage.InvalidName- Indicates the name does not identify a binding.InvalidName
-
to_name
This operation converts a Stringified Name into an equivalent array of Name Components.- Specified by:
to_namein interfaceNamingContextExtOperations- Parameters:
sn- Stringified Name of the object- Throws:
org.omg.CosNaming.NamingContextExtPackage.InvalidName- Indicates the name does not identify a binding.InvalidName
-
to_url
This operation creates a URL based "iiopname://" format name from the Stringified Name of the object.- Specified by:
to_urlin interfaceNamingContextExtOperations- Parameters:
addr- internet based address of the host machine where Name Service is runningsn- Stringified Name of the object- Throws:
org.omg.CosNaming.NamingContextExtPackage.InvalidName- Indicates the name does not identify a binding.org.omg.CosNaming.NamingContextPackage.InvalidAddress- Indicates the internet based address of the host machine is incorrectInvalidAddressInvalidName
-
resolve_str
This operation resolves the Stringified name into the object reference.- Specified by:
resolve_strin interfaceNamingContextExtOperations- Parameters:
sn- Stringified Name of the object- Throws:
NotFound- Indicates there is no object reference for the given name.CannotProceed- Indicates that the given compound name is incorrectorg.omg.CosNaming.NamingContextExtPackage.InvalidName- Indicates the name does not identify a binding.InvalidName
-
IsEmpty
public boolean IsEmpty()This is a Debugging Method- Specified by:
IsEmptyin interfaceNamingContextDataStore- Returns:
- true if this NamingContext contains no bindings.
-
printSize
public void printSize()This is a Debugging Method
-