package examples.rmi_iiop.hello;

import java.rmi.*;
import javax.naming.*;

/**
 * Implements the HelloWorld interface.
 *
 * @author Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved.
 */

public class HelloImpl implements HelloWorld {
  private static String NAME = "HelloServer";
  public HelloImpl() throws RemoteException {
    super();
  }

  /**
   * Prints "Hello World" to the Server's command shell.
   */
  public void sayHello() throws RemoteException {
    System.out.println("\n\nHello world!!!");
  }

  /**
   * Binds this class to the JNDI tree under the name "HelloServer".
   */
  public static void main(String args[]) throws Exception {
    HelloWorld obj = new HelloImpl();
    Context initialNamingContext = new InitialContext();
    initialNamingContext.rebind(NAME,obj);
    System.out.println(
      "HelloImpl created and bound to "+ NAME);

  }
}

