org.media.mn8
Class NamingManager

java.lang.Object
  |
  +--org.media.mn8.NamingManager

public class NamingManager
extends Object

Class who is responsible for wrapping and managing the JNDI Context specified in conf/naming.mn8.xml.

Version:
$Revision: 1.11 $ $Date: 2002/09/16 23:06:04 $
Author:
Remus Pereni

Field Summary
static String ENV_ID
           
static String MEM_ID
           
 
Method Summary
static void bind(String name, Object obj)
          Binds a name to an object.
static void close()
          Closes this context.
static Context createSubcontext(String name)
          Creates and binds a new context.
static void destroySubcontext(String name)
          Destroys the named context.
static void envBind(String name, Object obj)
          Because from the outside the env:/ context is read only this is the default method for populating it.
static NamingManager getReference()
          Method for getting the NamingManager instance.
static NamingEnumeration list(String name)
          Enumeratest the names bound in the named context.
static NamingEnumeration listBindings(String name)
          Enumeratest the names bound in the named context, along with the objects bound to them.
static Object lookup(String name)
          Retrieves the named object.
static void rebind(String name, Object obj)
          Rebinds or binds a name to an object.
static void rename(String oldName, String newName)
          Binds a new name to the object bound to an old name, and unbinds the old name.
static void unbind(String name)
          Unbinds the object binded under the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENV_ID

public static final String ENV_ID
See Also:
Constant Field Values

MEM_ID

public static final String MEM_ID
See Also:
Constant Field Values
Method Detail

getReference

public static NamingManager getReference()
Method for getting the NamingManager instance. Don't forget that it implements a Singleton pattern.

Returns:
The default instance of NamingManager

bind

public static void bind(String name,
                        Object obj)
                 throws NamingException
Binds a name to an object. The scheme must be specified ("mem:" or "env:")!

Parameters:
name - The name to bind
obj - The object to be binded.
Throws:
NamingException - If a naming exception is encountered.

rebind

public static void rebind(String name,
                          Object obj)
                   throws NamingException
Rebinds or binds a name to an object. The scheme must be specified ("mem:" or "env:")!

Parameters:
name - The name to bind
obj - The object to be binded.
Throws:
NamingException - If a naming exception is encountered.

rename

public static void rename(String oldName,
                          String newName)
                   throws NamingException
Binds a new name to the object bound to an old name, and unbinds the old name. The scheme must be specified ("mem:" or "env:")! Env: is read-only.

Parameters:
oldName - The name of the existing binding. May not be empty.
newName - The name of the new binding. May not be empty.
Throws:
NamingException - If a naming exception is encountered.

unbind

public static void unbind(String name)
                   throws NamingException
Unbinds the object binded under the name. The scheme must be specified ("mem:" or "env:")! Env: is read-only.

Parameters:
name - The name to unbind. May not be empty.
Throws:
NamingException - If a naming exception is encountered.

list

public static NamingEnumeration list(String name)
                              throws NamingException
Enumeratest the names bound in the named context. The scheme must be specified ("mem:" or "env:")!

Parameters:
name - The name of the context to list.
Returns:
An enumeration of the names and class names of the bindings in this context.
Throws:
NamingException - If a naming exception is encountered.

listBindings

public static NamingEnumeration listBindings(String name)
                                      throws NamingException
Enumeratest the names bound in the named context, along with the objects bound to them. The contens of any subcontext is not included. The scheme must be specified ("mem:" or "env:")!

Parameters:
name - The name of the context to list.
Returns:
An enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
Throws:
NamingException - If a naming exception is encountered.
See Also:
Binding

createSubcontext

public static Context createSubcontext(String name)
                                throws NamingException
Creates and binds a new context. The scheme must be specified ("mem:" or "env:")! However the env: schema is read-only.

Parameters:
name - The name of the subcontext.
Throws:
NamingException - If a naming exception is encountered.

destroySubcontext

public static void destroySubcontext(String name)
                              throws NamingException
Destroys the named context. The scheme must be specified ("mem:" or "env:")! However the env: schema is read-only.

Parameters:
name - The name of the subcontext.
Throws:
NamingException - If a naming exception is encountered.

close

public static void close()
                  throws NamingException
Closes this context.

Throws:
NamingException - If a naming exception is encountered.

lookup

public static Object lookup(String name)
                     throws NamingException
Retrieves the named object. The scheme must be specified ("mem:" or "env:")!

Parameters:
name - The name of the object to be looked up.
Throws:
NamingException - If a naming exception is encountered.

envBind

public static void envBind(String name,
                           Object obj)
                    throws NamingException
Because from the outside the env:/ context is read only this is the default method for populating it.
The name can be specified either as: "env:/somecontext/../name" or without the "env:" specifier as: "somecontext/../name".
It will properly create the subcontextes if there doesn't exist.

Parameters:
name - The name under which the object will be binded in the directory context.
obj - The object which will be binded.
Throws:
NamingException - If a naming exception is encountered.


"Copyright © 2000-2002 Internet Multicasting Services, media.org & noLimits Technologies. All Rights Reserved."