1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package zeus.generator.code;
25
26 import zeus.util.*;
27
28 /***
29 * used to generate the script that runs the visualiser
30 * Change log
31 * ----------
32 * 26/06/01 removed java from command line
33 */
34 public class VisualiserInfo extends GenerationInfo {
35 protected static int count = 0;
36
37 public boolean has_gui = false;
38 public String zeus_external = null;
39 public String dns_file = NameserverInfo.DEFAULT_DNS;
40 public String ontology_file = null;
41
42 public VisualiserInfo(String file) {
43 name = VISUALISER + (count++);
44 ontology_file = file;
45 }
46
47 public VisualiserInfo(String name, String file) {
48 this.name = name;
49 ontology_file = file;
50 }
51
52 /***
53 removed java from command line (done in scriptwriter now)
54 Simon 26.06.01
55 */
56 public String[] summarize() {
57 String[] out = new String[4];
58 out[NAME] = name;
59 out[TYPE] = VISUALISER;
60 out[ID] = id;
61 out[COMMAND] = "zeus.visualiser.Visualiser " + name +
62 " -s " + dns_file;
63
64 if ( ontology_file != null )
65 out[COMMAND] += " -o " + ontology_file;
66 if ( has_gui )
67 out[COMMAND] += " -gui zeus.agentviewer.BasicViewer";
68 if ( zeus_external != null )
69 out[COMMAND] += " -e " + zeus_external;
70
71 out[COMMAND] += " -quick";
72 return out;
73 }
74 public String isValid() {
75 String error = null;
76 if (dns_file == null )
77 error = "Visualiser " + name + ": domain nameserver file not specified\n";
78
79 return error;
80 }
81
82 public String toString() {
83 String s = "";
84 s += "(:name " + name;
85 s += " :has_gui " + has_gui;
86 if ( host != null && !host.equals(LOCALHOST) )
87 s += " :host \"" + Misc.escape(host) + "\"";
88 if ( zeus_external != null )
89 s += " :zeus_external \"" + Misc.escape(zeus_external) + "\"";
90 if ( dns_file != null )
91 s += " :dns_file \"" + Misc.escape(dns_file) + "\"";
92 s += ")";
93 return s;
94 }
95
96 public String pprint(int sp) {
97 String tabs = Misc.spaces(sp);
98 String eol = "\n" + tabs;
99
100 String s = tabs;
101 s += "(:name " + name + eol;
102 s += " :has_gui " + has_gui + eol;
103 if ( host != null && !host.equals(LOCALHOST) )
104 s += " :host \"" + Misc.escape(host) + "\"" + eol;
105 if ( zeus_external != null )
106 s += " :zeus_external \"" + Misc.escape(zeus_external) + "\"" + eol;
107 if ( dns_file != null )
108 s += " :dns_file \"" + Misc.escape(dns_file) + "\"" + eol;
109 s += ")";
110 return s;
111 }
112 }