summaryrefslogtreecommitdiff
path: root/TAO/examples/Simulator/DOVEBrowser/DOVEBrowser.java
blob: c6b27dff6628d6952b7872b24c7d7adfc035b4b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// = FILENAME
//   DOVEBrowser.java
//
// = AUTHOR
//   Michael Kircher (mk1@cs.wustl.edu)
//
// = DESCRIPTION
//   Entry point for the demo.
//
// ============================================================================


import java.awt.*;

public class DOVEBrowser {

  DemoCore demoCore_;

  public DOVEBrowser () {
    super ();
  }

  public void init (String nameServiceIOR, String nameServicePort,
                    String[] args, boolean use_queueing) {

    demoCore_ = new DemoCore (nameServiceIOR,
                              nameServicePort,
                              args,
                              use_queueing,
                              null);
    demoCore_.show ();
    demoCore_.run ();
  }

  public static void main (String[] args) {
    String nameServiceIOR = null;
    String nameServicePort = null;
    boolean use_queueing = false;
    int arg_index = 0;

    // Loop through command line arguments, acting on relevant options
    while (args.length > arg_index)
      {
        System.out.println ("args.length [" + args.length + "] arg_index [" +
                            arg_index + "]");
        // Set the name service IOR
        if (args[arg_index].equals ("-queue"))
          {
            ++arg_index;
            use_queueing = true;
          }
        else if ((args[arg_index].equals ("-nameserviceior")) &&
            (args.length > arg_index + 1))
          {
            System.out.println ("switch [" + args[arg_index] + "]");
            System.out.println ("value [" + args[arg_index + 1] + "]");
	    nameServiceIOR = args[arg_index + 1];
            System.out.println ("nameServiceIOR [" + nameServiceIOR + "]");
            arg_index += 2;
          }
        // Set the name service port
        else if ((args[arg_index].equals ("-nameserviceport")) &&
                 (args.length > arg_index + 1))
          {
            System.out.println ("switch [" + args[arg_index] + "]");
            System.out.println ("value [" + args[arg_index + 1] + "]");
	    nameServicePort = args[arg_index + 1];
            System.out.println ("nameServicePort [" + nameServicePort + "]");
            arg_index += 2;
          }
        // Skip over anything else
        else
          {
           System.out.println ("Skipping [" + args[arg_index] + "]");
            arg_index ++;
          }
      }

    DOVEBrowser doveBrowser = new DOVEBrowser();
    doveBrowser.init (nameServiceIOR, nameServicePort, args, use_queueing);
  }
}