org.objectweb.jeremie.services.registry.jndi.jrmi
Class jrmiURLContext

java.lang.Object
  extended by org.objectweb.jeremie.services.registry.jndi.jrmi.jrmiURLContext
All Implemented Interfaces:
Context

public class jrmiURLContext
extends Object
implements Context

Provides an implementation of a JNDI URL context for the Jeremie registry.

The allowed URL syntax for accessing the Jeremie registry is: jrmi://[host][:port][/[name]] or jrmi:[/][name]


Field Summary
 
Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
 
Constructor Summary
jrmiURLContext(Hashtable env)
          Creates a Jeremie registry URL context with the given environment.
 
Method Summary
 Object addToEnvironment(String propName, Object propVal)
          Sets the value of a property in the current URL context's environment.
 void bind(Name name, Object obj)
          Binds the given object under the name and in the Jeremie registry indicated by the given URL name.
 void bind(String name, Object obj)
          Binds the given object under the name and in the Jeremie registry indicated by the given URL string.
 void close()
          Closes this URL context.
 Name composeName(Name name, Name prefix)
          Composes two names, one being relative to the current context, the other being the name of the current context relative to one of its ancestors.
 String composeName(String name, String prefix)
          Composes two stringified names, one being relative to the current context, the other being the stringified name of the current context relative to one of its ancestors.
 Context createSubcontext(Name name)
          Subcontexts are not supported by Jeremie registry URL contexts.
 Context createSubcontext(String name)
          Subcontexts are not supported by Jeremie registry URL contexts.
 void destroySubcontext(Name name)
          Subcontexts are not supported by Jeremie registry URL contexts.
 void destroySubcontext(String name)
          Subcontexts are not supported by Jeremie registry URL contexts.
 Hashtable getEnvironment()
          Returns the environment of the current URL context.
 String getNameInNamespace()
          Retrieves the full name of the current context within its own namespace, in other words, the empty string "".
 NameParser getNameParser(Name name)
          Retrieves the name parser of the Jeremie registry context indicated by the given URL name.
 NameParser getNameParser(String name)
          Retrieves the name parser of the Jeremie registry context indicated by the given URL string.
 NamingEnumeration list(Name name)
          Enumerates the names and the class names of the objects that they are bound to in the Jeremie registry indicated by the given URL name.
 NamingEnumeration list(String name)
          Enumerates the names and the class names of the objects that they are bound to in the Jeremie registry indicated by the given URL string.
 NamingEnumeration listBindings(Name name)
          Enumerates the names and objects that they are bound to in the Jeremie registry indicated by the given URL name.
 NamingEnumeration listBindings(String name)
          Enumerates the names and objects that they are bound to in the Jeremie registry indicated by the given URL string.
 Object lookup(Name name)
          Retrieves the object bound under the name and in the Jeremie registry indicated by the given URL name.
 Object lookup(String name)
          Retrieves the object bound under the name and in the Jeremie registry indicated by the given URL string.
 Object lookupLink(Name name)
          Links are not treated specially by Jeremie registry URL contexts.
 Object lookupLink(String name)
          Links are not treated specially by Jeremie registry URL contexts.
 void rebind(Name name, Object obj)
          Rebinds the given object under the name and in the Jeremie registry indicated by the given URL name.
 void rebind(String name, Object obj)
          Rebinds the given object under the name and in the Jeremie registry indicated by the given URL string.
 Object removeFromEnvironment(String propName)
          Undefines the value of a property in the current URL context's environment.
 void rename(Name oldname, Name newname)
          Renames a name in a Jeremie registry as indicated by the given URL names.
 void rename(String oldname, String newname)
          Renames a name in a Jeremie registry as indicated by the given URL strings.
 void unbind(Name name)
          Unbinds a name from a Jeremie registry as indicated by the given URL name.
 void unbind(String name)
          Unbinds a name from a Jeremie registry as indicated by the given URL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

jrmiURLContext

public jrmiURLContext(Hashtable env)
               throws NamingException
Creates a Jeremie registry URL context with the given environment.

Parameters:
env - a hashtable representing the environment.
Throws:
NamingException
Method Detail

lookup

public Object lookup(Name name)
              throws NamingException
Retrieves the object bound under the name and in the Jeremie registry indicated by the given URL name.

Specified by:
lookup in interface Context
Parameters:
name - the URL of the registry location and the name of the object to be retrieved.
Returns:
the object bound to the given name in the given registry.
Throws:
NamingException - if something goes wrong.

