org.apache.tuscany.sca.host.corba.naming
Class TransientNamingContext

java.lang.Object
  extended by org.omg.PortableServer.Servant
      extended by org.omg.CosNaming.NamingContextExtPOA
          extended by org.apache.tuscany.sca.host.corba.naming.NamingContextBase
              extended by org.apache.tuscany.sca.host.corba.naming.TransientNamingContext
All Implemented Interfaces:
org.omg.CORBA.portable.InvokeHandler, org.omg.CosNaming.NamingContextExtOperations, org.omg.CosNaming.NamingContextOperations

public class TransientNamingContext
extends NamingContextBase


Nested Class Summary
 class TransientNamingContext.BoundObject
          Internal class used to store bound objects in the HashMap.
 class TransientNamingContext.TransientBindingIterator
          Context implementation version of the BindingIterator object used to return list items.
 
Field Summary
protected  java.util.HashMap bindings
           
protected  org.omg.CORBA.Object rootContext
           
 
Fields inherited from class org.apache.tuscany.sca.host.corba.naming.NamingContextBase
logger, nonEscaped, orb, poa
 
Constructor Summary
TransientNamingContext(org.omg.CORBA.ORB orb, org.omg.PortableServer.POA poa)
          Create a top-level naming context.
TransientNamingContext(org.omg.CORBA.ORB orb, org.omg.PortableServer.POA poa, org.omg.CORBA.Object root)
          Construct a TransientNamingContext subcontext.
 
Method Summary
protected  void bindObject(org.omg.CosNaming.NameComponent n, org.omg.CORBA.Object obj, org.omg.CosNaming.BindingTypeHolder type)
          Bind an object into the current context.
 void destroy()
          Destroy a context.
 org.omg.CORBA.Object getRootContext()
          Retrieve the rootContext for this NamingContext.
 void list(int how_many, org.omg.CosNaming.BindingListHolder bl, org.omg.CosNaming.BindingIteratorHolder bi)
          Create a list of bound objects an contexts contained within this context.
 org.omg.CosNaming.NamingContext new_context()
          Create a new context of the same type as the calling context.
protected  org.omg.CORBA.Object resolveObject(org.omg.CosNaming.NameComponent n, org.omg.CosNaming.BindingTypeHolder type)
          Resolve an object in this context (single level resolution).
protected  org.omg.CORBA.Object unbindObject(org.omg.CosNaming.NameComponent n)
          Unbind an object from the current context.
 
Methods inherited from class org.apache.tuscany.sca.host.corba.naming.NamingContextBase
bind_context, bind_new_context, bind, debug, encodeRFC2396Name, escapeName, extractSubName, isDebugEnabled, logNameComponent, nameToString, rebind_context, rebind, resolve_str, resolve, resolveContext, to_name, to_string, to_url, unbind, validateName
 
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
 

Field Detail

bindings

protected java.util.HashMap bindings

rootContext

protected org.omg.CORBA.Object rootContext
Constructor Detail

TransientNamingContext

public TransientNamingContext(org.omg.CORBA.ORB orb,
                              org.omg.PortableServer.POA poa)
                       throws java.lang.Exception
Create a top-level naming context.

Parameters:
orb - The orb hosting this context.
poa - The POA used to activate the object.
Throws:
java.lang.Exception

TransientNamingContext

public TransientNamingContext(org.omg.CORBA.ORB orb,
                              org.omg.PortableServer.POA poa,
                              org.omg.CORBA.Object root)
                       throws java.lang.Exception
Construct a TransientNamingContext subcontext.

Parameters:
orb - The orb this context is associated with.
poa - The POA the root context is activated under.
root - The root context.
Throws:
java.lang.Exception
Method Detail

new_context

public org.omg.CosNaming.NamingContext new_context()
                                            throws org.omg.CORBA.SystemException
Create a new context of the same type as the calling context.

Specified by:
new_context in interface org.omg.CosNaming.NamingContextOperations
Specified by:
new_context in class NamingContextBase
Returns:
A new NamingContext item.
Throws:
org.omg.CosNaming.NamingContextPackage.NotFound
org.omg.CORBA.SystemException

destroy

public void destroy()
             throws org.omg.CosNaming.NamingContextPackage.NotEmpty
Destroy a context. This method should clean up any backing resources associated with the context.

Specified by:
destroy in interface org.omg.CosNaming.NamingContextOperations
Specified by:
destroy in class NamingContextBase
Throws:
org.omg.CosNaming.NamingContextPackage.NotEmpty

list

public void list(int how_many,
                 org.omg.CosNaming.BindingListHolder bl,
                 org.omg.CosNaming.BindingIteratorHolder bi)
          throws org.omg.CORBA.SystemException
Create a list of bound objects an contexts contained within this context.

Specified by:
list in interface org.omg.CosNaming.NamingContextOperations
Specified by:
list in class NamingContextBase
Parameters:
how_many - The count of elements to return as a BindingList.
bl - A holder element for returning the source binding list.
bi - A holder for returning a BindingIterator. Any extra elements not returned in the BindingList are returned in the BindingIterator.
Throws:
org.omg.CORBA.SystemException

resolveObject

protected org.omg.CORBA.Object resolveObject(org.omg.CosNaming.NameComponent n,
                                             org.omg.CosNaming.BindingTypeHolder type)
                                      throws org.omg.CORBA.SystemException
Resolve an object in this context (single level resolution).

Specified by:
resolveObject in class NamingContextBase
Parameters:
n - The name of the target object.
type - A type holder for returning the bound object type information.
Returns:
The bound object. Returns null if the object does not exist in the context.
Throws:
org.omg.CORBA.SystemException

bindObject

protected void bindObject(org.omg.CosNaming.NameComponent n,
                          org.omg.CORBA.Object obj,
                          org.omg.CosNaming.BindingTypeHolder type)
                   throws org.omg.CORBA.SystemException
Bind an object into the current context. This can be either an object or a naming context.

Specified by:
bindObject in class NamingContextBase
Parameters:
n - The single-level name of the target object.
obj - The object or context to be bound.
type -
Throws:
org.omg.CORBA.SystemException

unbindObject

protected org.omg.CORBA.Object unbindObject(org.omg.CosNaming.NameComponent n)
                                     throws org.omg.CORBA.SystemException
Unbind an object from the current context.

Specified by:
unbindObject in class NamingContextBase
Parameters:
n - The name of the target object (single level).
Returns:
The object associated with the binding. Returns null if there was no binding currently associated with this name.
Throws:
org.omg.CORBA.SystemException

getRootContext

public org.omg.CORBA.Object getRootContext()
Retrieve the rootContext for this NamingContext.

Returns:
The rootContext CORBA object associated with this context.