Decompiled by Jad v1 8e Copyright 2001 Pavel Kouznetsov Jad home page

  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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
package com.stanfy.contest;
import com.stanfy.contest.a.e;
import com.stanfy.contest.b.c;
import java.io.File;
import java.io.FileInputStream;
import java.util.Arrays;
import java.util.Properties;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
// Referenced classes of package com.stanfy.contest:
// d, f, g
public final class ServerStarter
{
private ServerStarter()
{
}
private static boolean a(String s)
{
return "yes".equalsIgnoreCase(s) || "true".equalsIgnoreCase(s) || "y".equalsIgnoreCase(s);
}
public static void main(String args[])
{
if(args.length < 1)
{
a.fatal("Incorrect parameter.\nUsage: java -cp '<path to jars>' com.stanfy.contest.ServerStarter <config-file-name>");
System.exit(1);
}
Logger.getRootLogger().setLevel(Level.ERROR);
Object obj;
if(!((File) (obj = new File(args[0]))).exists())
{
a.fatal((new StringBuilder()).append("Configuration file does not exist! (").append(args[0]).append(")").toString());
System.exit(1);
}
a.info("Read configuration file.");
args = new Properties();
try
{
args.load(new FileInputStream(((File) (obj))));
}
catch(Throwable throwable)
{
a.fatal("Cannot read configuration file.", throwable);
System.exit(1);
}
a.info("Read map, create game model.");
throwable = args.getProperty("map");
Object obj1 = new File((new StringBuilder()).append(throwable).append(".map").toString());
Object obj2 = new File((new StringBuilder()).append(throwable).append(".properties").toString());
if(!((File) (obj1)).exists())
{
a.fatal((new StringBuilder()).append("Incorrect path to the map: ").append(throwable).append(".map").toString());
System.exit(1);
}
if(!((File) (obj2)).exists())
{
a.fatal((new StringBuilder()).append("Incorrect path to the map configuration: ").append(throwable).append(".properties").toString());
System.exit(1);
}
try
{
e = new c(new FileInputStream(((File) (obj1))), new FileInputStream(((File) (obj2))));
}
catch(Throwable throwable1)
{
a.fatal((new StringBuilder()).append("Unable to create game model: ").append(throwable1.getMessage()).toString(), throwable1);
System.exit(1);
}
a.info("Create client connectors.");
throwable1 = args.getProperty("client.ports");
String args1[];
try
{
args1 = throwable1.split("\\s*,\\s*");
}
catch(Exception _ex)
{
a.fatal((new StringBuilder()).append("Incorrect 'client.ports' parameter: ").append(throwable1).toString());
System.exit(1);
return;
}
int i = args1.length;
a.info((new StringBuilder()).append("Clients count: ").append(i).append(" ").append(Arrays.toString(args1)).toString());
c = new e[i];
b = new int[i];
for(int j = 0; j < i; j++)
{
try
{
b[j] = Integer.parseInt(args1[j]);
}
catch(NumberFormatException _ex)
{
a.fatal((new StringBuilder()).append("Incorrect port number ").append(args1[j]).toString());
if(d != null)
d.e();
System.exit(1);
}
a.debug((new StringBuilder()).append("Start connector on port ").append(b[j]).toString());
c[j] = new e(b[j]);
}
a.info("Read misc parameters.");
j = args.getProperty("trace.out");
i = args.getProperty("result.out");
args1 = args.getProperty("visualizer.port");
String s = args.getProperty("client.wait");
args = args.getProperty("visualizer.wait");
j = j != null ? ((int) (new File(j))) : null;
i = i != null ? ((int) (new File(i))) : null;
int k = 0;
if(args1 != null)
try
{
k = Integer.parseInt(args1);
}
catch(NumberFormatException _ex)
{
a.warn("Incorrect visualizer port. Ignore it.");
}
i = new g(j, i, k);
boolean flag = false;
if(args != null)
flag = a(args);
a.debug((new StringBuilder()).append("Wait visualizer: ").append(flag).toString());
i.b(flag);
args = 0;
if(s != null)
args = a(s);
flag = args;
a.debug((new StringBuilder()).append("waitAllConnectors = ").append(args).toString());
a.debug("Start model controller");
(new d("Model controller starter", i, flag)).start();
}
static f a(f f1)
{
return d = f1;
}
static c a()
{
return e;
}
static e[] b()
{
return c;
}
static Logger c()
{
return a;
}
private static final Logger a = Logger.getLogger(com/stanfy/contest/ServerStarter);
private static int b[];
private static e c[];
private static f d;
private static c e;
}