lookup

public Object lookup(String name)
              throws NamingException
Retrieves the object bound under the name and in the Jeremie registry indicated by the given URL string.

Specified by:
lookup in interface Context
Parameters:
name - the URL of the registry location and the name of the object to be retrieved.
Returns:
the object bound to the given name in the given registry.
Throws:
NamingException - if something goes wrong.

bind

public void bind(Name name,
                 Object obj)
          throws NamingException
Binds the given object under the name and in the Jeremie registry indicated by the given URL name.

Specified by:
bind in interface Context
Parameters:
name - the URL of the registry location and the name to be bound;
obj - the object to bind.
Throws:
NamingException - if something goes wrong.

bind

public void bind(String name,
                 Object obj)
          throws NamingException
Binds the given object under the name and in the Jeremie registry indicated by the given URL string.

Specified by:
bind in interface Context
Parameters:
name - the URL of the registry location and the name to be bound;
obj - the object to bind.
Throws:
NamingException - if something goes wrong.

rebind

public void rebind(Name name,
                   Object obj)
            throws NamingException
Rebinds the given object under the name and in the Jeremie registry indicated by the given URL name.

Specified by:
rebind in interface Context
Parameters:
name - the URL of the registry location and the name to be rebound;
obj - the object to bind.
Throws:
NamingException - if something goes wrong.

rebind

public void rebind(String name,
                   Object obj)
            throws NamingException
Rebinds the given object under the name and in the Jeremie registry indicated by the given URL string.

Specified by:
rebind in interface Context
Parameters:
name - the URL of the registry location and the name to be rebound;
obj - the object to bind.
Throws:
NamingException - if something goes wrong.

unbind

public void unbind(Name name)
            throws NamingException
Unbinds a name from a Jeremie registry as indicated by the given URL name.

Specified by:
unbind in interface Context
Parameters:
name - the URL of the registry location and the name to be unbound.
Throws:
NamingException - if something goes wrong.

unbind

public void unbind(String name)
            throws NamingException
Unbinds a name from a Jeremie registry as indicated by the given URL string.

Specified by:
unbind in interface Context
Parameters:
name - the URL of the registry location and the name to be unbound.
Throws:
NamingException - if something goes wrong.

rename

public void rename(Name oldname,
                   Name newname)
            throws NamingException
Renames a name in a Jeremie registry as indicated by the given URL names.

Specified by:
rename in interface Context
Parameters:
oldName - the existing bound name and registry;
newName - the new name to be bound in the registry.
Throws:
NamingException - if something goes wrong.

rename

public void rename(String oldname,
                   String newname)
            throws NamingException
Renames a name in a Jeremie registry as indicated by the given URL strings.

Specified by:
rename in interface Context
Parameters:
oldName - the existing bound name and registry;
newName - the new name to be bound in the registry.
Throws:
NamingException - if something goes wrong.

list

public NamingEnumeration list(Name name)
                       throws NamingException
Enumerates the names and the class names of the objects that they are bound to in the Jeremie registry indicated by the given URL name.

Specified by:
list in interface Context
Parameters:
name - the URL name of the registry to list.
Returns:
an enumeration of the (name, class name) pairs in the registry.
Throws:
NamingException - if something goes wrong.

list

public NamingEnumeration list(String name)
                       throws NamingException
Enumerates the names and the class names of the objects that they are bound to in the Jeremie registry indicated by the given URL string.

Specified by:
list in interface Context
Parameters:
name - the URL string of the registry to list.
Returns:
an enumeration of the (name, class name) pairs in the registry.
Throws:
NamingException - if something goes wrong.

listBindings

public NamingEnumeration listBindings(Name name)
                               throws NamingException
Enumerates the names and objects that they are bound to in the Jeremie registry indicated by the given URL name.

Specified by:
listBindings in interface Context
Parameters:
name - the URL name of the registry to list.
Returns:
an enumeration of the (name, object) pairs in the registry.
Throws:
NamingException - if something goes wrong.

listBindings

public NamingEnumeration listBindings(String name)
                               throws NamingException
Enumerates the names and objects that they are bound to in the Jeremie registry indicated by the given URL string.

Specified by:
listBindings in interface Context
Parameters:
name - the URL string of the registry to list.
Returns:
an enumeration of the (name, object) pairs in the registry.
Throws:
NamingException - if something goes wrong.

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException
Subcontexts are not supported by Jeremie registry URL contexts.

