01: package vicazh.hyperpool;
02:
03: import java.io.*;
04: import java.util.*;
05: import java.util.logging.*;
06:
07: /**
08: * The start class
09: *
10: * @author Victor Zhigunov
11: * @version 0.4.0
12: */
13: public class Start {
14:
15: public static final Logger logger = Logger.getLogger("hyperpool");
16:
17: public static final String NAME = "HyperPool";
18:
19: public static final String VERSION = "0.4.0";
20:
21: public static final String COPYRIGHT = "Copyright (c) 2003-2008 Victor Zhigunov";
22:
23: public static final String LICENCE = "GNU Lesser General Public Licence (LGPL)";
24:
25: public static boolean server;
26:
27: public static void main(String[] args) {
28: try {
29: System.out.println(NAME + " " + VERSION + " " + COPYRIGHT);
30: boolean b = false;
31: Reader reader = null;
32: boolean r = false;
33: for (int i = 0; i < args.length; i++)
34: if (args[i].equals("-d"))
35: server = true;
36: else if (args[i].equals("-i"))
37: reader = new IReader(args[++i]);
38: else if (reader == null)
39: reader = new MReader(args[i]);
40: else if (args[i].equals("-l"))
41: ((IReader) reader).connect(null);
42: else if (args[i].equals("-c"))
43: ((IReader) reader).connect(args[++i]);
44: else if (args[i].equals("-r"))
45: r = true;
46: else {
47: if (r) {
48: if (args[i].equals("-s"))
49: ((IReader) reader).send(args[++i]);
50: else if (args[i].equals("-p"))
51: ((IReader) reader).send(ResourceBundle
52: .getBundle(
53: args[++i],
54: Locale.getDefault(),
55: Class.forName(args[++i])
56: .getClassLoader())
57: .getString(args[++i]));
58: else
59: ((IReader) reader).send(new File(args[i]));
60: r = false;
61: } else {
62: if (args[i].equals("-s"))
63: reader.getObject(args[++i]);
64: else if (args[i].equals("-p"))
65: reader.getObject(ResourceBundle.getBundle(
66: args[++i],
67: Locale.getDefault(),
68: Class.forName(args[++i])
69: .getClassLoader())
70: .getString(args[++i]));
71: else
72: reader.getObject(new File(args[i]));
73: }
74: b = true;
75: }
76: if (server)
77: Thread.sleep(Long.MAX_VALUE);
78: else if (!b)
79: System.out
80: .println("Usage: [-i] <transformer> [-d] [-l] [-c <url>] <[-r] [file] [-s <source>] [-p <properties> <class> <name>]>");
81: } catch (Exception e) {
82: logger.log(Level.SEVERE, e.getMessage(), e);
83: }
84: }
85: }
|