1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.qedeq.kernel.bo.common;
17
18 import java.net.URLConnection;
19
20 import org.qedeq.base.utility.YodaUtility;
21
22
23
24
25
26
27
28 public final class BasicKernel implements KernelProperties {
29
30
31
32 private static final String KERNEL_VERSION = "0.04.08";
33
34
35 private static final String KERNEL_VERSION_DIRECTORY = KERNEL_VERSION.replace('.', '_');
36
37
38 private static final String KERNEL_CODE_NAME = "gaffsie";
39
40
41 private static final String KERNEL_DEDICATED
42 = "dedicated to Balsa, a spear woman and mercenary from Kanbal, the kingdom across the mountains.";
43
44
45 private static final String DESCRIPTIVE_KERNEL_VERSION
46 = "Hilbert II - Version " + KERNEL_VERSION + " (" + KERNEL_CODE_NAME + ") ["
47 + getBuildIdFromManifest() + "] " + KERNEL_DEDICATED;
48
49
50 private static final String MAXIMAL_RULE_VERSION = "1.01.00";
51
52
53
54
55 public BasicKernel() {
56
57 }
58
59
60
61
62
63
64
65 private static String getBuildIdFromManifest() {
66 String build = BasicKernel.class.getPackage().getImplementationVersion();
67 if (build == null) {
68 build = "no regular build";
69 }
70 return build;
71 }
72
73 public String getBuildId() {
74 return getBuildIdFromManifest();
75 }
76
77 public final String getKernelVersion() {
78 return KERNEL_VERSION;
79 }
80
81 public final String getKernelCodeName() {
82 return KERNEL_CODE_NAME;
83 }
84
85 public final String getKernelVersionDirectory() {
86 return KERNEL_VERSION_DIRECTORY;
87 }
88
89 public final String getDescriptiveKernelVersion() {
90 return DESCRIPTIVE_KERNEL_VERSION;
91 }
92
93 public final String getDedication() {
94 return KERNEL_DEDICATED;
95 }
96
97 public final String getMaximalRuleVersion() {
98 return MAXIMAL_RULE_VERSION;
99 }
100
101 public final boolean isRuleVersionSupported(final String ruleVersion) {
102
103 return MAXIMAL_RULE_VERSION.equals(ruleVersion);
104 }
105
106
107
108
109
110
111 private static final class LazyHolderTimeoutMethods {
112
113
114
115
116 private static final boolean IS_SET_CONNECTION_TIMEOUT_SUPPORTED = YodaUtility.existsMethod(
117 URLConnection.class, "setConnectTimeout",
118 new Class[] {Integer.TYPE});
119
120
121
122
123 private static final boolean IS_SET_READ_TIMEOUT_SUSPPORTED = YodaUtility.existsMethod(
124 URLConnection.class, "setReadTimeout",
125 new Class[] {Integer.TYPE});
126
127
128
129
130 private LazyHolderTimeoutMethods() {
131
132 }
133
134 }
135
136 public boolean isSetConnectionTimeOutSupported() {
137 return LazyHolderTimeoutMethods.IS_SET_CONNECTION_TIMEOUT_SUPPORTED;
138 }
139
140 public boolean isSetReadTimeoutSupported() {
141 return LazyHolderTimeoutMethods.IS_SET_READ_TIMEOUT_SUSPPORTED;
142 }
143
144 }