gnu.javax.naming.jndi.url.rmi

Class RmiContinuation

Implemented Interfaces:
Context

public class RmiContinuation
extends Object
implements Context

The implementation of the RMI URL context. This context connects

Field Summary

static String
DEFAULT_REGISTRY_LOCATION
The default registry location.

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

RmiContinuation(Map<K,V> props)
Create the rmi url context that works, talking with the given RMI registry.

Method Summary

Object
addToEnvironment(String key, Object value)
Add new environment property to the environment of this context.
void
bind(String name, Object obj)
Bind the given name into this context.
void
bind(Name name, Object obj)
Bind the given name into this context.
void
close()
Release the associated resources.
String
composeName(String name, String prefix)
Not supported.
Name
composeName(Name name, Name prefix)
Not supported.
Context
createSubcontext(String name)
Subcontexts are not supporte by RMI registry.
Context
createSubcontext(Name name)
Subcontexts are not supporte by RMI registry.
void
destroySubcontext(String name)
Subcontexts are not supporte by RMI registry.
void
destroySubcontext(Name name)
Subcontexts are not supporte by RMI registry.
Hashtable<K,V>
getEnvironment()
Returns the environment, associated with this naming context.
String
getNameInNamespace()
Returns the naming service URL, same that was passed vie Context.PROVIDER_URL.
NameParser
getNameParser(String name)
Not supported, this context never parses any names.
NameParser
getNameParser(Name name)
Not supported, this context never parses any names.
Registry
getRegistry()
Get the cached or new registry reference.
NamingEnumeration<T>
list(String name)
List existing bindings of this context (the parameter must be empty string, indicating the root context).
NamingEnumeration<T>
list(Name name)
List existing bindings of this context (the parameter must be empty name, indicating the root context).
NamingEnumeration<T>
listBindings(String name)
List existing bindings of this context (the parameter must be empty name, indicating the root context).
NamingEnumeration<T>
listBindings(Name name)
List existing bindings of this context (the parameter must be empty name, indicating the root context).
Object
lookup(String name)
Resolve the object by name
Object
lookup(Name name)
Resolve the object by name.
Object
lookupLink(String name)
Not supported.
Object
lookupLink(Name name)
Not supported.
void
rebind(String name, Object obj)
Rebinds this object.
void
rebind(Name name, Object obj)
Rebinds this object.
Object
removeFromEnvironment(String propName)
Removes the property with the given name from the environment.
void
removeRegistry()
Remove the current registry reference.
void
rename(String oldName, String newName)
Renames the object.
void
rename(Name oldName, Name newName)
Renames the object.
void
unbind(String name)
Unbind the object.
void
unbind(Name name)
Unbind the object.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

DEFAULT_REGISTRY_LOCATION

public static final String DEFAULT_REGISTRY_LOCATION
The default registry location.
Field Value:
"rmi://localhost:1099"

Constructor Details

RmiContinuation

public RmiContinuation(Map<K,V> props)
Create the rmi url context that works, talking with the given RMI registry.
Parameters:
props - the properties for this context

Method Details

addToEnvironment

public Object addToEnvironment(String key,
                               Object value)
Add new environment property to the environment of this context. Both name and value of the new property must not be null. If the property is already defined, is current value is replaced by the propVal. This method replaces the registry. The new registry will be lazily instantiated on the first call.
Specified by:
addToEnvironment in interface Context
Parameters:
key - the name of the new property
value - the value of the new property
Returns:
the previous value of this property or null if the property has not been previously defined

bind

public void bind(String name,
                 Object obj)
            throws NamingException
Bind the given name into this context.
Specified by:
bind in interface Context

bind

public void bind(Name name,
                 Object obj)
            throws NamingException
Bind the given name into this context. The .toString() is called to convert into the string representation, required by RMI registry.
Specified by:
bind in interface Context
Throws:
NamingException - if the object is not an instance of Remote

close

public void close()
            throws NamingException
Release the associated resources.
Specified by:
close in interface Context

composeName

public String composeName(String name,
                          String prefix)
            throws NamingException
Not supported.
Specified by:
composeName in interface Context

composeName

public Name composeName(Name name,
                        Name prefix)
            throws NamingException
Not supported.
Specified by:
composeName in interface Context

createSubcontext

public Context createSubcontext(String name)
            throws NamingException
Subcontexts are not supporte by RMI registry. The only supported case is an empty name (returns the cloned instance of self).
Specified by:
createSubcontext in interface Context

createSubcontext

public Context createSubcontext(Name name)
            throws NamingException
Subcontexts are not supporte by RMI registry. The only supported case is an empty name (returns the cloned instance of self).
Specified by:
createSubcontext in interface Context

destroySubcontext

