1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
package net.sf.tlc; |
7 |
|
|
8 |
|
import net.sf.tlc.core.I18nHelper; |
9 |
|
import net.sf.tlc.core.PropertyManager; |
10 |
|
import net.sf.tlc.core.TargetLauncher; |
11 |
|
import net.sf.tlc.core.impl.DefaultFinder; |
12 |
|
import net.sf.tlc.core.impl.DefaultI18nHelper; |
13 |
|
import net.sf.tlc.core.impl.DefaultLauncher; |
14 |
|
import net.sf.tlc.core.impl.DefaultPropertyManager; |
15 |
|
import net.sf.tlc.ioc.IocContainer; |
16 |
|
import net.sf.tlc.ioc.impl.EmbeddableContainer; |
17 |
|
import net.sf.tlc.loader.TlcClassLoader; |
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
public final class Main { |
25 |
|
|
26 |
|
private static final String DEFAULT_TARGET_DIR = "targets"; |
27 |
|
|
28 |
|
private static final String TLC_TARGET_DIR_KEY = "tlc.target.dir"; |
29 |
|
|
30 |
|
private static final String RESOURCES_MESSAGESBUNDLE = "resources.MessagesBundle"; |
31 |
|
|
32 |
|
private static final String STARTUP_MSG_KEY = "tlc.main.startupMessage"; |
33 |
|
|
34 |
|
private static final String SHUTDOWN_MSG_KEY = "tlc.main.shutdownMessage"; |
35 |
|
|
36 |
|
private static final String TLC_PROPERTIES = "tlc.properties"; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
0 |
private Main() { |
42 |
|
|
43 |
0 |
} |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
public static void main(final String[] args) { |
52 |
|
|
53 |
0 |
final I18nHelper i18nHelper = new DefaultI18nHelper(RESOURCES_MESSAGESBUNDLE); |
54 |
0 |
System.out.println(i18nHelper.getMessage(STARTUP_MSG_KEY)); |
55 |
|
|
56 |
0 |
final IocContainer container = new EmbeddableContainer(); |
57 |
0 |
final PropertyManager pm = new DefaultPropertyManager(TLC_PROPERTIES); |
58 |
0 |
container.add(pm); |
59 |
0 |
container.add(new TlcClassLoader(pm.getProperty(TLC_TARGET_DIR_KEY, DEFAULT_TARGET_DIR))); |
60 |
0 |
container.register(DefaultFinder.class); |
61 |
0 |
container.register(DefaultLauncher.class); |
62 |
0 |
final TargetLauncher launcher = (TargetLauncher) container.getInstance(TargetLauncher.class); |
63 |
0 |
launcher.loadTargets(); |
64 |
|
|
65 |
0 |
System.out.println(i18nHelper.getMessage(SHUTDOWN_MSG_KEY)); |
66 |
0 |
} |
67 |
|
} |