1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.river.tool.envcheck.plugins;
19
20 import org.apache.river.tool.envcheck.AbstractPlugin;
21 import org.apache.river.tool.envcheck.Plugin;
22 import org.apache.river.tool.envcheck.EnvCheck;
23 import org.apache.river.tool.envcheck.Reporter;
24 import org.apache.river.tool.envcheck.Reporter.Message;
25 import org.apache.river.tool.envcheck.SubVMTask;
26 import org.apache.river.tool.envcheck.Util;
27 import java.io.File;
28 import org.apache.river.start.SharedActivationGroupDescriptor;
29
30
31
32
33
34
35
36 public class CheckJDK1_4 extends AbstractPlugin {
37
38
39 private EnvCheck envCheck;
40
41
42 private String taskName = taskName("JDK1_4Task");
43
44
45
46
47
48
49 public void run(EnvCheck envCheck) {
50 this.envCheck = envCheck;
51 checkMainVM();
52 checkGroupVM();
53 }
54
55
56
57
58
59
60
61 private void checkGroupVM() {
62 SharedActivationGroupDescriptor gd = envCheck.getGroupDescriptor();
63 if (gd != null) {
64 String source;
65 String serverCommand = gd.getServerCommand();
66 if (serverCommand == null) {
67 source = getString("cmdlinejava", envCheck.getJavaCmd());
68 } else {
69 source = getString("groupjava", serverCommand);
70 }
71 processReturn(envCheck.launch(null, gd, taskName), source);
72 }
73 }
74
75
76
77
78 private void checkMainVM() {
79 String source = getString("mainsource", envCheck.getJavaCmd());
80 processReturn(envCheck.launch(taskName), source);
81 }
82
83
84
85
86
87
88
89
90 private void processReturn(Object o, String source) {
91 if (o instanceof Boolean) {
92 Message message;
93 if (((Boolean) o).booleanValue()) {
94 message = new Message(Reporter.INFO,
95 getString("goodjdk"),
96 getString("jdkExp"));
97 } else {
98 message = new Message(Reporter.INFO,
99 getString("badjdk"),
100 getString("jdkExp"));
101 }
102 Reporter.print(message, source);
103 } else {
104 handleUnexpectedSubtaskReturn(o, source);
105 }
106 }
107
108
109
110
111
112
113
114 public static class JDK1_4Task implements SubVMTask {
115
116 public Object run(String[] args) {
117 try {
118 Class.forName("java.rmi.server.RMIClassLoaderSpi");
119 return new Boolean(true);
120 } catch (ClassNotFoundException e) {
121 return new Boolean(false);
122 }
123 }
124 }
125 }