public void destroySubcontext(String name)
            throws NamingException
Subcontexts are not supporte by RMI registry.
Specified by:
destroySubcontext in interface Context

destroySubcontext

public void destroySubcontext(Name name)
            throws NamingException
Subcontexts are not supporte by RMI registry.
Specified by:
destroySubcontext in interface Context

getEnvironment

public Hashtable<K,V> getEnvironment()
            throws NamingException
Returns the environment, associated with this naming context. The returned table should never be modified by the caller (the registry would not be updated in such case). Use addToEnvironment(String,Object) and removeFromEnvironment(String) to modify the environement, if needed.
Specified by:
getEnvironment in interface Context
Returns:
the table, representing the environment of this context
Throws:
NamingException -

getNameInNamespace

public String getNameInNamespace()
            throws NamingException
Returns the naming service URL, same that was passed vie Context.PROVIDER_URL.
Specified by:
getNameInNamespace in interface Context

getNameParser

public NameParser getNameParser(String name)
            throws NamingException
Not supported, this context never parses any names.
Specified by:
getNameParser in interface Context

getNameParser

public NameParser getNameParser(Name name)
            throws NamingException
Not supported, this context never parses any names.
Specified by:
getNameParser in interface Context

getRegistry

public Registry getRegistry()
            throws NamingException
Get the cached or new registry reference.
Returns:
the registry reference, either cached or new.

list

public NamingEnumeration<T> list(String name)
            throws NamingException
List existing bindings of this context (the parameter must be empty string, indicating the root context). The class name of the returned name class pairs is "Remote", as this "quick preview" method should probably not call the naming service again. Use listBindings if more details are required.
Specified by:
list in interface Context

list

public NamingEnumeration<T> list(Name name)
            throws NamingException
List existing bindings of this context (the parameter must be empty name, indicating the root context). The class name of the returned name class pairs is "Remote", as this "quick preview" method should probably not call the naming service again. Use listBindings if more details are required.
Specified by:
list in interface Context

listBindings

public NamingEnumeration<T> listBindings(String name)
            throws NamingException
List existing bindings of this context (the parameter must be empty name, indicating the root context).
Specified by:
listBindings in interface Context

listBindings

public NamingEnumeration<T> listBindings(Name name)
            throws NamingException
List existing bindings of this context (the parameter must be empty name, indicating the root context).
Specified by:
listBindings in interface Context

lookup

public Object lookup(String name)
            throws NamingException
Resolve the object by name
Specified by:
lookup in interface Context
Parameters:
name - the object name.

lookup

public Object lookup(Name name)
            throws NamingException
Resolve the object by name.
Specified by:
lookup in interface Context
Parameters:
name - the object name, .toString() is used to get the string representation.

lookupLink

public Object lookupLink(String name)
            throws NamingException
Not supported.
Specified by:
lookupLink in interface Context

lookupLink

public Object lookupLink(Name name)
            throws NamingException
Not supported.
Specified by:
lookupLink in interface Context

rebind

public void rebind(String name,
                   Object obj)
            throws NamingException
Rebinds this object.
Specified by:
rebind in interface Context
Parameters:
name - the object name.
obj - object (must be an instance of Remote).

rebind

public void rebind(Name name,
                   Object obj)
            throws NamingException
Rebinds this object.
Specified by:
rebind in interface Context
Parameters:
name - the object name (.toString()) is used to convert into string representation.
obj - object (must be an instance of Remote).

removeFromEnvironment

public Object removeFromEnvironment(String propName)
            throws NamingException
Removes the property with the given name from the environment. Returns without action if this property is not defined. Replaces the ORB, constructing the new ORB with the changes set of properties (you can replace the CORBA implementation provider, for instance). The new ORB will be lazily instantiated on the first call.
Specified by:
removeFromEnvironment in interface Context
Parameters:
propName - the name of the property being removed.
Returns:
the value of the property that has been removed or null if the property was not defined.
Throws:
NamingException -

removeRegistry

public void removeRegistry()
Remove the current registry reference.

rename

public void rename(String oldName,
                   String newName)
            throws NamingException
Renames the object. If the new name is already bound in the given context, the AlreadyBoundException is thrown and the oldName binding is preserved.
Specified by:
rename in interface Context

rename

public void rename(Name oldName,
                   Name newName)
            throws NamingException
Renames the object. If the new name is already bound in the given context, the AlreadyBoundException is thrown and the oldName binding is preserved.
Specified by:
rename in interface Context

unbind

public void unbind(String name)
            throws NamingException
Unbind the object.
Specified by:
unbind in interface Context

unbind

public void unbind(Name name)
            throws NamingException
Unbind the object.
Specified by:
unbind in interface Context

RmiContinuation.java -- RMI naming context Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.