History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/rmi/server (60 of 18352 files). Show all

Unified · Split

60 files
  1. java/pkg/java/rmi/server/ExportException.class +0 −0
  2. java/pkg/java/rmi/server/ExportException.java +68 −0
  3. java/pkg/java/rmi/server/LoaderHandler.class +0 −0
  4. java/pkg/java/rmi/server/LoaderHandler.java +95 −0
  5. java/pkg/java/rmi/server/LogStream.class +0 −0
  6. java/pkg/java/rmi/server/LogStream.java +265 −0
  7. java/pkg/java/rmi/server/ObjID.class +0 −0
  8. java/pkg/java/rmi/server/ObjID.java +248 −0
  9. java/pkg/java/rmi/server/Operation.class +0 −0
  10. java/pkg/java/rmi/server/Operation.java +73 −0
  11. java/pkg/java/rmi/server/RMIClassLoader$1.class +0 −0
  12. java/pkg/java/rmi/server/RMIClassLoader$2.class +0 −0
  13. java/pkg/java/rmi/server/RMIClassLoader.class +0 −0
  14. java/pkg/java/rmi/server/RMIClassLoader.java +722 −0
  15. java/pkg/java/rmi/server/RMIClassLoaderSpi.class +0 −0
  16. java/pkg/java/rmi/server/RMIClassLoaderSpi.java +192 −0
  17. java/pkg/java/rmi/server/RMIClientSocketFactory.class +0 −0
  18. java/pkg/java/rmi/server/RMIClientSocketFactory.java +74 −0
  19. java/pkg/java/rmi/server/RMIFailureHandler.class +0 −0
  20. java/pkg/java/rmi/server/RMIFailureHandler.java +60 −0
  21. java/pkg/java/rmi/server/RMIServerSocketFactory.class +0 −0
  22. java/pkg/java/rmi/server/RMIServerSocketFactory.java +74 −0
  23. java/pkg/java/rmi/server/RMISocketFactory.class +0 −0
  24. java/pkg/java/rmi/server/RMISocketFactory.java +188 −0
  25. java/pkg/java/rmi/server/RemoteCall.class +0 −0
  26. java/pkg/java/rmi/server/RemoteCall.java +132 −0
  27. java/pkg/java/rmi/server/RemoteObject.class +0 −0
  28. java/pkg/java/rmi/server/RemoteObject.java +458 −0
  29. java/pkg/java/rmi/server/RemoteObjectInvocationHandler$MethodToHash_Maps$1.class +0 −0
  30. java/pkg/java/rmi/server/RemoteObjectInvocationHandler$MethodToHash_Maps.class +0 −0
  31. java/pkg/java/rmi/server/RemoteObjectInvocationHandler.class +0 −0
  32. java/pkg/java/rmi/server/RemoteObjectInvocationHandler.java +283 −0
  33. java/pkg/java/rmi/server/RemoteRef.class +0 −0
  34. java/pkg/java/rmi/server/RemoteRef.java +195 −0
  35. java/pkg/java/rmi/server/RemoteServer.class +0 −0
  36. java/pkg/java/rmi/server/RemoteServer.java +115 −0
  37. java/pkg/java/rmi/server/RemoteStub.class +0 −0
  38. java/pkg/java/rmi/server/RemoteStub.java +74 −0
  39. java/pkg/java/rmi/server/ServerCloneException.class +0 −0
  40. java/pkg/java/rmi/server/ServerCloneException.java +112 −0
  41. java/pkg/java/rmi/server/ServerNotActiveException.class +0 −0
  42. java/pkg/java/rmi/server/ServerNotActiveException.java +61 −0
  43. java/pkg/java/rmi/server/ServerRef.class +0 −0
  44. java/pkg/java/rmi/server/ServerRef.java +66 −0
  45. java/pkg/java/rmi/server/Skeleton.class +0 −0
  46. java/pkg/java/rmi/server/Skeleton.java +70 −0
  47. java/pkg/java/rmi/server/SkeletonMismatchException.class +0 −0
  48. java/pkg/java/rmi/server/SkeletonMismatchException.java +62 −0
  49. java/pkg/java/rmi/server/SkeletonNotFoundException.class +0 −0
  50. java/pkg/java/rmi/server/SkeletonNotFoundException.java +68 −0
  51. java/pkg/java/rmi/server/SocketSecurityException.class +0 −0
  52. java/pkg/java/rmi/server/SocketSecurityException.java +62 −0
  53. java/pkg/java/rmi/server/UID.class +0 −0
  54. java/pkg/java/rmi/server/UID.java +267 −0
  55. java/pkg/java/rmi/server/UnicastRemoteObject.class +0 −0
  56. java/pkg/java/rmi/server/UnicastRemoteObject.java +312 −0
  57. java/pkg/java/rmi/server/Unreferenced.class +0 −0
  58. java/pkg/java/rmi/server/Unreferenced.java +45 −0
  59. java/pkg/java/rmi/server/mkfile +34 −0
  60. java/pkg/java/rmi/server/package.html +53 −0
