GNU Classpath (0.95) | |
Frames | No Frames |
1: /* RemoteServer.java -- 2: Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006 3: Free Software Foundation, Inc. 4: 5: This file is part of GNU Classpath. 6: 7: GNU Classpath is free software; you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation; either version 2, or (at your option) 10: any later version. 11: 12: GNU Classpath is distributed in the hope that it will be useful, but 13: WITHOUT ANY WARRANTY; without even the implied warranty of 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15: General Public License for more details. 16: 17: You should have received a copy of the GNU General Public License 18: along with GNU Classpath; see the file COPYING. If not, write to the 19: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20: 02110-1301 USA. 21: 22: Linking this library statically or dynamically with other modules is 23: making a combined work based on this library. Thus, the terms and 24: conditions of the GNU General Public License cover the whole 25: combination. 26: 27: As a special exception, the copyright holders of this library give you 28: permission to link this library with independent modules to produce an 29: executable, regardless of the license terms of these independent 30: modules, and to copy and distribute the resulting executable under 31: terms of your choice, provided that you also meet, for each linked 32: independent module, the terms and conditions of the license of that 33: module. An independent module is a module which is not derived from 34: or based on this library. If you modify this library, you may extend 35: this exception to your version of the library, but you are not 36: obligated to do so. If you do not wish to do so, delete this 37: exception statement from your version. */ 38: 39: 40: package java.rmi.server; 41: 42: import gnu.java.rmi.server.RMIIncomingThread; 43: 44: import java.io.OutputStream; 45: import java.io.PrintStream; 46: 47: /** 48: * A common superclass for the server implementations. 49: */ 50: public abstract class RemoteServer 51: extends RemoteObject 52: { 53: private static final long serialVersionUID = - 4100238210092549637L; 54: 55: /** 56: * Does nothing, delegates to super(). 57: */ 58: protected RemoteServer() 59: { 60: super(); 61: } 62: 63: /** 64: * Does nothing, delegates to super(ref). 65: */ 66: protected RemoteServer(RemoteRef ref) 67: { 68: super(ref); 69: } 70: 71: /** 72: * Get the host of the calling client. The current thread must be an instance 73: * of the {@link RMIIncomingThread}. 74: * 75: * @return the client host address 76: * 77: * @throws ServerNotActiveException if the current thread is not an instance 78: * of the RMIIncomingThread. 79: */ 80: public static String getClientHost() throws ServerNotActiveException 81: { 82: Thread currThread = Thread.currentThread(); 83: if (currThread instanceof RMIIncomingThread) 84: { 85: RMIIncomingThread incomingThread = (RMIIncomingThread) currThread; 86: return incomingThread.getClientHost(); 87: } 88: else 89: { 90: throw new ServerNotActiveException( 91: "Unknown client host - current thread not instance of 'RMIIncomingThread'"); 92: } 93: } 94: 95: /** 96: * Set the stream for logging RMI calls. 97: * 98: * @param out the stream to set or null to turn the logging off. 99: */ 100: public static void setLog(OutputStream out) 101: { 102: throw new Error("Not implemented"); 103: } 104: 105: /** 106: * Get the stream for logging RMI calls. 107: * 108: * @return the associated stream. 109: */ 110: public static PrintStream getLog() 111: { 112: throw new Error("Not implemented"); 113: } 114: 115: }
GNU Classpath (0.95) |