1242
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
|
|
4 |
New code and modifications done at SWING Research Group [1]:
|
|
5 |
|
|
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
7 |
SWING Research Group, Czech Technical University in Prague
|
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
|
15 |
|
|
16 |
[1] Code written at SWING Research Group contains a signature
|
|
17 |
of one of the above copright owners. For exact set of such code,
|
|
18 |
see the differences between this version and version stx:libjava
|
|
19 |
as of 1.9.2010
|
|
20 |
"
|
|
21 |
"{ Package: 'stx:libjava' }"
|
|
22 |
|
|
23 |
Object subclass:#JavaUtilities
|
|
24 |
instanceVariableNames:''
|
|
25 |
classVariableNames:''
|
|
26 |
poolDictionaries:''
|
|
27 |
category:'Languages-Java-Utilities'
|
|
28 |
!
|
|
29 |
|
1487
|
30 |
Object subclass:#Tomcat6x
|
|
31 |
instanceVariableNames:'bootstrap'
|
1554
|
32 |
classVariableNames:'OldspaceIncreased'
|
1487
|
33 |
poolDictionaries:''
|
|
34 |
privateIn:JavaUtilities
|
|
35 |
!
|
|
36 |
|
|
37 |
Object subclass:#Tomcat7x
|
1242
|
38 |
instanceVariableNames:'bootstrap'
|
1554
|
39 |
classVariableNames:'OldspaceIncreased'
|
1242
|
40 |
poolDictionaries:''
|
|
41 |
privateIn:JavaUtilities
|
|
42 |
!
|
|
43 |
|
|
44 |
!JavaUtilities class methodsFor:'documentation'!
|
|
45 |
|
|
46 |
copyright
|
|
47 |
"
|
|
48 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
49 |
|
|
50 |
New code and modifications done at SWING Research Group [1]:
|
|
51 |
|
|
52 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
53 |
SWING Research Group, Czech Technical University in Prague
|
|
54 |
|
|
55 |
This software is furnished under a license and may be used
|
|
56 |
only in accordance with the terms of that license and with the
|
|
57 |
inclusion of the above copyright notice. This software may not
|
|
58 |
be provided or otherwise made available to, or used by, any
|
|
59 |
other person. No title to or ownership of the software is
|
|
60 |
hereby transferred.
|
|
61 |
|
|
62 |
[1] Code written at SWING Research Group contains a signature
|
|
63 |
of one of the above copright owners. For exact set of such code,
|
|
64 |
see the differences between this version and version stx:libjava
|
|
65 |
as of 1.9.2010
|
|
66 |
|
|
67 |
"
|
|
68 |
! !
|
|
69 |
|
|
70 |
!JavaUtilities class methodsFor:'instance creation'!
|
|
71 |
|
|
72 |
tomcat
|
|
73 |
|
1487
|
74 |
^self tomcat6x
|
1242
|
75 |
|
|
76 |
"Created: / 08-12-2011 / 00:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1487
|
77 |
!
|
|
78 |
|
|
79 |
tomcat6x
|
|
80 |
|
|
81 |
^Tomcat6x new
|
|
82 |
|
|
83 |
"Created: / 07-05-2012 / 22:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
84 |
!
|
|
85 |
|
|
86 |
tomcat7x
|
|
87 |
|
|
88 |
^Tomcat7x new
|
|
89 |
|
|
90 |
"Created: / 07-05-2012 / 22:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1242
|
91 |
! !
|
|
92 |
|
1487
|
93 |
!JavaUtilities::Tomcat6x methodsFor:'accessing - paths'!
|
1253
|
94 |
|
|
95 |
catalinaHome
|
1255
|
96 |
"Bit hacky, but..."
|
1665
|
97 |
"/ OperatingSystem getLoginName = 'jv' ifTrue: [
|
|
98 |
"/ ^ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src/output/build'
|
|
99 |
"/ ].
|
1275
|
100 |
|
|
101 |
OperatingSystem getLoginName = 'm' ifTrue: [
|
1665
|
102 |
^ '/home/m/Projects/stx/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src/output/build'
|
1663
|
103 |
].
|
1275
|
104 |
"Add your default here"
|
|
105 |
^ ((Smalltalk at: #'stx_libjava') packageDirectory / 'examples' / 'tomcat'
|
1665
|
106 |
/ 'apache-tomcat-6.0.35-src' / 'output'
|
|
107 |
/ 'build') pathName
|
1253
|
108 |
|
|
109 |
"Created: / 08-12-2011 / 22:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1275
|
110 |
"Modified: / 13-12-2011 / 14:32:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
1663
|
111 |
"Modified (format): / 23-08-2012 / 00:12:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1665
|
112 |
"Modified: / 23-08-2012 / 01:58:37 / m"
|
1253
|
113 |
!
|
|
114 |
|
|
115 |
classPath1
|
|
116 |
|
|
117 |
^ self catalinaHome , '/bin/bootstrap.jar'
|
|
118 |
|
|
119 |
"Created: / 08-12-2011 / 22:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
120 |
!
|
|
121 |
|
|
122 |
classPath2
|
|
123 |
|
|
124 |
^ self catalinaHome , '/lib/*.jar'
|
|
125 |
|
|
126 |
"Created: / 08-12-2011 / 22:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
127 |
!
|
|
128 |
|
|
129 |
sourcePath
|
1665
|
130 |
| pkgdir root path p |
|
|
131 |
pkgdir := Smalltalk getPackageDirectoryForPackage: self class package.
|
|
132 |
pkgdir isNil ifTrue: [ ^ #() ].
|
1570
|
133 |
root := pkgdir / 'examples' / 'tomcat' / 'apache-tomcat-6.0.35-src'.
|
|
134 |
OperatingSystem getLoginName = 'm' ifTrue: [
|
1665
|
135 |
root := '/home/m/Projects/stx/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src'
|
|
136 |
asFilename
|
1275
|
137 |
].
|
1570
|
138 |
OperatingSystem getLoginName = 'jv' ifTrue: [
|
1665
|
139 |
root := '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src/'
|
|
140 |
asFilename
|
1570
|
141 |
].
|
1665
|
142 |
root exists ifFalse: [ ^ #() ].
|
1570
|
143 |
path := OrderedCollection new.
|
|
144 |
(p := root / 'java') exists ifTrue: [ path add: p ].
|
|
145 |
(p := root / 'java-extras') exists ifTrue: [ path add: p ].
|
1665
|
146 |
^ path
|
1253
|
147 |
|
|
148 |
"Created: / 08-12-2011 / 23:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1275
|
149 |
"Modified: / 13-12-2011 / 14:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
1570
|
150 |
"Modified: / 30-07-2012 / 15:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1665
|
151 |
"Modified: / 23-08-2012 / 01:58:54 / m"
|
1253
|
152 |
! !
|
1251
|
153 |
|
1487
|
154 |
!JavaUtilities::Tomcat6x methodsFor:'initialization'!
|
1242
|
155 |
|
|
156 |
initializeVM
|
1251
|
157 |
|
1242
|
158 |
Java flushAllJavaResources.
|
|
159 |
Java initialize.
|
|
160 |
JavaVM initializeVM.
|
|
161 |
|
|
162 |
"Created: / 08-12-2011 / 00:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
1481
|
163 |
!
|
1242
|
164 |
|
1481
|
165 |
setup
|
1242
|
166 |
|
1251
|
167 |
| catalinaHome java_lang_System |
|
|
168 |
|
1255
|
169 |
catalinaHome := self catalinaHome.
|
|
170 |
catalinaHome asFilename exists ifFalse:[
|
|
171 |
self error:'Catalina home does not exist'.
|
|
172 |
^self.
|
|
173 |
].
|
|
174 |
|
1251
|
175 |
Java addToClassPath: self classPath1.
|
|
176 |
Java addToClassPath: self classPath2.
|
1570
|
177 |
self sourcePath do:[:each|Java addToSourcePath: each].
|
1242
|
178 |
JavaVM booted ifFalse:[self initializeVM].
|
|
179 |
java_lang_System := Java classForName:'java.lang.System'.
|
|
180 |
|
|
181 |
{
|
1251
|
182 |
'java.util.logging.config.file'. catalinaHome , '/conf/logging.properties' .
|
1242
|
183 |
'java.util.logging.manager'. 'org.apache.juli.ClassLoaderLogManager' .
|
1251
|
184 |
'java.endorsed.dirs'. catalinaHome , '/endorsed' .
|
|
185 |
'catalina.base'. catalinaHome .
|
|
186 |
'catalina.home'. catalinaHome .
|
|
187 |
'java.io.tmpdir'. catalinaHome , '/temp' .
|
1242
|
188 |
} pairWiseDo:[:key :value|
|
|
189 |
java_lang_System perform: #'setProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;'
|
|
190 |
with: (Java as_String: key)
|
|
191 |
with: (Java as_String: value)
|
|
192 |
].
|
1554
|
193 |
OldspaceIncreased ~~ true ifTrue:[
|
|
194 |
ObjectMemory moreOldSpace: 64"MB"*(1024*1024).
|
|
195 |
OldspaceIncreased := true.
|
|
196 |
].
|
|
197 |
|
1481
|
198 |
"Created: / 18-04-2012 / 08:08:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
199 |
! !
|
|
200 |
|
1487
|
201 |
!JavaUtilities::Tomcat6x methodsFor:'start/stop'!
|
1481
|
202 |
|
|
203 |
start
|
|
204 |
|
|
205 |
self setup.
|
|
206 |
|
1499
|
207 |
[
|
1242
|
208 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap')
|
|
209 |
perform: #'main([Ljava/lang/String;)V'
|
|
210 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'start'))
|
1499
|
211 |
] fork.
|
1242
|
212 |
|
|
213 |
"Created: / 07-12-2011 / 23:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
214 |
!
|
|
215 |
|
|
216 |
stop
|
|
217 |
|
1499
|
218 |
self setup.
|
|
219 |
|
1242
|
220 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap')
|
|
221 |
perform: #'main([Ljava/lang/String;)V'
|
1499
|
222 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'stop'))
|
1242
|
223 |
|
|
224 |
"Created: / 08-12-2011 / 00:32:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
225 |
! !
|
|
226 |
|
1488
|
227 |
!JavaUtilities::Tomcat7x methodsFor:'accessing - paths'!
|
1487
|
228 |
|
1488
|
229 |
catalinaHome
|
|
230 |
"Bit hacky, but..."
|
|
231 |
|
|
232 |
OperatingSystem getLoginName = 'jv' ifTrue: [
|
|
233 |
^ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/output/build'
|
|
234 |
].
|
|
235 |
OperatingSystem getLoginName = 'm' ifTrue: [
|
|
236 |
^ '/home/m/Projects/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/output/build'
|
|
237 |
].
|
|
238 |
"Add your default here"
|
|
239 |
^ ((Smalltalk at: #'stx_libjava') packageDirectory / 'examples' / 'tomcat'
|
|
240 |
/ 'apache-tomcat-7.0.27-src' / 'output'
|
|
241 |
/ 'build') pathName
|
1487
|
242 |
|
1488
|
243 |
"Created: / 08-12-2011 / 22:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
244 |
"Modified: / 13-12-2011 / 14:32:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
245 |
"Modified: / 07-05-2012 / 22:04:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
246 |
!
|
|
247 |
|
|
248 |
classPath1
|
|
249 |
|
|
250 |
^ self catalinaHome , '/bin/bootstrap.jar'
|
|
251 |
|
|
252 |
"Created: / 08-12-2011 / 22:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
253 |
!
|
|
254 |
|
|
255 |
classPath2
|
|
256 |
|
|
257 |
^ self catalinaHome , '/lib/*.jar'
|
|
258 |
|
|
259 |
"Created: / 08-12-2011 / 22:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
260 |
!
|
|
261 |
|
|
262 |
sourcePath
|
|
263 |
OperatingSystem getLoginName = 'm' ifTrue: [
|
|
264 |
^ '/home/m/Projects/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/java'
|
|
265 |
].
|
|
266 |
^ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/java'
|
|
267 |
|
|
268 |
"Created: / 08-12-2011 / 23:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
269 |
"Modified: / 13-12-2011 / 14:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
270 |
"Modified: / 07-05-2012 / 22:05:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
271 |
! !
|
|
272 |
|
|
273 |
!JavaUtilities::Tomcat7x methodsFor:'initialization'!
|
|
274 |
|
|
275 |
initializeVM
|
|
276 |
|
|
277 |
Java flushAllJavaResources.
|
|
278 |
Java initialize.
|
|
279 |
JavaVM initializeVM.
|
|
280 |
|
|
281 |
"Created: / 08-12-2011 / 00:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
282 |
!
|
|
283 |
|
|
284 |
setup
|
|
285 |
|
|
286 |
| catalinaHome java_lang_System |
|
|
287 |
|
|
288 |
catalinaHome := self catalinaHome.
|
|
289 |
catalinaHome asFilename exists ifFalse:[
|
|
290 |
self error:'Catalina home does not exist'.
|
|
291 |
^self.
|
|
292 |
].
|
|
293 |
|
|
294 |
Java addToClassPath: self classPath1.
|
|
295 |
Java addToClassPath: self classPath2.
|
|
296 |
Java addToSourcePath: self sourcePath.
|
|
297 |
JavaVM booted ifFalse:[self initializeVM].
|
|
298 |
java_lang_System := Java classForName:'java.lang.System'.
|
|
299 |
|
|
300 |
{
|
|
301 |
'java.util.logging.config.file'. catalinaHome , '/conf/logging.properties' .
|
|
302 |
'java.util.logging.manager'. 'org.apache.juli.ClassLoaderLogManager' .
|
|
303 |
'java.endorsed.dirs'. catalinaHome , '/endorsed' .
|
|
304 |
'catalina.base'. catalinaHome .
|
|
305 |
'catalina.home'. catalinaHome .
|
|
306 |
'java.io.tmpdir'. catalinaHome , '/temp' .
|
|
307 |
} pairWiseDo:[:key :value|
|
|
308 |
java_lang_System perform: #'setProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;'
|
|
309 |
with: (Java as_String: key)
|
|
310 |
with: (Java as_String: value)
|
|
311 |
].
|
|
312 |
|
|
313 |
"Created: / 18-04-2012 / 08:08:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
314 |
! !
|
|
315 |
|
|
316 |
!JavaUtilities::Tomcat7x methodsFor:'start/stop'!
|
|
317 |
|
|
318 |
start
|
|
319 |
|
|
320 |
self setup.
|
|
321 |
|
|
322 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap')
|
|
323 |
perform: #'main([Ljava/lang/String;)V'
|
|
324 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'start'))
|
|
325 |
|
|
326 |
"Created: / 07-12-2011 / 23:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
327 |
!
|
|
328 |
|
|
329 |
stop
|
|
330 |
|
|
331 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap')
|
|
332 |
perform: #'main([Ljava/lang/String;)V'
|
|
333 |
with: (String javaArrayClass with:(Java as_String:'stop'))
|
|
334 |
|
|
335 |
"Created: / 08-12-2011 / 00:32:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
336 |
! !
|
1487
|
337 |
|
1242
|
338 |
!JavaUtilities class methodsFor:'documentation'!
|
|
339 |
|
1864
|
340 |
version_HG
|
|
341 |
|
|
342 |
^ '$Changeset: <not expanded> $'
|
|
343 |
!
|
|
344 |
|
1242
|
345 |
version_SVN
|
1864
|
346 |
^ '§Id§'
|
1242
|
347 |
! !
|