java/pkg/java/rmi/server/ExportException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/ExportException.java+68−0
@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * An <code>ExportException</code> is a <code>RemoteException</code>
30 * thrown if an attempt to export a remote object fails. A remote object is
31 * exported via the constructors and <code>exportObject</code> methods of
32 * <code>java.rmi.server.UnicastRemoteObject</code> and
33 * <code>java.rmi.activation.Activatable</code>.
34 *
35 * @author Ann Wollrath
36 * @since JDK1.1
37 * @see java.rmi.server.UnicastRemoteObject
38 * @see java.rmi.activation.Activatable
39 */
40public class ExportException extends java.rmi.RemoteException {
41
42 /* indicate compatibility with JDK 1.1.x version of class */
43 private static final long serialVersionUID = -9155485338494060170L;
44
45 /**
46 * Constructs an <code>ExportException</code> with the specified
47 * detail message.
48 *
49 * @param s the detail message
50 * @since JDK1.1
51 */
52 public ExportException(String s) {
53 super(s);
54 }
55
56 /**
57 * Constructs an <code>ExportException</code> with the specified
58 * detail message and nested exception.
59 *
60 * @param s the detail message
61 * @param ex the nested exception
62 * @since JDK1.1
63 */
64 public ExportException(String s, Exception ex) {
65 super(s, ex);
66 }
67
68}
java/pkg/java/rmi/server/LoaderHandler.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/LoaderHandler.java+95−0
@@ -0,0 +1,95 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.net.MalformedURLException;
29import java.net.URL;
30
31/**
32 * <code>LoaderHandler</code> is an interface used internally by the RMI
33 * runtime in previous implementation versions. It should never be accessed
34 * by application code.
35 *
36 * @author Ann Wollrath
37 * @since JDK1.1
38 *
39 * @deprecated no replacement
40 */
41@Deprecated
42public interface LoaderHandler {
43
44 /** package of system <code>LoaderHandler</code> implementation. */
45 final static String packagePrefix = "sun.rmi.server";
46
47 /**
48 * Loads a class from the location specified by the
49 * <code>java.rmi.server.codebase</code> property.
50 *
51 * @param name the name of the class to load
52 * @return the <code>Class</code> object representing the loaded class
53 * @exception MalformedURLException
54 * if the system property <b>java.rmi.server.codebase</b>
55 * contains an invalid URL
56 * @exception ClassNotFoundException
57 * if a definition for the class could not
58 * be found at the codebase location.
59 * @since JDK1.1
60 * @deprecated no replacement
61 */
62 @Deprecated
63 Class<?> loadClass(String name)
64 throws MalformedURLException, ClassNotFoundException;
65
66 /**
67 * Loads a class from a URL.
68 *
69 * @param codebase the URL from which to load the class
70 * @param name the name of the class to load
71 * @return the <code>Class</code> object representing the loaded class
72 * @exception MalformedURLException
73 * if the <code>codebase</code> paramater
74 * contains an invalid URL
75 * @exception ClassNotFoundException
76 * if a definition for the class could not
77 * be found at the specified URL
78 * @since JDK1.1
79 * @deprecated no replacement
80 */
81 @Deprecated
82 Class<?> loadClass(URL codebase, String name)
83 throws MalformedURLException, ClassNotFoundException;
84
85 /**
86 * Returns the security context of the given class loader.
87 *
88 * @param loader a class loader from which to get the security context
89 * @return the security context
90 * @since JDK1.1
91 * @deprecated no replacement
92 */
93 @Deprecated
94 Object getSecurityContext(ClassLoader loader);
95}
java/pkg/java/rmi/server/LogStream.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/LogStream.java+265−0
@@ -0,0 +1,265 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.io.*;
28import java.util.*;
29
30/**
31 * <code>LogStream</code> provides a mechanism for logging errors that are
32 * of possible interest to those monitoring a system.
33 *
34 * @author Ann Wollrath (lots of code stolen from Ken Arnold)
35 * @since JDK1.1
36 * @deprecated no replacement
37 */
38@Deprecated
39public class LogStream extends PrintStream {
40
41 /** table mapping known log names to log stream objects */
42 private static Hashtable known = new Hashtable(5);
43 /** default output stream for new logs */
44 private static PrintStream defaultStream = System.err;
45
46 /** log name for this log */
47 private String name;
48
49 /** stream where output of this log is sent to */
50 private OutputStream logOut;
51
52 /** string writer for writing message prefixes to log stream */
53 private OutputStreamWriter logWriter;
54
55 /** string buffer used for constructing log message prefixes */
56 private StringBuffer buffer = new StringBuffer();
57
58 /** stream used for buffering lines */
59 private ByteArrayOutputStream bufOut;
60
61 /**
62 * Create a new LogStream object. Since this only constructor is
63 * private, users must have a LogStream created through the "log"
64 * method.
65 * @param name string identifying messages from this log
66 * @out output stream that log messages will be sent to
67 * @since JDK1.1
68 * @deprecated no replacement
69 */
70 @Deprecated
71 private LogStream(String name, OutputStream out)
72 {
73 super(new ByteArrayOutputStream());
74 bufOut = (ByteArrayOutputStream) super.out;
75
76 this.name = name;
77 setOutputStream(out);
78 }
79
80 /**
81 * Return the LogStream identified by the given name. If
82 * a log corresponding to "name" does not exist, a log using
83 * the default stream is created.
84 * @param name name identifying the desired LogStream
85 * @return log associated with given name
86 * @since JDK1.1
87 * @deprecated no replacement
88 */
89 @Deprecated
90 public static LogStream log(String name) {
91 LogStream stream;
92 synchronized (known) {
93 stream = (LogStream)known.get(name);
94 if (stream == null) {
95 stream = new LogStream(name, defaultStream);
96 }
97 known.put(name, stream);
98 }
99 return stream;
100 }
101
102 /**
103 * Return the current default stream for new logs.
104 * @return default log stream
105 * @see #setDefaultStream
106 * @since JDK1.1
107 * @deprecated no replacement
108 */
109 @Deprecated
110 public static synchronized PrintStream getDefaultStream() {
111 return defaultStream;
112 }
113
114 /**
115 * Set the default stream for new logs.
116 * @param newDefault new default log stream
117 * @see #getDefaultStream
118 * @since JDK1.1
119 * @deprecated no replacement
120 */
121 @Deprecated
122 public static synchronized void setDefaultStream(PrintStream newDefault) {
123 defaultStream = newDefault;
124 }
125
126 /**
127 * Return the current stream to which output from this log is sent.
128 * @return output stream for this log
129 * @see #setOutputStream
130 * @since JDK1.1
131 * @deprecated no replacement
132 */
133 @Deprecated
134 public synchronized OutputStream getOutputStream()
135 {
136 return logOut;
137 }
138
139 /**
140 * Set the stream to which output from this log is sent.
141 * @param out new output stream for this log
142 * @see #getOutputStream
143 * @since JDK1.1
144 * @deprecated no replacement
145 */
146 @Deprecated
147 public synchronized void setOutputStream(OutputStream out)
148 {
149 logOut = out;
150 // Maintain an OutputStreamWriter with default CharToByteConvertor
151 // (just like new PrintStream) for writing log message prefixes.
152 logWriter = new OutputStreamWriter(logOut);
153 }
154
155 /**
156 * Write a byte of data to the stream. If it is not a newline, then
157 * the byte is appended to the internal buffer. If it is a newline,
158 * then the currently buffered line is sent to the log's output
159 * stream, prefixed with the appropriate logging information.
160 * @since JDK1.1
161 * @deprecated no replacement
162 */
163 @Deprecated
164 public void write(int b)
165 {
166 if (b == '\n') {
167 // synchronize on "this" first to avoid potential deadlock
168 synchronized (this) {
169 synchronized (logOut) {
170 // construct prefix for log messages:
171 buffer.setLength(0);;
172 buffer.append( // date/time stamp...
173 (new Date()).toString());
174 buffer.append(':');
175 buffer.append(name); // ...log name...
176 buffer.append(':');
177 buffer.append(Thread.currentThread().getName());
178 buffer.append(':'); // ...and thread name
179
180 try {
181 // write prefix through to underlying byte stream
182 logWriter.write(buffer.toString());
183 logWriter.flush();
184
185 // finally, write the already converted bytes of
186 // the log message
187 bufOut.writeTo(logOut);
188 logOut.write(b);
189 logOut.flush();
190 } catch (IOException e) {
191 setError();
192 } finally {
193 bufOut.reset();
194 }
195 }
196 }
197 }
198 else
199 super.write(b);
200 }
201
202 /**
203 * Write a subarray of bytes. Pass each through write byte method.
204 * @since JDK1.1
205 * @deprecated no replacement
206 */
207 @Deprecated
208 public void write(byte b[], int off, int len)
209 {
210 if (len < 0)
211 throw new ArrayIndexOutOfBoundsException(len);
212 for (int i = 0; i < len; ++ i)
213 write(b[off + i]);
214 }
215
216 /**
217 * Return log name as string representation.
218 * @return log name
219 * @since JDK1.1
220 * @deprecated no replacement
221 */
222 @Deprecated
223 public String toString()
224 {
225 return name;
226 }
227
228 /** log level constant (no logging). */
229 public static final int SILENT = 0;
230 /** log level constant (brief logging). */
231 public static final int BRIEF = 10;
232 /** log level constant (verbose logging). */
233 public static final int VERBOSE = 20;
234
235 /**
236 * Convert a string name of a logging level to its internal
237 * integer representation.
238 * @param s name of logging level (e.g., 'SILENT', 'BRIEF', 'VERBOSE')
239 * @return corresponding integer log level
240 * @since JDK1.1
241 * @deprecated no replacement
242 */
243 @Deprecated
244 public static int parseLevel(String s)
245 {
246 if ((s == null) || (s.length() < 1))
247 return -1;
248
249 try {
250 return Integer.parseInt(s);
251 } catch (NumberFormatException e) {
252 }
253 if (s.length() < 1)
254 return -1;
255
256 if ("SILENT".startsWith(s.toUpperCase()))
257 return SILENT;
258 else if ("BRIEF".startsWith(s.toUpperCase()))
259 return BRIEF;
260 else if ("VERBOSE".startsWith(s.toUpperCase()))
261 return VERBOSE;
262
263 return -1;
264 }
265}
java/pkg/java/rmi/server/ObjID.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/ObjID.java+248−0
@@ -0,0 +1,248 @@
1/*
2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.io.DataInput;
28import java.io.DataOutput;
29import java.io.IOException;
30import java.io.ObjectInput;
31import java.io.ObjectOutput;
32import java.io.Serializable;
33import java.security.AccessController;
34import java.security.SecureRandom;
35import java.util.concurrent.atomic.AtomicLong;
36import sun.security.action.GetPropertyAction;
37
38/**
39 * An <code>ObjID</code> is used to identify a remote object exported
40 * to an RMI runtime. When a remote object is exported, it is assigned
41 * an object identifier either implicitly or explicitly, depending on
42 * the API used to export.
43 *
44 * <p>The {@link #ObjID()} constructor can be used to generate a unique
45 * object identifier. Such an <code>ObjID</code> is unique over time
46 * with respect to the host it is generated on.
47 *
48 * The {@link #ObjID(int)} constructor can be used to create a
49 * "well-known" object identifier. The scope of a well-known
50 * <code>ObjID</code> depends on the RMI runtime it is exported to.
51 *
52 * <p>An <code>ObjID</code> instance contains an object number (of type
53 * <code>long</code>) and an address space identifier (of type
54 * {@link UID}). In a unique <code>ObjID</code>, the address space
55 * identifier is unique with respect to a given host over time. In a
56 * well-known <code>ObjID</code>, the address space identifier is
57 * equivalent to one returned by invoking the {@link UID#UID(short)}
58 * constructor with the value zero.
59 *
60 * <p>If the system property <code>java.rmi.server.randomIDs</code>
61 * is defined to equal the string <code>"true"</code> (case insensitive),
62 * then the {@link #ObjID()} constructor will use a cryptographically
63 * strong random number generator to choose the object number of the
64 * returned <code>ObjID</code>.
65 *
66 * @author Ann Wollrath
67 * @author Peter Jones
68 * @since JDK1.1
69 */
70public final class ObjID implements Serializable {
71
72 /** Object number for well-known <code>ObjID</code> of the registry. */
73 public static final int REGISTRY_ID = 0;
74
75 /** Object number for well-known <code>ObjID</code> of the activator. */
76 public static final int ACTIVATOR_ID = 1;
77
78 /**
79 * Object number for well-known <code>ObjID</code> of
80 * the distributed garbage collector.
81 */
82 public static final int DGC_ID = 2;
83
84 /** indicate compatibility with JDK 1.1.x version of class */
85 private static final long serialVersionUID = -6386392263968365220L;
86
87 private static final AtomicLong nextObjNum = new AtomicLong(0);
88 private static final UID mySpace = new UID();
89 private static final SecureRandom secureRandom = new SecureRandom();
90
91 /**
92 * @serial object number
93 * @see #hashCode
94 */
95 private final long objNum;
96
97 /**
98 * @serial address space identifier (unique to host over time)
99 */
100 private final UID space;
101
102 /**
103 * Generates a unique object identifier.
104 *
105 * <p>If the system property <code>java.rmi.server.randomIDs</code>
106 * is defined to equal the string <code>"true"</code> (case insensitive),
107 * then this constructor will use a cryptographically
108 * strong random number generator to choose the object number of the
109 * returned <code>ObjID</code>.
110 */
111 public ObjID() {
112 /*
113 * If generating random object numbers, create a new UID to
114 * ensure uniqueness; otherwise, use a shared UID because
115 * sequential object numbers already ensure uniqueness.
116 */
117 if (useRandomIDs()) {
118 space = new UID();
119 objNum = secureRandom.nextLong();
120 } else {
121 space = mySpace;
122 objNum = nextObjNum.getAndIncrement();
123 }
124 }
125
126 /**
127 * Creates a "well-known" object identifier.
128 *
129 * <p>An <code>ObjID</code> created via this constructor will not
130 * clash with any <code>ObjID</code>s generated via the no-arg
131 * constructor.
132 *
133 * @param objNum object number for well-known object identifier
134 */
135 public ObjID(int objNum) {
136 space = new UID((short) 0);
137 this.objNum = objNum;
138 }
139
140 /**
141 * Constructs an object identifier given data read from a stream.
142 */
143 private ObjID(long objNum, UID space) {
144 this.objNum = objNum;
145 this.space = space;
146 }
147
148 /**
149 * Marshals a binary representation of this <code>ObjID</code> to
150 * an <code>ObjectOutput</code> instance.
151 *
152 * <p>Specifically, this method first invokes the given stream's
153 * {@link ObjectOutput#writeLong(long)} method with this object
154 * identifier's object number, and then it writes its address
155 * space identifier by invoking its {@link UID#write(DataOutput)}
156 * method with the stream.
157 *
158 * @param out the <code>ObjectOutput</code> instance to write
159 * this <code>ObjID</code> to
160 *
161 * @throws IOException if an I/O error occurs while performing
162 * this operation
163 */
164 public void write(ObjectOutput out) throws IOException {
165 out.writeLong(objNum);
166 space.write(out);
167 }
168
169 /**
170 * Constructs and returns a new <code>ObjID</code> instance by
171 * unmarshalling a binary representation from an
172 * <code>ObjectInput</code> instance.
173 *
174 * <p>Specifically, this method first invokes the given stream's
175 * {@link ObjectInput#readLong()} method to read an object number,
176 * then it invokes {@link UID#read(DataInput)} with the
177 * stream to read an address space identifier, and then it
178 * creates and returns a new <code>ObjID</code> instance that
179 * contains the object number and address space identifier that
180 * were read from the stream.
181 *
182 * @param in the <code>ObjectInput</code> instance to read
183 * <code>ObjID</code> from
184 *
185 * @return unmarshalled <code>ObjID</code> instance
186 *
187 * @throws IOException if an I/O error occurs while performing
188 * this operation
189 */
190 public static ObjID read(ObjectInput in) throws IOException {
191 long num = in.readLong();
192 UID space = UID.read(in);
193 return new ObjID(num, space);
194 }
195
196 /**
197 * Returns the hash code value for this object identifier, the
198 * object number.
199 *
200 * @return the hash code value for this object identifier
201 */
202 public int hashCode() {
203 return (int) objNum;
204 }
205
206 /**
207 * Compares the specified object with this <code>ObjID</code> for
208 * equality.
209 *
210 * This method returns <code>true</code> if and only if the
211 * specified object is an <code>ObjID</code> instance with the same
212 * object number and address space identifier as this one.
213 *
214 * @param obj the object to compare this <code>ObjID</code> to
215 *
216 * @return <code>true</code> if the given object is equivalent to
217 * this one, and <code>false</code> otherwise
218 */
219 public boolean equals(Object obj) {
220 if (obj instanceof ObjID) {
221 ObjID id = (ObjID) obj;
222 return objNum == id.objNum && space.equals(id.space);
223 } else {
224 return false;
225 }
226 }
227
228 /**
229 * Returns a string representation of this object identifier.
230 *
231 * @return a string representation of this object identifier
232 */
233 /*
234 * The address space identifier is only included in the string
235 * representation if it does not denote the local address space
236 * (or if the randomIDs property was set).
237 */
238 public String toString() {
239 return "[" + (space.equals(mySpace) ? "" : space + ", ") +
240 objNum + "]";
241 }
242
243 private static boolean useRandomIDs() {
244 String value = AccessController.doPrivileged(
245 new GetPropertyAction("java.rmi.server.randomIDs"));
246 return value == null ? true : Boolean.parseBoolean(value);
247 }
248}
java/pkg/java/rmi/server/Operation.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/Operation.java+73−0
@@ -0,0 +1,73 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * An <code>Operation</code> contains a description of a Java method.
30 * <code>Operation</code> objects were used in JDK1.1 version stubs and
31 * skeletons. The <code>Operation</code> class is not needed for 1.2 style
32 * stubs (stubs generated with <code>rmic -v1.2</code>); hence, this class
33 * is deprecated.
34 *
35 * @since JDK1.1
36 * @deprecated no replacement
37 */
38@Deprecated
39public class Operation {
40 private String operation;
41
42 /**
43 * Creates a new Operation object.
44 * @param op method name
45 * @deprecated no replacement
46 * @since JDK1.1
47 */
48 @Deprecated
49 public Operation(String op) {
50 operation = op;
51 }
52
53 /**
54 * Returns the name of the method.
55 * @return method name
56 * @deprecated no replacement
57 * @since JDK1.1
58 */
59 @Deprecated
60 public String getOperation() {
61 return operation;
62 }
63
64 /**
65 * Returns the string representation of the operation.
66 * @deprecated no replacement
67 * @since JDK1.1
68 */
69 @Deprecated
70 public String toString() {
71 return operation;
72 }
73}
java/pkg/java/rmi/server/RMIClassLoader$1.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIClassLoader$2.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIClassLoader.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIClassLoader.java+722−0
@@ -0,0 +1,722 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.net.MalformedURLException;
29import java.net.URL;
30import java.security.AccessController;
31import java.security.PrivilegedAction;
32import java.util.Iterator;
33import java.util.ServiceLoader;
34
35/**
36 * <code>RMIClassLoader</code> comprises static methods to support
37 * dynamic class loading with RMI. Included are methods for loading
38 * classes from a network location (one or more URLs) and obtaining
39 * the location from which an existing class should be loaded by
40 * remote parties. These methods are used by the RMI runtime when
41 * marshalling and unmarshalling classes contained in the arguments
42 * and return values of remote method calls, and they also may be
43 * invoked directly by applications in order to mimic RMI's dynamic
44 * class loading behavior.
45 *
46 * <p>The implementation of the following static methods
47 *
48 * <ul>
49 *
50 * <li>{@link #loadClass(URL,String)}
51 * <li>{@link #loadClass(String,String)}
52 * <li>{@link #loadClass(String,String,ClassLoader)}
53 * <li>{@link #loadProxyClass(String,String[],ClassLoader)}
54 * <li>{@link #getClassLoader(String)}
55 * <li>{@link #getClassAnnotation(Class)}
56 *
57 * </ul>
58 *
59 * is provided by an instance of {@link RMIClassLoaderSpi}, the
60 * service provider interface for those methods. When one of the
61 * methods is invoked, its behavior is to delegate to a corresponding
62 * method on the service provider instance. The details of how each
63 * method delegates to the provider instance is described in the
64 * documentation for each particular method.
65 *
66 * <p>The service provider instance is chosen as follows:
67 *
68 * <ul>
69 *
70 * <li>If the system property
71 * <code>java.rmi.server.RMIClassLoaderSpi</code> is defined, then if
72 * its value equals the string <code>"default"</code>, the provider
73 * instance will be the value returned by an invocation of the {@link
74 * #getDefaultProviderInstance()} method, and for any other value, if
75 * a class named with the value of the property can be loaded by the
76 * system class loader (see {@link ClassLoader#getSystemClassLoader})
77 * and that class is assignable to {@link RMIClassLoaderSpi} and has a
78 * public no-argument constructor, then that constructor will be
79 * invoked to create the provider instance. If the property is
80 * defined but any other of those conditions are not true, then an
81 * unspecified <code>Error</code> will be thrown to code that attempts
82 * to use <code>RMIClassLoader</code>, indicating the failure to
83 * obtain a provider instance.
84 *
85 * <li>If a resource named
86 * <code>META-INF/services/java.rmi.server.RMIClassLoaderSpi</code> is
87 * visible to the system class loader, then the contents of that
88 * resource are interpreted as a provider-configuration file, and the
89 * first class name specified in that file is used as the provider
90 * class name. If a class with that name can be loaded by the system
91 * class loader and that class is assignable to {@link
92 * RMIClassLoaderSpi} and has a public no-argument constructor, then
93 * that constructor will be invoked to create the provider instance.
94 * If the resource is found but a provider cannot be instantiated as
95 * described, then an unspecified <code>Error</code> will be thrown to
96 * code that attempts to use <code>RMIClassLoader</code>, indicating
97 * the failure to obtain a provider instance.
98 *
99 * <li>Otherwise, the provider instance will be the value returned by
100 * an invocation of the {@link #getDefaultProviderInstance()} method.
101 *
102 * </ul>
103 *
104 * @author Ann Wollrath
105 * @author Peter Jones
106 * @author Laird Dornin
107 * @see RMIClassLoaderSpi
108 * @since JDK1.1
109 */
110public class RMIClassLoader {
111
112 /** "default" provider instance */
113 private static final RMIClassLoaderSpi defaultProvider =
114 newDefaultProviderInstance();
115
116 /** provider instance */
117 private static final RMIClassLoaderSpi provider =
118 AccessController.doPrivileged(
119 new PrivilegedAction<RMIClassLoaderSpi>() {
120 public RMIClassLoaderSpi run() { return initializeProvider(); }
121 });
122
123 /*
124 * Disallow anyone from creating one of these.
125 */
126 private RMIClassLoader() {}
127
128 /**
129 * Loads the class with the specified <code>name</code>.
130 *
131 * <p>This method delegates to {@link #loadClass(String,String)},
132 * passing <code>null</code> as the first argument and
133 * <code>name</code> as the second argument.
134 *
135 * @param name the name of the class to load
136 *
137 * @return the <code>Class</code> object representing the loaded class
138 *
139 * @throws MalformedURLException if a provider-specific URL used
140 * to load classes is invalid
141 *
142 * @throws ClassNotFoundException if a definition for the class
143 * could not be found at the codebase location
144 *
145 * @deprecated replaced by <code>loadClass(String,String)</code> method
146 * @see #loadClass(String,String)
147 */
148 @Deprecated
149 public static Class<?> loadClass(String name)
150 throws MalformedURLException, ClassNotFoundException
151 {
152 return loadClass((String) null, name);
153 }
154
155 /**
156 * Loads a class from a codebase URL.
157 *
158 * If <code>codebase</code> is <code>null</code>, then this method
159 * will behave the same as {@link #loadClass(String,String)} with a
160 * <code>null</code> <code>codebase</code> and the given class name.
161 *
162 * <p>This method delegates to the
163 * {@link RMIClassLoaderSpi#loadClass(String,String,ClassLoader)}
164 * method of the provider instance, passing the result of invoking
165 * {@link URL#toString} on the given URL (or <code>null</code> if
166 * <code>codebase</code> is null) as the first argument,
167 * <code>name</code> as the second argument,
168 * and <code>null</code> as the third argument.
169 *
170 * @param codebase the URL to load the class from, or <code>null</code>
171 *
172 * @param name the name of the class to load
173 *
174 * @return the <code>Class</code> object representing the loaded class
175 *
176 * @throws MalformedURLException if <code>codebase</code> is
177 * <code>null</code> and a provider-specific URL used
178 * to load classes is invalid
179 *
180 * @throws ClassNotFoundException if a definition for the class
181 * could not be found at the specified URL
182 */
183 public static Class<?> loadClass(URL codebase, String name)
184 throws MalformedURLException, ClassNotFoundException
185 {
186 return provider.loadClass(
187 codebase != null ? codebase.toString() : null, name, null);
188 }
189
190 /**
191 * Loads a class from a codebase URL path.
192 *
193 * <p>This method delegates to the
194 * {@link RMIClassLoaderSpi#loadClass(String,String,ClassLoader)}
195 * method of the provider instance, passing <code>codebase</code>
196 * as the first argument, <code>name</code> as the second argument,
197 * and <code>null</code> as the third argument.
198 *
199 * @param codebase the list of URLs (separated by spaces) to load
200 * the class from, or <code>null</code>
201 *
202 * @param name the name of the class to load
203 *
204 * @return the <code>Class</code> object representing the loaded class
205 *
206 * @throws MalformedURLException if <code>codebase</code> is
207 * non-<code>null</code> and contains an invalid URL, or if
208 * <code>codebase</code> is <code>null</code> and a provider-specific
209 * URL used to load classes is invalid
210 *
211 * @throws ClassNotFoundException if a definition for the class
212 * could not be found at the specified location
213 *
214 * @since 1.2
215 */
216 public static Class<?> loadClass(String codebase, String name)
217 throws MalformedURLException, ClassNotFoundException
218 {
219 return provider.loadClass(codebase, name, null);
220 }
221
222 /**
223 * Loads a class from a codebase URL path, optionally using the
224 * supplied loader.
225 *
226 * This method should be used when the caller would like to make
227 * available to the provider implementation an additional contextual
228 * class loader to consider, such as the loader of a caller on the
229 * stack. Typically, a provider implementation will attempt to
230 * resolve the named class using the given <code>defaultLoader</code>,
231 * if specified, before attempting to resolve the class from the
232 * codebase URL path.
233 *
234 * <p>This method delegates to the
235 * {@link RMIClassLoaderSpi#loadClass(String,String,ClassLoader)}
236 * method of the provider instance, passing <code>codebase</code>
237 * as the first argument, <code>name</code> as the second argument,
238 * and <code>defaultLoader</code> as the third argument.
239 *
240 * @param codebase the list of URLs (separated by spaces) to load
241 * the class from, or <code>null</code>
242 *
243 * @param name the name of the class to load
244 *
245 * @param defaultLoader additional contextual class loader
246 * to use, or <code>null</code>
247 *
248 * @return the <code>Class</code> object representing the loaded class
249 *
250 * @throws MalformedURLException if <code>codebase</code> is
251 * non-<code>null</code> and contains an invalid URL, or if
252 * <code>codebase</code> is <code>null</code> and a provider-specific
253 * URL used to load classes is invalid
254 *
255 * @throws ClassNotFoundException if a definition for the class
256 * could not be found at the specified location
257 *
258 * @since 1.4
259 */
260 public static Class<?> loadClass(String codebase, String name,
261 ClassLoader defaultLoader)
262 throws MalformedURLException, ClassNotFoundException
263 {
264 return provider.loadClass(codebase, name, defaultLoader);
265 }
266
267 /**
268 * Loads a dynamic proxy class (see {@link java.lang.reflect.Proxy})
269 * that implements a set of interfaces with the given names
270 * from a codebase URL path.
271 *
272 * <p>The interfaces will be resolved similar to classes loaded via
273 * the {@link #loadClass(String,String)} method using the given
274 * <code>codebase</code>.
275 *
276 * <p>This method delegates to the
277 * {@link RMIClassLoaderSpi#loadProxyClass(String,String[],ClassLoader)}
278 * method of the provider instance, passing <code>codebase</code>
279 * as the first argument, <code>interfaces</code> as the second argument,
280 * and <code>defaultLoader</code> as the third argument.
281 *
282 * @param codebase the list of URLs (space-separated) to load
283 * classes from, or <code>null</code>
284 *
285 * @param interfaces the names of the interfaces for the proxy class
286 * to implement
287 *
288 * @param defaultLoader additional contextual class loader
289 * to use, or <code>null</code>
290 *
291 * @return a dynamic proxy class that implements the named interfaces
292 *
293 * @throws MalformedURLException if <code>codebase</code> is
294 * non-<code>null</code> and contains an invalid URL, or
295 * if <code>codebase</code> is <code>null</code> and a provider-specific
296 * URL used to load classes is invalid
297 *
298 * @throws ClassNotFoundException if a definition for one of
299 * the named interfaces could not be found at the specified location,
300 * or if creation of the dynamic proxy class failed (such as if
301 * {@link java.lang.reflect.Proxy#getProxyClass(ClassLoader,Class[])}
302 * would throw an <code>IllegalArgumentException</code> for the given
303 * interface list)
304 *
305 * @since 1.4
306 */
307 public static Class<?> loadProxyClass(String codebase, String[] interfaces,
308 ClassLoader defaultLoader)
309 throws ClassNotFoundException, MalformedURLException
310 {
311 return provider.loadProxyClass(codebase, interfaces, defaultLoader);
312 }
313
314 /**
315 * Returns a class loader that loads classes from the given codebase
316 * URL path.
317 *
318 * <p>The class loader returned is the class loader that the
319 * {@link #loadClass(String,String)} method would use to load classes
320 * for the same <code>codebase</code> argument.
321 *
322 * <p>This method delegates to the
323 * {@link RMIClassLoaderSpi#getClassLoader(String)} method
324 * of the provider instance, passing <code>codebase</code> as the argument.
325 *
326 * <p>If there is a security manger, its <code>checkPermission</code>
327 * method will be invoked with a
328 * <code>RuntimePermission("getClassLoader")</code> permission;
329 * this could result in a <code>SecurityException</code>.
330 * The provider implementation of this method may also perform further
331 * security checks to verify that the calling context has permission to
332 * connect to all of the URLs in the codebase URL path.
333 *
334 * @param codebase the list of URLs (space-separated) from which
335 * the returned class loader will load classes from, or <code>null</code>
336 *
337 * @return a class loader that loads classes from the given codebase URL
338 * path
339 *
340 * @throws MalformedURLException if <code>codebase</code> is
341 * non-<code>null</code> and contains an invalid URL, or
342 * if <code>codebase</code> is <code>null</code> and a provider-specific
343 * URL used to identify the class loader is invalid
344 *
345 * @throws SecurityException if there is a security manager and the
346 * invocation of its <code>checkPermission</code> method fails, or
347 * if the caller does not have permission to connect to all of the
348 * URLs in the codebase URL path
349 *
350 * @since 1.3
351 */
352 public static ClassLoader getClassLoader(String codebase)
353 throws MalformedURLException, SecurityException
354 {
355 return provider.getClassLoader(codebase);
356 }
357
358 /**
359 * Returns the annotation string (representing a location for
360 * the class definition) that RMI will use to annotate the class
361 * descriptor when marshalling objects of the given class.
362 *
363 * <p>This method delegates to the
364 * {@link RMIClassLoaderSpi#getClassAnnotation(Class)} method
365 * of the provider instance, passing <code>cl</code> as the argument.
366 *
367 * @param cl the class to obtain the annotation for
368 *
369 * @return a string to be used to annotate the given class when
370 * it gets marshalled, or <code>null</code>
371 *
372 * @throws NullPointerException if <code>cl</code> is <code>null</code>
373 *
374 * @since 1.2
375 */
376 /*
377 * REMIND: Should we say that the returned class annotation will or
378 * should be a (space-separated) list of URLs?
379 */
380 public static String getClassAnnotation(Class<?> cl) {
381 return provider.getClassAnnotation(cl);
382 }
383
384 /**
385 * Returns the canonical instance of the default provider
386 * for the service provider interface {@link RMIClassLoaderSpi}.
387 * If the system property <code>java.rmi.server.RMIClassLoaderSpi</code>
388 * is not defined, then the <code>RMIClassLoader</code> static
389 * methods
390 *
391 * <ul>
392 *
393 * <li>{@link #loadClass(URL,String)}
394 * <li>{@link #loadClass(String,String)}
395 * <li>{@link #loadClass(String,String,ClassLoader)}
396 * <li>{@link #loadProxyClass(String,String[],ClassLoader)}
397 * <li>{@link #getClassLoader(String)}
398 * <li>{@link #getClassAnnotation(Class)}
399 *
400 * </ul>
401 *
402 * will use the canonical instance of the default provider
403 * as the service provider instance.
404 *
405 * <p>If there is a security manager, its
406 * <code>checkPermission</code> method will be invoked with a
407 * <code>RuntimePermission("setFactory")</code> permission; this
408 * could result in a <code>SecurityException</code>.
409 *
410 * <p>The default service provider instance implements
411 * {@link RMIClassLoaderSpi} as follows:
412 *
413 * <blockquote>
414 *
415 * <p>The <b>{@link RMIClassLoaderSpi#getClassAnnotation(Class)
416 * getClassAnnotation}</b> method returns a <code>String</code>
417 * representing the codebase URL path that a remote party should
418 * use to download the definition for the specified class. The
419 * format of the returned string is a path of URLs separated by
420 * spaces.
421 *
422 * The codebase string returned depends on the defining class
423 * loader of the specified class:
424 *
425 * <ul>
426 *
427 * <p><li>If the class loader is the system class loader (see
428 * {@link ClassLoader#getSystemClassLoader}), a parent of the
429 * system class loader such as the loader used for installed
430 * extensions, or the bootstrap class loader (which may be
431 * represented by <code>null</code>), then the value of the
432 * <code>java.rmi.server.codebase</code> property (or possibly an
433 * earlier cached value) is returned, or
434 * <code>null</code> is returned if that property is not set.
435 *
436 * <p><li>Otherwise, if the class loader is an instance of
437 * <code>URLClassLoader</code>, then the returned string is a
438 * space-separated list of the external forms of the URLs returned
439 * by invoking the <code>getURLs</code> methods of the loader. If
440 * the <code>URLClassLoader</code> was created by this provider to
441 * service an invocation of its <code>loadClass</code> or
442 * <code>loadProxyClass</code> methods, then no permissions are
443 * required to get the associated codebase string. If it is an
444 * arbitrary other <code>URLClassLoader</code> instance, then if
445 * there is a security manager, its <code>checkPermission</code>
446 * method will be invoked once for each URL returned by the
447 * <code>getURLs</code> method, with the permission returned by
448 * invoking <code>openConnection().getPermission()</code> on each
449 * URL; if any of those invocations throws a
450 * <code>SecurityException</code> or an <code>IOException</code>,
451 * then the value of the <code>java.rmi.server.codebase</code>
452 * property (or possibly an earlier cached value) is returned, or
453 * <code>null</code> is returned if that property is not set.
454 *
455 * <p><li>Finally, if the class loader is not an instance of
456 * <code>URLClassLoader</code>, then the value of the
457 * <code>java.rmi.server.codebase</code> property (or possibly an
458 * earlier cached value) is returned, or
459 * <code>null</code> is returned if that property is not set.
460 *
461 * </ul>
462 *
463 * <p>For the implementations of the methods described below,
464 * which all take a <code>String</code> parameter named
465 * <code>codebase</code> that is a space-separated list of URLs,
466 * each invocation has an associated <i>codebase loader</i> that
467 * is identified using the <code>codebase</code> argument in
468 * conjunction with the current thread's context class loader (see
469 * {@link Thread#getContextClassLoader()}). When there is a
470 * security manager, this provider maintains an internal table of
471 * class loader instances (which are at least instances of {@link
472 * java.net.URLClassLoader}) keyed by the pair of their parent
473 * class loader and their codebase URL path (an ordered list of
474 * URLs). If the <code>codebase</code> argument is <code>null</code>,
475 * the codebase URL path is the value of the system property
476 * <code>java.rmi.server.codebase</code> or possibly an
477 * earlier cached value. For a given codebase URL path passed as the
478 * <code>codebase</code> argument to an invocation of one of the
479 * below methods in a given context, the codebase loader is the
480 * loader in the table with the specified codebase URL path and
481 * the current thread's context class loader as its parent. If no
482 * such loader exists, then one is created and added to the table.
483 * The table does not maintain strong references to its contained
484 * loaders, in order to allow them and their defined classes to be
485 * garbage collected when not otherwise reachable. In order to
486 * prevent arbitrary untrusted code from being implicitly loaded
487 * into a virtual machine with no security manager, if there is no
488 * security manager set, the codebase loader is just the current
489 * thread's context class loader (the supplied codebase URL path
490 * is ignored, so remote class loading is disabled).
491 *
492 * <p>The <b>{@link RMIClassLoaderSpi#getClassLoader(String)
493 * getClassLoader}</b> method returns the codebase loader for the
494 * specified codebase URL path. If there is a security manager,
495 * then if the calling context does not have permission to connect
496 * to all of the URLs in the codebase URL path, a
497 * <code>SecurityException</code> will be thrown.
498 *
499 * <p>The <b>{@link
500 * RMIClassLoaderSpi#loadClass(String,String,ClassLoader)
501 * loadClass}</b> method attempts to load the class with the
502 * specified name as follows:
503 *
504 * <blockquote>
505 *
506 * If the <code>defaultLoader</code> argument is
507 * non-<code>null</code>, it first attempts to load the class with the
508 * specified <code>name</code> using the
509 * <code>defaultLoader</code>, such as by evaluating
510 *
511 * <pre>
512 * Class.forName(name, false, defaultLoader)
513 * </pre>
514 *
515 * If the class is successfully loaded from the
516 * <code>defaultLoader</code>, that class is returned. If an
517 * exception other than <code>ClassNotFoundException</code> is
518 * thrown, that exception is thrown to the caller.
519 *
520 * <p>Next, the <code>loadClass</code> method attempts to load the
521 * class with the specified <code>name</code> using the codebase
522 * loader for the specified codebase URL path.
523 * If there is a security manager, then the calling context
524 * must have permission to connect to all of the URLs in the
525 * codebase URL path; otherwise, the current thread's context
526 * class loader will be used instead of the codebase loader.
527 *
528 * </blockquote>
529 *
530 * <p>The <b>{@link
531 * RMIClassLoaderSpi#loadProxyClass(String,String[],ClassLoader)
532 * loadProxyClass}</b> method attempts to return a dynamic proxy
533 * class with the named interface as follows:
534 *
535 * <blockquote>
536 *
537 * <p>If the <code>defaultLoader</code> argument is
538 * non-<code>null</code> and all of the named interfaces can be
539 * resolved through that loader, then,
540 *
541 * <ul>
542 *
543 * <li>if all of the resolved interfaces are <code>public</code>,
544 * then it first attempts to obtain a dynamic proxy class (using
545 * {@link
546 * java.lang.reflect.Proxy#getProxyClass(ClassLoader,Class[])
547 * Proxy.getProxyClass}) for the resolved interfaces defined in
548 * the codebase loader; if that attempt throws an
549 * <code>IllegalArgumentException</code>, it then attempts to
550 * obtain a dynamic proxy class for the resolved interfaces
551 * defined in the <code>defaultLoader</code>. If both attempts
552 * throw <code>IllegalArgumentException</code>, then this method
553 * throws a <code>ClassNotFoundException</code>. If any other
554 * exception is thrown, that exception is thrown to the caller.
555 *
556 * <li>if all of the non-<code>public</code> resolved interfaces
557 * are defined in the same class loader, then it attempts to
558 * obtain a dynamic proxy class for the resolved interfaces
559 * defined in that loader.
560 *
561 * <li>otherwise, a <code>LinkageError</code> is thrown (because a
562 * class that implements all of the specified interfaces cannot be
563 * defined in any loader).
564 *
565 * </ul>
566 *
567 * <p>Otherwise, if all of the named interfaces can be resolved
568 * through the codebase loader, then,
569 *
570 * <ul>
571 *
572 * <li>if all of the resolved interfaces are <code>public</code>,
573 * then it attempts to obtain a dynamic proxy class for the
574 * resolved interfaces in the codebase loader. If the attempt
575 * throws an <code>IllegalArgumentException</code>, then this
576 * method throws a <code>ClassNotFoundException</code>.
577 *
578 * <li>if all of the non-<code>public</code> resolved interfaces
579 * are defined in the same class loader, then it attempts to
580 * obtain a dynamic proxy class for the resolved interfaces
581 * defined in that loader.
582 *
583 * <li>otherwise, a <code>LinkageError</code> is thrown (because a
584 * class that implements all of the specified interfaces cannot be
585 * defined in any loader).
586 *
587 * </ul>
588 *
589 * <p>Otherwise, a <code>ClassNotFoundException</code> is thrown
590 * for one of the named interfaces that could not be resolved.
591 *
592 * </blockquote>
593 *
594 * </blockquote>
595 *
596 * @return the canonical instance of the default service provider
597 *
598 * @throws SecurityException if there is a security manager and the
599 * invocation of its <code>checkPermission</code> method fails
600 *
601 * @since 1.4
602 */
603 public static RMIClassLoaderSpi getDefaultProviderInstance() {
604 SecurityManager sm = System.getSecurityManager();
605 if (sm != null) {
606 sm.checkPermission(new RuntimePermission("setFactory"));
607 }
608 return defaultProvider;
609 }
610
611 /**
612 * Returns the security context of the given class loader.
613 *
614 * @param loader a class loader from which to get the security context
615 *
616 * @return the security context
617 *
618 * @deprecated no replacement. As of the Java 2 platform v1.2, RMI no
619 * longer uses this method to obtain a class loader's security context.
620 * @see java.lang.SecurityManager#getSecurityContext()
621 */
622 @Deprecated
623 public static Object getSecurityContext(ClassLoader loader)
624 {
625 return sun.rmi.server.LoaderHandler.getSecurityContext(loader);
626 }
627
628 /**
629 * Creates an instance of the default provider class.
630 */
631 private static RMIClassLoaderSpi newDefaultProviderInstance() {
632 return new RMIClassLoaderSpi() {
633 public Class<?> loadClass(String codebase, String name,
634 ClassLoader defaultLoader)
635 throws MalformedURLException, ClassNotFoundException
636 {
637 return sun.rmi.server.LoaderHandler.loadClass(
638 codebase, name, defaultLoader);
639 }
640
641 public Class<?> loadProxyClass(String codebase,
642 String[] interfaces,
643 ClassLoader defaultLoader)
644 throws MalformedURLException, ClassNotFoundException
645 {
646 return sun.rmi.server.LoaderHandler.loadProxyClass(
647 codebase, interfaces, defaultLoader);
648 }
649
650 public ClassLoader getClassLoader(String codebase)
651 throws MalformedURLException
652 {
653 return sun.rmi.server.LoaderHandler.getClassLoader(codebase);
654 }
655
656 public String getClassAnnotation(Class<?> cl) {
657 return sun.rmi.server.LoaderHandler.getClassAnnotation(cl);
658 }
659 };
660 }
661
662 /**
663 * Chooses provider instance, following above documentation.
664 *
665 * This method assumes that it has been invoked in a privileged block.
666 */
667 private static RMIClassLoaderSpi initializeProvider() {
668 /*
669 * First check for the system property being set:
670 */
671 String providerClassName =
672 System.getProperty("java.rmi.server.RMIClassLoaderSpi");
673
674 if (providerClassName != null) {
675 if (providerClassName.equals("default")) {
676 return defaultProvider;
677 }
678
679 try {
680 Class<? extends RMIClassLoaderSpi> providerClass =
681 Class.forName(providerClassName, false,
682 ClassLoader.getSystemClassLoader())
683 .asSubclass(RMIClassLoaderSpi.class);
684 return providerClass.newInstance();
685
686 } catch (ClassNotFoundException e) {
687 throw new NoClassDefFoundError(e.getMessage());
688 } catch (IllegalAccessException e) {
689 throw new IllegalAccessError(e.getMessage());
690 } catch (InstantiationException e) {
691 throw new InstantiationError(e.getMessage());
692 } catch (ClassCastException e) {
693 Error error = new LinkageError(
694 "provider class not assignable to RMIClassLoaderSpi");
695 error.initCause(e);
696 throw error;
697 }
698 }
699
700 /*
701 * Next look for a provider configuration file installed:
702 */
703 Iterator<RMIClassLoaderSpi> iter =
704 ServiceLoader.load(RMIClassLoaderSpi.class,
705 ClassLoader.getSystemClassLoader()).iterator();
706 if (iter.hasNext()) {
707 try {
708 return iter.next();
709 } catch (ClassCastException e) {
710 Error error = new LinkageError(
711 "provider class not assignable to RMIClassLoaderSpi");
712 error.initCause(e);
713 throw error;
714 }
715 }
716
717 /*
718 * Finally, return the canonical instance of the default provider.
719 */
720 return defaultProvider;
721 }
722}
java/pkg/java/rmi/server/RMIClassLoaderSpi.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIClassLoaderSpi.java+192−0
@@ -0,0 +1,192 @@
1/*
2 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.net.MalformedURLException;
29import java.net.URL;
30
31/**
32 * <code>RMIClassLoaderSpi</code> is the service provider interface for
33 * <code>RMIClassLoader</code>.
34 *
35 * In particular, an <code>RMIClassLoaderSpi</code> instance provides an
36 * implementation of the following static methods of
37 * <code>RMIClassLoader</code>:
38 *
39 * <ul>
40 *
41 * <li>{@link RMIClassLoader#loadClass(URL,String)}
42 * <li>{@link RMIClassLoader#loadClass(String,String)}
43 * <li>{@link RMIClassLoader#loadClass(String,String,ClassLoader)}
44 * <li>{@link RMIClassLoader#loadProxyClass(String,String[],ClassLoader)}
45 * <li>{@link RMIClassLoader#getClassLoader(String)}
46 * <li>{@link RMIClassLoader#getClassAnnotation(Class)}
47 *
48 * </ul>
49 *
50 * When one of those methods is invoked, its behavior is to delegate
51 * to a corresponding method on an instance of this class.
52 * The details of how each method delegates to the provider instance is
53 * described in the documentation for each particular method.
54 * See the documentation for {@link RMIClassLoader} for a description
55 * of how a provider instance is chosen.
56 *
57 * @author Peter Jones
58 * @author Laird Dornin
59 * @see RMIClassLoader
60 * @since 1.4
61 */
62public abstract class RMIClassLoaderSpi {
63
64 /**
65 * Provides the implementation for
66 * {@link RMIClassLoader#loadClass(URL,String)},
67 * {@link RMIClassLoader#loadClass(String,String)}, and
68 * {@link RMIClassLoader#loadClass(String,String,ClassLoader)}.
69 *
70 * Loads a class from a codebase URL path, optionally using the
71 * supplied loader.
72 *
73 * Typically, a provider implementation will attempt to
74 * resolve the named class using the given <code>defaultLoader</code>,
75 * if specified, before attempting to resolve the class from the
76 * codebase URL path.
77 *
78 * <p>An implementation of this method must either return a class
79 * with the given name or throw an exception.
80 *
81 * @param codebase the list of URLs (separated by spaces) to load
82 * the class from, or <code>null</code>
83 *
84 * @param name the name of the class to load
85 *
86 * @param defaultLoader additional contextual class loader
87 * to use, or <code>null</code>
88 *
89 * @return the <code>Class</code> object representing the loaded class
90 *
91 * @throws MalformedURLException if <code>codebase</code> is
92 * non-<code>null</code> and contains an invalid URL, or
93 * if <code>codebase</code> is <code>null</code> and a provider-specific
94 * URL used to load classes is invalid
95 *
96 * @throws ClassNotFoundException if a definition for the class
97 * could not be found at the specified location
98 */
99 public abstract Class<?> loadClass(String codebase, String name,
100 ClassLoader defaultLoader)
101 throws MalformedURLException, ClassNotFoundException;
102
103 /**
104 * Provides the implementation for
105 * {@link RMIClassLoader#loadProxyClass(String,String[],ClassLoader)}.
106 *
107 * Loads a dynamic proxy class (see {@link java.lang.reflect.Proxy}
108 * that implements a set of interfaces with the given names
109 * from a codebase URL path, optionally using the supplied loader.
110 *
111 * <p>An implementation of this method must either return a proxy
112 * class that implements the named interfaces or throw an exception.
113 *
114 * @param codebase the list of URLs (space-separated) to load
115 * classes from, or <code>null</code>
116 *
117 * @param interfaces the names of the interfaces for the proxy class
118 * to implement
119 *
120 * @return a dynamic proxy class that implements the named interfaces
121 *
122 * @param defaultLoader additional contextual class loader
123 * to use, or <code>null</code>
124 *
125 * @throws MalformedURLException if <code>codebase</code> is
126 * non-<code>null</code> and contains an invalid URL, or
127 * if <code>codebase</code> is <code>null</code> and a provider-specific
128 * URL used to load classes is invalid
129 *
130 * @throws ClassNotFoundException if a definition for one of
131 * the named interfaces could not be found at the specified location,
132 * or if creation of the dynamic proxy class failed (such as if
133 * {@link java.lang.reflect.Proxy#getProxyClass(ClassLoader,Class[])}
134 * would throw an <code>IllegalArgumentException</code> for the given
135 * interface list)
136 */
137 public abstract Class<?> loadProxyClass(String codebase,
138 String[] interfaces,
139 ClassLoader defaultLoader)
140 throws MalformedURLException, ClassNotFoundException;
141
142 /**
143 * Provides the implementation for
144 * {@link RMIClassLoader#getClassLoader(String)}.
145 *
146 * Returns a class loader that loads classes from the given codebase
147 * URL path.
148 *
149 * <p>If there is a security manger, its <code>checkPermission</code>
150 * method will be invoked with a
151 * <code>RuntimePermission("getClassLoader")</code> permission;
152 * this could result in a <code>SecurityException</code>.
153 * The implementation of this method may also perform further security
154 * checks to verify that the calling context has permission to connect
155 * to all of the URLs in the codebase URL path.
156 *
157 * @param codebase the list of URLs (space-separated) from which
158 * the returned class loader will load classes from, or <code>null</code>
159 *
160 * @return a class loader that loads classes from the given codebase URL
161 * path
162 *
163 * @throws MalformedURLException if <code>codebase</code> is
164 * non-<code>null</code> and contains an invalid URL, or
165 * if <code>codebase</code> is <code>null</code> and a provider-specific
166 * URL used to identify the class loader is invalid
167 *
168 * @throws SecurityException if there is a security manager and the
169 * invocation of its <code>checkPermission</code> method fails, or
170 * if the caller does not have permission to connect to all of the
171 * URLs in the codebase URL path
172 */
173 public abstract ClassLoader getClassLoader(String codebase)
174 throws MalformedURLException; // SecurityException
175
176 /**
177 * Provides the implementation for
178 * {@link RMIClassLoader#getClassAnnotation(Class)}.
179 *
180 * Returns the annotation string (representing a location for
181 * the class definition) that RMI will use to annotate the class
182 * descriptor when marshalling objects of the given class.
183 *
184 * @param cl the class to obtain the annotation for
185 *
186 * @return a string to be used to annotate the given class when
187 * it gets marshalled, or <code>null</code>
188 *
189 * @throws NullPointerException if <code>cl</code> is <code>null</code>
190 */
191 public abstract String getClassAnnotation(Class<?> cl);
192}
java/pkg/java/rmi/server/RMIClientSocketFactory.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIClientSocketFactory.java+74−0
@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.io.*;
29import java.net.*;
30
31/**
32 * An <code>RMIClientSocketFactory</code> instance is used by the RMI runtime
33 * in order to obtain client sockets for RMI calls. A remote object can be
34 * associated with an <code>RMIClientSocketFactory</code> when it is
35 * created/exported via the constructors or <code>exportObject</code> methods
36 * of <code>java.rmi.server.UnicastRemoteObject</code> and
37 * <code>java.rmi.activation.Activatable</code> .
38 *
39 * <p>An <code>RMIClientSocketFactory</code> instance associated with a remote
40 * object will be downloaded to clients when the remote object's reference is
41 * transmitted in an RMI call. This <code>RMIClientSocketFactory</code> will
42 * be used to create connections to the remote object for remote method calls.
43 *
44 * <p>An <code>RMIClientSocketFactory</code> instance can also be associated
45 * with a remote object registry so that clients can use custom socket
46 * communication with a remote object registry.
47 *
48 * <p>An implementation of this interface should be serializable and
49 * should implement {@link Object#equals} to return <code>true</code> when
50 * passed an instance that represents the same (functionally equivalent)
51 * client socket factory, and <code>false</code> otherwise (and it should also
52 * implement {@link Object#hashCode} consistently with its
53 * <code>Object.equals</code> implementation).
54 *
55 * @author Ann Wollrath
56 * @author Peter Jones
57 * @since 1.2
58 * @see java.rmi.server.UnicastRemoteObject
59 * @see java.rmi.activation.Activatable
60 * @see java.rmi.registry.LocateRegistry
61 */
62public interface RMIClientSocketFactory {
63
64 /**
65 * Create a client socket connected to the specified host and port.
66 * @param host the host name
67 * @param port the port number
68 * @return a socket connected to the specified host and port.
69 * @exception IOException if an I/O error occurs during socket creation
70 * @since 1.2
71 */
72 public Socket createSocket(String host, int port)
73 throws IOException;
74}
java/pkg/java/rmi/server/RMIFailureHandler.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIFailureHandler.java+60−0
@@ -0,0 +1,60 @@
1/*
2 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * An <code>RMIFailureHandler</code> can be registered via the
30 * <code>RMISocketFactory.setFailureHandler</code> call. The
31 * <code>failure</code> method of the handler is invoked when the RMI
32 * runtime is unable to create a <code>ServerSocket</code> to listen
33 * for incoming calls. The <code>failure</code> method returns a boolean
34 * indicating whether the runtime should attempt to re-create the
35 * <code>ServerSocket</code>.
36 *
37 * @author Ann Wollrath
38 * @since JDK1.1
39 */
40public interface RMIFailureHandler {
41
42 /**
43 * The <code>failure</code> callback is invoked when the RMI
44 * runtime is unable to create a <code>ServerSocket</code> via the
45 * <code>RMISocketFactory</code>. An <code>RMIFailureHandler</code>
46 * is registered via a call to
47 * <code>RMISocketFacotry.setFailureHandler</code>. If no failure
48 * handler is installed, the default behavior is to attempt to
49 * re-create the ServerSocket.
50 *
51 * @param ex the exception that occurred during <code>ServerSocket</code>
52 * creation
53 * @return if true, the RMI runtime attempts to retry
54 * <code>ServerSocket</code> creation
55 * @see java.rmi.server.RMISocketFactory#setFailureHandler(RMIFailureHandler)
56 * @since JDK1.1
57 */
58 public boolean failure(Exception ex);
59
60}
java/pkg/java/rmi/server/RMIServerSocketFactory.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMIServerSocketFactory.java+74−0
@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.io.*;
29import java.net.*;
30
31/**
32 * An <code>RMIServerSocketFactory</code> instance is used by the RMI runtime
33 * in order to obtain server sockets for RMI calls. A remote object can be
34 * associated with an <code>RMIServerSocketFactory</code> when it is
35 * created/exported via the constructors or <code>exportObject</code> methods
36 * of <code>java.rmi.server.UnicastRemoteObject</code> and
37 * <code>java.rmi.activation.Activatable</code> .
38 *
39 * <p>An <code>RMIServerSocketFactory</code> instance associated with a remote
40 * object is used to obtain the <code>ServerSocket</code> used to accept
41 * incoming calls from clients.
42 *
43 * <p>An <code>RMIServerSocketFactory</code> instance can also be associated
44 * with a remote object registry so that clients can use custom socket
45 * communication with a remote object registry.
46 *
47 * <p>An implementation of this interface
48 * should implement {@link Object#equals} to return <code>true</code> when
49 * passed an instance that represents the same (functionally equivalent)
50 * server socket factory, and <code>false</code> otherwise (and it should also
51 * implement {@link Object#hashCode} consistently with its
52 * <code>Object.equals</code> implementation).
53 *
54 * @author Ann Wollrath
55 * @author Peter Jones
56 * @since 1.2
57 * @see java.rmi.server.UnicastRemoteObject
58 * @see java.rmi.activation.Activatable
59 * @see java.rmi.registry.LocateRegistry
60 */
61public interface RMIServerSocketFactory {
62
63 /**
64 * Create a server socket on the specified port (port 0 indicates
65 * an anonymous port).
66 * @param port the port number
67 * @return the server socket on the specified port
68 * @exception IOException if an I/O error occurs during server socket
69 * creation
70 * @since 1.2
71 */
72 public ServerSocket createServerSocket(int port)
73 throws IOException;
74}
java/pkg/java/rmi/server/RMISocketFactory.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RMISocketFactory.java+188−0
@@ -0,0 +1,188 @@
1/*
2 * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.io.*;
29import java.net.*;
30
31/**
32 * An <code>RMISocketFactory</code> instance is used by the RMI runtime
33 * in order to obtain client and server sockets for RMI calls. An
34 * application may use the <code>setSocketFactory</code> method to
35 * request that the RMI runtime use its socket factory instance
36 * instead of the default implementation.<p>
37 *
38 * The default socket factory implementation used goes through a
39 * three-tiered approach to creating client sockets. First, a direct
40 * socket connection to the remote VM is attempted. If that fails
41 * (due to a firewall), the runtime uses HTTP with the explicit port
42 * number of the server. If the firewall does not allow this type of
43 * communication, then HTTP to a cgi-bin script on the server is used
44 * to POST the RMI call.<p>
45 *
46 * @author Ann Wollrath
47 * @author Peter Jones
48 * @since JDK1.1
49 */
50public abstract class RMISocketFactory
51 implements RMIClientSocketFactory, RMIServerSocketFactory
52{
53
54 /** Client/server socket factory to be used by RMI runtime */
55 private static RMISocketFactory factory = null;
56 /** default socket factory used by this RMI implementation */
57 private static RMISocketFactory defaultSocketFactory;
58 /** Handler for socket creation failure */
59 private static RMIFailureHandler handler = null;
60
61 /**
62 * Constructs an <code>RMISocketFactory</code>.
63 * @since JDK1.1
64 */
65 public RMISocketFactory() {
66 super();
67 }
68
69 /**
70 * Creates a client socket connected to the specified host and port.
71 * @param host the host name
72 * @param port the port number
73 * @return a socket connected to the specified host and port.
74 * @exception IOException if an I/O error occurs during socket creation
75 * @since JDK1.1
76 */
77 public abstract Socket createSocket(String host, int port)
78 throws IOException;
79
80 /**
81 * Create a server socket on the specified port (port 0 indicates
82 * an anonymous port).
83 * @param port the port number
84 * @return the server socket on the specified port
85 * @exception IOException if an I/O error occurs during server socket
86 * creation
87 * @since JDK1.1
88 */
89 public abstract ServerSocket createServerSocket(int port)
90 throws IOException;
91
92 /**
93 * Set the global socket factory from which RMI gets sockets (if the
94 * remote object is not associated with a specific client and/or server
95 * socket factory). The RMI socket factory can only be set once. Note: The
96 * RMISocketFactory may only be set if the current security manager allows
97 * setting a socket factory; if disallowed, a SecurityException will be
98 * thrown.
99 * @param fac the socket factory
100 * @exception IOException if the RMI socket factory is already set
101 * @exception SecurityException if a security manager exists and its
102 * <code>checkSetFactory</code> method doesn't allow the operation.
103 * @see #getSocketFactory
104 * @see java.lang.SecurityManager#checkSetFactory()
105 * @since JDK1.1
106 */
107 public synchronized static void setSocketFactory(RMISocketFactory fac)
108 throws IOException
109 {
110 if (factory != null) {
111 throw new SocketException("factory already defined");
112 }
113 SecurityManager security = System.getSecurityManager();
114 if (security != null) {
115 security.checkSetFactory();
116 }
117 factory = fac;
118 }
119
120 /**
121 * Returns the socket factory set by the <code>setSocketFactory</code>
122 * method. Returns <code>null</code> if no socket factory has been
123 * set.
124 * @return the socket factory
125 * @see #setSocketFactory(RMISocketFactory)
126 * @since JDK1.1
127 */
128 public synchronized static RMISocketFactory getSocketFactory()
129 {
130 return factory;
131 }
132
133 /**
134 * Returns a reference to the default socket factory used
135 * by this RMI implementation. This will be the factory used
136 * by the RMI runtime when <code>getSocketFactory</code>
137 * returns <code>null</code>.
138 * @return the default RMI socket factory
139 * @since JDK1.1
140 */
141 public synchronized static RMISocketFactory getDefaultSocketFactory() {
142 if (defaultSocketFactory == null) {
143 defaultSocketFactory =
144 new sun.rmi.transport.proxy.RMIMasterSocketFactory();
145 }
146 return defaultSocketFactory;
147 }
148
149 /**
150 * Sets the failure handler to be called by the RMI runtime if server
151 * socket creation fails. By default, if no failure handler is installed
152 * and server socket creation fails, the RMI runtime does attempt to
153 * recreate the server socket.
154 *
155 * <p>If there is a security manager, this method first calls
156 * the security manager's <code>checkSetFactory</code> method
157 * to ensure the operation is allowed.
158 * This could result in a <code>SecurityException</code>.
159 *
160 * @param fh the failure handler
161 * @throws SecurityException if a security manager exists and its
162 * <code>checkSetFactory</code> method doesn't allow the
163 * operation.
164 * @see #getFailureHandler
165 * @see java.rmi.server.RMIFailureHandler#failure(Exception)
166 * @since JDK1.1
167 */
168 public synchronized static void setFailureHandler(RMIFailureHandler fh)
169 {
170 SecurityManager security = System.getSecurityManager();
171 if (security != null) {
172 security.checkSetFactory();
173 }
174 handler = fh;
175 }
176
177 /**
178 * Returns the handler for socket creation failure set by the
179 * <code>setFailureHandler</code> method.
180 * @return the failure handler
181 * @see #setFailureHandler(RMIFailureHandler)
182 * @since JDK1.1
183 */
184 public synchronized static RMIFailureHandler getFailureHandler()
185 {
186 return handler;
187 }
188}
java/pkg/java/rmi/server/RemoteCall.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteCall.java+132−0
@@ -0,0 +1,132 @@
1/*
2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27import java.rmi.*;
28import java.io.ObjectOutput;
29import java.io.ObjectInput;
30import java.io.StreamCorruptedException;
31import java.io.IOException;
32
33/**
34 * <code>RemoteCall</code> is an abstraction used solely by the RMI runtime
35 * (in conjunction with stubs and skeletons of remote objects) to carry out a
36 * call to a remote object. The <code>RemoteCall</code> interface is
37 * deprecated because it is only used by deprecated methods of
38 * <code>java.rmi.server.RemoteRef</code>.
39 *
40 * @since JDK1.1
41 * @author Ann Wollrath
42 * @author Roger Riggs
43 * @see java.rmi.server.RemoteRef
44 * @deprecated no replacement.
45 */
46@Deprecated
47public interface RemoteCall {
48
49 /**
50 * Return the output stream the stub/skeleton should put arguments/results
51 * into.
52 *
53 * @return output stream for arguments/results
54 * @exception java.io.IOException if an I/O error occurs.
55 * @since JDK1.1
56 * @deprecated no replacement
57 */
58 @Deprecated
59 ObjectOutput getOutputStream() throws IOException;
60
61 /**
62 * Release the output stream; in some transports this would release
63 * the stream.
64 *
65 * @exception java.io.IOException if an I/O error occurs.
66 * @since JDK1.1
67 * @deprecated no replacement
68 */
69 @Deprecated
70 void releaseOutputStream() throws IOException;
71
72 /**
73 * Get the InputStream that the stub/skeleton should get
74 * results/arguments from.
75 *
76 * @return input stream for reading arguments/results
77 * @exception java.io.IOException if an I/O error occurs.
78 * @since JDK1.1
79 * @deprecated no replacement
80 */
81 @Deprecated
82 ObjectInput getInputStream() throws IOException;
83
84
85 /**
86 * Release the input stream. This would allow some transports to release
87 * the channel early.
88 *
89 * @exception java.io.IOException if an I/O error occurs.
90 * @since JDK1.1
91 * @deprecated no replacement
92 */
93 @Deprecated
94 void releaseInputStream() throws IOException;
95
96 /**
97 * Returns an output stream (may put out header information
98 * relating to the success of the call). Should only succeed
99 * once per remote call.
100 *
101 * @param success If true, indicates normal return, else indicates
102 * exceptional return.
103 * @return output stream for writing call result
104 * @exception java.io.IOException if an I/O error occurs.
105 * @exception java.io.StreamCorruptedException If already been called.
106 * @since JDK1.1
107 * @deprecated no replacement
108 */
109 @Deprecated
110 ObjectOutput getResultStream(boolean success) throws IOException,
111 StreamCorruptedException;
112
113 /**
114 * Do whatever it takes to execute the call.
115 *
116 * @exception java.lang.Exception if a general exception occurs.
117 * @since JDK1.1
118 * @deprecated no replacement
119 */
120 @Deprecated
121 void executeCall() throws Exception;
122
123 /**
124 * Allow cleanup after the remote call has completed.
125 *
126 * @exception java.io.IOException if an I/O error occurs.
127 * @since JDK1.1
128 * @deprecated no replacement
129 */
130 @Deprecated
131 void done() throws IOException;
132}
java/pkg/java/rmi/server/RemoteObject.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteObject.java+458−0
@@ -0,0 +1,458 @@
1/*
2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.rmi.Remote;
29import java.rmi.NoSuchObjectException;
30import java.lang.reflect.Proxy;
31import sun.rmi.server.Util;
32
33/**
34 * The <code>RemoteObject</code> class implements the
35 * <code>java.lang.Object</code> behavior for remote objects.
36 * <code>RemoteObject</code> provides the remote semantics of Object by
37 * implementing methods for hashCode, equals, and toString.
38 *
39 * @author Ann Wollrath
40 * @author Laird Dornin
41 * @author Peter Jones
42 * @since JDK1.1
43 */
44public abstract class RemoteObject implements Remote, java.io.Serializable {
45
46 /** The object's remote reference. */
47 transient protected RemoteRef ref;
48
49 /** indicate compatibility with JDK 1.1.x version of class */
50 private static final long serialVersionUID = -3215090123894869218L;
51
52 /**
53 * Creates a remote object.
54 */
55 protected RemoteObject() {
56 ref = null;
57 }
58
59 /**
60 * Creates a remote object, initialized with the specified remote
61 * reference.
62 * @param newref remote reference
63 */
64 protected RemoteObject(RemoteRef newref) {
65 ref = newref;
66 }
67
68 /**
69 * Returns the remote reference for the remote object.
70 *
71 * <p>Note: The object returned from this method may be an instance of
72 * an implementation-specific class. The <code>RemoteObject</code>
73 * class ensures serialization portability of its instances' remote
74 * references through the behavior of its custom
75 * <code>writeObject</code> and <code>readObject</code> methods. An
76 * instance of <code>RemoteRef</code> should not be serialized outside
77 * of its <code>RemoteObject</code> wrapper instance or the result may
78 * be unportable.
79 *
80 * @return remote reference for the remote object
81 * @since 1.2
82 */
83 public RemoteRef getRef() {
84 return ref;
85 }
86
87 /**
88 * Returns the stub for the remote object <code>obj</code> passed
89 * as a parameter. This operation is only valid <i>after</i>
90 * the object has been exported.
91 * @param obj the remote object whose stub is needed
92 * @return the stub for the remote object, <code>obj</code>.
93 * @exception NoSuchObjectException if the stub for the
94 * remote object could not be found.
95 * @since 1.2
96 */
97 public static Remote toStub(Remote obj) throws NoSuchObjectException {
98 if (obj instanceof RemoteStub ||
99 (obj != null &&
100 Proxy.isProxyClass(obj.getClass()) &&
101 Proxy.getInvocationHandler(obj) instanceof
102 RemoteObjectInvocationHandler))
103 {
104 return obj;
105 } else {
106 return sun.rmi.transport.ObjectTable.getStub(obj);
107 }
108 }
109
110 /**
111 * Returns a hashcode for a remote object. Two remote object stubs
112 * that refer to the same remote object will have the same hash code
113 * (in order to support remote objects as keys in hash tables).
114 *
115 * @see java.util.Hashtable
116 */
117 public int hashCode() {
118 return (ref == null) ? super.hashCode() : ref.remoteHashCode();
119 }
120
121 /**
122 * Compares two remote objects for equality.
123 * Returns a boolean that indicates whether this remote object is
124 * equivalent to the specified Object. This method is used when a
125 * remote object is stored in a hashtable.
126 * If the specified Object is not itself an instance of RemoteObject,
127 * then this method delegates by returning the result of invoking the
128 * <code>equals</code> method of its parameter with this remote object
129 * as the argument.
130 * @param obj the Object to compare with
131 * @return true if these Objects are equal; false otherwise.
132 * @see java.util.Hashtable
133 */
134 public boolean equals(Object obj) {
135 if (obj instanceof RemoteObject) {
136 if (ref == null) {
137 return obj == this;
138 } else {
139 return ref.remoteEquals(((RemoteObject)obj).ref);
140 }
141 } else if (obj != null) {
142 /*
143 * Fix for 4099660: if object is not an instance of RemoteObject,
144 * use the result of its equals method, to support symmetry is a
145 * remote object implementation class that does not extend
146 * RemoteObject wishes to support equality with its stub objects.
147 */
148 return obj.equals(this);
149 } else {
150 return false;
151 }
152 }
153
154 /**
155 * Returns a String that represents the value of this remote object.
156 */
157 public String toString() {
158 String classname = Util.getUnqualifiedName(getClass());
159 return (ref == null) ? classname :
160 classname + "[" + ref.remoteToString() + "]";
161 }
162
163 /**
164 * <code>writeObject</code> for custom serialization.
165 *
166 * <p>This method writes this object's serialized form for this class
167 * as follows:
168 *
169 * <p>The {@link RemoteRef#getRefClass(java.io.ObjectOutput) getRefClass}
170 * method is invoked on this object's <code>ref</code> field
171 * to obtain its external ref type name.
172 * If the value returned by <code>getRefClass</code> was
173 * a non-<code>null</code> string of length greater than zero,
174 * the <code>writeUTF</code> method is invoked on <code>out</code>
175 * with the value returned by <code>getRefClass</code>, and then
176 * the <code>writeExternal</code> method is invoked on
177 * this object's <code>ref</code> field passing <code>out</code>
178 * as the argument; otherwise,
179 * the <code>writeUTF</code> method is invoked on <code>out</code>
180 * with a zero-length string (<code>""</code>), and then
181 * the <code>writeObject</code> method is invoked on <code>out</code>
182 * passing this object's <code>ref</code> field as the argument.
183 *
184 * @serialData
185 *
186 * The serialized data for this class comprises a string (written with
187 * <code>ObjectOutput.writeUTF</code>) that is either the external
188 * ref type name of the contained <code>RemoteRef</code> instance
189 * (the <code>ref</code> field) or a zero-length string, followed by
190 * either the external form of the <code>ref</code> field as written by
191 * its <code>writeExternal</code> method if the string was of non-zero
192 * length, or the serialized form of the <code>ref</code> field as
193 * written by passing it to the serialization stream's
194 * <code>writeObject</code> if the string was of zero length.
195 *
196 * <p>If this object is an instance of
197 * {@link RemoteStub} or {@link RemoteObjectInvocationHandler}
198 * that was returned from any of
199 * the <code>UnicastRemoteObject.exportObject</code> methods
200 * and custom socket factories are not used,
201 * the external ref type name is <code>"UnicastRef"</code>.
202 *
203 * If this object is an instance of
204 * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
205 * that was returned from any of
206 * the <code>UnicastRemoteObject.exportObject</code> methods
207 * and custom socket factories are used,
208 * the external ref type name is <code>"UnicastRef2"</code>.
209 *
210 * If this object is an instance of
211 * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
212 * that was returned from any of
213 * the <code>java.rmi.activation.Activatable.exportObject</code> methods,
214 * the external ref type name is <code>"ActivatableRef"</code>.
215 *
216 * If this object is an instance of
217 * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
218 * that was returned from
219 * the <code>RemoteObject.toStub</code> method (and the argument passed
220 * to <code>toStub</code> was not itself a <code>RemoteStub</code>),
221 * the external ref type name is a function of how the remote object
222 * passed to <code>toStub</code> was exported, as described above.
223 *
224 * If this object is an instance of
225 * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
226 * that was originally created via deserialization,
227 * the external ref type name is the same as that which was read
228 * when this object was deserialized.
229 *
230 * <p>If this object is an instance of
231 * <code>java.rmi.server.UnicastRemoteObject</code> that does not
232 * use custom socket factories,
233 * the external ref type name is <code>"UnicastServerRef"</code>.
234 *
235 * If this object is an instance of
236 * <code>UnicastRemoteObject</code> that does
237 * use custom socket factories,
238 * the external ref type name is <code>"UnicastServerRef2"</code>.
239 *
240 * <p>Following is the data that must be written by the
241 * <code>writeExternal</code> method and read by the
242 * <code>readExternal</code> method of <code>RemoteRef</code>
243 * implementation classes that correspond to the each of the
244 * defined external ref type names:
245 *
246 * <p>For <code>"UnicastRef"</code>:
247 *
248 * <ul>
249 *
250 * <li>the hostname of the referenced remote object,
251 * written by {@link java.io.ObjectOutput#writeUTF(String)}
252 *
253 * <li>the port of the referenced remote object,
254 * written by {@link java.io.ObjectOutput#writeInt(int)}
255 *
256 * <li>the data written as a result of calling
257 * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
258 * on the <code>ObjID</code> instance contained in the reference
259 *
260 * <li>the boolean value <code>false</code>,
261 * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
262 *
263 * </ul>
264 *
265 * <p>For <code>"UnicastRef2"</code> with a
266 * <code>null</code> client socket factory:
267 *
268 * <ul>
269 *
270 * <li>the byte value <code>0x00</code>
271 * (indicating <code>null</code> client socket factory),
272 * written by {@link java.io.ObjectOutput#writeByte(int)}
273 *
274 * <li>the hostname of the referenced remote object,
275 * written by {@link java.io.ObjectOutput#writeUTF(String)}
276 *
277 * <li>the port of the referenced remote object,
278 * written by {@link java.io.ObjectOutput#writeInt(int)}
279 *
280 * <li>the data written as a result of calling
281 * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
282 * on the <code>ObjID</code> instance contained in the reference
283 *
284 * <li>the boolean value <code>false</code>,
285 * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
286 *
287 * </ul>
288 *
289 * <p>For <code>"UnicastRef2"</code> with a
290 * non-<code>null</code> client socket factory:
291 *
292 * <ul>
293 *
294 * <li>the byte value <code>0x01</code>
295 * (indicating non-<code>null</code> client socket factory),
296 * written by {@link java.io.ObjectOutput#writeByte(int)}
297 *
298 * <li>the hostname of the referenced remote object,
299 * written by {@link java.io.ObjectOutput#writeUTF(String)}
300 *
301 * <li>the port of the referenced remote object,
302 * written by {@link java.io.ObjectOutput#writeInt(int)}
303 *
304 * <li>a client socket factory (object of type
305 * <code>java.rmi.server.RMIClientSocketFactory</code>),
306 * written by passing it to an invocation of
307 * <code>writeObject</code> on the stream instance
308 *
309 * <li>the data written as a result of calling
310 * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
311 * on the <code>ObjID</code> instance contained in the reference
312 *
313 * <li>the boolean value <code>false</code>,
314 * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
315 *
316 * </ul>
317 *
318 * <p>For <code>"ActivatableRef"</code> with a
319 * <code>null</code> nested remote reference:
320 *
321 * <ul>
322 *
323 * <li>an instance of
324 * <code>java.rmi.activation.ActivationID</code>,
325 * written by passing it to an invocation of
326 * <code>writeObject</code> on the stream instance
327 *
328 * <li>a zero-length string (<code>""</code>),
329 * written by {@link java.io.ObjectOutput#writeUTF(String)}
330 *
331 * </ul>
332 *
333 * <p>For <code>"ActivatableRef"</code> with a
334 * non-<code>null</code> nested remote reference:
335 *
336 * <ul>
337 *
338 * <li>an instance of
339 * <code>java.rmi.activation.ActivationID</code>,
340 * written by passing it to an invocation of
341 * <code>writeObject</code> on the stream instance
342 *
343 * <li>the external ref type name of the nested remote reference,
344 * which must be <code>"UnicastRef2"</code>,
345 * written by {@link java.io.ObjectOutput#writeUTF(String)}
346 *
347 * <li>the external form of the nested remote reference,
348 * written by invoking its <code>writeExternal</code> method
349 * with the stream instance
350 * (see the description of the external form for
351 * <code>"UnicastRef2"</code> above)
352 *
353 * </ul>
354 *
355 * <p>For <code>"UnicastServerRef"</code> and
356 * <code>"UnicastServerRef2"</code>, no data is written by the
357 * <code>writeExternal</code> method or read by the
358 * <code>readExternal</code> method.
359 */
360 private void writeObject(java.io.ObjectOutputStream out)
361 throws java.io.IOException, java.lang.ClassNotFoundException
362 {
363 if (ref == null) {
364 throw new java.rmi.MarshalException("Invalid remote object");
365 } else {
366 String refClassName = ref.getRefClass(out);
367 if (refClassName == null || refClassName.length() == 0) {
368 /*
369 * No reference class name specified, so serialize
370 * remote reference.
371 */
372 out.writeUTF("");
373 out.writeObject(ref);
374 } else {
375 /*
376 * Built-in reference class specified, so delegate
377 * to reference to write out its external form.
378 */
379 out.writeUTF(refClassName);
380 ref.writeExternal(out);
381 }
382 }
383 }
384
385 /**
386 * <code>readObject</code> for custom serialization.
387 *
388 * <p>This method reads this object's serialized form for this class
389 * as follows:
390 *
391 * <p>The <code>readUTF</code> method is invoked on <code>in</code>
392 * to read the external ref type name for the <code>RemoteRef</code>
393 * instance to be filled in to this object's <code>ref</code> field.
394 * If the string returned by <code>readUTF</code> has length zero,
395 * the <code>readObject</code> method is invoked on <code>in</code>,
396 * and than the value returned by <code>readObject</code> is cast to
397 * <code>RemoteRef</code> and this object's <code>ref</code> field is
398 * set to that value.
399 * Otherwise, this object's <code>ref</code> field is set to a
400 * <code>RemoteRef</code> instance that is created of an
401 * implementation-specific class corresponding to the external ref
402 * type name returned by <code>readUTF</code>, and then
403 * the <code>readExternal</code> method is invoked on
404 * this object's <code>ref</code> field.
405 *
406 * <p>If the external ref type name is
407 * <code>"UnicastRef"</code>, <code>"UnicastServerRef"</code>,
408 * <code>"UnicastRef2"</code>, <code>"UnicastServerRef2"</code>,
409 * or <code>"ActivatableRef"</code>, a corresponding
410 * implementation-specific class must be found, and its
411 * <code>readExternal</code> method must read the serial data
412 * for that external ref type name as specified to be written
413 * in the <b>serialData</b> documentation for this class.
414 * If the external ref type name is any other string (of non-zero
415 * length), a <code>ClassNotFoundException</code> will be thrown,
416 * unless the implementation provides an implementation-specific
417 * class corresponding to that external ref type name, in which
418 * case this object's <code>ref</code> field will be set to an
419 * instance of that implementation-specific class.
420 */
421 private void readObject(java.io.ObjectInputStream in)
422 throws java.io.IOException, java.lang.ClassNotFoundException
423 {
424 String refClassName = in.readUTF();
425 if (refClassName == null || refClassName.length() == 0) {
426 /*
427 * No reference class name specified, so construct
428 * remote reference from its serialized form.
429 */
430 ref = (RemoteRef) in.readObject();
431 } else {
432 /*
433 * Built-in reference class specified, so delegate to
434 * internal reference class to initialize its fields from
435 * its external form.
436 */
437 String internalRefClassName =
438 RemoteRef.packagePrefix + "." + refClassName;
439 Class refClass = Class.forName(internalRefClassName);
440 try {
441 ref = (RemoteRef) refClass.newInstance();
442
443 /*
444 * If this step fails, assume we found an internal
445 * class that is not meant to be a serializable ref
446 * type.
447 */
448 } catch (InstantiationException e) {
449 throw new ClassNotFoundException(internalRefClassName, e);
450 } catch (IllegalAccessException e) {
451 throw new ClassNotFoundException(internalRefClassName, e);
452 } catch (ClassCastException e) {
453 throw new ClassNotFoundException(internalRefClassName, e);
454 }
455 ref.readExternal(in);
456 }
457 }
458}
java/pkg/java/rmi/server/RemoteObjectInvocationHandler$MethodToHash_Maps$1.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteObjectInvocationHandler$MethodToHash_Maps.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteObjectInvocationHandler.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteObjectInvocationHandler.java+283−0
@@ -0,0 +1,283 @@
1/*
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.io.InvalidObjectException;
28import java.lang.reflect.InvocationHandler;
29import java.lang.reflect.Method;
30import java.lang.reflect.Proxy;
31import java.rmi.Remote;
32import java.rmi.UnexpectedException;
33import java.rmi.activation.Activatable;
34import java.util.Map;
35import java.util.WeakHashMap;
36import sun.rmi.server.Util;
37import sun.rmi.server.WeakClassHashMap;
38
39/**
40 * An implementation of the <code>InvocationHandler</code> interface for
41 * use with Java Remote Method Invocation (Java RMI). This invocation
42 * handler can be used in conjunction with a dynamic proxy instance as a
43 * replacement for a pregenerated stub class.
44 *
45 * <p>Applications are not expected to use this class directly. A remote
46 * object exported to use a dynamic proxy with {@link UnicastRemoteObject}
47 * or {@link Activatable} has an instance of this class as that proxy's
48 * invocation handler.
49 *
50 * @author Ann Wollrath
51 * @since 1.5
52 **/
53public class RemoteObjectInvocationHandler
54 extends RemoteObject
55 implements InvocationHandler
56{
57 private static final long serialVersionUID = 2L;
58
59 /**
60 * A weak hash map, mapping classes to weak hash maps that map
61 * method objects to method hashes.
62 **/
63 private static final MethodToHash_Maps methodToHash_Maps =
64 new MethodToHash_Maps();
65
66 /**
67 * Creates a new <code>RemoteObjectInvocationHandler</code> constructed
68 * with the specified <code>RemoteRef</code>.
69 *
70 * @param ref the remote ref
71 *
72 * @throws NullPointerException if <code>ref</code> is <code>null</code>
73 **/
74 public RemoteObjectInvocationHandler(RemoteRef ref) {
75 super(ref);
76 if (ref == null) {
77 throw new NullPointerException();
78 }
79 }
80
81 /**
82 * Processes a method invocation made on the encapsulating
83 * proxy instance, <code>proxy</code>, and returns the result.
84 *
85 * <p><code>RemoteObjectInvocationHandler</code> implements this method
86 * as follows:
87 *
88 * <p>If <code>method</code> is one of the following methods, it
89 * is processed as described below:
90 *
91 * <ul>
92 *
93 * <li>{@link Object#hashCode Object.hashCode}: Returns the hash
94 * code value for the proxy.
95 *
96 * <li>{@link Object#equals Object.equals}: Returns <code>true</code>
97 * if the argument (<code>args[0]</code>) is an instance of a dynamic
98 * proxy class and this invocation handler is equal to the invocation
99 * handler of that argument, and returns <code>false</code> otherwise.
100 *
101 * <li>{@link Object#toString Object.toString}: Returns a string
102 * representation of the proxy.
103 * </ul>
104 *
105 * <p>Otherwise, a remote call is made as follows:
106 *
107 * <ul>
108 * <li>If <code>proxy</code> is not an instance of the interface
109 * {@link Remote}, then an {@link IllegalArgumentException} is thrown.
110 *
111 * <li>Otherwise, the {@link RemoteRef#invoke invoke} method is invoked
112 * on this invocation handler's <code>RemoteRef</code>, passing
113 * <code>proxy</code>, <code>method</code>, <code>args</code>, and the
114 * method hash (defined in section 8.3 of the "Java Remote Method
115 * Invocation (RMI) Specification") for <code>method</code>, and the
116 * result is returned.
117 *
118 * <li>If an exception is thrown by <code>RemoteRef.invoke</code> and
119 * that exception is a checked exception that is not assignable to any
120 * exception in the <code>throws</code> clause of the method
121 * implemented by the <code>proxy</code>'s class, then that exception
122 * is wrapped in an {@link UnexpectedException} and the wrapped
123 * exception is thrown. Otherwise, the exception thrown by
124 * <code>invoke</code> is thrown by this method.
125 * </ul>
126 *
127 * <p>The semantics of this method are unspecified if the
128 * arguments could not have been produced by an instance of some
129 * valid dynamic proxy class containing this invocation handler.
130 *
131 * @param proxy the proxy instance that the method was invoked on
132 * @param method the <code>Method</code> instance corresponding to the
133 * interface method invoked on the proxy instance
134 * @param args an array of objects containing the values of the
135 * arguments passed in the method invocation on the proxy instance, or
136 * <code>null</code> if the method takes no arguments
137 * @return the value to return from the method invocation on the proxy
138 * instance
139 * @throws Throwable the exception to throw from the method invocation
140 * on the proxy instance
141 **/
142 public Object invoke(Object proxy, Method method, Object[] args)
143 throws Throwable
144 {
145 if (method.getDeclaringClass() == Object.class) {
146 return invokeObjectMethod(proxy, method, args);
147 } else {
148 return invokeRemoteMethod(proxy, method, args);
149 }
150 }
151
152 /**
153 * Handles java.lang.Object methods.
154 **/
155 private Object invokeObjectMethod(Object proxy,
156 Method method,
157 Object[] args)
158 {
159 String name = method.getName();
160
161 if (name.equals("hashCode")) {
162 return hashCode();
163
164 } else if (name.equals("equals")) {
165 Object obj = args[0];
166 return
167 proxy == obj ||
168 (obj != null &&
169 Proxy.isProxyClass(obj.getClass()) &&
170 equals(Proxy.getInvocationHandler(obj)));
171
172 } else if (name.equals("toString")) {
173 return proxyToString(proxy);
174
175 } else {
176 throw new IllegalArgumentException(
177 "unexpected Object method: " + method);
178 }
179 }
180
181 /**
182 * Handles remote methods.
183 **/
184 private Object invokeRemoteMethod(Object proxy,
185 Method method,
186 Object[] args)
187 throws Exception
188 {
189 try {
190 if (!(proxy instanceof Remote)) {
191 throw new IllegalArgumentException(
192 "proxy not Remote instance");
193 }
194 return ref.invoke((Remote) proxy, method, args,
195 getMethodHash(method));
196 } catch (Exception e) {
197 if (!(e instanceof RuntimeException)) {
198 Class<?> cl = proxy.getClass();
199 try {
200 method = cl.getMethod(method.getName(),
201 method.getParameterTypes());
202 } catch (NoSuchMethodException nsme) {
203 throw (IllegalArgumentException)
204 new IllegalArgumentException().initCause(nsme);
205 }
206 Class<?> thrownType = e.getClass();
207 for (Class<?> declaredType : method.getExceptionTypes()) {
208 if (declaredType.isAssignableFrom(thrownType)) {
209 throw e;
210 }
211 }
212 e = new UnexpectedException("unexpected exception", e);
213 }
214 throw e;
215 }
216 }
217
218 /**
219 * Returns a string representation for a proxy that uses this invocation
220 * handler.
221 **/
222 private String proxyToString(Object proxy) {
223 Class<?>[] interfaces = proxy.getClass().getInterfaces();
224 if (interfaces.length == 0) {
225 return "Proxy[" + this + "]";
226 }
227 String iface = interfaces[0].getName();
228 if (iface.equals("java.rmi.Remote") && interfaces.length > 1) {
229 iface = interfaces[1].getName();
230 }
231 int dot = iface.lastIndexOf('.');
232 if (dot >= 0) {
233 iface = iface.substring(dot + 1);
234 }
235 return "Proxy[" + iface + "," + this + "]";
236 }
237
238 /**
239 * @throws InvalidObjectException unconditionally
240 **/
241 private void readObjectNoData() throws InvalidObjectException {
242 throw new InvalidObjectException("no data in stream; class: " +
243 this.getClass().getName());
244 }
245
246 /**
247 * Returns the method hash for the specified method. Subsequent calls
248 * to "getMethodHash" passing the same method argument should be faster
249 * since this method caches internally the result of the method to
250 * method hash mapping. The method hash is calculated using the
251 * "computeMethodHash" method.
252 *
253 * @param method the remote method
254 * @return the method hash for the specified method
255 */
256 private static long getMethodHash(Method method) {
257 return methodToHash_Maps.get(method.getDeclaringClass()).get(method);
258 }
259
260 /**
261 * A weak hash map, mapping classes to weak hash maps that map
262 * method objects to method hashes.
263 **/
264 private static class MethodToHash_Maps
265 extends WeakClassHashMap<Map<Method,Long>>
266 {
267 MethodToHash_Maps() {}
268
269 protected Map<Method,Long> computeValue(Class<?> remoteClass) {
270 return new WeakHashMap<Method,Long>() {
271 public synchronized Long get(Object key) {
272 Long hash = super.get(key);
273 if (hash == null) {
274 Method method = (Method) key;
275 hash = Util.computeMethodHash(method);
276 put(method, hash);
277 }
278 return hash;
279 }
280 };
281 }
282 }
283}
java/pkg/java/rmi/server/RemoteRef.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteRef.java+195−0
@@ -0,0 +1,195 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.rmi.*;
29
30/**
31 * <code>RemoteRef</code> represents the handle for a remote object. A
32 * <code>RemoteStub</code> uses a remote reference to carry out a
33 * remote method invocation to a remote object.
34 *
35 * @author Ann Wollrath
36 * @since JDK1.1
37 * @see java.rmi.server.RemoteStub
38 */
39public interface RemoteRef extends java.io.Externalizable {
40
41 /** indicate compatibility with JDK 1.1.x version of class. */
42 static final long serialVersionUID = 3632638527362204081L;
43
44 /**
45 * Initialize the server package prefix: assumes that the
46 * implementation of server ref classes (e.g., UnicastRef,
47 * UnicastServerRef) are located in the package defined by the
48 * prefix.
49 */
50 final static String packagePrefix = "sun.rmi.server";
51
52 /**
53 * Invoke a method. This form of delegating method invocation
54 * to the reference allows the reference to take care of
55 * setting up the connection to the remote host, marshaling
56 * some representation for the method and parameters, then
57 * communicating the method invocation to the remote host.
58 * This method either returns the result of a method invocation
59 * on the remote object which resides on the remote host or
60 * throws a RemoteException if the call failed or an
61 * application-level exception if the remote invocation throws
62 * an exception.
63 *
64 * @param obj the object that contains the RemoteRef (e.g., the
65 * RemoteStub for the object.
66 * @param method the method to be invoked
67 * @param params the parameter list
68 * @param opnum a hash that may be used to represent the method
69 * @return result of remote method invocation
70 * @exception Exception if any exception occurs during remote method
71 * invocation
72 * @since 1.2
73 */
74 Object invoke(Remote obj,
75 java.lang.reflect.Method method,
76 Object[] params,
77 long opnum)
78 throws Exception;
79
80 /**
81 * Creates an appropriate call object for a new remote method
82 * invocation on this object. Passing operation array and index,
83 * allows the stubs generator to assign the operation indexes and
84 * interpret them. The remote reference may need the operation to
85 * encode in the call.
86 *
87 * @since JDK1.1
88 * @deprecated 1.2 style stubs no longer use this method. Instead of
89 * using a sequence of method calls on the stub's the remote reference
90 * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
91 * stub uses a single method, <code>invoke(Remote, Method, Object[],
92 * int)</code>, on the remote reference to carry out parameter
93 * marshalling, remote method executing and unmarshalling of the return
94 * value.
95 *
96 * @param obj remote stub through which to make call
97 * @param op array of stub operations
98 * @param opnum operation number
99 * @param hash stub/skeleton interface hash
100 * @return call object representing remote call
101 * @throws RemoteException if failed to initiate new remote call
102 * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
103 */
104 @Deprecated
105 RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash)
106 throws RemoteException;
107
108 /**
109 * Executes the remote call.
110 *
111 * Invoke will raise any "user" exceptions which
112 * should pass through and not be caught by the stub. If any
113 * exception is raised during the remote invocation, invoke should
114 * take care of cleaning up the connection before raising the
115 * "user" or remote exception.
116 *
117 * @since JDK1.1
118 * @deprecated 1.2 style stubs no longer use this method. Instead of
119 * using a sequence of method calls to the remote reference
120 * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
121 * stub uses a single method, <code>invoke(Remote, Method, Object[],
122 * int)</code>, on the remote reference to carry out parameter
123 * marshalling, remote method executing and unmarshalling of the return
124 * value.
125 *
126 * @param call object representing remote call
127 * @throws Exception if any exception occurs during remote method
128 * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
129 */
130 @Deprecated
131 void invoke(RemoteCall call) throws Exception;
132
133 /**
134 * Allows the remote reference to clean up (or reuse) the connection.
135 * Done should only be called if the invoke returns successfully
136 * (non-exceptionally) to the stub.
137 *
138 * @since JDK1.1
139 * @deprecated 1.2 style stubs no longer use this method. Instead of
140 * using a sequence of method calls to the remote reference
141 * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
142 * stub uses a single method, <code>invoke(Remote, Method, Object[],
143 * int)</code>, on the remote reference to carry out parameter
144 * marshalling, remote method executing and unmarshalling of the return
145 * value.
146 *
147 * @param call object representing remote call
148 * @throws RemoteException if remote error occurs during call cleanup
149 * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
150 */
151 @Deprecated
152 void done(RemoteCall call) throws RemoteException;
153
154 /**
155 * Returns the class name of the ref type to be serialized onto
156 * the stream 'out'.
157 * @param out the output stream to which the reference will be serialized
158 * @return the class name (without package qualification) of the reference
159 * type
160 * @since JDK1.1
161 */
162 String getRefClass(java.io.ObjectOutput out);
163
164 /**
165 * Returns a hashcode for a remote object. Two remote object stubs
166 * that refer to the same remote object will have the same hash code
167 * (in order to support remote objects as keys in hash tables).
168 *
169 * @return remote object hashcode
170 * @see java.util.Hashtable
171 * @since JDK1.1
172 */
173 int remoteHashCode();
174
175 /**
176 * Compares two remote objects for equality.
177 * Returns a boolean that indicates whether this remote object is
178 * equivalent to the specified Object. This method is used when a
179 * remote object is stored in a hashtable.
180 * @param obj the Object to compare with
181 * @return true if these Objects are equal; false otherwise.
182 * @see java.util.Hashtable
183 * @since JDK1.1
184 */
185 boolean remoteEquals(RemoteRef obj);
186
187 /**
188 * Returns a String that represents the reference of this remote
189 * object.
190 * @return string representing remote object reference
191 * @since JDK1.1
192 */
193 String remoteToString();
194
195}
java/pkg/java/rmi/server/RemoteServer.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteServer.java+115−0
@@ -0,0 +1,115 @@
1/*
2 * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.rmi.*;
28import sun.rmi.server.UnicastServerRef;
29import sun.rmi.runtime.Log;
30
31/**
32 * The <code>RemoteServer</code> class is the common superclass to server
33 * implementations and provides the framework to support a wide range
34 * of remote reference semantics. Specifically, the functions needed
35 * to create and export remote objects (i.e. to make them remotely
36 * available) are provided abstractly by <code>RemoteServer</code> and
37 * concretely by its subclass(es).
38 *
39 * @author Ann Wollrath
40 * @since JDK1.1
41 */
42public abstract class RemoteServer extends RemoteObject
43{
44 /* indicate compatibility with JDK 1.1.x version of class */
45 private static final long serialVersionUID = -4100238210092549637L;
46
47 /**
48 * Constructs a <code>RemoteServer</code>.
49 * @since JDK1.1
50 */
51 protected RemoteServer() {
52 super();
53 }
54
55 /**
56 * Constructs a <code>RemoteServer</code> with the given reference type.
57 *
58 * @param ref the remote reference
59 * @since JDK1.1
60 */
61 protected RemoteServer(RemoteRef ref) {
62 super(ref);
63 }
64
65 /**
66 * Returns a string representation of the client host for the
67 * remote method invocation being processed in the current thread.
68 *
69 * @return a string representation of the client host
70 *
71 * @throws ServerNotActiveException if no remote method invocation
72 * is being processed in the current thread
73 *
74 * @since JDK1.1
75 */
76 public static String getClientHost() throws ServerNotActiveException {
77 return sun.rmi.transport.tcp.TCPTransport.getClientHost();
78 }
79
80 /**
81 * Log RMI calls to the output stream <code>out</code>. If
82 * <code>out</code> is <code>null</code>, call logging is turned off.
83 *
84 * <p>If there is a security manager, its
85 * <code>checkPermission</code> method will be invoked with a
86 * <code>java.util.logging.LoggingPermission("control")</code>
87 * permission; this could result in a <code>SecurityException</code>.
88 *
89 * @param out the output stream to which RMI calls should be logged
90 * @throws SecurityException if there is a security manager and
91 * the invocation of its <code>checkPermission</code> method
92 * fails
93 * @see #getLog
94 * @since JDK1.1
95 */
96 public static void setLog(java.io.OutputStream out)
97 {
98 logNull = (out == null);
99 UnicastServerRef.callLog.setOutputStream(out);
100 }
101
102 /**
103 * Returns stream for the RMI call log.
104 * @return the call log
105 * @see #setLog
106 * @since JDK1.1
107 */
108 public static java.io.PrintStream getLog()
109 {
110 return (logNull ? null : UnicastServerRef.callLog.getPrintStream());
111 }
112
113 // initialize log status
114 private static boolean logNull = !UnicastServerRef.logCalls;
115}
java/pkg/java/rmi/server/RemoteStub.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/RemoteStub.java+74−0
@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27/**
28 * The <code>RemoteStub</code> class is the common superclass to client
29 * stubs and provides the framework to support a wide range of remote
30 * reference semantics. Stub objects are surrogates that support
31 * exactly the same set of remote interfaces defined by the actual
32 * implementation of the remote object.
33 *
34 * @author Ann Wollrath
35 * @since JDK1.1
36 */
37abstract public class RemoteStub extends RemoteObject {
38
39 /** indicate compatibility with JDK 1.1.x version of class */
40 private static final long serialVersionUID = -1585587260594494182L;
41
42 /**
43 * Constructs a <code>RemoteStub</code>.
44 */
45 protected RemoteStub() {
46 super();
47 }
48
49 /**
50 * Constructs a <code>RemoteStub</code>, with the specified remote
51 * reference.
52 *
53 * @param ref the remote reference
54 * @since JDK1.1
55 */
56 protected RemoteStub(RemoteRef ref) {
57 super(ref);
58 }
59
60 /**
61 * Sets the remote reference inside the remote stub.
62 *
63 * @param stub the remote stub
64 * @param ref the remote reference
65 * @since JDK1.1
66 * @deprecated no replacement. The <code>setRef</code> method
67 * is not needed since <code>RemoteStub</code>s can be created with
68 * the <code>RemoteStub(RemoteRef)</code> constructor.
69 */
70 @Deprecated
71 protected static void setRef(RemoteStub stub, RemoteRef ref) {
72 throw new UnsupportedOperationException();
73 }
74}
java/pkg/java/rmi/server/ServerCloneException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/ServerCloneException.java+112−0
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * A <code>ServerCloneException</code> is thrown if a remote exception occurs
30 * during the cloning of a <code>UnicastRemoteObject</code>.
31 *
32 * <p>As of release 1.4, this exception has been retrofitted to conform to
33 * the general purpose exception-chaining mechanism. The "nested exception"
34 * that may be provided at construction time and accessed via the public
35 * {@link #detail} field is now known as the <i>cause</i>, and may be
36 * accessed via the {@link Throwable#getCause()} method, as well as
37 * the aforementioned "legacy field."
38 *
39 * <p>Invoking the method {@link Throwable#initCause(Throwable)} on an
40 * instance of <code>ServerCloneException</code> always throws {@link
41 * IllegalStateException}.
42 *
43 * @author Ann Wollrath
44 * @since JDK1.1
45 * @see java.rmi.server.UnicastRemoteObject#clone()
46 */
47public class ServerCloneException extends CloneNotSupportedException {
48
49 /**
50 * The cause of the exception.
51 *
52 * <p>This field predates the general-purpose exception chaining facility.
53 * The {@link Throwable#getCause()} method is now the preferred means of
54 * obtaining this information.
55 *
56 * @serial
57 */
58 public Exception detail;
59
60 /* indicate compatibility with JDK 1.1.x version of class */
61 private static final long serialVersionUID = 6617456357664815945L;
62
63 /**
64 * Constructs a <code>ServerCloneException</code> with the specified
65 * detail message.
66 *
67 * @param s the detail message.
68 */
69 public ServerCloneException(String s) {
70 super(s);
71 initCause(null); // Disallow subsequent initCause
72 }
73
74 /**
75 * Constructs a <code>ServerCloneException</code> with the specified
76 * detail message and cause.
77 *
78 * @param s the detail message.
79 * @param cause the cause
80 */
81 public ServerCloneException(String s, Exception cause) {
82 super(s);
83 initCause(null); // Disallow subsequent initCause
84 detail = cause;
85 }
86
87 /**
88 * Returns the detail message, including the message from the cause, if
89 * any, of this exception.
90 *
91 * @return the detail message
92 */
93 public String getMessage() {
94 if (detail == null)
95 return super.getMessage();
96 else
97 return super.getMessage() +
98 "; nested exception is: \n\t" +
99 detail.toString();
100 }
101
102 /**
103 * Returns the cause of this exception. This method returns the value
104 * of the {@link #detail} field.
105 *
106 * @return the cause, which may be <tt>null</tt>.
107 * @since 1.4
108 */
109 public Throwable getCause() {
110 return detail;
111 }
112}
java/pkg/java/rmi/server/ServerNotActiveException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/ServerNotActiveException.java+61−0
@@ -0,0 +1,61 @@
1/*
2 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * An <code>ServerNotActiveException</code> is an <code>Exception</code>
30 * thrown during a call to <code>RemoteServer.getClientHost</code> if
31 * the getClientHost method is called outside of servicing a remote
32 * method call.
33 *
34 * @author Roger Riggs
35 * @since JDK1.1
36 * @see java.rmi.server.RemoteServer#getClientHost()
37 */
38public class ServerNotActiveException extends java.lang.Exception {
39
40 /* indicate compatibility with JDK 1.1.x version of class */
41 private static final long serialVersionUID = 4687940720827538231L;
42
43 /**
44 * Constructs an <code>ServerNotActiveException</code> with no specified
45 * detail message.
46 * @since JDK1.1
47 */
48 public ServerNotActiveException() {}
49
50 /**
51 * Constructs an <code>ServerNotActiveException</code> with the specified
52 * detail message.
53 *
54 * @param s the detail message.
55 * @since JDK1.1
56 */
57 public ServerNotActiveException(String s)
58 {
59 super(s);
60 }
61}
java/pkg/java/rmi/server/ServerRef.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/ServerRef.java+66−0
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.rmi.*;
29
30/**
31 * A ServerRef represents the server-side handle for a remote object
32 * implementation.
33 *
34 * @author Ann Wollrath
35 * @since JDK1.1
36 */
37public interface ServerRef extends RemoteRef {
38
39 /** indicate compatibility with JDK 1.1.x version of class. */
40 static final long serialVersionUID = -4557750989390278438L;
41
42 /**
43 * Creates a client stub object for the supplied Remote object.
44 * If the call completes successfully, the remote object should
45 * be able to accept incoming calls from clients.
46 * @param obj the remote object implementation
47 * @param data information necessary to export the object
48 * @return the stub for the remote object
49 * @exception RemoteException if an exception occurs attempting
50 * to export the object (e.g., stub class could not be found)
51 * @since JDK1.1
52 */
53 RemoteStub exportObject(Remote obj, Object data)
54 throws RemoteException;
55
56 /**
57 * Returns the hostname of the current client. When called from a
58 * thread actively handling a remote method invocation the
59 * hostname of the client is returned.
60 * @return the client's host name
61 * @exception ServerNotActiveException if called outside of servicing
62 * a remote method invocation
63 * @since JDK1.1
64 */
65 String getClientHost() throws ServerNotActiveException;
66}
java/pkg/java/rmi/server/Skeleton.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/Skeleton.java+70−0
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.rmi.Remote;
28
29/**
30 * The <code>Skeleton</code> interface is used solely by the RMI
31 * implementation.
32 *
33 * <p> Every version 1.1 (and version 1.1 compatible skeletons generated in
34 * 1.2 using <code>rmic -vcompat</code>) skeleton class generated by the rmic
35 * stub compiler implements this interface. A skeleton for a remote object is
36 * a server-side entity that dispatches calls to the actual remote object
37 * implementation.
38 *
39 * @author Ann Wollrath
40 * @since JDK1.1
41 * @deprecated no replacement. Skeletons are no longer required for remote
42 * method calls in the Java 2 platform v1.2 and greater.
43 */
44@Deprecated
45public interface Skeleton {
46 /**
47 * Unmarshals arguments, calls the actual remote object implementation,
48 * and marshals the return value or any exception.
49 *
50 * @param obj remote implementation to dispatch call to
51 * @param theCall object representing remote call
52 * @param opnum operation number
53 * @param hash stub/skeleton interface hash
54 * @exception java.lang.Exception if a general exception occurs.
55 * @since JDK1.1
56 * @deprecated no replacement
57 */
58 @Deprecated
59 void dispatch(Remote obj, RemoteCall theCall, int opnum, long hash)
60 throws Exception;
61
62 /**
63 * Returns the operations supported by the skeleton.
64 * @return operations supported by skeleton
65 * @since JDK1.1
66 * @deprecated no replacement
67 */
68 @Deprecated
69 Operation[] getOperations();
70}
java/pkg/java/rmi/server/SkeletonMismatchException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/SkeletonMismatchException.java+62−0
@@ -0,0 +1,62 @@
1/*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.rmi.RemoteException;
29
30/**
31 * This exception is thrown when a call is received that does not
32 * match the available skeleton. It indicates either that the
33 * remote method names or signatures in this interface have changed or
34 * that the stub class used to make the call and the skeleton
35 * receiving the call were not generated by the same version of
36 * the stub compiler (<code>rmic</code>).
37 *
38 * @author Roger Riggs
39 * @since JDK1.1
40 * @deprecated no replacement. Skeletons are no longer required for remote
41 * method calls in the Java 2 platform v1.2 and greater.
42 */
43@Deprecated
44public class SkeletonMismatchException extends RemoteException {
45
46 /* indicate compatibility with JDK 1.1.x version of class */
47 private static final long serialVersionUID = -7780460454818859281L;
48
49 /**
50 * Constructs a new <code>SkeletonMismatchException</code> with
51 * a specified detail message.
52 *
53 * @param s the detail message
54 * @since JDK1.1
55 * @deprecated no replacement
56 */
57 @Deprecated
58 public SkeletonMismatchException(String s) {
59 super(s);
60 }
61
62}
java/pkg/java/rmi/server/SkeletonNotFoundException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/SkeletonNotFoundException.java+68−0
@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28import java.rmi.RemoteException;
29
30/**
31 * A <code>SkeletonNotFoundException</code> is thrown if the
32 * <code>Skeleton</code> corresponding to the remote object being
33 * exported is not found. Skeletons are no longer required, so this
34 * exception is never thrown.
35 *
36 * @since JDK1.1
37 * @deprecated no replacement. Skeletons are no longer required for remote
38 * method calls in the Java 2 platform v1.2 and greater.
39 */
40@Deprecated
41public class SkeletonNotFoundException extends RemoteException {
42
43 /* indicate compatibility with JDK 1.1.x version of class */
44 private static final long serialVersionUID = -7860299673822761231L;
45
46 /**
47 * Constructs a <code>SkeletonNotFoundException</code> with the specified
48 * detail message.
49 *
50 * @param s the detail message.
51 * @since JDK1.1
52 */
53 public SkeletonNotFoundException(String s) {
54 super(s);
55 }
56
57 /**
58 * Constructs a <code>SkeletonNotFoundException</code> with the specified
59 * detail message and nested exception.
60 *
61 * @param s the detail message.
62 * @param ex the nested exception
63 * @since JDK1.1
64 */
65 public SkeletonNotFoundException(String s, Exception ex) {
66 super(s, ex);
67 }
68}
java/pkg/java/rmi/server/SocketSecurityException.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/SocketSecurityException.java+62−0
@@ -0,0 +1,62 @@
1/*
2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * An obsolete subclass of {@link ExportException}.
30 *
31 * @author Ann Wollrath
32 * @since JDK1.1
33 **/
34public class SocketSecurityException extends ExportException {
35
36 /* indicate compatibility with JDK 1.1.x version of class */
37 private static final long serialVersionUID = -7622072999407781979L;
38
39 /**
40 * Constructs an <code>SocketSecurityException</code> with the specified
41 * detail message.
42 *
43 * @param s the detail message.
44 * @since JDK1.1
45 */
46 public SocketSecurityException(String s) {
47 super(s);
48 }
49
50 /**
51 * Constructs an <code>SocketSecurityException</code> with the specified
52 * detail message and nested exception.
53 *
54 * @param s the detail message.
55 * @param ex the nested exception
56 * @since JDK1.1
57 */
58 public SocketSecurityException(String s, Exception ex) {
59 super(s, ex);
60 }
61
62}
java/pkg/java/rmi/server/UID.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/UID.java+267−0
@@ -0,0 +1,267 @@
1/*
2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.io.DataInput;
28import java.io.DataOutput;
29import java.io.IOException;
30import java.io.Serializable;
31import java.security.SecureRandom;
32
33/**
34 * A <code>UID</code> represents an identifier that is unique over time
35 * with respect to the host it is generated on, or one of 2<sup>16</sup>
36 * "well-known" identifiers.
37 *
38 * <p>The {@link #UID()} constructor can be used to generate an
39 * identifier that is unique over time with respect to the host it is
40 * generated on. The {@link #UID(short)} constructor can be used to
41 * create one of 2<sup>16</sup> well-known identifiers.
42 *
43 * <p>A <code>UID</code> instance contains three primitive values:
44 * <ul>
45 * <li><code>unique</code>, an <code>int</code> that uniquely identifies
46 * the VM that this <code>UID</code> was generated in, with respect to its
47 * host and at the time represented by the <code>time</code> value (an
48 * example implementation of the <code>unique</code> value would be a
49 * process identifier),
50 * or zero for a well-known <code>UID</code>
51 * <li><code>time</code>, a <code>long</code> equal to a time (as returned
52 * by {@link System#currentTimeMillis()}) at which the VM that this
53 * <code>UID</code> was generated in was alive,
54 * or zero for a well-known <code>UID</code>
55 * <li><code>count</code>, a <code>short</code> to distinguish
56 * <code>UID</code>s generated in the same VM with the same
57 * <code>time</code> value
58 * </ul>
59 *
60 * <p>An independently generated <code>UID</code> instance is unique
61 * over time with respect to the host it is generated on as long as
62 * the host requires more than one millisecond to reboot and its system
63 * clock is never set backward. A globally unique identifier can be
64 * constructed by pairing a <code>UID</code> instance with a unique host
65 * identifier, such as an IP address.
66 *
67 * @author Ann Wollrath
68 * @author Peter Jones
69 * @since JDK1.1
70 */
71public final class UID implements Serializable {
72
73 private static int hostUnique;
74 private static boolean hostUniqueSet = false;
75
76 private static final Object lock = new Object();
77 private static long lastTime = System.currentTimeMillis();
78 private static short lastCount = Short.MIN_VALUE;
79
80 /** indicate compatibility with JDK 1.1.x version of class */
81 private static final long serialVersionUID = 1086053664494604050L;
82
83 /**
84 * number that uniquely identifies the VM that this <code>UID</code>
85 * was generated in with respect to its host and at the given time
86 * @serial
87 */
88 private final int unique;
89
90 /**
91 * a time (as returned by {@link System#currentTimeMillis()}) at which
92 * the VM that this <code>UID</code> was generated in was alive
93 * @serial
94 */
95 private final long time;
96
97 /**
98 * 16-bit number to distinguish <code>UID</code> instances created
99 * in the same VM with the same time value
100 * @serial
101 */
102 private final short count;
103
104 /**
105 * Generates a <code>UID</code> that is unique over time with
106 * respect to the host that it was generated on.
107 */
108 public UID() {
109
110 synchronized (lock) {
111 if (!hostUniqueSet) {
112 hostUnique = (new SecureRandom()).nextInt();
113 hostUniqueSet = true;
114 }
115 unique = hostUnique;
116 if (lastCount == Short.MAX_VALUE) {
117 boolean interrupted = Thread.interrupted();
118 boolean done = false;
119 while (!done) {
120 long now = System.currentTimeMillis();
121 if (now <= lastTime) {
122 // wait for time to change
123 try {
124 Thread.currentThread().sleep(1);
125 } catch (InterruptedException e) {
126 interrupted = true;
127 }
128 } else {
129 lastTime = now;
130 lastCount = Short.MIN_VALUE;
131 done = true;
132 }
133 }
134 if (interrupted) {
135 Thread.currentThread().interrupt();
136 }
137 }
138 time = lastTime;
139 count = lastCount++;
140 }
141 }
142
143 /**
144 * Creates a "well-known" <code>UID</code>.
145 *
146 * There are 2<sup>16</sup> possible such well-known ids.
147 *
148 * <p>A <code>UID</code> created via this constructor will not
149 * clash with any <code>UID</code>s generated via the no-arg
150 * constructor.
151 *
152 * @param num number for well-known <code>UID</code>
153 */
154 public UID(short num) {
155 unique = 0;
156 time = 0;
157 count = num;
158 }
159
160 /**
161 * Constructs a <code>UID</code> given data read from a stream.
162 */
163 private UID(int unique, long time, short count) {
164 this.unique = unique;
165 this.time = time;
166 this.count = count;
167 }
168
169 /**
170 * Returns the hash code value for this <code>UID</code>.
171 *
172 * @return the hash code value for this <code>UID</code>
173 */
174 public int hashCode() {
175 return (int) time + (int) count;
176 }
177
178 /**
179 * Compares the specified object with this <code>UID</code> for
180 * equality.
181 *
182 * This method returns <code>true</code> if and only if the
183 * specified object is a <code>UID</code> instance with the same
184 * <code>unique</code>, <code>time</code>, and <code>count</code>
185 * values as this one.
186 *
187 * @param obj the object to compare this <code>UID</code> to
188 *
189 * @return <code>true</code> if the given object is equivalent to
190 * this one, and <code>false</code> otherwise
191 */
192 public boolean equals(Object obj) {
193 if (obj instanceof UID) {
194 UID uid = (UID) obj;
195 return (unique == uid.unique &&
196 count == uid.count &&
197 time == uid.time);
198 } else {
199 return false;
200 }
201 }
202
203 /**
204 * Returns a string representation of this <code>UID</code>.
205 *
206 * @return a string representation of this <code>UID</code>
207 */
208 public String toString() {
209 return Integer.toString(unique,16) + ":" +
210 Long.toString(time,16) + ":" +
211 Integer.toString(count,16);
212 }
213
214 /**
215 * Marshals a binary representation of this <code>UID</code> to
216 * a <code>DataOutput</code> instance.
217 *
218 * <p>Specifically, this method first invokes the given stream's
219 * {@link DataOutput#writeInt(int)} method with this <code>UID</code>'s
220 * <code>unique</code> value, then it invokes the stream's
221 * {@link DataOutput#writeLong(long)} method with this <code>UID</code>'s
222 * <code>time</code> value, and then it invokes the stream's
223 * {@link DataOutput#writeShort(int)} method with this <code>UID</code>'s
224 * <code>count</code> value.
225 *
226 * @param out the <code>DataOutput</code> instance to write
227 * this <code>UID</code> to
228 *
229 * @throws IOException if an I/O error occurs while performing
230 * this operation
231 */
232 public void write(DataOutput out) throws IOException {
233 out.writeInt(unique);
234 out.writeLong(time);
235 out.writeShort(count);
236 }
237
238 /**
239 * Constructs and returns a new <code>UID</code> instance by
240 * unmarshalling a binary representation from an
241 * <code>DataInput</code> instance.
242 *
243 * <p>Specifically, this method first invokes the given stream's
244 * {@link DataInput#readInt()} method to read a <code>unique</code> value,
245 * then it invoke's the stream's
246 * {@link DataInput#readLong()} method to read a <code>time</code> value,
247 * then it invoke's the stream's
248 * {@link DataInput#readShort()} method to read a <code>count</code> value,
249 * and then it creates and returns a new <code>UID</code> instance
250 * that contains the <code>unique</code>, <code>time</code>, and
251 * <code>count</code> values that were read from the stream.
252 *
253 * @param in the <code>DataInput</code> instance to read
254 * <code>UID</code> from
255 *
256 * @return unmarshalled <code>UID</code> instance
257 *
258 * @throws IOException if an I/O error occurs while performing
259 * this operation
260 */
261 public static UID read(DataInput in) throws IOException {
262 int unique = in.readInt();
263 long time = in.readLong();
264 short count = in.readShort();
265 return new UID(unique, time, count);
266 }
267}
java/pkg/java/rmi/server/UnicastRemoteObject.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/UnicastRemoteObject.java+312−0
@@ -0,0 +1,312 @@
1/*
2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package java.rmi.server;
26
27import java.rmi.*;
28import sun.rmi.server.UnicastServerRef;
29import sun.rmi.server.UnicastServerRef2;
30
31/**
32 * Used for exporting a remote object with JRMP and obtaining a stub
33 * that communicates to the remote object.
34 *
35 * <p>For the constructors and static <code>exportObject</code> methods
36 * below, the stub for a remote object being exported is obtained as
37 * follows:
38 *
39 * <p><ul>
40 *
41 * <li>If the remote object is exported using the {@link
42 * #exportObject(Remote) UnicastRemoteObject.exportObject(Remote)} method,
43 * a stub class (typically pregenerated from the remote object's class
44 * using the <code>rmic</code> tool) is loaded and an instance of that stub
45 * class is constructed as follows.
46 * <ul>
47 *
48 * <li>A "root class" is determined as follows: if the remote object's
49 * class directly implements an interface that extends {@link Remote}, then
50 * the remote object's class is the root class; otherwise, the root class is
51 * the most derived superclass of the remote object's class that directly
52 * implements an interface that extends <code>Remote</code>.
53 *
54 * <li>The name of the stub class to load is determined by concatenating
55 * the binary name of the root class with the suffix <code>"_Stub"</code>.
56 *
57 * <li>The stub class is loaded by name using the class loader of the root
58 * class. The stub class must extend {@link RemoteStub} and must have a
59 * public constructor that has one parameter, of type {@link RemoteRef}.
60 *
61 * <li>Finally, an instance of the stub class is constructed with a
62 * {@link RemoteRef}.
63 * </ul>
64 *
65 * <li>If the appropriate stub class could not be found, or the stub class
66 * could not be loaded, or a problem occurs creating the stub instance, a
67 * {@link StubNotFoundException} is thrown.
68 *
69 * <p>
70 * <li>For all other means of exporting:
71 * <p><ul>
72 *
73 * <li>If the remote object's stub class (as defined above) could not be
74 * loaded or the system property
75 * <code>java.rmi.server.ignoreStubClasses</code> is set to
76 * <code>"true"</code> (case insensitive), a {@link
77 * java.lang.reflect.Proxy} instance is constructed with the following
78 * properties:
79 *
80 * <ul>
81 *
82 * <li>The proxy's class is defined by the class loader of the remote
83 * object's class.
84 *
85 * <li>The proxy implements all the remote interfaces implemented by the
86 * remote object's class.
87 *
88 * <li>The proxy's invocation handler is a {@link
89 * RemoteObjectInvocationHandler} instance constructed with a
90 * {@link RemoteRef}.
91 *
92 * <li>If the proxy could not be created, a {@link StubNotFoundException}
93 * will be thrown.
94 * </ul>
95 *
96 * <p>
97 * <li>Otherwise, an instance of the remote object's stub class (as
98 * described above) is used as the stub.
99 *
100 * </ul>
101 * </ul>
102 *
103 * @author Ann Wollrath
104 * @author Peter Jones
105 * @since JDK1.1
106 **/
107public class UnicastRemoteObject extends RemoteServer {
108
109 /**
110 * @serial port number on which to export object
111 */
112 private int port = 0;
113
114 /**
115 * @serial client-side socket factory (if any)
116 */
117 private RMIClientSocketFactory csf = null;
118
119 /**
120 * @serial server-side socket factory (if any) to use when
121 * exporting object
122 */
123 private RMIServerSocketFactory ssf = null;
124
125 /* indicate compatibility with JDK 1.1.x version of class */
126 private static final long serialVersionUID = 4974527148936298033L;
127
128 /**
129 * Creates and exports a new UnicastRemoteObject object using an
130 * anonymous port.
131 * @throws RemoteException if failed to export object
132 * @since JDK1.1
133 */
134 protected UnicastRemoteObject() throws RemoteException
135 {
136 this(0);
137 }
138
139 /**
140 * Creates and exports a new UnicastRemoteObject object using the
141 * particular supplied port.
142 * @param port the port number on which the remote object receives calls
143 * (if <code>port</code> is zero, an anonymous port is chosen)
144 * @throws RemoteException if failed to export object
145 * @since 1.2
146 */
147 protected UnicastRemoteObject(int port) throws RemoteException
148 {
149 this.port = port;
150 exportObject((Remote) this, port);
151 }
152
153 /**
154 * Creates and exports a new UnicastRemoteObject object using the
155 * particular supplied port and socket factories.
156 * @param port the port number on which the remote object receives calls
157 * (if <code>port</code> is zero, an anonymous port is chosen)
158 * @param csf the client-side socket factory for making calls to the
159 * remote object
160 * @param ssf the server-side socket factory for receiving remote calls
161 * @throws RemoteException if failed to export object
162 * @since 1.2
163 */
164 protected UnicastRemoteObject(int port,
165 RMIClientSocketFactory csf,
166 RMIServerSocketFactory ssf)
167 throws RemoteException
168 {
169 this.port = port;
170 this.csf = csf;
171 this.ssf = ssf;
172 exportObject((Remote) this, port, csf, ssf);
173 }
174
175 /**
176 * Re-export the remote object when it is deserialized.
177 */
178 private void readObject(java.io.ObjectInputStream in)
179 throws java.io.IOException, java.lang.ClassNotFoundException
180 {
181 in.defaultReadObject();
182 reexport();
183 }
184
185 /**
186 * Returns a clone of the remote object that is distinct from
187 * the original.
188 *
189 * @exception CloneNotSupportedException if clone failed due to
190 * a RemoteException.
191 * @return the new remote object
192 * @since JDK1.1
193 */
194 public Object clone() throws CloneNotSupportedException
195 {
196 try {
197 UnicastRemoteObject cloned = (UnicastRemoteObject) super.clone();
198 cloned.reexport();
199 return cloned;
200 } catch (RemoteException e) {
201 throw new ServerCloneException("Clone failed", e);
202 }
203 }
204
205 /*
206 * Exports this UnicastRemoteObject using its initialized fields because
207 * its creation bypassed running its constructors (via deserialization
208 * or cloning, for example).
209 */
210 private void reexport() throws RemoteException
211 {
212 if (csf == null && ssf == null) {
213 exportObject((Remote) this, port);
214 } else {
215 exportObject((Remote) this, port, csf, ssf);
216 }
217 }
218
219 /**
220 * Exports the remote object to make it available to receive incoming
221 * calls using an anonymous port.
222 * @param obj the remote object to be exported
223 * @return remote object stub
224 * @exception RemoteException if export fails
225 * @since JDK1.1
226 */
227 public static RemoteStub exportObject(Remote obj)
228 throws RemoteException
229 {
230 /*
231 * Use UnicastServerRef constructor passing the boolean value true
232 * to indicate that only a generated stub class should be used. A
233 * generated stub class must be used instead of a dynamic proxy
234 * because the return value of this method is RemoteStub which a
235 * dynamic proxy class cannot extend.
236 */
237 return (RemoteStub) exportObject(obj, new UnicastServerRef(true));
238 }
239
240 /**
241 * Exports the remote object to make it available to receive incoming
242 * calls, using the particular supplied port.
243 * @param obj the remote object to be exported
244 * @param port the port to export the object on
245 * @return remote object stub
246 * @exception RemoteException if export fails
247 * @since 1.2
248 */
249 public static Remote exportObject(Remote obj, int port)
250 throws RemoteException
251 {
252 return exportObject(obj, new UnicastServerRef(port));
253 }
254
255 /**
256 * Exports the remote object to make it available to receive incoming
257 * calls, using a transport specified by the given socket factory.
258 * @param obj the remote object to be exported
259 * @param port the port to export the object on
260 * @param csf the client-side socket factory for making calls to the
261 * remote object
262 * @param ssf the server-side socket factory for receiving remote calls
263 * @return remote object stub
264 * @exception RemoteException if export fails
265 * @since 1.2
266 */
267 public static Remote exportObject(Remote obj, int port,
268 RMIClientSocketFactory csf,
269 RMIServerSocketFactory ssf)
270 throws RemoteException
271 {
272
273 return exportObject(obj, new UnicastServerRef2(port, csf, ssf));
274 }
275
276 /**
277 * Removes the remote object, obj, from the RMI runtime. If
278 * successful, the object can no longer accept incoming RMI calls.
279 * If the force parameter is true, the object is forcibly unexported
280 * even if there are pending calls to the remote object or the
281 * remote object still has calls in progress. If the force
282 * parameter is false, the object is only unexported if there are
283 * no pending or in progress calls to the object.
284 *
285 * @param obj the remote object to be unexported
286 * @param force if true, unexports the object even if there are
287 * pending or in-progress calls; if false, only unexports the object
288 * if there are no pending or in-progress calls
289 * @return true if operation is successful, false otherwise
290 * @exception NoSuchObjectException if the remote object is not
291 * currently exported
292 * @since 1.2
293 */
294 public static boolean unexportObject(Remote obj, boolean force)
295 throws java.rmi.NoSuchObjectException
296 {
297 return sun.rmi.transport.ObjectTable.unexportObject(obj, force);
298 }
299
300 /**
301 * Exports the specified object using the specified server ref.
302 */
303 private static Remote exportObject(Remote obj, UnicastServerRef sref)
304 throws RemoteException
305 {
306 // if obj extends UnicastRemoteObject, set its ref.
307 if (obj instanceof UnicastRemoteObject) {
308 ((UnicastRemoteObject) obj).ref = sref;
309 }
310 return sref.exportObject(obj, null, false);
311 }
312}
java/pkg/java/rmi/server/Unreferenced.class+0−0

Binary file not shown.

java/pkg/java/rmi/server/Unreferenced.java+45−0
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.rmi.server;
27
28/**
29 * A remote object implementation should implement the
30 * <code>Unreferenced</code> interface to receive notification when there are
31 * no more clients that reference that remote object.
32 *
33 * @author Ann Wollrath
34 * @author Roger Riggs
35 * @since JDK1.1
36 */
37public interface Unreferenced {
38 /**
39 * Called by the RMI runtime sometime after the runtime determines that
40 * the reference list, the list of clients referencing the remote object,
41 * becomes empty.
42 * @since JDK1.1
43 */
44 public void unreferenced();
45}
java/pkg/java/rmi/server/mkfile+34−0
@@ -0,0 +1,34 @@
1<../../../../../mkconfig
2
3TARG=\
4 ExportException.dis\
5 LoaderHandler.dis\
6 LogStream.dis\
7 ObjID.dis\
8 Operation.dis\
9 RemoteCall.dis\
10 RemoteObject.dis\
11 RemoteObjectInvocationHandler.dis\
12 RemoteRef.dis\
13 RemoteServer.dis\
14 RemoteStub.dis\
15 RMIClassLoader.dis\
16 RMIClassLoaderSpi.dis\
17 RMIClientSocketFactory.dis\
18 RMIFailureHandler.dis\
19 RMIServerSocketFactory.dis\
20 RMISocketFactory.dis\
21 ServerCloneException.dis\
22 ServerNotActiveException.dis\
23 ServerRef.dis\
24 Skeleton.dis\
25 SkeletonMismatchException.dis\
26 SkeletonNotFoundException.dis\
27 SocketSecurityException.dis\
28 UID.dis\
29 UnicastRemoteObject.dis\
30 Unreferenced.dis\
31
32DISBIN=$ROOT/java/dis/java/java/java/rmi/server
33
34<$ROOT/mkfiles/mkjava
java/pkg/java/rmi/server/package.html+53−0
@@ -0,0 +1,53 @@
1<!--
2 Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5 This code is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License version 2 only, as
7 published by the Free Software Foundation. Oracle designates this
8 particular file as subject to the "Classpath" exception as provided
9 by Oracle in the LICENSE file that accompanied this code.
10
11 This code is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 version 2 for more details (a copy is included in the LICENSE file that
15 accompanied this code).
16
17 You should have received a copy of the GNU General Public License version
18 2 along with this work; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 or visit www.oracle.com if you need additional information or have any
23 questions.
24-->
25
26<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
27<html>
28<body bgcolor="white">
29
30Provides classes and interfaces for supporting the server
31side of RMI. A group of classes are used by the stubs and skeletons
32generated by the rmic stub compiler. Another group of classes
33implements the RMI Transport protocol and HTTP tunneling.
34
35<!--
36<h2>Package Specification</h2>
37
38##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
39<ul>
40 <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
41</ul>
42
43<h2>Related Documentation</h2>
44
45For overviews, tutorials, examples, guides, and tool documentation, please see:
46<ul>
47 <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
48</ul>
49-->
50
51@since JDK1.1
52</body>
53</html>