public class

CNCtx

extends Object
implements Context
java.lang.Object
   ↳ com.sun.jndi.cosnaming.CNCtx

Class Overview

Provides a bridge to the CosNaming server provided by JavaIDL. This class provides the InitialContext from CosNaming.

Summary

[Expand]
Inherited Constants
From interface javax.naming.Context
Fields
public NamingContext _nc
Public Methods
Object addToEnvironment(String propName, Object propValue)
Adds to the environment for the current context.
void bind(Name name, Object obj)
Converts the "Name" name into a NameComponent[] object and performs the bind operation.
void bind(String name, Object obj)
Converts the "String" name into a CompositeName object and performs the bind operation.
synchronized void close()
Closes this context.
String composeName(String name, String prefix)
Composes the name of this context with a name relative to this context.
Name composeName(Name name, Name prefix)
Composes the name of this context with a name relative to this context.
Context createSubcontext(Name name)
Uses the callBindNewContext convenience function to create a new context.
Context createSubcontext(String name)
Uses the callBindNewContext convenience function to create a new context.
static ResolveResult createUsingURL(String url, Hashtable env)
This method is used by the iiop and iiopname URL Context factories.
synchronized void decEnumCount()
void destroySubcontext(Name name)
Uses the callDestroy function to destroy the context.
void destroySubcontext(String name)
Uses the callDestroy function to destroy the context.
Hashtable getEnvironment()
Returns the current environment.
String getNameInNamespace()
Retrieves the full name of this context within its own namespace.
NameParser getNameParser(Name name)
Allow access to the name parser object.
NameParser getNameParser(String name)
Allow access to the name parser object.
synchronized void incEnumCount()
NamingEnumeration list(String name)
Returns a NameClassEnumeration object which has a list of name class pairs.
NamingEnumeration list(Name name)
Returns a NameClassEnumeration object which has a list of name class pairs.
NamingEnumeration listBindings(Name name)
Returns a BindingEnumeration object which has a list of name class pairs.
NamingEnumeration listBindings(String name)
Returns a BindingEnumeration object which has a list of name object pairs.
Object lookup(String name)
Converts the "String" name into a CompositeName returns the object resolved by the COS Naming api, resolve.
Object lookup(Name name)
Converts the "Name" name into a NameComponent[] object and returns the object resolved by the COS Naming api, resolve.
Object lookupLink(String name)
Is mapped to resolve in the COS Naming api.
Object lookupLink(Name name)
Is mapped to resolve in the COS Naming api.
void rebind(String name, Object obj)
Converts the "String" name into a CompositeName object and performs the rebind operation.
void rebind(Name name, Object obj)
Converts the "Name" name into a NameComponent[] object and performs the rebind operation.
Object removeFromEnvironment(String propName)
Removes an environment property from the environment of this context.
void rename(String oldName, String newName)
Renames an object.
void rename(Name oldName, Name newName)
Renames an object.
void unbind(Name name)
Converts the "Name" name into a NameComponent[] object and performs the unbind operation.
void unbind(String name)
Converts the "String" name into a CompositeName object and performs the unbind operation.
Protected Methods
void finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.naming.Context

Fields

public NamingContext _nc

Public Methods

public Object addToEnvironment (String propName, Object propValue)

Adds to the environment for the current context. Record change but do not reinitialize ORB.

Parameters
propName The property name.
propValue the value of the property to add; may not be null
Returns
  • the previous value of this property if any.

public void bind (Name name, Object obj)

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.

Parameters
name JNDI Name object
obj Object to be bound.
Throws
NamingException See callBindOrRebind

public void bind (String name, Object obj)

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.

Parameters
name string
obj Object to be bound.
Throws
NamingException See callBindOrRebind

public synchronized void close ()

Closes this context. This method releases this context's resources immediately, instead of waiting for them to be released automatically by the garbage collector.

This method is idempotent: invoking it on a context that has already been closed has no effect. Invoking any other method on a closed context is not allowed, and results in undefined behaviour.

public String composeName (String name, String prefix)

Composes the name of this context with a name relative to this context. See composeName(Name, Name) for details.

Parameters
name a name relative to this context
prefix the name of this context relative to one of its ancestors
Returns
  • the composition of prefix and name

public Name composeName (Name name, Name prefix)

Composes the name of this context with a name relative to this context. Given a name (name) relative to this context, and the name (prefix) of this context relative to one of its ancestors, this method returns the composition of the two names using the syntax appropriate for the naming system(s) involved. That is, if name names an object relative to this context, the result is the name of the same object, but relative to the ancestor context. None of the names may be null.

For example, if this context is named "wiz.com" relative to the initial context, then

  composeName("east", "wiz.com")  
