01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management.remote.rmi;
10:
11: import java.io.IOException;
12: import java.rmi.Remote;
13: import java.util.Map;
14: import javax.rmi.CORBA.Stub;
15: import javax.rmi.PortableRemoteObject;
16: import javax.security.auth.Subject;
17:
18: /**
19: * @version $Revision: 1.8 $
20: */
21: public class RMIIIOPServerImpl extends RMIServerImpl {
22: public RMIIIOPServerImpl(Map env) throws IOException {
23: super (env);
24: }
25:
26: protected void export() throws IOException {
27: PortableRemoteObject.exportObject(this );
28: }
29:
30: protected String getProtocol() {
31: return "iiop";
32: }
33:
34: public Remote toStub() throws IOException {
35: Remote remote = PortableRemoteObject.toStub(this );
36: if (!(remote instanceof Stub))
37: throw new IOException("Could not find IIOP stub");
38: return remote;
39: }
40:
41: protected RMIConnection makeClient(String connectionId,
42: Subject subject) throws IOException {
43: RMIConnectionImpl client = new RMIConnectionImpl(this ,
44: connectionId, getDefaultClassLoader(), subject,
45: getEnvironment());
46: client.setContext(getContext());
47: PortableRemoteObject.exportObject(client);
48: return client;
49: }
50:
51: protected void closeClient(RMIConnection client) throws IOException {
52: PortableRemoteObject.unexportObject(client);
53: }
54:
55: protected void closeServer() throws IOException {
56: PortableRemoteObject.unexportObject(this);
57: }
58: }
|