1 package com.starphoenixmedia.candle_pos;
2
3 import java.io.File;
4 import java.lang.reflect.InvocationTargetException;
5 import java.lang.reflect.Method;
6 import java.util.ArrayList;
7 import java.util.Iterator;
8 import java.util.Map.Entry;
9 import java.util.logging.Level;
10 import java.util.logging.Logger;
11
12
13
14
15
16 public class Starter
17 {
18 public static void main(final String[] args)
19 {
20 for ( String s : args )
21 {
22 if ( "dumpvars".equals(s.toLowerCase()) )
23 {
24 Iterator<Entry<Object, Object>> it = System.getProperties().entrySet().iterator();
25 Entry<Object, Object> e;
26 while ( it.hasNext() )
27 {
28 e = it.next();
29 System.out.print(e.getKey().toString());
30 System.out.print("\t=\t");
31 System.out.println(e.getValue().toString());
32 }
33 Iterator<Entry<String, String>>its = System.getenv().entrySet().iterator();
34 Entry<String, String> es;
35 while ( its.hasNext() )
36 {
37 es = its.next();
38 System.out.print(es.getKey());
39 System.out.print("\t=\t");
40 System.out.println(es.getValue());
41 }
42 return;
43 }
44 }
45
46 final FireCodeClassLoader fccl = new FireCodeClassLoader(CandleStart.class.getClassLoader());
47 fccl.init();
48
49 ArrayList<File> locs = new ArrayList<>();
50
51 Thread t = new Thread()
52 {
53 @Override public void run()
54 {
55 System.out.println("Booting...");
56 Class cls = null;
57 try { cls = fccl.loadClass("com.starphoenixmedia.candle_pos.CandleStart"); }
58 catch (ClassNotFoundException ex)
59 { Logger.getLogger(CandleStart.class.getName()).log(Level.SEVERE, null, ex); return; }
60
61
62
63
64
65
66
67
68
69
70
71
72 Method m = null;
73 try { m = cls.getMethod("init", String[].class); }
74 catch (NoSuchMethodException | SecurityException ex)
75 { Logger.getLogger(CandleStart.class.getName()).log(Level.SEVERE, null, ex); return; }
76
77 Object o = null;
78 try { o = cls.newInstance(); }
79 catch ( InstantiationException | IllegalAccessException ex)
80 { Logger.getLogger(CandleStart.class.getName()).log(Level.SEVERE, null, ex); }
81
82 if ( (m != null) && (o != null) )
83 {
84 try { m.invoke(o, (Object) args); }
85 catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException ex)
86 {
87 if ( (ex instanceof InvocationTargetException) && (ex.getCause() != null) )
88 { Logger.getLogger(CandleStart.class.getName()).log(Level.SEVERE, null, ex.getCause()); }
89 else { Logger.getLogger(CandleStart.class.getName()).log(Level.SEVERE, null, ex); }
90 }
91 }
92
93 }
94 };
95
96 t.setName("Candle-Main");
97 t.setContextClassLoader(fccl);
98 t.setDaemon(false);
99 t.start();
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 }