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: package mx4j.examples.mbeans.iiop;
09:
10: import javax.management.MBeanServer;
11: import javax.management.MBeanServerFactory;
12: import javax.management.MBeanServerInvocationHandler;
13: import javax.management.ObjectName;
14:
15: /**
16: * This example starts a RMI over IIOP server that listens for RMI clients to connect
17: * and exposes its functionalities via JMX.
18: * To be run, be sure to have started the tnameserv or the orbd utility on the port
19: * specified by {@link Hello#IIOP_JNDI_NAME}, with the following command:
20: * <pre>
21: * $JAVA_HOME/bin/orbd -ORBInitialPort 1900
22: * </pre>
23: *
24: * @version $Revision: 1.1 $
25: */
26: public class IIOPServer {
27: public static void main(String[] args) throws Exception {
28: MBeanServer server = MBeanServerFactory.newMBeanServer();
29:
30: ObjectName name = new ObjectName("examples:type=iiop-remote");
31: HelloImpl remote = new HelloImpl();
32: server.registerMBean(remote, name);
33:
34: HelloImplMBean managed = (HelloImplMBean) MBeanServerInvocationHandler
35: .newProxyInstance(server, name, HelloImplMBean.class,
36: false);
37: managed.start();
38: }
39: }
|