Specified by:
createSubcontext in interface Context
Throws:
OperationNotSupportedException
NamingException

createSubcontext

public Context createSubcontext(String name)
                         throws NamingException
Subcontexts are not supported by Jeremie registry URL contexts.

Specified by:
createSubcontext in interface Context
Throws:
OperationNotSupportedException
NamingException

destroySubcontext

public void destroySubcontext(Name name)
                       throws NamingException
Subcontexts are not supported by Jeremie registry URL contexts.

Specified by:
destroySubcontext in interface Context
Throws:
OperationNotSupportedException
NamingException

destroySubcontext

public void destroySubcontext(String name)
                       throws NamingException
Subcontexts are not supported by Jeremie registry URL contexts.

Specified by:
destroySubcontext in interface Context
Throws:
OperationNotSupportedException
NamingException

lookupLink

public Object lookupLink(Name name)
                  throws NamingException
Links are not treated specially by Jeremie registry URL contexts. This method does the same as the lookup(Name) method.

Specified by:
lookupLink in interface Context
Parameters:
name - the URL of the registry location and the name of the object to be retrieved.
Returns:
the object bound to the given name in the given registry.
Throws:
NamingException - if something goes wrong.

lookupLink

public Object lookupLink(String name)
                  throws NamingException
Links are not treated specially by Jeremie registry URL contexts. This method does the same as the lookup(String) method.

Specified by:
lookupLink in interface Context
Parameters:
name - the URL of the registry location and the name of the object to be retrieved.
Returns:
the object bound to the given name in the given registry.
Throws:
NamingException - if something goes wrong.

getNameParser

public NameParser getNameParser(Name name)
                         throws NamingException
Retrieves the name parser of the Jeremie registry context indicated by the given URL name.

Specified by:
getNameParser in interface Context
Parameters:
name - the URL name of the registry context from which to get the parser.
Returns:
the name parser of the current registry context.
Throws:
NamingException - if something goes wrong.

getNameParser

public NameParser getNameParser(String name)
                         throws NamingException
Retrieves the name parser of the Jeremie registry context indicated by the given URL string.

Specified by:
getNameParser in interface Context
Parameters:
name - the URL string of the registry context from which to get the parser.
Returns:
the name parser of the current registry context.
Throws:
NamingException - if something goes wrong.

composeName

public Name composeName(Name name,
                        Name prefix)
                 throws NamingException
Composes two names, one being relative to the current context, the other being the name of the current context relative to one of its ancestors.

Specified by:
composeName in interface Context
Parameters:
name - a name relative to this registry context;
prefix - the name of this context relative to one of its ancestors.
Returns:
a composed name.
Throws:
NamingException - if something goes wrong.

composeName

public String composeName(String name,
                          String prefix)
                   throws NamingException
Composes two stringified names, one being relative to the current context, the other being the stringified name of the current context relative to one of its ancestors.

Specified by:
composeName in interface Context
Parameters:
name - a stringified name relative to this registry context;
prefix - the stringified name of this context relative to one of its ancestors.
Returns:
a composed stringified name.
Throws:
NamingException - if something goes wrong.

getEnvironment

public Hashtable getEnvironment()
                         throws NamingException
Returns the environment of the current URL context.

Specified by:
getEnvironment in interface Context
Returns:
the possibly empty environment of this context.
Throws:
NamingException

addToEnvironment

public Object addToEnvironment(String propName,
                               Object propVal)
                        throws NamingException
Sets the value of a property in the current URL context's environment. Overwrites any previous value of the property.

Specified by:
addToEnvironment in interface Context
Parameters:
propName - the name of the property;
propVal - the value of the property.
Returns:
the previous value of the property, possibly null.
Throws:
NamingException - if something goes wrong.

removeFromEnvironment

public Object removeFromEnvironment(String propName)
                             throws NamingException
Undefines the value of a property in the current URL context's environment.

Specified by:
removeFromEnvironment in interface Context
Parameters:
propName - the name of the property;
Returns:
the previous value of the property, possibly null.
Throws:
NamingException - if something goes wrong.

getNameInNamespace

public String getNameInNamespace()
                          throws NamingException
Retrieves the full name of the current context within its own namespace, in other words, the empty string "".

Specified by:
getNameInNamespace in interface Context
Returns:
the full name of the current context.
Throws:
NamingException - if something goes wrong.

close

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

Specified by:
close in interface Context
Throws:
NamingException - if something goes wrong.