KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > rmi > server > RemoteServer


1 /*
2  * @(#)RemoteServer.java 1.32 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package java.rmi.server;
8
9 import java.rmi.*;
10 import sun.rmi.server.UnicastServerRef;
11 import sun.rmi.runtime.Log;
12
13 /**
14  * The <code>RemoteServer</code> class is the common superclass to server
15  * implementations and provides the framework to support a wide range
16  * of remote reference semantics. Specifically, the functions needed
17  * to create and export remote objects (i.e. to make them remotely
18  * available) are provided abstractly by <code>RemoteServer</code> and
19  * concretely by its subclass(es).
20  *
21  * @version 1.32, 12/19/03
22  * @author Ann Wollrath
23  * @since JDK1.1
24  */

25 public abstract class RemoteServer extends RemoteObject JavaDoc
26 {
27     /* indicate compatibility with JDK 1.1.x version of class */
28     private static final long serialVersionUID = -4100238210092549637L;
29
30     /**
31      * Constructs a <code>RemoteServer</code>.
32      * @since JDK1.1
33      */

34     protected RemoteServer() {
35     super();
36     }
37
38     /**
39      * Constructs a <code>RemoteServer</code> with the given reference type.
40      *
41      * @param ref the remote reference
42      * @since JDK1.1
43      */

44     protected RemoteServer(RemoteRef JavaDoc ref) {
45     super(ref);
46     }
47
48     /**
49      * Returns a string representation of the client host for the
50      * remote method invocation being processed in the current thread.
51      *
52      * @return a string representation of the client host
53      *
54      * @throws ServerNotActiveException if no remote method invocation
55      * is being processed in the current thread
56      *
57      * @since JDK1.1
58      */

59     public static String JavaDoc getClientHost() throws ServerNotActiveException JavaDoc {
60     return sun.rmi.transport.tcp.TCPTransport.getClientHost();
61     }
62
63     /**
64      * Log RMI calls to the output stream <code>out</code>. If
65      * <code>out</code> is <code>null</code>, call logging is turned off.
66      *
67      * <p>If there is a security manager, its
68      * <code>checkPermission</code> method will be invoked with a
69      * <code>java.util.logging.LoggingPermission("control")</code>
70      * permission; this could result in a <code>SecurityException</code>.
71      *
72      * @param out the output stream to which RMI calls should be logged
73      * @throws SecurityException if there is a security manager and
74      * the invocation of its <code>checkPermission</code> method
75      * fails
76      * @see #getLog
77      * @since JDK1.1
78      */

79     public static void setLog(java.io.OutputStream JavaDoc out)
80     {
81     logNull = (out == null);
82     UnicastServerRef.callLog.setOutputStream(out);
83     }
84     
85     /**
86      * Returns stream for the RMI call log.
87      * @return the call log
88      * @see #setLog
89      * @since JDK1.1
90      */

91     public static java.io.PrintStream JavaDoc getLog()
92     {
93     return (logNull ? null : UnicastServerRef.callLog.getPrintStream());
94     }
95
96     // initialize log status
97
private static boolean logNull = !UnicastServerRef.logCalls;
98 }
99
Popular Tags