1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.gridsystems.config.modules.tomcat;
18
19 import java.io.File;
20
21 import com.gridsystems.config.Configurator;
22 import com.gridsystems.config.ConfiguratorModel;
23 import com.gridsystems.config.ConsoleConfiguratorView;
24 import com.gridsystems.config.SwingConfiguratorView;
25
26
27
28
29
30
31
32 public final class TomcatConfigurator extends Configurator {
33
34
35
36 static final String BUNDLE = "com/gridsystems/config/modules/tomcat/config_tomcat";
37
38
39
40
41 private static TomcatConfigurator instance = new TomcatConfigurator();
42
43
44
45
46 private TomcatSwingView swingView = null;
47
48
49
50
51 private TomcatConsoleView consoleView = null;
52
53
54
55
56 private TomcatConfigurator() {
57 super(BUNDLE, "config");
58 setModel(new TomcatConfigModel());
59
60
61 File f = new File("../server/lib/catalina.jar");
62 if (!f.exists()) {
63 throw new IllegalStateException("Catalina server not found");
64 }
65
66 String kernelContext = System.getProperty("context.dir");
67 if (kernelContext == null) {
68 System.setProperty("context.dir", "../webapps/kernel");
69 }
70 }
71
72
73
74
75
76
77 public static TomcatConfigurator getInstance() {
78 return instance;
79 }
80
81
82
83
84 protected SwingConfiguratorView getSwingView() {
85 if (swingView == null) {
86 swingView = new TomcatSwingView(this);
87 }
88 return swingView;
89 }
90
91
92
93
94 protected ConsoleConfiguratorView getConsoleView() {
95 if (consoleView == null) {
96 consoleView = new TomcatConsoleView(this);
97 }
98 return consoleView;
99 }
100
101
102
103
104 @Override protected ConfiguratorModel createModel() {
105 return new TomcatConfigModel((TomcatConfigModel)this.getModel());
106 }
107
108
109
110
111 public void apply() throws Exception {
112 TomcatConfigModel oldModel = (TomcatConfigModel)this.getModel();
113 super.apply();
114 WindowsFirewallManager.closePorts(oldModel.getConnectors());
115 }
116 }