Class NamingContextImpl
- java.lang.Object
-
- org.omg.PortableServer.Servant
-
- org.omg.CosNaming.NamingContextExtPOA
-
- com.sun.corba.ee.impl.naming.cosnaming.NamingContextImpl
-
- All Implemented Interfaces:
NamingContextDataStore
,InvokeHandler
,NamingContextExtOperations
,NamingContextOperations
- Direct Known Subclasses:
TransientNamingContext
public abstract class NamingContextImpl extends NamingContextExtPOA implements NamingContextDataStore
Class NamingContextImpl implements the org.omg.CosNaming::NamingContext interface, but does not implement the methods associated with maintaining the "table" of current bindings in a NamingContext. Instead, this implementation assumes that the derived implementation implements the NamingContextDataStore interface, which has the necessary methods. This allows multiple NamingContext implementations that differ in storage of the bindings, as well as implementations of interfaces derived from CosNaming::NamingContext that still reuses the implementation.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.
An implementation a NamingContext must extend this class and implement the NamingContextDataStore interface with the operations: Bind(), Resolve(), Unbind(), List(), NewContext() and Destroy(). Calls to these methods are synchronized; these methods should therefore not be synchronized.
-
-
Field Summary
Fields Modifier and Type Field Description private InterOperableNamingImpl
insImpl
protected POA
nsPOA
protected ORB
orb
private static NamingSystemException
wrapper
-
Constructor Summary
Constructors Constructor Description NamingContextImpl(ORB orb, POA poa)
Create a naming context servant.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(NameComponent[] n, Object obj)
Bind an object under a name in this NamingContext.void
bind_context(NameComponent[] n, NamingContext nc)
Bind a NamingContext under a name in this NamingContext.NamingContext
bind_new_context(NameComponent[] n)
Create a new NamingContext, bind it in this Naming Context and return its object reference.void
destroy()
Destroy this NamingContext object.static void
doBind(NamingContextDataStore impl, NameComponent[] n, Object obj, boolean rebind, BindingType bt)
Implements all four flavors of binding.static Object
doResolve(NamingContextDataStore impl, NameComponent[] n)
Implements resolving names in this NamingContext.static void
doUnbind(NamingContextDataStore impl, NameComponent[] n)
Implements unbinding bound names in this NamingContext.POA
getNSPOA()
void
list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
List the contents of this NamingContest.NamingContext
new_context()
Create a NamingContext object and return its object reference.void
rebind(NameComponent[] n, Object obj)
Bind an object under a name in this NamingContext.void
rebind_context(NameComponent[] n, NamingContext nc)
Bind a NamingContext under a name in this NamingContext.Object
resolve(NameComponent[] n)
Resolve a name in this NamingContext and return the object reference bound to the name.Object
resolve_str(java.lang.String sn)
This operation resolves the Stringified name into the object reference.protected static NamingContext
resolveFirstAsContext(NamingContextDataStore impl, NameComponent[] n)
Implements resolving a NameComponent in this context and narrowing it to CosNaming::NamingContext.NameComponent[]
to_name(java.lang.String sn)
This operation converts a Stringified Name into an equivalent array of Name Components.java.lang.String
to_string(NameComponent[] n)
This operation creates a stringified name from the array of Name components.java.lang.String
to_url(java.lang.String addr, java.lang.String sn)
This operation creates a URL based "iiopname://" format name from the Stringified Name of the object.void
unbind(NameComponent[] n)
Remove a binding from this NamingContext.-
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
bindImpl, destroyImpl, isEmptyImpl, listImpl, newContextImpl, resolveImpl, unbindImpl
-
-
-
-
Field Detail
-
orb
protected ORB orb
-
nsPOA
protected POA nsPOA
-
wrapper
private static final NamingSystemException wrapper
-
insImpl
private InterOperableNamingImpl insImpl
-
-
Method Detail
-
getNSPOA
public POA getNSPOA()
- Specified by:
getNSPOA
in 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:
bind
in 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
- 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.ee.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_context
in interfaceNamingContextOperations
- Parameters:
n
- a sequence of NameComponents which is the name under which the object will be bound.nc
- 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.ee.impl.naming.cosnaming.NamingContextDataStore, org.omg.CosNaming.NameComponent[], org.omg.CORBA.Object, boolean, org.omg.CosNaming.BindingType)
-
rebind
public void rebind(NameComponent[] n, Object obj) throws NotFound, CannotProceed, InvalidName
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:
rebind
in 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.ee.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_context
in interfaceNamingContextOperations
- Parameters:
n
- a sequence of NameComponents which is the name under which the object will be bound.nc
- 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.ee.impl.naming.cosnaming.NamingContextDataStore, org.omg.CosNaming.NameComponent[], org.omg.CORBA.Object, boolean, org.omg.CosNaming.BindingType)
-
resolve
public Object resolve(NameComponent[] n) throws NotFound, CannotProceed, InvalidName
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:
resolve
in 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:
doResolve(com.sun.corba.ee.impl.naming.cosnaming.NamingContextDataStore, org.omg.CosNaming.NameComponent[])
-
unbind
public void unbind(NameComponent[] n) throws NotFound, CannotProceed, InvalidName
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:
unbind
in 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:
doUnbind(com.sun.corba.ee.impl.naming.cosnaming.NamingContextDataStore, org.omg.CosNaming.NameComponent[])
-
list
public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
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:
list
in 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:
BindingListHolder
,BindingIteratorImpl
-
new_context
public NamingContext new_context()
Create a NamingContext object and return its object reference.- Specified by:
new_context
in 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_context
in 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:
new_context()
,bind_context(org.omg.CosNaming.NameComponent[], org.omg.CosNaming.NamingContext)
-
destroy
public void destroy() throws NotEmpty
Destroy this NamingContext object. If this NamingContext contains no bindings, the NamingContext is deleted.- Specified by:
destroy
in interfaceNamingContextOperations
- Throws:
NotEmpty
- This NamingContext is not empty (i.e., contains bindings).SystemException
- One of a fixed set of CORBA system exceptions.
-
doBind
public static void doBind(NamingContextDataStore impl, NameComponent[] n, Object obj, boolean rebind, BindingType bt) throws NotFound, CannotProceed, InvalidName, AlreadyBound
Implements all four flavors of binding. It uses Resolve() to check if a binding already exists (for bind and bind_context), and unbind() to ensure that a binding does not already exist. If the length of the name is 1, then Bind() is called with the name and the object to bind. Otherwise, the first component of the name is resolved in this NamingContext and the appropriate form of bind 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 under which the object will be bound.obj
- the object reference to be bound.rebind
- Replace an existing binding or not.bt
- Type of binding (as object or as context).- 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).AlreadyBound
- An object is already bound under the supplied name.SystemException
- One of a fixed set of CORBA system exceptions.- See Also:
resolve(org.omg.CosNaming.NameComponent[])
,unbind(org.omg.CosNaming.NameComponent[])
,bind(org.omg.CosNaming.NameComponent[], org.omg.CORBA.Object)
,bind_context(org.omg.CosNaming.NameComponent[], org.omg.CosNaming.NamingContext)
,rebind(org.omg.CosNaming.NameComponent[], org.omg.CORBA.Object)
,rebind_context(org.omg.CosNaming.NameComponent[], org.omg.CosNaming.NamingContext)
-
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:
resolve(org.omg.CosNaming.NameComponent[])
-
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:
resolve(org.omg.CosNaming.NameComponent[])
-
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.- Returns:
- a naming context
- Throws:
NotFound
- The first component could not be resolved.SystemException
- One of a fixed set of CORBA system exceptions.- See Also:
resolve(org.omg.CosNaming.NameComponent[])
-
to_string
public java.lang.String to_string(NameComponent[] n) throws InvalidName
This operation creates a stringified name from the array of Name components.- Specified by:
to_string
in interfaceNamingContextExtOperations
- Parameters:
n
- Name of the object- Returns:
- the object name as a single string
- Throws:
InvalidName
- Indicates the name does not identify a binding.
-
to_name
public NameComponent[] to_name(java.lang.String sn) throws InvalidName
This operation converts a Stringified Name into an equivalent array of Name Components.- Specified by:
to_name
in interfaceNamingContextExtOperations
- Parameters:
sn
- Stringified Name of the object- Returns:
- an array of name components
- Throws:
InvalidName
- if the name is invalid
-
to_url
public java.lang.String to_url(java.lang.String addr, java.lang.String sn) throws InvalidAddress, InvalidName
This operation creates a URL based "iiopname://" format name from the Stringified Name of the object.- Specified by:
to_url
in interfaceNamingContextExtOperations
- Parameters:
addr
- internet based address of the host machine where Name Service is runningsn
- Stringified Name of the object- Returns:
- a url string
- Throws:
InvalidAddress
- if the provided address is invalidInvalidName
- if the provided Name is invalid
-
resolve_str
public Object resolve_str(java.lang.String sn) throws NotFound, CannotProceed, InvalidName
This operation resolves the Stringified name into the object reference.- Specified by:
resolve_str
in interfaceNamingContextExtOperations
- Parameters:
sn
- Stringified Name of the object- Returns:
- an object
- Throws:
NotFound
- Indicates there is no object reference for the given name.CannotProceed
- Indicates that the given compound name is incorrectInvalidName
- if the provided Name was invalid
-
-