Exemplo n.º 1
0
  public static void main(String[] args) {
    java.util.Properties props = new Properties();
    props.putAll(System.getProperties());
    props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
    props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");

    int status = 0;
    ORB orb = null;

    try {
      orb = ORB.init(args, props);
      status = run(orb, false, args);
    } catch (Exception ex) {
      ex.printStackTrace();
      status = 1;
    }

    if (orb != null) {
      try {
        orb.destroy();
      } catch (Exception ex) {
        ex.printStackTrace();
        status = 1;
      }
    }

    System.exit(status);
  }
Exemplo n.º 2
0
  public static void main(String[] args) {
    java.util.Properties props = new Properties();
    props.putAll(System.getProperties());
    props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
    props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");

    int status = 0;
    ORB orb = null;

    try {
      Client.ClientRegisterInterceptors(props, true);
      Server.ServerRegisterInterceptors(props);

      props.put("yoko.orb.id", "myORB");
      orb = ORB.init(args, props);
      status = Server.ServerRun(orb, true, args);

      if (status == 0) {
        status = Client.ClientRun(orb, true, args);

        //
        // The ORB must be totally shutdown before the servants
        // are deleted.
        //
        orb.shutdown(true);

        Server.ServerCleanup();
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      status = 1;
    }

    if (orb != null) {
      try {
        orb.destroy();
      } catch (Exception ex) {
        ex.printStackTrace();
        status = 1;
      }
    }

    System.exit(status);
  }
Exemplo n.º 3
0
  public void startMockServer(int corbaPort) {
    ORB orb = null;

    try {
      orb = getOrbForServer(corbaPort);
      System.out.println("Server Started...");
      orb.run(); // blocks the current thread until the ORB is shutdown
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
      System.out.println("Unable to start the CORBA server.");
      e.printStackTrace();
    } catch (IOException e) {
      System.out.println("Unable to generate the IOR file.");
      e.printStackTrace();
    }

    if (orb != null) {
      orb.destroy();
    }
  }