01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: *
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * @author Mikhail A. Markov
21: * @version $Revision: 1.7.4.3 $
22: */package java.rmi.server;
23:
24: import java.io.OutputStream;
25: import java.io.PrintStream;
26: import java.util.logging.LoggingPermission;
27:
28: import org.apache.harmony.rmi.common.RMILog;
29: import org.apache.harmony.rmi.internal.nls.Messages;
30: import org.apache.harmony.rmi.server.ServerConnectionManager;
31:
32: /**
33: * @com.intel.drl.spec_ref
34: *
35: * @author Mikhail A. Markov
36: * @version $Revision: 1.7.4.3 $
37: */
38: public abstract class RemoteServer extends RemoteObject {
39:
40: private static final long serialVersionUID = -4100238210092549637L;
41:
42: /**
43: * @com.intel.drl.spec_ref
44: */
45: protected RemoteServer(RemoteRef ref) {
46: super (ref);
47: }
48:
49: /**
50: * @com.intel.drl.spec_ref
51: */
52: protected RemoteServer() {
53: super ();
54: }
55:
56: /**
57: * @com.intel.drl.spec_ref
58: */
59: public static String getClientHost()
60: throws ServerNotActiveException {
61: String host = ServerConnectionManager.getClientHost();
62:
63: if (host == null) {
64: // rmi.19=There are no in-progress RMI calls in this thread.
65: throw new ServerNotActiveException(Messages
66: .getString("rmi.19")); //$NON-NLS-1$
67: }
68: return host;
69: }
70:
71: /**
72: * @com.intel.drl.spec_ref
73: */
74: public static PrintStream getLog() {
75: return RMILog.getServerCallsLog().getPrintStream();
76: }
77:
78: /**
79: * @com.intel.drl.spec_ref
80: */
81: public static void setLog(OutputStream out) {
82: SecurityManager mgr = System.getSecurityManager();
83:
84: if (mgr != null) {
85: mgr.checkPermission(new LoggingPermission("control", null)); //$NON-NLS-1$
86: }
87: RMILog.getServerCallsLog().setOutputStream(out);
88: }
89: }
|