diff options
Diffstat (limited to 'libjava/classpath/java/rmi')
71 files changed, 5904 insertions, 0 deletions
diff --git a/libjava/classpath/java/rmi/AccessException.java b/libjava/classpath/java/rmi/AccessException.java new file mode 100644 index 00000000000..b470780046c --- /dev/null +++ b/libjava/classpath/java/rmi/AccessException.java @@ -0,0 +1,76 @@ +/* AccessException.java -- thrown if the caller does not have access + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown to indicate that the caller does not have permission to access + * certain data, such as <code>bind</code> in an ActivationSystem. + * + * @author unknown + * @see Naming + * @see ActivationSystem + * @since 1.1 + */ +public class AccessException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 6314925228044966088l; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public AccessException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public AccessException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/AlreadyBoundException.java b/libjava/classpath/java/rmi/AlreadyBoundException.java new file mode 100644 index 00000000000..091c0ee5862 --- /dev/null +++ b/libjava/classpath/java/rmi/AlreadyBoundException.java @@ -0,0 +1,73 @@ +/* AlreadyBoundException.java -- thrown if a binding is already bound + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown on an attempt to bind an object in the registry that is already + * bound. + * + * @author unknown + * @see Naming#bind(String, Remote) + * @see Registry#bind(String, Remote) + * @since 1.1 + * @status updated to 1.4 + */ +public class AlreadyBoundException extends Exception +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 9218657361741657110L; + + /** + * Create an exception with no message. + */ + public AlreadyBoundException() + { + } + + /** + * Create an exception with a message. + * + * @param s the message + */ + public AlreadyBoundException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/ConnectException.java b/libjava/classpath/java/rmi/ConnectException.java new file mode 100644 index 00000000000..dc3abd19741 --- /dev/null +++ b/libjava/classpath/java/rmi/ConnectException.java @@ -0,0 +1,74 @@ +/* ConnectException.java -- thrown if a connection is refused + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if a connection is refused for a remote call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class ConnectException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 4863550261346652506L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ConnectException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public ConnectException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/ConnectIOException.java b/libjava/classpath/java/rmi/ConnectIOException.java new file mode 100644 index 00000000000..dde753ad558 --- /dev/null +++ b/libjava/classpath/java/rmi/ConnectIOException.java @@ -0,0 +1,74 @@ +/* ConnectIOException.java -- thrown if an IO exception occurs during connect + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Wraps an I/O Exception thrown while connecting for a remote call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class ConnectIOException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -8087809532704668744L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ConnectIOException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public ConnectIOException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/MarshalException.java b/libjava/classpath/java/rmi/MarshalException.java new file mode 100644 index 00000000000..e5c10a4bf79 --- /dev/null +++ b/libjava/classpath/java/rmi/MarshalException.java @@ -0,0 +1,76 @@ +/* MarshalException.java -- wraps error while marshalling parameters + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if an exception occurs while marshalling data to send in a remote + * call. The call may not be retransmitted, if the "at most once" semantics + * are to be preserved. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class MarshalException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 6223554758134037936L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public MarshalException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public MarshalException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/MarshalledObject.java b/libjava/classpath/java/rmi/MarshalledObject.java new file mode 100644 index 00000000000..9ec0ace0e70 --- /dev/null +++ b/libjava/classpath/java/rmi/MarshalledObject.java @@ -0,0 +1,113 @@ +/* MarshalledObject.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi; + +import gnu.java.rmi.RMIMarshalledObjectInputStream; +import gnu.java.rmi.RMIMarshalledObjectOutputStream; + +import java.io.ByteArrayOutputStream; +import java.io.Serializable; + +/** + * FIXME - doc missing + */ +public final class MarshalledObject implements Serializable +{ + //The following fields are from Java API Documentation "Serialized form" + private static final long serialVersionUID = 8988374069173025854L; + byte[] objBytes; + byte[] locBytes; + int hash; + + public MarshalledObject(Object obj) throws java.io.IOException + { + ByteArrayOutputStream objStream = new ByteArrayOutputStream(); + RMIMarshalledObjectOutputStream stream = new RMIMarshalledObjectOutputStream(objStream); + stream.writeObject(obj); + stream.flush(); + objBytes = objStream.toByteArray(); + locBytes = stream.getLocBytes(); + + //The following algorithm of calculating hashCode is similar to String + hash = 0; + for (int i = 0; i < objBytes.length; i++) + hash = hash * 31 + objBytes[i]; + if(locBytes != null) + for (int i = 0; i < locBytes.length; i++) + hash = hash * 31 + locBytes[i]; + } + + public boolean equals(Object obj) + { + if (! (obj instanceof MarshalledObject)) + return false; + + // hashCode even differs, don't do the time-consuming comparisons + if (obj.hashCode() != hash) + return false; + + MarshalledObject aobj = (MarshalledObject)obj; + if (objBytes == null || aobj.objBytes == null) + return objBytes == aobj.objBytes; + if (objBytes.length != aobj.objBytes.length) + return false; + for (int i = 0; i < objBytes.length; i++) + { + if (objBytes[i] != aobj.objBytes[i]) + return false; + } + // Ignore comparison of locBytes(annotation) + return true; + } + +public Object get() + throws java.io.IOException, java.lang.ClassNotFoundException +{ + if(objBytes == null) + return null; + RMIMarshalledObjectInputStream stream = + new RMIMarshalledObjectInputStream(objBytes, locBytes); + return stream.readObject(); +} + + public int hashCode() { + return hash; + } + +} diff --git a/libjava/classpath/java/rmi/Naming.java b/libjava/classpath/java/rmi/Naming.java new file mode 100644 index 00000000000..d48df069d8d --- /dev/null +++ b/libjava/classpath/java/rmi/Naming.java @@ -0,0 +1,220 @@ +/* Naming.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi; + +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; + +/** + * <p> + * The <code>Naming</code> class handles interactions with RMI registries. + * Each method takes a URL in <code>String</code> form, which points to + * the RMI registry. The scheme of the URL is irrelevant. The relevant + * part is: + * </p> + * <p> + * <code>//host:port/name</code> + * </p> + * <p> + * which tells the method how to locate and access the registry. The host + * and port are both optional, and default to `localhost' and the standard + * RMI registry port (1099) respectively. The name is simply a string + * used to refer to a particular service hosted by the registry. The + * registry does not attempt to interpret this further. + * </p> + * <p> + * RMI services are registered using one of these names, and the same name + * is later used by the client to lookup the service and access its methods. + * Registries can be shared by multiple services, or a service can create + * its own registry using <code>createRegistry()</code>. + * </p> + * + * @author Original author unknown. + * @author Ingo Proetel (proetel@aicas.com) + * @author Guilhem Lavaux (guilhem@kaffe.org) + * @author Jeroen Frijters (jeroen@frijters.net) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + * @since 1.1 + */ +public final class Naming { + + /** + * This class isn't intended to be instantiated. + */ + private Naming() {} + +/** + * Looks for the remote object that is associated with the named service. + * Name and location is given in form of a URL without a scheme: + * + * <pre> + * //host:port/service-name + * </pre> + * + * The port is optional. + * + * @param name the service name and location + * @return Remote-object that implements the named service + * @throws NotBoundException if no object implements the service + * @throws MalformedURLException + * @throws RemoteException + */ +public static Remote lookup(String name) throws NotBoundException, MalformedURLException, RemoteException { + URL u = parseURL(name); + String serviceName = getName(u); + return (getRegistry(u).lookup(serviceName)); +} + +/** + * Try to bind the given object to the given service name. + * @param name + * @param obj + * @throws AlreadyBoundException + * @throws MalformedURLException + * @throws RemoteException + */ +public static void bind(String name, Remote obj) throws AlreadyBoundException, MalformedURLException, RemoteException { + URL u = parseURL(name); + String serviceName = getName(u); + getRegistry(u).bind(serviceName, obj); +} + +/** + * Remove a binding for a given service name. + * @param name + * @throws RemoteException + * @throws NotBoundException + * @throws MalformedURLException + */ +public static void unbind(String name) throws RemoteException, NotBoundException, MalformedURLException { + URL u = parseURL(name); + String serviceName = getName(u); + getRegistry(u).unbind(serviceName); +} + +/** + * Forces the binding between the given Remote-object and the given service name, even + * if there was already an object bound to this name. + * @param name + * @param obj + * @throws RemoteException + * @throws MalformedURLException + */ +public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException { + URL u = parseURL(name); + String serviceName = getName(u); + getRegistry(u).rebind(serviceName, obj); +} + +/** + * Lists all services at the named registry. + * @param name url that specifies the registry + * @return list of services at the name registry + * @throws RemoteException + * @throws MalformedURLException + */ +public static String[] list(String name) throws RemoteException, MalformedURLException { + return (getRegistry(parseURL(name)).list()); +} + +private static Registry getRegistry(URL u) throws RemoteException { + if (u.getPort() == -1) { + return (LocateRegistry.getRegistry(u.getHost())); + } + else { + return (LocateRegistry.getRegistry(u.getHost(), u.getPort())); + } +} + + /** + * Parses the supplied URL and converts it to use the HTTP + * protocol. From an RMI perspective, the scheme is irrelevant + * and we want to be able to create a URL for which a handler is + * available. + * + * @param name the URL in String form. + * @throws MalformedURLException if the URL is invalid. + */ + private static URL parseURL(String name) + throws MalformedURLException + { + try + { + URI uri = new URI(name); + String host = uri.getHost(); + int port = uri.getPort(); + String query = uri.getQuery(); + String path = uri.getPath(); + return new URL("http", + (host == null ? "localhost" : host), + (port == -1 ? 1099 : port), + uri.getPath() + (query == null ? "" : query)); + } + catch (URISyntaxException e) + { + throw new MalformedURLException("The URL syntax was invalid: " + + e.getMessage()); + } + } + + /** + * Checks that the URL contains a name, and removes any leading + * slashes. + * + * @param url the URL to check. + * @throws MalformedURLException if no name is specified. + */ + private static String getName(URL url) + throws MalformedURLException + { + String filename = url.getFile(); + if (filename.length() == 0) + throw new MalformedURLException("No path specified: " + url); + // If the filename begins with a slash we must cut it for + // name resolution. + if (filename.charAt(0) == '/') + return filename.substring(1); + return filename; + } + +} diff --git a/libjava/classpath/java/rmi/NoSuchObjectException.java b/libjava/classpath/java/rmi/NoSuchObjectException.java new file mode 100644 index 00000000000..69f7d6c52fb --- /dev/null +++ b/libjava/classpath/java/rmi/NoSuchObjectException.java @@ -0,0 +1,68 @@ +/* NoSuchObjectException.java -- thrown if the remote object no longer exists + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown on an attempt to invoke a call on an object that no longer exists + * in the remote Virtual Machine. The call may be retransmitted and still + * obey the semantics of "at most once". + * + * @author unknown + * @see RemoteObject#toStub(Remote) + * @see UnicastRemoteObject#unexportObject(Remote, boolean) + * @see Activatable#unexportObject(Remote, boolean) + * @since 1.1 + * @status updated to 1.4 + */ +public class NoSuchObjectException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 6619395951570472985L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public NoSuchObjectException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/NotBoundException.java b/libjava/classpath/java/rmi/NotBoundException.java new file mode 100644 index 00000000000..b8bc0a5320a --- /dev/null +++ b/libjava/classpath/java/rmi/NotBoundException.java @@ -0,0 +1,75 @@ +/* NotBoundException.java -- attempt to use a registry name with no binding + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown on an attempt to lookup or unbind a registry name that has no + * associated binding. + * + * @author unknown + * @see Naming#lookup(String) + * @see Naming#unbind(String) + * @see Registry#lookup(String) + * @see Registry#unbind(String) + * @since 1.1 + * @status updated to 1.4 + */ +public class NotBoundException extends Exception +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -1857741824849069317l; + + /** + * Create an exception with no message. + */ + public NotBoundException() + { + } + + /** + * Create an exception with a message. + * + * @param s the message + */ + public NotBoundException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/RMISecurityException.java b/libjava/classpath/java/rmi/RMISecurityException.java new file mode 100644 index 00000000000..a44a67e2a02 --- /dev/null +++ b/libjava/classpath/java/rmi/RMISecurityException.java @@ -0,0 +1,77 @@ +/* RMISecurityException.java -- deprecated version of SecurityException + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Never thrown, but originally intended to wrap a java.lang.SecurityException. + * + * @author unknown + * @since 1.1 + * @deprecated use {@link SecurityException} instead + * @status updated to 1.4 + */ +public class RMISecurityException extends SecurityException +{ + /** + * Compatible with JDK 1.1. + */ + private static final long serialVersionUID = -8433406075740433514L; + + /** + * Create an exception with a message. + * + * @param s the message + * @deprecated no longer needed + */ + public RMISecurityException(String n) + { + super(n); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + * @deprecated no longer needed + */ + public RMISecurityException(String n, String a) + { + super(n); + } +} diff --git a/libjava/classpath/java/rmi/RMISecurityManager.java b/libjava/classpath/java/rmi/RMISecurityManager.java new file mode 100644 index 00000000000..a8eb13e1a0a --- /dev/null +++ b/libjava/classpath/java/rmi/RMISecurityManager.java @@ -0,0 +1,48 @@ +/* RMISecurityManager.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2003 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. */ + +package java.rmi; + +/** + * @since 1.1 + */ +public class RMISecurityManager extends SecurityManager +{ + public RMISecurityManager() + { + } +} diff --git a/libjava/classpath/java/rmi/Remote.java b/libjava/classpath/java/rmi/Remote.java new file mode 100644 index 00000000000..93c8d0aa127 --- /dev/null +++ b/libjava/classpath/java/rmi/Remote.java @@ -0,0 +1,41 @@ +/* Remote.java + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi; + +public interface Remote { +} diff --git a/libjava/classpath/java/rmi/RemoteException.java b/libjava/classpath/java/rmi/RemoteException.java new file mode 100644 index 00000000000..cbbb26299c3 --- /dev/null +++ b/libjava/classpath/java/rmi/RemoteException.java @@ -0,0 +1,127 @@ +/* RemoteException.java -- common superclass for exceptions in java.rmi + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +import java.io.IOException; + +/** + * The superclass of exceptions related to RMI (remote method invocation). + * Classes that implement <code>java.rmi.Remote</code> should list this + * exception in their throws clause. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class RemoteException extends IOException +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = -5148567311918794206l; + + /** + * The cause of this exception. This pre-dates the exception chaining + * of Throwable; and although you can change this field, you are wiser + * to leave it alone. + * + * @serial the exception cause + */ + public Throwable detail; + + /** + * Create an exception with no message, and cause initialized to null. + */ + public RemoteException() + { + this(null, null); + } + + /** + * Create an exception with the given message, and cause initialized to null. + * + * @param s the message + */ + public RemoteException(String s) + { + this(s, null); + } + + /** + * Create an exception with the given message and cause. + * + * @param s the message + * @param ex the cause + */ + public RemoteException(String s, Throwable e) + { + super(s); + initCause(e); + detail = e; + } + + /** + * This method returns a message indicating what went wrong, in this + * format: + * <code>super.getMessage() + (detail == null ? "" + * : "; nested exception is:\n\t" + detail)</code>. + * + * @return the chained message + */ + public String getMessage() + { + if (detail == this || detail == null) + return super.getMessage(); + return super.getMessage() + "; nested exception is:\n\t" + detail; + } + + /** + * Returns the cause of this exception. Note that this may not be the + * original cause, thanks to the <code>detail</code> field being public + * and non-final (yuck). However, to avoid violating the contract of + * Throwable.getCause(), this returns null if <code>detail == this</code>, + * as no exception can be its own cause. + * + * @return the cause + * @since 1.4 + */ + public Throwable getCause() + { + return detail == this ? null : detail; + } +} diff --git a/libjava/classpath/java/rmi/ServerError.java b/libjava/classpath/java/rmi/ServerError.java new file mode 100644 index 00000000000..b1a15b02e74 --- /dev/null +++ b/libjava/classpath/java/rmi/ServerError.java @@ -0,0 +1,64 @@ +/* ServerError.java -- wraps an error while creating the server + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Wraps any error thrown while processing the server of a remote call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class ServerError extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 8455284893909696482L; + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public ServerError(String s, Error e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/ServerException.java b/libjava/classpath/java/rmi/ServerException.java new file mode 100644 index 00000000000..5170aa7b0b5 --- /dev/null +++ b/libjava/classpath/java/rmi/ServerException.java @@ -0,0 +1,74 @@ +/* ServerException.java -- wraps an exception while creating the server + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Wraps any exception thrown while processing the server of a remote call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class ServerException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -4775845313121906682l; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ServerException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public ServerException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/ServerRuntimeException.java b/libjava/classpath/java/rmi/ServerRuntimeException.java new file mode 100644 index 00000000000..1f0813739a6 --- /dev/null +++ b/libjava/classpath/java/rmi/ServerRuntimeException.java @@ -0,0 +1,67 @@ +/* ServerRuntimeException.java -- wraps an exception while creating the server + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Wraps any runtime exception thrown while processing the server of a + * remote call. Note, this exception is no longer used. + * + * @author unknown + * @since 1.1 + * @deprecated no replacement + * @status updated to 1.4 + */ +public class ServerRuntimeException extends RemoteException +{ + /** + * Compatible with JDK 1.1. + */ + private static final long serialVersionUID = 7054464920481467219L; + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + * @deprecated no longer needed + */ + public ServerRuntimeException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/StubNotFoundException.java b/libjava/classpath/java/rmi/StubNotFoundException.java new file mode 100644 index 00000000000..2f9e0f5ff59 --- /dev/null +++ b/libjava/classpath/java/rmi/StubNotFoundException.java @@ -0,0 +1,77 @@ +/* StubNotFoundException.java -- thrown if a valid stub is not found + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if a valid stub class is not found for an object when it is exported. + * + * @author unknown + * @see UnicastRemoteObject + * @see Activatable + * @since 1.1 + * @status updated to 1.4 + */ +public class StubNotFoundException extends RemoteException +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = -7088199405468872373L; + + + /** + * Create an exception with a message. + * + * @param s the message + */ + public StubNotFoundException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public StubNotFoundException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/UnexpectedException.java b/libjava/classpath/java/rmi/UnexpectedException.java new file mode 100644 index 00000000000..e9e0d6a9d48 --- /dev/null +++ b/libjava/classpath/java/rmi/UnexpectedException.java @@ -0,0 +1,75 @@ +/* UnexpectedException.java -- an unexpected checked exception was received + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if an unexpected checked exception was received in a remote + * procedure call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class UnexpectedException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 1800467484195073863L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public UnexpectedException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public UnexpectedException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/UnknownHostException.java b/libjava/classpath/java/rmi/UnknownHostException.java new file mode 100644 index 00000000000..e21b9944c6b --- /dev/null +++ b/libjava/classpath/java/rmi/UnknownHostException.java @@ -0,0 +1,75 @@ +/* UnknownHostException.java -- wraps java.net.UnknownHostException in RMI + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if a java.net.UnknownHostException occurs during a remote + * procedure call. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class UnknownHostException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -8152710247442114228L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public UnknownHostException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public UnknownHostException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/UnmarshalException.java b/libjava/classpath/java/rmi/UnmarshalException.java new file mode 100644 index 00000000000..6567062a523 --- /dev/null +++ b/libjava/classpath/java/rmi/UnmarshalException.java @@ -0,0 +1,88 @@ +/* UnmarshalException.java -- wraps error while unmarshalling parameters + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi; + +/** + * Thrown if an exception occurs while unmarshalling parameters or results + * of a remote method call. This includes:<br><ul> + * <li>if an exception occurs while unmarshalling the call header</li> + * <li>if the protocol for the return value is invalid</li> + * <li>if a java.io.IOException occurs unmarshalling parameters (on the + * server side) or the return value (on the client side).</li> + * <li>if a java.lang.ClassNotFoundException occurs during unmarshalling + * parameters or return values</li> + * <li>if no skeleton can be loaded on the server-side; note that skeletons + * are required in the 1.1 stub protocol, but not in the 1.2 stub + * protocol.</li> + * <li>if the method hash is invalid (i.e., missing method).</li> + * <li>if there is a failure to create a remote reference object for a remote + * object's stub when it is unmarshalled.</li> + * </ul> + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class UnmarshalException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 594380845140740218l; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public UnmarshalException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public UnmarshalException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/activation/Activatable.java b/libjava/classpath/java/rmi/activation/Activatable.java new file mode 100644 index 00000000000..b4c38bf61a8 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/Activatable.java @@ -0,0 +1,105 @@ +/* Activatable.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.rmi.MarshalledObject; +import java.rmi.NoSuchObjectException; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.server.RMIClientSocketFactory; +import java.rmi.server.RMIServerSocketFactory; +import java.rmi.server.RemoteServer; + +public abstract class Activatable extends RemoteServer +{ +static final long serialVersionUID = -3120617863591563455L; + +protected Activatable(String location, MarshalledObject data, boolean restart, int port) throws ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +protected Activatable(String location, MarshalledObject data, boolean restart, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +protected Activatable(ActivationID id, int port) throws RemoteException { + throw new Error("Not implemented"); +} + +protected Activatable(ActivationID id, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + throw new Error("Not implemented"); +} + +protected ActivationID getID() { + throw new Error("Not implemented"); +} + +public static Remote register(ActivationDesc desc) throws UnknownGroupException, ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +public static boolean inactive(ActivationID id) throws UnknownObjectException, ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +public static void unregister(ActivationID id) throws UnknownObjectException, ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +public static ActivationID exportObject(Remote obj, String location, MarshalledObject data, boolean restart, int port) throws ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +public static ActivationID exportObject(Remote obj, String location, MarshalledObject data, boolean restart, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws ActivationException, RemoteException { + throw new Error("Not implemented"); +} + +public static Remote exportObject(Remote obj, ActivationID id, int port) throws RemoteException { + throw new Error("Not implemented"); +} + +public static Remote exportObject(Remote obj, ActivationID id, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + throw new Error("Not implemented"); +} + +public static boolean unexportObject(Remote obj, boolean force) throws NoSuchObjectException { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivateFailedException.java b/libjava/classpath/java/rmi/activation/ActivateFailedException.java new file mode 100644 index 00000000000..1c2e10ee3e6 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivateFailedException.java @@ -0,0 +1,76 @@ +/* ActivateFailedException.java -- thrown when activation fails + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.activation; + +import java.rmi.RemoteException; + +/** + * Thrown when activation fails on a remote call to an activatable object. + * + * @author unknown + * @since 1.2 + * @status updated to 1.4 + */ +public class ActivateFailedException extends RemoteException +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = 4863550261346652506L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ActivateFailedException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param ex the cause + */ + public ActivateFailedException(String s, Exception ex) + { + super(s, ex); + } +} diff --git a/libjava/classpath/java/rmi/activation/ActivationDesc.java b/libjava/classpath/java/rmi/activation/ActivationDesc.java new file mode 100644 index 00000000000..65894f808d2 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationDesc.java @@ -0,0 +1,113 @@ +/* ActivationDecc.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.activation; + +import java.io.Serializable; +import java.rmi.MarshalledObject; + +public final class ActivationDesc implements Serializable +{ + static final long serialVersionUID = 7455834104417690957L; + +private ActivationGroupID groupid; +private String classname; +private String location; +private MarshalledObject data; +private boolean restart; + +public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException { + this(ActivationGroup.currentGroupID(), className, location, data, false); +} + +public ActivationDesc(String className, String location, MarshalledObject data, boolean restart) throws ActivationException { + this(ActivationGroup.currentGroupID(), className, location, data, restart); +} + +public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data) { + this(groupID, className, location, data, false); +} + +public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data, boolean restart) { + this.groupid = groupID; + this.classname = className; + this.location = location; + this.data = data; + this.restart = restart; +} + +public ActivationGroupID getGroupID() { + return (groupid); +} + +public String getClassName() { + return (classname); +} + +public String getLocation() { + return (location); +} + +public MarshalledObject getData() { + return (data); +} + +public boolean getRestartMode() { + return (restart); +} + +public boolean equals(Object obj) { + if (!(obj instanceof ActivationDesc)) { + return (false); + } + ActivationDesc that = (ActivationDesc)obj; + + if (this.groupid.equals(that.groupid) && + this.classname.equals(that.classname) && + this.location.equals(that.location) && + this.data.equals(that.data) && + this.restart == that.restart) { + return (true); + } + return (false); +} + +public int hashCode() { + return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode()); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivationException.java b/libjava/classpath/java/rmi/activation/ActivationException.java new file mode 100644 index 00000000000..418f4385757 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationException.java @@ -0,0 +1,122 @@ +/* ActivationException.java -- general Activation exception + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.activation; + +/** + * General exception class for <code>java.rmi.activation</code>. + * + * @author unknown + * @since 1.2 + * @status updated to 1.4 + */ +public class ActivationException extends Exception +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = -4320118837291406071L; + + /** + * The cause of this exception. This pre-dates the exception chaining + * of Throwable; and although you can change this field, you are wiser + * to leave it alone. + * + * @serial the exception cause + */ + public Throwable detail; + + /** + * Create an exception with no message, and cause initialized to null. + */ + public ActivationException() + { + this(null, null); + } + + /** + * Create an exception with the given message, and cause initialized to null. + * + * @param s the message + */ + public ActivationException(String s) + { + this(s, null); + } + + /** + * Create an exception with the given message and cause. + * + * @param s the message + * @param ex the cause + */ + public ActivationException(String s, Throwable ex) + { + super(s, ex); + detail = ex; + } + + /** + * This method returns a message indicating what went wrong, in this + * format: + * <code>super.getMessage() + (detail == null ? "" + * : "; nested exception is:\n\t" + detail)</code>. + * + * @return the chained message + */ + public String getMessage() + { + if (detail == this || detail == null) + return super.getMessage(); + return super.getMessage() + "; nested exception is:\n\t" + detail; + } + + /** + * Returns the cause of this exception. Note that this may not be the + * original cause, thanks to the <code>detail</code> field being public + * and non-final (yuck). However, to avoid violating the contract of + * Throwable.getCause(), this returns null if <code>detail == this</code>, + * as no exception can be its own cause. + * + * @return the cause + * @since 1.4 + */ + public Throwable getCause() + { + return detail == this ? null : detail; + } +} diff --git a/libjava/classpath/java/rmi/activation/ActivationGroup.java b/libjava/classpath/java/rmi/activation/ActivationGroup.java new file mode 100644 index 00000000000..e5774a1b961 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationGroup.java @@ -0,0 +1,85 @@ +/* ActivationGroup.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + + +package java.rmi.activation; + +import java.rmi.MarshalledObject; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; + +public abstract class ActivationGroup extends UnicastRemoteObject + implements ActivationInstantiator +{ +static final long serialVersionUID = -7696947875314805420L; + +protected ActivationGroup(ActivationGroupID groupID) throws RemoteException { + throw new Error("Not implemented"); +} + +public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { + throw new Error("Not implemented"); +} + +public abstract void activeObject(ActivationID id, Remote obj) throws ActivationException, UnknownObjectException, RemoteException; + +public static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation) throws ActivationException { + throw new Error("Not implemented"); +} + +public static ActivationGroupID currentGroupID() { + throw new Error("Not implemented"); +} + +public static void setSystem(ActivationSystem system) throws ActivationException { + throw new Error("Not implemented"); +} + +public static ActivationSystem getSystem() throws ActivationException { + throw new Error("Not implemented"); +} + +protected void activeObject(ActivationID id, MarshalledObject mobj) throws ActivationException, UnknownObjectException, RemoteException { + throw new Error("Not implemented"); +} + +protected void inactiveGroup() throws UnknownGroupException, RemoteException { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivationGroupDesc.java b/libjava/classpath/java/rmi/activation/ActivationGroupDesc.java new file mode 100644 index 00000000000..35b546e3294 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationGroupDesc.java @@ -0,0 +1,134 @@ +/* ActivationGroupDesc.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.io.Serializable; +import java.rmi.MarshalledObject; +import java.util.Properties; + +public final class ActivationGroupDesc implements Serializable +{ + static final long serialVersionUID = -4936225423168276595L; + +public static class CommandEnvironment + implements Serializable { + +static final long serialVersionUID = 6165754737887770191L; + +private String cmdpath; +private String[] argv; + +public CommandEnvironment(String cmdpath, String[] argv) { + this.cmdpath = cmdpath; + this.argv = argv; +} + +public String getCommandPath() { + return (cmdpath); +} + +public String[] getCommandOptions() { + return (argv); +} + +public boolean equals(Object obj) { + if (!(obj instanceof CommandEnvironment)) { + return (false); + } + CommandEnvironment that = (CommandEnvironment)obj; + + if (!this.cmdpath.equals(that.cmdpath)) { + return (false); + } + + int len = this.argv.length; + if (len != that.argv.length) { + return (false); + } + for (int i = 0; i < len; i++) { + if (!this.argv[i].equals(that.argv[i])) { + return (false); + } + } + return (true); +} + +public int hashCode() { + return (cmdpath.hashCode()); // Not a very good hash code. +} + +} + +public ActivationGroupDesc(Properties overrides, ActivationGroupDesc.CommandEnvironment cmd) { + throw new Error("Not implemented"); +} + +public ActivationGroupDesc(String className, String location, MarshalledObject data, Properties overrides, ActivationGroupDesc.CommandEnvironment cmd) { + throw new Error("Not implemented"); +} + +public String getClassName() { + throw new Error("Not implemented"); +} + +public String getLocation() { + throw new Error("Not implemented"); +} + +public MarshalledObject getData() { + throw new Error("Not implemented"); +} + +public Properties getPropertyOverrides() { + throw new Error("Not implemented"); +} + +public ActivationGroupDesc.CommandEnvironment getCommandEnvironment() { + throw new Error("Not implemented"); +} + +public boolean equals(Object obj) { + throw new Error("Not implemented"); +} + +public int hashCode() { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivationGroupID.java b/libjava/classpath/java/rmi/activation/ActivationGroupID.java new file mode 100644 index 00000000000..5e0b96442e8 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationGroupID.java @@ -0,0 +1,70 @@ +/* ActivationGroupID.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.activation; + +import java.io.Serializable; + +public class ActivationGroupID implements Serializable +{ + static final long serialVersionUID = -1648432278909740833L; + +private ActivationSystem system; + +public ActivationGroupID(ActivationSystem system) { + this.system = system; +} + +public ActivationSystem getSystem() { + return (system); +} + +public int hashCode() { + return (system.hashCode()); +} + +public boolean equals(Object obj) { + if (obj instanceof ActivationGroupID) { + ActivationGroupID that = (ActivationGroupID)obj; + if (this.system.equals(that.system)) { + return (true); + } + } + return (false); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivationID.java b/libjava/classpath/java/rmi/activation/ActivationID.java new file mode 100644 index 00000000000..23ed853a478 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationID.java @@ -0,0 +1,72 @@ +/* ActivationID.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.activation; + +import java.io.Serializable; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public class ActivationID implements Serializable +{ + static final long serialVersionUID = -4608673054848209235L; + +private Activator activator; + +public ActivationID(Activator activator) { + this.activator = activator; +} + +public Remote activate(boolean force) throws ActivationException, UnknownObjectException, RemoteException { + throw new Error("Not implemented"); +} + +public int hashCode() { + return (activator.hashCode()); +} + +public boolean equals(Object obj) { + if (obj instanceof ActivationID) { + ActivationID that = (ActivationID)obj; + if (this.activator.equals(that.activator)) { + return (true); + } + } + return (false); +} + +} diff --git a/libjava/classpath/java/rmi/activation/ActivationInstantiator.java b/libjava/classpath/java/rmi/activation/ActivationInstantiator.java new file mode 100644 index 00000000000..0aceb7a4ad6 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationInstantiator.java @@ -0,0 +1,50 @@ +/* ActivationInstantiator.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.rmi.MarshalledObject; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface ActivationInstantiator + extends Remote +{ + MarshalledObject newInstance (ActivationID id, ActivationDesc desc) + throws ActivationException, RemoteException; +} diff --git a/libjava/classpath/java/rmi/activation/ActivationMonitor.java b/libjava/classpath/java/rmi/activation/ActivationMonitor.java new file mode 100644 index 00000000000..1e64257edd1 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationMonitor.java @@ -0,0 +1,55 @@ +/* ActivationMonitor.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.rmi.MarshalledObject; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface ActivationMonitor extends Remote +{ + void inactiveObject (ActivationID id) + throws UnknownObjectException, RemoteException; + + void activeObject (ActivationID id, MarshalledObject obj) + throws UnknownObjectException, RemoteException; + + void inactiveGroup (ActivationGroupID id, long incarnation) + throws UnknownGroupException, RemoteException; +} diff --git a/libjava/classpath/java/rmi/activation/ActivationSystem.java b/libjava/classpath/java/rmi/activation/ActivationSystem.java new file mode 100644 index 00000000000..4b92d40cb44 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/ActivationSystem.java @@ -0,0 +1,78 @@ +/* ActivationSystem.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface ActivationSystem extends Remote +{ + int SYSTEM_PORT = 1098; + + ActivationID registerObject (ActivationDesc desc) + throws ActivationException, UnknownGroupException, RemoteException; + + void unregisterObject (ActivationID id) + throws ActivationException, UnknownObjectException, RemoteException; + + ActivationGroupID registerGroup (ActivationGroupDesc desc) + throws ActivationException, RemoteException; + + ActivationMonitor activeGroup (ActivationGroupID id, + ActivationInstantiator group, long incarnation) + throws UnknownGroupException, ActivationException, RemoteException; + + void unregisterGroup (ActivationGroupID id) + throws ActivationException, UnknownGroupException, RemoteException; + + void shutdown() + throws RemoteException; + + ActivationDesc setActivationDesc (ActivationID id, ActivationDesc desc) + throws ActivationException, UnknownObjectException, UnknownGroupException, + RemoteException; + + ActivationGroupDesc setActivationGroupDesc (ActivationGroupID id, + ActivationGroupDesc desc) + throws ActivationException, UnknownGroupException, RemoteException; + + ActivationDesc getActivationDesc (ActivationID id) throws ActivationException, UnknownObjectException, RemoteException; + + ActivationGroupDesc getActivationGroupDesc (ActivationGroupID id) throws ActivationException, UnknownGroupException, RemoteException; +} diff --git a/libjava/classpath/java/rmi/activation/Activator.java b/libjava/classpath/java/rmi/activation/Activator.java new file mode 100644 index 00000000000..2fb5a581002 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/Activator.java @@ -0,0 +1,50 @@ +/* Activator.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.activation; + +import java.rmi.MarshalledObject; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface Activator + extends Remote +{ + MarshalledObject activate (ActivationID id, boolean force) + throws ActivationException, UnknownObjectException, RemoteException; +} diff --git a/libjava/classpath/java/rmi/activation/UnknownGroupException.java b/libjava/classpath/java/rmi/activation/UnknownGroupException.java new file mode 100644 index 00000000000..91890a9073d --- /dev/null +++ b/libjava/classpath/java/rmi/activation/UnknownGroupException.java @@ -0,0 +1,69 @@ +/* UnknownGroupException.java -- thrown on an invalid ActivationGroupID + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.activation; + +/** + * Thrown when an <code>ActivationGroupID</code> parameter is invalid or + * unknown. + * + * @author unknown + * @see Activatable + * @see ActivationGroup + * @see ActivationID + * @see ActivationMonitor + * @see ActivationSystem + * @since 1.2 + * @status updated to 1.4 + */ +public class UnknownGroupException extends ActivationException +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = 7056094974750002460L; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public UnknownGroupException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/activation/UnknownObjectException.java b/libjava/classpath/java/rmi/activation/UnknownObjectException.java new file mode 100644 index 00000000000..8dbeb0e6050 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/UnknownObjectException.java @@ -0,0 +1,69 @@ +/* UnknownObjectException.java -- thrown on an invalid ActivationID + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.activation; + +/** + * Thrown when an <code>ActivationID</code> parameter is invalid or unknown. + * + * @author unknown + * @see Activatable + * @see ActivationGroup + * @see ActivationID + * @see ActivationMonitor + * @see ActivationSystem + * @see Activator + * @since 1.2 + * @status updated to 1.4 + */ +public class UnknownObjectException extends ActivationException +{ + /** + * Compatible with JDK 1.2+. + */ + private static final long serialVersionUID = 3425547551622251430L; + + /** + * Create an exception with an error message. + * + * @param s the message + */ + public UnknownObjectException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/activation/package.html b/libjava/classpath/java/rmi/activation/package.html new file mode 100644 index 00000000000..444782dd721 --- /dev/null +++ b/libjava/classpath/java/rmi/activation/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.rmi.activation package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - java.rmi.activation</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/java/rmi/dgc/DGC.java b/libjava/classpath/java/rmi/dgc/DGC.java new file mode 100644 index 00000000000..e78ec2a3aa7 --- /dev/null +++ b/libjava/classpath/java/rmi/dgc/DGC.java @@ -0,0 +1,51 @@ +/* DGC.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.dgc; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.server.ObjID; + +public interface DGC extends Remote +{ + Lease dirty (ObjID[] ids, long sequenceNum, Lease lease) + throws RemoteException; + + void clean (ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) + throws RemoteException; +} diff --git a/libjava/classpath/java/rmi/dgc/Lease.java b/libjava/classpath/java/rmi/dgc/Lease.java new file mode 100644 index 00000000000..d3d7f695216 --- /dev/null +++ b/libjava/classpath/java/rmi/dgc/Lease.java @@ -0,0 +1,67 @@ +/* Lease.java + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.dgc; + +import java.io.Serializable; + +public final class Lease + implements Serializable { + +static final long serialVersionUID = -5713411624328831948L; + +private VMID vmid; +private long value; + +public Lease(VMID id, long duration) { + vmid = id; + value = duration; +} + +public VMID getVMID() { + return (vmid); +} + +public long getValue() { + return (value); +} + +public String toString() { + return ("[" + vmid.toString() + ", " + Long.toString(value) + "]"); +} + +} diff --git a/libjava/classpath/java/rmi/dgc/VMID.java b/libjava/classpath/java/rmi/dgc/VMID.java new file mode 100644 index 00000000000..f960d9ccd79 --- /dev/null +++ b/libjava/classpath/java/rmi/dgc/VMID.java @@ -0,0 +1,138 @@ +/* VMID.java + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.dgc; + +import java.io.Serializable; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.rmi.server.UID; + +public final class VMID implements Serializable +{ + static final long serialVersionUID = -538642295484486218L; + + static final boolean areWeUnique; + + static byte[] localAddr; + + private byte[] addr; + + private UID uid; + + static + { + byte[] addr; + boolean awu = true; + try { + addr = InetAddress.getLocalHost().getAddress(); + if (addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) { + awu = false; + } + } + catch (UnknownHostException _) { + addr = new byte[]{ 127, 0, 0, 1 }; + awu = false; + } + localAddr = addr; + areWeUnique = awu; + } + + public VMID() + { + addr = localAddr; + uid = new UID(); + } + + /** + * @deprecated + */ + public static boolean isUnique () + { + return areWeUnique; + } + + public int hashCode () + { + return super.hashCode(); + } + + public boolean equals (Object obj) + { + if (!(obj instanceof VMID)) + { + return false; + } + + VMID other = (VMID) obj; + if (addr.length != other.addr.length) + { + return false; + } + + for (int i = addr.length - 1; i >= 0; i--) + { + if (addr[i] != other.addr[i]) + { + return false; + } + } + + return uid.equals(other.uid); + } + + public String toString () + { + StringBuffer buf = new StringBuffer ("[VMID: "); + + for (int i = 0; i < addr.length; i++) + { + if (i > 0) + { + buf.append ("."); + } + + buf.append (Integer.toString (addr [i])); + } + + buf.append (" "); + buf.append (uid.toString ()); + buf.append ("]"); + + return buf.toString(); + } +} diff --git a/libjava/classpath/java/rmi/dgc/package.html b/libjava/classpath/java/rmi/dgc/package.html new file mode 100644 index 00000000000..9458d4c25f9 --- /dev/null +++ b/libjava/classpath/java/rmi/dgc/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.rmi.dgc package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - java.rmi.dgc</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/java/rmi/package.html b/libjava/classpath/java/rmi/package.html new file mode 100644 index 00000000000..a7bf8502056 --- /dev/null +++ b/libjava/classpath/java/rmi/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.rmi package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - java.rmi</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/java/rmi/registry/LocateRegistry.java b/libjava/classpath/java/rmi/registry/LocateRegistry.java new file mode 100644 index 00000000000..3547a7ad0f4 --- /dev/null +++ b/libjava/classpath/java/rmi/registry/LocateRegistry.java @@ -0,0 +1,87 @@ +/* LocateRegistry.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.registry; + +import gnu.java.rmi.registry.RegistryImpl; +import gnu.java.rmi.registry.RegistryImpl_Stub; +import gnu.java.rmi.server.UnicastRef; + +import java.rmi.RemoteException; +import java.rmi.server.ObjID; +import java.rmi.server.RMIClientSocketFactory; +import java.rmi.server.RMIServerSocketFactory; +import java.rmi.server.RMISocketFactory; +import java.rmi.server.RemoteRef; + +public final class LocateRegistry { + /** + * This class isn't intended to be instantiated. + */ + private LocateRegistry() {} + +public static Registry getRegistry() throws RemoteException { + return (getRegistry("localhost", Registry.REGISTRY_PORT)); +} + +public static Registry getRegistry(int port) throws RemoteException { + return (getRegistry("localhost", port)); +} + +public static Registry getRegistry(String host) throws RemoteException { + return (getRegistry(host, Registry.REGISTRY_PORT)); +} + +public static Registry getRegistry(String host, int port) throws RemoteException { + return (getRegistry(host, port, RMISocketFactory.getSocketFactory())); +} + +public static Registry getRegistry(String host, int port, RMIClientSocketFactory csf) throws RemoteException { + RemoteRef ref = new UnicastRef(new ObjID(ObjID.REGISTRY_ID), host, port, csf); + return (new RegistryImpl_Stub(ref)); +} + +public static Registry createRegistry(int port) throws RemoteException { + return (createRegistry(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory())); +} + +public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + return (new RegistryImpl(port, csf, ssf)); +} + +} diff --git a/libjava/classpath/java/rmi/registry/Registry.java b/libjava/classpath/java/rmi/registry/Registry.java new file mode 100644 index 00000000000..6cd2a04a685 --- /dev/null +++ b/libjava/classpath/java/rmi/registry/Registry.java @@ -0,0 +1,65 @@ +/* Registry.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.registry; + +import java.rmi.AccessException; +import java.rmi.AlreadyBoundException; +import java.rmi.NotBoundException; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface Registry extends Remote +{ + int REGISTRY_PORT = 1099; + + Remote lookup(String name) + throws RemoteException, NotBoundException, AccessException; + + void bind(String name, Remote obj) + throws RemoteException, AlreadyBoundException, AccessException; + + void unbind(String name) + throws RemoteException, NotBoundException, AccessException; + + void rebind(String name, Remote obj) + throws RemoteException, AccessException; + + String[] list() + throws RemoteException, AccessException; +} diff --git a/libjava/classpath/java/rmi/registry/RegistryHandler.java b/libjava/classpath/java/rmi/registry/RegistryHandler.java new file mode 100644 index 00000000000..b9b45092305 --- /dev/null +++ b/libjava/classpath/java/rmi/registry/RegistryHandler.java @@ -0,0 +1,58 @@ +/* RegistryHandler.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.registry; + +import java.rmi.RemoteException; +import java.rmi.UnknownHostException; + +/** + * @deprecated + */ +public interface RegistryHandler +{ + /** + * @deprecated + */ + Registry registryStub (String host, int port) + throws RemoteException, UnknownHostException; + + /** + * @deprecated + */ + Registry registryImpl (int port) throws RemoteException; +} diff --git a/libjava/classpath/java/rmi/registry/package.html b/libjava/classpath/java/rmi/registry/package.html new file mode 100644 index 00000000000..4e16672709c --- /dev/null +++ b/libjava/classpath/java/rmi/registry/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.rmi.registry package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - java.rmi.registry</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/java/rmi/server/ExportException.java b/libjava/classpath/java/rmi/server/ExportException.java new file mode 100644 index 00000000000..b2d5bfca52e --- /dev/null +++ b/libjava/classpath/java/rmi/server/ExportException.java @@ -0,0 +1,78 @@ +/* ExportException.java -- an export attempt failed + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +import java.rmi.RemoteException; + +/** + * Thrown if an attempt to export a remote object fails. + * + * @author unknown + * @see UnicastRemoteObject + * @see Activatable + * @since 1.1 + * @status updated to 1.4 + */ +public class ExportException extends RemoteException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -9155485338494060170L; + + /** + * Create an exception with the specified message. + * + * @param s the message + */ + public ExportException(String s) + { + super(s); + } + + /** + * Create an exception with the specified message and cause. + * + * @param s the message + * @param e the cause + */ + public ExportException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/server/LoaderHandler.java b/libjava/classpath/java/rmi/server/LoaderHandler.java new file mode 100644 index 00000000000..189085710b4 --- /dev/null +++ b/libjava/classpath/java/rmi/server/LoaderHandler.java @@ -0,0 +1,66 @@ +/* LoaderHandler.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.server; + +import java.net.MalformedURLException; +import java.net.URL; + +/** + * @deprecated + */ +public interface LoaderHandler +{ + String packagePrefix = ""; + + /** + * @deprecated + */ + Class loadClass(String name) + throws MalformedURLException, ClassNotFoundException; + + /** + * @deprecated + */ + Class loadClass(URL codebase, String name) + throws MalformedURLException, ClassNotFoundException; + + /** + * @deprecated + */ + Object getSecurityContext(ClassLoader loader); +} diff --git a/libjava/classpath/java/rmi/server/LogStream.java b/libjava/classpath/java/rmi/server/LogStream.java new file mode 100644 index 00000000000..a2dfbb47fcc --- /dev/null +++ b/libjava/classpath/java/rmi/server/LogStream.java @@ -0,0 +1,146 @@ +/* LogStream.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.OutputStream; +import java.io.PrintStream; + +/** + * @deprecated + */ +public class LogStream extends PrintStream +{ + public static final int SILENT = 0; + public static final int BRIEF = 10; + public static final int VERBOSE = 20; + + private static PrintStream defStream; + + private LogStream (OutputStream s) + { + super (s); + } + + /** + * @deprecated + */ + public static LogStream log (String name) + { + throw new Error ("Not implemented"); + } + + /** + * @deprecated + */ + public static PrintStream getDefaultStream () + { + return defStream; + } + + /** + * @deprecated + */ + public static void setDefaultStream (PrintStream s) + { + defStream = s; + } + + /** + * @deprecated + */ + public OutputStream getOutputStream () + { + return out; + } + + /** + * @deprecated + */ + public void setOutputStream (OutputStream s) + { + out = s; + } + + /** + * @deprecated + */ + public void write (int buffer) + { + super.write (buffer); + } + + /** + * @deprecated + */ + public void write (byte[] buffer, int offset, int len) + { + super.write (buffer, offset, len); + } + + /** + * @deprecated + */ + public String toString () + { + throw new Error ("Not implemented"); + } + + /** + * @deprecated + */ + public static int parseLevel (String s) + { + if (s.equalsIgnoreCase ("silent")) + { + return SILENT; + } + + if (s.equalsIgnoreCase ("brief")) + { + return BRIEF; + } + + if (s.equalsIgnoreCase ("verbose")) + { + return VERBOSE; + } + + return SILENT; + } +} diff --git a/libjava/classpath/java/rmi/server/ObjID.java b/libjava/classpath/java/rmi/server/ObjID.java new file mode 100644 index 00000000000..07cbbde3a62 --- /dev/null +++ b/libjava/classpath/java/rmi/server/ObjID.java @@ -0,0 +1,103 @@ +/* ObjID.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; + +public final class ObjID implements Serializable +{ +static final long serialVersionUID = -6386392263968365220L; + +private static long next = 0x8000000000000000L; +private static final Object lock = ObjID.class; + +public static final int REGISTRY_ID = 0; +public static final int ACTIVATOR_ID = 1; +public static final int DGC_ID = 2; + +private long objNum; +private UID space; + +public ObjID() { + synchronized (lock) { + objNum = next++; + } + space = new UID(); +} + +public ObjID(int num) { + objNum = (long)num; + space = new UID((short)0); +} + +public void write(ObjectOutput out) throws IOException { + DataOutput dout = (DataOutput)out; + dout.writeLong(objNum); + space.write(dout); +} + +public static ObjID read(ObjectInput in) throws IOException { + DataInput din = (DataInput)in; + ObjID id = new ObjID(); + id.objNum = din.readLong(); + id.space = UID.read(din); + return (id); +} + +public int hashCode() { + return ((int)objNum); +} + +public boolean equals(Object obj) { + if (obj instanceof ObjID && this.objNum == ((ObjID)obj).objNum) { + return (true); + } + return (false); +} + +public String toString() { + return ("[objNum: " + objNum + ", " + space + "]"); +} + +} diff --git a/libjava/classpath/java/rmi/server/Operation.java b/libjava/classpath/java/rmi/server/Operation.java new file mode 100644 index 00000000000..64faf66e2f8 --- /dev/null +++ b/libjava/classpath/java/rmi/server/Operation.java @@ -0,0 +1,70 @@ +/* Operation.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.server; + +/** + * @deprecated + */ +public class Operation +{ + private String operation; + + /** + * @deprecated + */ + public Operation (String op) + { + operation = op; + } + + /** + * @deprecated + */ + public String getOperation () + { + return operation; + } + + /** + * @deprecated + */ + public String toString () + { + return operation; + } +} diff --git a/libjava/classpath/java/rmi/server/RMIClassLoader.java b/libjava/classpath/java/rmi/server/RMIClassLoader.java new file mode 100644 index 00000000000..1a2e2837dd8 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMIClassLoader.java @@ -0,0 +1,339 @@ +/* RMIClassLoader.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2004 + 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. */ + +package java.rmi.server; + +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; +import java.util.StringTokenizer; + + +/** + * This class provides a set of public static utility methods for supporting + * network-based class loading in RMI. These methods are called by RMI's + * internal marshal streams to implement the dynamic class loading of types for + * RMI parameters and return values. + */ +public class RMIClassLoader +{ + /** + * This class isn't intended to be instantiated. + */ + private RMIClassLoader() {} + + private static class MyClassLoader extends URLClassLoader + { + // Package-private to avoid a trampoline constructor. + MyClassLoader (URL[] urls, ClassLoader parent, String annotation) + { + super (urls, parent); + this.annotation = annotation; + } + + private MyClassLoader (URL[] urls, ClassLoader parent) + { + super (urls, parent); + this.annotation = urlToAnnotation (urls); + } + + public static String urlToAnnotation (URL[] urls) + { + if (urls.length == 0) + return null; + + StringBuffer annotation = new StringBuffer (64 * urls.length); + + for (int i = 0; i < urls.length; i++) + { + annotation.append (urls [i].toExternalForm()); + annotation.append (' '); + } + + return annotation.toString(); + } + + public final String getClassAnnotation() + { + return annotation; + } + + private final String annotation; + } + + /** + * This class is used to identify a cached classloader by its codebase and + * the context classloader that is its parent. + */ + private static class CacheKey + { + private String mCodeBase; + private ClassLoader mContextClassLoader; + + public CacheKey (String theCodebase, ClassLoader theContextClassLoader) + { + mCodeBase = theCodebase; + mContextClassLoader = theContextClassLoader; + } + + /** + * @return true if the codebase and the context classloader are equal + */ + public boolean equals (Object theOther) + { + if (theOther instanceof CacheKey) + { + CacheKey key = (CacheKey) theOther; + + return (equals (this.mCodeBase,key.mCodeBase) + && equals (this.mContextClassLoader, key.mContextClassLoader)); + } + return false; + } + + /** + * Test if the two objects are equal or both null. + * @param theOne + * @param theOther + * @return + */ + private boolean equals (Object theOne, Object theOther) + { + return theOne != null ? theOne.equals (theOther) : theOther == null; + } + + /** + * @return hashCode + */ + public int hashCode() + { + return ((mCodeBase != null ? mCodeBase.hashCode() : 0) + ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1)); + } + + public String toString() + { + return "[" + mCodeBase + "," + mContextClassLoader + "]"; + } + + } + + private static Map cacheLoaders; //map annotations to loaders + private static Map cacheAnnotations; //map loaders to annotations + + //defaultAnnotation is got from system property + // "java.rmi.server.defaultAnnotation" + private static String defaultAnnotation; + + //URL object for defaultAnnotation + private static URL defaultCodebase; + + //class loader for defaultAnnotation + private static MyClassLoader defaultLoader; + + static + { + // 89 is a nice prime number for Hashtable initial capacity + cacheLoaders = new Hashtable (89); + cacheAnnotations = new Hashtable (89); + + defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation"); + + try + { + if (defaultAnnotation != null) + defaultCodebase = new URL (defaultAnnotation); + } + catch (Exception _) + { + defaultCodebase = null; + } + + if (defaultCodebase != null) + { + defaultLoader = new MyClassLoader (new URL[] { defaultCodebase }, null, + defaultAnnotation); + cacheLoaders.put (new CacheKey (defaultAnnotation, + Thread.currentThread().getContextClassLoader()), + defaultLoader); + } + } + + /** + * @deprecated + */ + public static Class loadClass (String name) + throws MalformedURLException, ClassNotFoundException + { + return loadClass ("", name); + } + + public static Class loadClass (String codebases, String name) + throws MalformedURLException, ClassNotFoundException + { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + //try context class loader first + try + { + return loader.loadClass (name); + } + catch (ClassNotFoundException e) + { + // class not found in the local classpath + } + + if (codebases.length() == 0) //=="" + { + loader = defaultLoader; + } + else + { + loader = getClassLoader(codebases); + } + + if (loader == null) + { + //do not throw NullPointerException + throw new ClassNotFoundException ("Could not find class (" + name + + ") at codebase (" + codebases + ")"); + } + + return loader.loadClass (name); + } + + /** + * Gets a classloader for the given codebase and with the current + * context classloader as parent. + * + * @param codebases + * + * @return a classloader for the given codebase + * + * @throws MalformedURLException if the codebase contains a malformed URL + */ + public static ClassLoader getClassLoader (String codebases) + throws MalformedURLException + { + ClassLoader loader; + CacheKey loaderKey = new CacheKey + (codebases, Thread.currentThread().getContextClassLoader()); + loader = (ClassLoader) cacheLoaders.get (loaderKey); + + if (loader == null) + { + //create an entry in cacheLoaders mapping a loader to codebases. + // codebases are separated by " " + StringTokenizer tok = new StringTokenizer (codebases, " "); + ArrayList urls = new ArrayList(); + + while (tok.hasMoreTokens()) + urls.add (new URL (tok.nextToken())); + + loader = new MyClassLoader ((URL[]) urls.toArray (new URL [urls.size()]), + Thread.currentThread().getContextClassLoader(), + codebases); + cacheLoaders.put (loaderKey, loader); + } + + return loader; + } + + /** + * Returns a string representation of the network location where a remote + * endpoint can get the class-definition of the given class. + * + * @param cl + * + * @return a space seperated list of URLs where the class-definition + * of cl may be found + */ + public static String getClassAnnotation (Class cl) + { + ClassLoader loader = cl.getClassLoader(); + + if (loader == null + || loader == ClassLoader.getSystemClassLoader()) + { + return System.getProperty ("java.rmi.server.codebase"); + } + + if (loader instanceof MyClassLoader) + { + return ((MyClassLoader) loader).getClassAnnotation(); + } + + String s = (String) cacheAnnotations.get (loader); + + if (s != null) + return s; + + if (loader instanceof URLClassLoader) + { + URL[] urls = ((URLClassLoader) loader).getURLs(); + + if (urls.length == 0) + return null; + + StringBuffer annotation = new StringBuffer (64 * urls.length); + + for (int i = 0; i < urls.length; i++) + { + annotation.append (urls [i].toExternalForm()); + annotation.append (' '); + } + + s = annotation.toString(); + cacheAnnotations.put (loader, s); + return s; + } + + return System.getProperty ("java.rmi.server.codebase"); + } + + /** + * @deprecated + */ + public static Object getSecurityContext (ClassLoader loader) + { + throw new Error ("Not implemented"); + } +} diff --git a/libjava/classpath/java/rmi/server/RMIClassLoaderSpi.java b/libjava/classpath/java/rmi/server/RMIClassLoaderSpi.java new file mode 100644 index 00000000000..372d81879f9 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMIClassLoaderSpi.java @@ -0,0 +1,64 @@ +/* RMIClassLoaderSpi.java -- + Copyright (c) 2002 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. */ + +package java.rmi.server; + +import java.net.MalformedURLException; + +/** + * @author Michael Koch + * @since 1.4 + */ +public abstract class RMIClassLoaderSpi +{ + public RMIClassLoaderSpi() + { + } + + public abstract Class loadClass (String codeBase, String name, + ClassLoader defaultLoader) + throws MalformedURLException, ClassNotFoundException; + + public abstract Class loadProxyClass (String codeBase, String[] interfaces, + ClassLoader defaultLoader) + throws MalformedURLException, ClassNotFoundException; + + public abstract ClassLoader getClassLoader (String codebase) + throws MalformedURLException; + + public abstract String getClassAnnotation (Class cl); +} diff --git a/libjava/classpath/java/rmi/server/RMIClientSocketFactory.java b/libjava/classpath/java/rmi/server/RMIClientSocketFactory.java new file mode 100644 index 00000000000..a54d11175e0 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMIClientSocketFactory.java @@ -0,0 +1,47 @@ +/* RMIClientSocketFactory.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.IOException; +import java.net.Socket; + +public interface RMIClientSocketFactory +{ + Socket createSocket (String host, int port) throws IOException; +} diff --git a/libjava/classpath/java/rmi/server/RMIFailureHandler.java b/libjava/classpath/java/rmi/server/RMIFailureHandler.java new file mode 100644 index 00000000000..3496cd6a073 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMIFailureHandler.java @@ -0,0 +1,46 @@ +/* RMIFailureHandler.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.server; + +public interface RMIFailureHandler +{ + /** + * @exception IOException If an error occurs + */ + boolean failure (Exception ex); +} diff --git a/libjava/classpath/java/rmi/server/RMIServerSocketFactory.java b/libjava/classpath/java/rmi/server/RMIServerSocketFactory.java new file mode 100644 index 00000000000..88eaff32dbc --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMIServerSocketFactory.java @@ -0,0 +1,47 @@ +/* RMIServerSocketFactory.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.IOException; +import java.net.ServerSocket; + +public interface RMIServerSocketFactory +{ + ServerSocket createServerSocket(int port) throws IOException; +} diff --git a/libjava/classpath/java/rmi/server/RMISocketFactory.java b/libjava/classpath/java/rmi/server/RMISocketFactory.java new file mode 100644 index 00000000000..953f1ef33ce --- /dev/null +++ b/libjava/classpath/java/rmi/server/RMISocketFactory.java @@ -0,0 +1,108 @@ +/* RMISocketFactory.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import gnu.java.rmi.server.RMIDefaultSocketFactory; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; + +public abstract class RMISocketFactory + implements RMIClientSocketFactory, RMIServerSocketFactory +{ + private static RMISocketFactory defaultFactory; + private static RMISocketFactory currentFactory; + private static RMIFailureHandler currentHandler; + + static + { + defaultFactory = new RMIDefaultSocketFactory(); + currentFactory = defaultFactory; + } + + public RMISocketFactory () + { + } + + /** + * @exception IOException If an error occurs + */ + public abstract Socket createSocket (String host, int port) + throws IOException; + + /** + * @exception IOException If an error occurs + */ + public abstract ServerSocket createServerSocket (int port) + throws IOException; + + /** + * @exception IOException If an error occurs + * @exception SecurityException FIXME + */ + public static void setSocketFactory (RMISocketFactory fac) + throws IOException + { + currentFactory = fac; + } + + public static RMISocketFactory getSocketFactory () + { + return currentFactory; + } + + public static RMISocketFactory getDefaultSocketFactory () + { + return defaultFactory; + } + + /** + * @exception SecurityException FIXME + */ + public static void setFailureHandler (RMIFailureHandler fh) + { + currentHandler = fh; + } + + public static RMIFailureHandler getFailureHandler () + { + return currentHandler; + } +} diff --git a/libjava/classpath/java/rmi/server/RemoteCall.java b/libjava/classpath/java/rmi/server/RemoteCall.java new file mode 100644 index 00000000000..35f3bf1a655 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RemoteCall.java @@ -0,0 +1,86 @@ +/* RemoteCall.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.StreamCorruptedException; + +/** + * @deprecated + */ +public interface RemoteCall +{ + /** + * @deprecated + */ + ObjectOutput getOutputStream () throws IOException; + + /** + * @deprecated + */ + void releaseOutputStream () throws IOException; + + /** + * @deprecated + */ + ObjectInput getInputStream () throws IOException; + + /** + * @deprecated + */ + void releaseInputStream () throws IOException; + + /** + * @deprecated + */ + ObjectOutput getResultStream (boolean success) + throws IOException, StreamCorruptedException; + + /** + * @deprecated + */ + void executeCall () throws Exception; + + /** + * @deprecated + */ + void done () throws IOException; +} diff --git a/libjava/classpath/java/rmi/server/RemoteObject.java b/libjava/classpath/java/rmi/server/RemoteObject.java new file mode 100644 index 00000000000..0b3c229c9d9 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RemoteObject.java @@ -0,0 +1,160 @@ +/* RemoteObject.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + +package java.rmi.server; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.rmi.NoSuchObjectException; +import java.rmi.Remote; +import java.rmi.UnmarshalException; +import java.util.WeakHashMap; + +public abstract class RemoteObject + implements Remote, Serializable { + +private static final long serialVersionUID = -3215090123894869218l; + +protected transient RemoteRef ref; + +private static final WeakHashMap stubs = new WeakHashMap(); + +protected RemoteObject() { + this(null); +} + +protected RemoteObject(RemoteRef newref) { + ref = newref; +} + +public RemoteRef getRef() { + return (ref); +} + +synchronized static void addStub(Remote obj, Remote stub) +{ + stubs.put(obj, stub); +} + +synchronized static void deleteStub(Remote obj) +{ + stubs.remove(obj); +} + + public static Remote toStub(Remote obj) throws NoSuchObjectException + { + Remote stub = (Remote)stubs.get(obj); + + if (stub == null) + throw new NoSuchObjectException(obj.getClass().getName()); + + return stub; + } + +public int hashCode() { + if (ref == null) { + return (0); + } + else { + return (ref.hashCode()); + } +} + +public boolean equals(Object obj) { + // We only compare references. + return (this == obj); +} + + public String toString() + { + if (ref == null) + return getClass ().toString (); + return (ref.toString ()); + } + + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException + { + String cname = in.readUTF(); + if (!cname.equals("")) + { + if (cname.equals ("UnicastRef2")) + { + // hack for interoperating with JDK + cname = "UnicastRef"; + in.read (); //some unknown UnicastRef2 field + } + + cname = RemoteRef.packagePrefix + '.' + cname; + try + { + Class cls = Class.forName(cname); + ref = (RemoteRef)cls.newInstance(); + } + catch (InstantiationException e1) + { + throw new UnmarshalException("failed to create ref", e1); + } + catch (IllegalAccessException e2) + { + throw new UnmarshalException("failed to create ref", e2); + } + ref.readExternal(in); + } + else + { + ref = (RemoteRef)in.readObject(); + } + } + +private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { + if (ref == null) { + throw new UnmarshalException("no ref to serialize"); + } + String cname = ref.getRefClass(out); + if (cname != null && cname.length() > 0) { + out.writeUTF(cname); + ref.writeExternal(out); + } + else { + out.writeUTF(""); + out.writeObject(ref); + } +} + +} diff --git a/libjava/classpath/java/rmi/server/RemoteRef.java b/libjava/classpath/java/rmi/server/RemoteRef.java new file mode 100644 index 00000000000..7e34db39e89 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RemoteRef.java @@ -0,0 +1,79 @@ +/* RemoteRef.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.Externalizable; +import java.io.ObjectOutput; +import java.lang.reflect.Method; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface RemoteRef extends Externalizable +{ + long serialVersionUID = 3632638527362204081L; + + String packagePrefix = "gnu.java.rmi.server"; + + /** + * @deprecated + */ + void invoke (RemoteCall call) throws Exception; + + Object invoke (Remote obj, Method method, Object[] params, long opnum) + throws Exception; + + /** + * @deprecated + */ + RemoteCall newCall (RemoteObject obj, Operation[] op, int opnum, long hash) + throws RemoteException; + + /** + * @deprecated + */ + void done (RemoteCall call) throws RemoteException; + + boolean remoteEquals (RemoteRef ref); + + int remoteHashCode(); + + String getRefClass (ObjectOutput out); + + String remoteToString(); +} diff --git a/libjava/classpath/java/rmi/server/RemoteServer.java b/libjava/classpath/java/rmi/server/RemoteServer.java new file mode 100644 index 00000000000..9efb12a782d --- /dev/null +++ b/libjava/classpath/java/rmi/server/RemoteServer.java @@ -0,0 +1,76 @@ +/* RemoteServer.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + +package java.rmi.server; + +import gnu.java.rmi.server.RMIIncomingThread; + +import java.io.OutputStream; +import java.io.PrintStream; + +public abstract class RemoteServer extends RemoteObject +{ +private static final long serialVersionUID = -4100238210092549637L; + +protected RemoteServer() { + super(); +} + +protected RemoteServer(RemoteRef ref) { + super(ref); +} + +public static String getClientHost() throws ServerNotActiveException { + Thread currThread = Thread.currentThread(); + if (currThread instanceof RMIIncomingThread) { + RMIIncomingThread incomingThread = (RMIIncomingThread) currThread; + return incomingThread.getClientHost(); + } else { + throw new ServerNotActiveException( + "Unknown client host - current thread not instance of 'RMIIncomingThread'"); + } +} + +public static void setLog(OutputStream out) { + throw new Error("Not implemented"); +} + +public static PrintStream getLog() { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/classpath/java/rmi/server/RemoteStub.java b/libjava/classpath/java/rmi/server/RemoteStub.java new file mode 100644 index 00000000000..18c614b54a8 --- /dev/null +++ b/libjava/classpath/java/rmi/server/RemoteStub.java @@ -0,0 +1,61 @@ +/* RemoteStub.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +public abstract class RemoteStub extends RemoteObject +{ + static final long serialVersionUID = -1585587260594494182l; + + protected RemoteStub () + { + super (); + } + + protected RemoteStub (RemoteRef ref) + { + super (ref); + } + + /** + * @deprecated + */ + protected static void setRef (RemoteStub stub, RemoteRef ref) + { + stub.ref = ref; + } +} // class RemoteSub diff --git a/libjava/classpath/java/rmi/server/ServerCloneException.java b/libjava/classpath/java/rmi/server/ServerCloneException.java new file mode 100644 index 00000000000..bda41b3ce91 --- /dev/null +++ b/libjava/classpath/java/rmi/server/ServerCloneException.java @@ -0,0 +1,117 @@ +/* ServerCloneException.java -- a UnicastRemoteObject could not be cloned + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +/** + * Thrown if a remote exception occurs during the cloning process of a + * <code>UnicastRemoteObject</code>. + * + * @author unknown + * @see UnicastRemoteObject#clone() + * @since 1.1 + * @status updated to 1.4 + */ +public class ServerCloneException extends CloneNotSupportedException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 6617456357664815945L; + + /** + * The cause of this exception. This pre-dates the exception chaining + * of Throwable; and although you can change this field, you are wiser + * to leave it alone. + * + * @serial the exception cause + */ + public Exception detail; + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ServerCloneException(String s) + { + this(s, null); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param e the cause + */ + public ServerCloneException(String s, Exception e) + { + super(s); + initCause(e); + detail = e; + } + + /** + * This method returns a message indicating what went wrong, in this + * format: + * <code>super.getMessage() + (detail == null ? "" + * : "; nested exception is:\n\t" + detail)</code>. + * + * @return the chained message + */ + public String getMessage() + { + if (detail == this || detail == null) + return super.getMessage(); + return super.getMessage() + "; nested exception is:\n\t" + detail; + } + + /** + * Returns the cause of this exception. Note that this may not be the + * original cause, thanks to the <code>detail</code> field being public + * and non-final (yuck). However, to avoid violating the contract of + * Throwable.getCause(), this returns null if <code>detail == this</code>, + * as no exception can be its own cause. + * + * @return the cause + * @since 1.4 + */ + public Throwable getCause() + { + return detail == this ? null : detail; + } +} diff --git a/libjava/classpath/java/rmi/server/ServerNotActiveException.java b/libjava/classpath/java/rmi/server/ServerNotActiveException.java new file mode 100644 index 00000000000..0581b63bc82 --- /dev/null +++ b/libjava/classpath/java/rmi/server/ServerNotActiveException.java @@ -0,0 +1,72 @@ +/* ServerNotActiveException.java -- the method is not servicing a remote call + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +/** + * Thrown during <code>RemoteServer.getClientHost</code> if the host is + * not servicing a remote method call. + * + * @author unknown + * @see RemoteServer#getClientHost() + * @since 1.1 + * @status updated to 1.4 + */ +public class ServerNotActiveException extends Exception +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 4687940720827538231L; + + /** + * Create an exception with no message. + */ + public ServerNotActiveException() + { + } + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ServerNotActiveException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/server/ServerRef.java b/libjava/classpath/java/rmi/server/ServerRef.java new file mode 100644 index 00000000000..cf1013cf02b --- /dev/null +++ b/libjava/classpath/java/rmi/server/ServerRef.java @@ -0,0 +1,51 @@ +/* ServerRef.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface ServerRef extends RemoteRef +{ + long serialVersionUID = -4557750989390278438L; + + RemoteStub exportObject(Remote obj, Object data) throws RemoteException; + + String getClientHost() throws ServerNotActiveException; +} diff --git a/libjava/classpath/java/rmi/server/Skeleton.java b/libjava/classpath/java/rmi/server/Skeleton.java new file mode 100644 index 00000000000..82f5d3837f4 --- /dev/null +++ b/libjava/classpath/java/rmi/server/Skeleton.java @@ -0,0 +1,57 @@ +/* Skeleton.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.server; + +import java.rmi.Remote; + +/** + * @deprecated + */ +public interface Skeleton +{ + /** + * @deprecated + */ + void dispatch (Remote obj, RemoteCall theCall, int opnum, long hash) + throws Exception; + + /** + * @deprecated + */ + Operation[] getOperations(); +} diff --git a/libjava/classpath/java/rmi/server/SkeletonMismatchException.java b/libjava/classpath/java/rmi/server/SkeletonMismatchException.java new file mode 100644 index 00000000000..9c0206ab3bc --- /dev/null +++ b/libjava/classpath/java/rmi/server/SkeletonMismatchException.java @@ -0,0 +1,68 @@ +/* SkeletonMismatchException.java -- thrown when stub class versions mismatch + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +import java.rmi.RemoteException; + +/** + * Thrown if a call is received that does not match a Skeleton. Note that + * Skeletons are no longer required. + * + * @author unknown + * @since 1.1 + * @deprecated no replacement. Skeletons are no longer required. + * @status updated to 1.4 + */ +public class SkeletonMismatchException extends RemoteException +{ + /** + * Compatible with JDK 1.1. + */ + private static final long serialVersionUID = -7780460454818859281l; + + /** + * Create an exception with the specified message. + * + * @param s the message + * @deprecated no longer needed + */ + public SkeletonMismatchException(String s) + { + super(s); + } +} diff --git a/libjava/classpath/java/rmi/server/SkeletonNotFoundException.java b/libjava/classpath/java/rmi/server/SkeletonNotFoundException.java new file mode 100644 index 00000000000..596aae15417 --- /dev/null +++ b/libjava/classpath/java/rmi/server/SkeletonNotFoundException.java @@ -0,0 +1,79 @@ +/* SkeletonNotFoundException.java -- thrown if a Skeleton is not found + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + + +package java.rmi.server; + +import java.rmi.RemoteException; + +/** + * Thrown if a Skeleton corresponding to the remote object is not found. + * Note that Skeletons are no longer required. + * + * @author unknown + * @since 1.1 + * @deprecated no replacement. Skeletons are no longer required. + * @status updated to 1.4 + */ +public class SkeletonNotFoundException extends RemoteException +{ + /** + * Compatible with JDK 1.1. + */ + private static final long serialVersionUID = -7860299673822761231L; + + /** + * Create an exception with the specified message. + * + * @param s the message + */ + public SkeletonNotFoundException(String s) + { + super(s); + } + + /** + * Create an exception with the specified message and cause. + * + * @param s the message + * @param e the cause + */ + public SkeletonNotFoundException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/server/SocketSecurityException.java b/libjava/classpath/java/rmi/server/SocketSecurityException.java new file mode 100644 index 00000000000..aaf7698f4bc --- /dev/null +++ b/libjava/classpath/java/rmi/server/SocketSecurityException.java @@ -0,0 +1,75 @@ +/* SocketSecurityException.java -- the socket could not be created + Copyright (c) 1996, 1997, 1998, 1999, 2002 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. */ + +package java.rmi.server; + +/** + * Thrown during remote object export if the code does not have permission + * to create a <code>java.net.ServerSocket</code> on the specified port. + * + * @author unknown + * @since 1.1 + * @status updated to 1.4 + */ +public class SocketSecurityException extends ExportException +{ + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -7622072999407781979L; + + /** + * Create an exception with the specified message. + * + * @param s the message + */ + public SocketSecurityException(String s) + { + super(s); + } + + /** + * Create an exception with the specified message and cause. + * + * @param s the message + * @param e the cause + */ + public SocketSecurityException(String s, Exception e) + { + super(s, e); + } +} diff --git a/libjava/classpath/java/rmi/server/UID.java b/libjava/classpath/java/rmi/server/UID.java new file mode 100644 index 00000000000..0f492bae77a --- /dev/null +++ b/libjava/classpath/java/rmi/server/UID.java @@ -0,0 +1,127 @@ +/* UID.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2004 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. */ + + +package java.rmi.server; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.Serializable; + +public final class UID implements Serializable +{ +private static final long serialVersionUID = 1086053664494604050L; + +private static final Object lock = UID.class; +private static long baseTime = System.currentTimeMillis(); +private static short nextCount = Short.MIN_VALUE; +// This is sun's algorithm - don't ask me why ... +private static final int uniqueNr = (new Object()).hashCode(); + +private int unique; +private long time; +private short count; + +/** + * This is sun's algorithm - don't ask me why ... + */ +public UID() { + synchronized (lock) { + if (nextCount == Short.MAX_VALUE) { + long newtime; + for (;;) { + newtime = System.currentTimeMillis(); + if (newtime - baseTime > 1000) { + break; + } + try { + Thread.sleep(1000); + } + catch (InterruptedException _) { + } + } + baseTime = newtime; + nextCount = Short.MIN_VALUE; + } + count = nextCount++; + unique = uniqueNr; + time = baseTime; + } +} + +public UID(short num) { + unique = (int)num; + time = 0; + count = 0; +} + +public int hashCode() { + return (unique); +} + +public boolean equals(Object obj) { + if (obj instanceof UID) { + UID uid = (UID)obj; + if (this.unique == uid.unique && + this.time == uid.time && + this.count == uid.count) { + return (true); + } + } + return (false); +} + +public String toString() { + return ("[UID: " + unique + "," + time + "," + count + "]"); +} + +public void write(DataOutput out) throws IOException { + out.writeInt(unique); + out.writeLong(time); + out.writeShort(count); +} + +public static UID read(DataInput in) throws IOException { + UID id = new UID(); + id.unique = in.readInt(); + id.time = in.readLong(); + id.count = in.readShort(); + return (id); +} + +} diff --git a/libjava/classpath/java/rmi/server/UnicastRemoteObject.java b/libjava/classpath/java/rmi/server/UnicastRemoteObject.java new file mode 100644 index 00000000000..dbe25bda3fd --- /dev/null +++ b/libjava/classpath/java/rmi/server/UnicastRemoteObject.java @@ -0,0 +1,133 @@ +/* UnicastRemoteObject.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 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. */ + + +package java.rmi.server; + +import gnu.java.rmi.server.UnicastServerRef; + +import java.rmi.NoSuchObjectException; +import java.rmi.Remote; +import java.rmi.RemoteException; + +public class UnicastRemoteObject extends RemoteServer +{ +private static final long serialVersionUID = 4974527148936298033L; +//The following serialized fields are from Java API Documentation "Serialized form" +private int port = 0; +private RMIClientSocketFactory csf = null; +private RMIServerSocketFactory ssf = null; + +protected UnicastRemoteObject() throws RemoteException { + this(0); +} + +protected UnicastRemoteObject(int port) throws RemoteException { + this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()); +} + +protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + this.port = port; + //Is RMIXXXSocketFactory serializable + //this.csf = csf; + //this.ssf = ssf; + this.ref = new UnicastServerRef(new ObjID(), port, ssf); + exportObject(this); +} + +protected UnicastRemoteObject(RemoteRef ref) throws RemoteException { + super((UnicastServerRef)ref); + exportObject(this); +} + +public Object clone() throws CloneNotSupportedException { + throw new Error("Not implemented"); +} + +public static RemoteStub exportObject(Remote obj) throws RemoteException { + UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef(); + return (sref.exportObject(obj)); +} + + public static Remote exportObject(Remote obj, int port) throws RemoteException + { + return exportObject(obj, port, null); + } + + static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf) + throws RemoteException + { + UnicastServerRef sref = null; + if (obj instanceof RemoteObject) + sref = (UnicastServerRef)((RemoteObject)obj).getRef (); + if(sref == null) + { + sref = new UnicastServerRef(new ObjID (), port, ssf); + } + Remote stub = sref.exportObject (obj); + addStub(obj, stub); + return stub; + } + + /** + * FIXME + */ + public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, + RMIServerSocketFactory ssf) + throws RemoteException + { + return (exportObject(obj, port, ssf)); + } + + public static boolean unexportObject(Remote obj, boolean force) + throws NoSuchObjectException + { + if (obj instanceof RemoteObject) + { + deleteStub(obj); + UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef(); + return sref.unexportObject(obj, force); + } + else + { + //FIX ME + ; + } + return true; + } + +} diff --git a/libjava/classpath/java/rmi/server/Unreferenced.java b/libjava/classpath/java/rmi/server/Unreferenced.java new file mode 100644 index 00000000000..982aa64458f --- /dev/null +++ b/libjava/classpath/java/rmi/server/Unreferenced.java @@ -0,0 +1,43 @@ +/* Unreferenced.java -- + Copyright (c) 1996, 1997, 1998, 1999 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. */ + +package java.rmi.server; + +public interface Unreferenced +{ + void unreferenced(); +} diff --git a/libjava/classpath/java/rmi/server/package.html b/libjava/classpath/java/rmi/server/package.html new file mode 100644 index 00000000000..54055a72158 --- /dev/null +++ b/libjava/classpath/java/rmi/server/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.rmi.server package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - java.rmi.server</title></head> + +<body> +<p></p> + +</body> +</html> |