java.lang.Object
org.wildfly.iiop.openjdk.naming.jndi.CNCtx
All Implemented Interfaces:
Context

public class CNCtx extends Object implements Context
Provides a bridge to the CosNaming server provided by JavaIDL. This class provides the InitialContext from CosNaming.
Author:
Raj Krishnamurthy, Rosanna Lee
  • Field Details

    • _nc

      public org.omg.CosNaming.NamingContext _nc
  • Method Details

    • createUsingURL

      public static ResolveResult createUsingURL(String url, Hashtable env) throws NamingException
      This method is used by the iiop and iiopname URL Context factories.
      Throws:
      NamingException
    • getNameInNamespace

      public String getNameInNamespace() throws NamingException
      Specified by:
      getNameInNamespace in interface Context
      Throws:
      NamingException
    • lookup

      public Object lookup(String name) throws NamingException
      Converts the "String" name into a CompositeName returns the object resolved by the COS Naming api, resolve. Returns the current context if the name is empty. Returns either an org.omg.CORBA.Object or javax.naming.Context object.
      Specified by:
      lookup in interface Context
      Parameters:
      name - string used to resolve the object.
      Returns:
      the resolved object
      Throws:
      NamingException - See callResolve.
    • lookup

      public Object lookup(Name name) throws NamingException
      Converts the "Name" name into a NameComponent[] object and returns the object resolved by the COS Naming api, resolve. Returns the current context if the name is empty. Returns either an org.omg.CORBA.Object or javax.naming.Context object.
      Specified by:
      lookup in interface Context
      Parameters:
      name - JNDI Name used to resolve the object.
      Returns:
      the resolved object
      Throws:
      NamingException - See callResolve.
    • bind

      public void bind(Name name, Object obj) throws NamingException
      Converts the "Name" name into a NameComponent[] object and performs the bind operation. Uses callBindOrRebind. Throws an invalid name exception if the name is empty. We need a name to bind the object even when we work within the current context.
      Specified by:
      bind in interface Context
      Parameters:
      name - JNDI Name object
      obj - Object to be bound.
      Throws:
      NamingException - See callBindOrRebind
    • bind

      public void bind(String name, Object obj) throws NamingException
      Converts the "String" name into a CompositeName object and performs the bind operation. Uses callBindOrRebind. Throws an invalid name exception if the name is empty.
      Specified by:
      bind in interface Context
      Parameters:
      name - string
      obj - Object to be bound.
      Throws:
      NamingException - See callBindOrRebind
    • rebind

      public void rebind(Name name, Object obj) throws NamingException
      Converts the "Name" name into a NameComponent[] object and performs the rebind operation. Uses callBindOrRebind. Throws an invalid name exception if the name is empty. We must have a name to rebind the object to even if we are working within the current context.
      Specified by:
      rebind in interface Context
      Parameters:
      name - string
      obj - Object to be bound.
      Throws:
      NamingException - See callBindOrRebind
    • rebind

      public void rebind(String name, Object obj) throws NamingException
      Converts the "String" name into a CompositeName object and performs the rebind operation. Uses callBindOrRebind. Throws an invalid name exception if the name is an empty string.
      Specified by:
      rebind in interface Context
      Parameters:
      name - string
      obj - Object to be bound.
      Throws:
      NamingException - See callBindOrRebind
    • unbind

      public void unbind(String name) throws NamingException
      Converts the "String" name into a CompositeName object and performs the unbind operation. Uses callUnbind. If the name is empty, throws an invalid name exception. Do we unbind the current context (JNDI spec says work with the current context if the name is empty) ?
      Specified by:
      unbind in interface Context
      Parameters:
      name - string
      Throws:
      NamingException - See callUnbind
    • unbind

      public void unbind(Name name) throws NamingException
      Converts the "Name" name into a NameComponent[] object and performs the unbind operation. Uses callUnbind. Throws an invalid name exception if the name is empty.
      Specified by:
      unbind in interface Context
      Parameters:
      name - string
      Throws:
      NamingException - See callUnbind
    • rename

      public void rename(String oldName, String newName) throws NamingException
      Renames an object. Since COS Naming does not support a rename api, this method unbinds the object with the "oldName" and creates a new binding.
      Specified by:
      rename in interface Context
      Parameters:
      oldName - string, existing name for the binding.
      newName - string, name used to replace.
      Throws:
      NamingException - See bind
    • rename

      public void rename(Name oldName, Name newName) throws NamingException
      Renames an object. Since COS Naming does not support a rename api, this method unbinds the object with the "oldName" and creates a new binding.
      Specified by:
      rename in interface Context
      Parameters:
      oldName - JNDI Name, existing name for the binding.
      newName - JNDI Name, name used to replace.
      Throws:
      NamingException - See bind
    • list

      public NamingEnumeration list(String name) throws NamingException
      Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.
      Specified by:
      list in interface Context
      Parameters:
      name - string
      Returns:
      a list of name-class objects as a NameClassEnumeration.
      Throws:
      NamingException - All exceptions thrown by lookup with a non-null argument
    • list

      public NamingEnumeration list(Name name) throws NamingException
      Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.
      Specified by:
      list in interface Context
      Parameters:
      name - JNDI Name
      Returns:
      a list of name-class objects as a NameClassEnumeration.
      Throws:
      NamingException - All exceptions thrown by lookup
    • listBindings

      public NamingEnumeration listBindings(String name) throws NamingException
      Returns a BindingEnumeration object which has a list of name object pairs. Lists the current context if the name is empty.
      Specified by:
      listBindings in interface Context
      Parameters:
      name - string
      Returns:
      a list of bindings as a BindingEnumeration.
      Throws:
      NamingException - all exceptions returned by lookup
    • listBindings

      public NamingEnumeration listBindings(Name name) throws NamingException
      Returns a BindingEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.
      Specified by:
      listBindings in interface Context
      Parameters:
      name - JNDI Name
      Returns:
      a list of bindings as a BindingEnumeration.
      Throws:
      NamingException - all exceptions returned by lookup.
    • destroySubcontext

      public void destroySubcontext(String name) throws NamingException
      Uses the callDestroy function to destroy the context. If name is empty destroys the current context.
      Specified by:
      destroySubcontext in interface Context
      Parameters:
      name - string
      Throws:
      OperationNotSupportedException - when list is invoked with a non-null argument
      NamingException
    • destroySubcontext

      public void destroySubcontext(Name name) throws NamingException
      Uses the callDestroy function to destroy the context. Destroys the current context if name is empty.
      Specified by:
      destroySubcontext in interface Context
      Parameters:
      name - JNDI Name
      Throws:
      OperationNotSupportedException - when list is invoked with a non-null argument
      NamingException
    • createSubcontext

      public Context createSubcontext(String name) throws NamingException
      Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the name is empty.
      Specified by:
      createSubcontext in interface Context
      Parameters:
      name - string
      Returns:
      the new context object.
      Throws:
      NamingException - See callBindNewContext
    • createSubcontext

      public Context createSubcontext(Name name) throws NamingException
      Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the name is empty.
      Specified by:
      createSubcontext in interface Context
      Parameters:
      name - string
      Returns:
      the new context object.
      Throws:
      NamingException - See callBindNewContext
    • lookupLink

      public Object lookupLink(String name) throws NamingException
      Is mapped to resolve in the COS Naming api.
      Specified by:
      lookupLink in interface Context
      Parameters:
      name - string
      Returns:
      the resolved object.
      Throws:
      NamingException - See lookup.
    • lookupLink

      public Object lookupLink(Name name) throws NamingException
      Is mapped to resolve in the COS Naming api.
      Specified by:
      lookupLink in interface Context
      Parameters:
      name - string
      Returns:
      the resolved object.
      Throws:
      NamingException - See lookup.
    • getNameParser

      public NameParser getNameParser(String name) throws NamingException
      Allow access to the name parser object.
      Specified by:
      getNameParser in interface Context
      Parameters:
      name - , is ignored since there is only one Name Parser object.
      Returns:
      NameParser object
      Throws:
      NamingException - --
    • getNameParser

      public NameParser getNameParser(Name name) throws NamingException
      Allow access to the name parser object.
      Specified by:
      getNameParser in interface Context
      Parameters:
      name - JNDI name, is ignored since there is only one Name Parser object.
      Returns:
      NameParser object
      Throws:
      NamingException - --
    • getEnvironment

      public Hashtable getEnvironment() throws NamingException
      Returns the current environment.
      Specified by:
      getEnvironment in interface Context
      Returns:
      Environment.
      Throws:
      NamingException
    • composeName

      public String composeName(String name, String prefix) throws NamingException
      Specified by:
      composeName in interface Context
      Throws:
      NamingException
    • composeName

      public Name composeName(Name name, Name prefix) throws NamingException
      Specified by:
      composeName in interface Context
      Throws:
      NamingException
    • addToEnvironment

      public Object addToEnvironment(String propName, Object propValue) throws NamingException
      Adds to the environment for the current context. Record change but do not reinitialize ORB.
      Specified by:
      addToEnvironment in interface Context
      Parameters:
      propName - The property name.
      propValue - The ORB.
      Returns:
      the previous value of this property if any.
      Throws:
      NamingException
    • removeFromEnvironment

      public Object removeFromEnvironment(String propName) throws NamingException
      Specified by:
      removeFromEnvironment in interface Context
      Throws:
      NamingException
    • close

      public void close() throws NamingException
      Specified by:
      close in interface Context
      Throws:
      NamingException
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object