Registry.java revision 0
0N/A * Copyright 1996-2001 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * <code>Registry</code> is a remote interface to a simple remote 0N/A * object registry that provides methods for storing and retrieving 0N/A * remote object references bound with arbitrary string names. The 0N/A * <code>bind</code>, <code>unbind</code>, and <code>rebind</code> 0N/A * methods are used to alter the name bindings in the registry, and 0N/A * the <code>lookup</code> and <code>list</code> methods are used to 0N/A * query the current name bindings. 0N/A * <p>In its typical usage, a <code>Registry</code> enables RMI client 0N/A * bootstrapping: it provides a simple means for a client to obtain an 0N/A * initial reference to a remote object. Therefore, a registry's 0N/A * remote object implementation is typically exported with a 0N/A * well-known address, such as with a well-known {@link 0N/A * java.rmi.server.ObjID#REGISTRY_ID ObjID} and TCP port number 0N/A * (default is {@link #REGISTRY_PORT 1099}). 0N/A * <p>The {@link LocateRegistry} class provides a programmatic API for 0N/A * constructing a bootstrap reference to a <code>Registry</code> at a 0N/A * remote address (see the static <code>getRegistry</code> methods) 0N/A * and for creating and exporting a <code>Registry</code> in the 0N/A * current VM on a particular local address (see the static 0N/A * <code>createRegistry</code> methods). 0N/A * <p>A <code>Registry</code> implementation may choose to restrict 0N/A * access to some or all of its methods (for example, methods that 0N/A * mutate the registry's bindings may be restricted to calls 0N/A * originating from the local host). If a <code>Registry</code> 0N/A * method chooses to deny access for a given invocation, its 0N/A * implementation may throw {@link java.rmi.AccessException}, which 0N/A * (because it extends {@link java.rmi.RemoteException}) will be 0N/A * wrapped in a {@link java.rmi.ServerException} when caught by a 0N/A * <p>The names used for bindings in a <code>Registry</code> are pure 0N/A * strings, not parsed. A service which stores its remote reference 0N/A * in a <code>Registry</code> may wish to use a package name as a 0N/A * prefix in the name binding to reduce the likelihood of name 0N/A * collisions in the registry. 0N/A * @author Ann Wollrath 0N/A * @author Peter Jones 0N/A * @see LocateRegistry 0N/A /** Well known port for registry. */ 0N/A * Returns the remote reference bound to the specified 0N/A * <code>name</code> in this registry. 0N/A * @param name the name for the remote reference to look up 0N/A * @return a reference to a remote object 0N/A * @throws NotBoundException if <code>name</code> is not currently bound 0N/A * @throws RemoteException if remote communication with the 0N/A * registry failed; if exception is a <code>ServerException</code> 0N/A * containing an <code>AccessException</code>, then the registry 0N/A * denies the caller access to perform this operation 0N/A * @throws AccessException if this registry is local and it denies 0N/A * the caller access to perform this operation 0N/A * @throws NullPointerException if <code>name</code> is <code>null</code> 0N/A * Binds a remote reference to the specified <code>name</code> in 0N/A * @param name the name to associate with the remote reference 0N/A * @param obj a reference to a remote object (usually a stub) 0N/A * @throws AlreadyBoundException if <code>name</code> is already bound 0N/A * @throws RemoteException if remote communication with the 0N/A * registry failed; if exception is a <code>ServerException</code> 0N/A * containing an <code>AccessException</code>, then the registry 0N/A * denies the caller access to perform this operation (if 0N/A * originating from a non-local host, for example) 0N/A * @throws AccessException if this registry is local and it denies 0N/A * the caller access to perform this operation 0N/A * @throws NullPointerException if <code>name</code> is 0N/A * <code>null</code>, or if <code>obj</code> is <code>null</code> 0N/A * Removes the binding for the specified <code>name</code> in 0N/A * @param name the name of the binding to remove 0N/A * @throws NotBoundException if <code>name</code> is not currently bound 0N/A * @throws RemoteException if remote communication with the 0N/A * registry failed; if exception is a <code>ServerException</code> 0N/A * containing an <code>AccessException</code>, then the registry 0N/A * denies the caller access to perform this operation (if 0N/A * originating from a non-local host, for example) 0N/A * @throws AccessException if this registry is local and it denies 0N/A * the caller access to perform this operation 0N/A * @throws NullPointerException if <code>name</code> is <code>null</code> 0N/A * Replaces the binding for the specified <code>name</code> in 0N/A * this registry with the supplied remote reference. If there is 0N/A * an existing binding for the specified <code>name</code>, it is 0N/A * @param name the name to associate with the remote reference 0N/A * @param obj a reference to a remote object (usually a stub) 0N/A * @throws RemoteException if remote communication with the 0N/A * registry failed; if exception is a <code>ServerException</code> 0N/A * containing an <code>AccessException</code>, then the registry 0N/A * denies the caller access to perform this operation (if 0N/A * originating from a non-local host, for example) 0N/A * @throws AccessException if this registry is local and it denies 0N/A * the caller access to perform this operation 0N/A * @throws NullPointerException if <code>name</code> is 0N/A * <code>null</code>, or if <code>obj</code> is <code>null</code> 0N/A * Returns an array of the names bound in this registry. The 0N/A * array will contain a snapshot of the names bound in this 0N/A * registry at the time of the given invocation of this method. 0N/A * @return an array of the names bound in this registry 0N/A * @throws RemoteException if remote communication with the 0N/A * registry failed; if exception is a <code>ServerException</code> 0N/A * containing an <code>AccessException</code>, then the registry 0N/A * denies the caller access to perform this operation 0N/A * @throws AccessException if this registry is local and it denies 0N/A * the caller access to perform this operation