might return "east.wiz.com". If instead this context is named "org/research", then
  composeName("user/jane", "org/research")        
might return "org/research/user/jane" while
  composeName("user/jane", "research")    
returns "research/user/jane".

Parameters
name a name relative to this context
prefix the name of this context relative to one of its ancestors
Returns
  • the composition of prefix and name

public Context createSubcontext (Name name)

Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the name is empty.

Parameters
name string
Returns
  • the new context object.
Throws
NamingException See callBindNewContext

public Context createSubcontext (String name)

Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the name is empty.

Parameters
name string
Returns
  • the new context object.
Throws
NamingException See callBindNewContext

public static ResolveResult createUsingURL (String url, Hashtable env)

This method is used by the iiop and iiopname URL Context factories.

public synchronized void decEnumCount ()

public void destroySubcontext (Name name)

Uses the callDestroy function to destroy the context. Destroys the current context if name is empty.

Parameters
name JNDI Name
Throws
OperationNotSupportedException when list is invoked with a non-null argument
NamingException

public void destroySubcontext (String name)

Uses the callDestroy function to destroy the context. If name is empty destroys the current context.

Parameters
name string
Throws
OperationNotSupportedException when list is invoked with a non-null argument
NamingException

public Hashtable getEnvironment ()

Returns the current environment.

Returns
  • Environment.

public String getNameInNamespace ()

Retrieves the full name of this context within its own namespace.

Many naming services have a notion of a "full name" for objects in their respective namespaces. For example, an LDAP entry has a distinguished name, and a DNS record has a fully qualified name. This method allows the client application to retrieve this name. The string returned by this method is not a JNDI composite name and should not be passed directly to context methods. In naming systems for which the notion of full name does not make sense, OperationNotSupportedException is thrown.

Returns
  • this context's name in its own namespace; never null

public NameParser getNameParser (Name name)

Allow access to the name parser object.

Parameters
name the name of the context from which to get the parser
Returns
  • NameParser object
Throws
NamingException --

public NameParser getNameParser (String name)

Allow access to the name parser object.

Parameters
name the name of the context from which to get the parser
Returns
  • NameParser object
Throws
NamingException --

public synchronized void incEnumCount ()

public NamingEnumeration list (String name)

Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.

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

public NamingEnumeration list (Name name)

Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.

Parameters
name JNDI Name
Returns
  • a list of name-class objects as a NameClassEnumeration.
Throws
NamingException All exceptions thrown by lookup

public NamingEnumeration listBindings (Name name)

Returns a BindingEnumeration object which has a list of name class pairs. Lists the current context if the name is empty.

Parameters
name JNDI Name
Returns
  • a list of bindings as a BindingEnumeration.
Throws
NamingException all exceptions returned by lookup.

public NamingEnumeration listBindings (String name)

Returns a BindingEnumeration object which has a list of name object pairs. Lists the current context if the name is empty.

Parameters
name string
Returns
  • a list of bindings as a BindingEnumeration.
Throws
NamingException all exceptions returned by lookup

public Object lookup (String name)

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.

Parameters
name string used to resolve the object.
Returns
  • the resolved object
Throws
NamingException See callResolve.

public Object lookup (Name name)

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.

Parameters
name JNDI Name used to resolve the object.
Returns
  • the resolved object
Throws
NamingException See callResolve.

public Object lookupLink (String name)

Is mapped to resolve in the COS Naming api.

Parameters
name string
Returns
  • the resolved object.
Throws
NamingException See lookup.

public Object lookupLink (Name name)

Is mapped to resolve in the COS Naming api.

Parameters
name string
Returns
  • the resolved object.
Throws
NamingException See lookup.

public void rebind (String name, Object obj)

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.

Parameters
name string
obj Object to be bound.
Throws
NamingException See callBindOrRebind

public void rebind (Name name, Object obj)

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.

Parameters
name string
obj Object to be bound.
Throws
NamingException See callBindOrRebind

public Object removeFromEnvironment (String propName)

Removes an environment property from the environment of this context. See class description for more details on environment properties.

Parameters
propName the name of the environment property to remove; may not be null
Returns
  • the previous value of the property, or null if the property was not in the environment

public void rename (String oldName, String newName)

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.

Parameters
oldName string, existing name for the binding.
newName string, name used to replace.
Throws
NamingException See bind

public void rename (Name oldName, Name newName)

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.

Parameters
oldName JNDI Name, existing name for the binding.
newName JNDI Name, name used to replace.
Throws
NamingException See bind

public void unbind (Name name)

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.

Parameters
name string
Throws
NamingException See callUnbind

public void unbind (String name)

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) ?

Parameters
name string
Throws
NamingException See callUnbind

Protected Methods

protected void finalize ()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.