author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 13:27:16 +0000 | |
branch | refactoring-vmdata |
changeset 2008 | c348b894fbfe |
parent 1936 | 53d635308057 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
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 |
||
1929
c9773c4b32d8
Tomcat boot .jar updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1864
diff
changeset
|
117 |
^ self catalinaHome , '/bin/*.jar' |
1253 | 118 |
|
119 |
"Created: / 08-12-2011 / 22:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1929
c9773c4b32d8
Tomcat boot .jar updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1864
diff
changeset
|
120 |
"Modified: / 09-01-2013 / 16:47:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1253 | 121 |
! |
122 |
||
123 |
classPath2 |
|
124 |
||
125 |
^ self catalinaHome , '/lib/*.jar' |
|
126 |
||
127 |
"Created: / 08-12-2011 / 22:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
128 |
! |
|
129 |
||
130 |
sourcePath |
|
1665 | 131 |
| pkgdir root path p | |
132 |
pkgdir := Smalltalk getPackageDirectoryForPackage: self class package. |
|
133 |
pkgdir isNil ifTrue: [ ^ #() ]. |
|
1570 | 134 |
root := pkgdir / 'examples' / 'tomcat' / 'apache-tomcat-6.0.35-src'. |
135 |
OperatingSystem getLoginName = 'm' ifTrue: [ |
|
1665 | 136 |
root := '/home/m/Projects/stx/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src' |
137 |
asFilename |
|
1275 | 138 |
]. |
1570 | 139 |
OperatingSystem getLoginName = 'jv' ifTrue: [ |
1665 | 140 |
root := '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-6.0.35-src/' |
141 |
asFilename |
|
1570 | 142 |
]. |
1665 | 143 |
root exists ifFalse: [ ^ #() ]. |
1570 | 144 |
path := OrderedCollection new. |
145 |
(p := root / 'java') exists ifTrue: [ path add: p ]. |
|
146 |
(p := root / 'java-extras') exists ifTrue: [ path add: p ]. |
|
1665 | 147 |
^ path |
1253 | 148 |
|
149 |
"Created: / 08-12-2011 / 23:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1275 | 150 |
"Modified: / 13-12-2011 / 14:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1570 | 151 |
"Modified: / 30-07-2012 / 15:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1665 | 152 |
"Modified: / 23-08-2012 / 01:58:54 / m" |
1253 | 153 |
! ! |
1251 | 154 |
|
1487 | 155 |
!JavaUtilities::Tomcat6x methodsFor:'initialization'! |
1242 | 156 |
|
157 |
initializeVM |
|
1251 | 158 |
|
1242 | 159 |
Java flushAllJavaResources. |
160 |
Java initialize. |
|
161 |
JavaVM initializeVM. |
|
162 |
||
163 |
"Created: / 08-12-2011 / 00:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1481 | 164 |
! |
1242 | 165 |
|
1481 | 166 |
setup |
1242 | 167 |
|
1251 | 168 |
| catalinaHome java_lang_System | |
169 |
||
1255 | 170 |
catalinaHome := self catalinaHome. |
171 |
catalinaHome asFilename exists ifFalse:[ |
|
172 |
self error:'Catalina home does not exist'. |
|
173 |
^self. |
|
174 |
]. |
|
175 |
||
1251 | 176 |
Java addToClassPath: self classPath1. |
177 |
Java addToClassPath: self classPath2. |
|
1570 | 178 |
self sourcePath do:[:each|Java addToSourcePath: each]. |
1242 | 179 |
JavaVM booted ifFalse:[self initializeVM]. |
180 |
java_lang_System := Java classForName:'java.lang.System'. |
|
181 |
||
182 |
{ |
|
1251 | 183 |
'java.util.logging.config.file'. catalinaHome , '/conf/logging.properties' . |
1242 | 184 |
'java.util.logging.manager'. 'org.apache.juli.ClassLoaderLogManager' . |
1251 | 185 |
'java.endorsed.dirs'. catalinaHome , '/endorsed' . |
186 |
'catalina.base'. catalinaHome . |
|
187 |
'catalina.home'. catalinaHome . |
|
188 |
'java.io.tmpdir'. catalinaHome , '/temp' . |
|
1242 | 189 |
} pairWiseDo:[:key :value| |
190 |
java_lang_System perform: #'setProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;' |
|
191 |
with: (Java as_String: key) |
|
192 |
with: (Java as_String: value) |
|
193 |
]. |
|
1554 | 194 |
OldspaceIncreased ~~ true ifTrue:[ |
195 |
ObjectMemory moreOldSpace: 64"MB"*(1024*1024). |
|
196 |
OldspaceIncreased := true. |
|
197 |
]. |
|
198 |
||
1481 | 199 |
"Created: / 18-04-2012 / 08:08:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
200 |
! ! |
|
201 |
||
1487 | 202 |
!JavaUtilities::Tomcat6x methodsFor:'start/stop'! |
1481 | 203 |
|
204 |
start |
|
205 |
||
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
206 |
| notifier | |
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
207 |
|
1481 | 208 |
self setup. |
209 |
||
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
210 |
notifier := (Java classForName: 'stx.libjava.tomcat.StartupNotifier'). |
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
211 |
|
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
212 |
|
1499 | 213 |
[ |
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
214 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap') |
1242 | 215 |
perform: #'main([Ljava/lang/String;)V' |
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
216 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'start')). |
1499 | 217 |
] fork. |
1242 | 218 |
|
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
219 |
notifier waitUntilStarted. |
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
220 |
Transcript showCR: '== TomCat ready!! ==' |
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
221 |
|
1242 | 222 |
"Created: / 07-12-2011 / 23:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1936
53d635308057
TomCat startup code improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1929
diff
changeset
|
223 |
"Modified: / 10-01-2013 / 16:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1242 | 224 |
! |
225 |
||
226 |
stop |
|
227 |
||
1499 | 228 |
self setup. |
229 |
||
1242 | 230 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap') |
231 |
perform: #'main([Ljava/lang/String;)V' |
|
1499 | 232 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'stop')) |
1242 | 233 |
|
234 |
"Created: / 08-12-2011 / 00:32:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
235 |
! ! |
|
236 |
||
1488 | 237 |
!JavaUtilities::Tomcat7x methodsFor:'accessing - paths'! |
1487 | 238 |
|
1488 | 239 |
catalinaHome |
240 |
"Bit hacky, but..." |
|
241 |
||
242 |
OperatingSystem getLoginName = 'jv' ifTrue: [ |
|
243 |
^ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/output/build' |
|
244 |
]. |
|
245 |
OperatingSystem getLoginName = 'm' ifTrue: [ |
|
246 |
^ '/home/m/Projects/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/output/build' |
|
247 |
]. |
|
248 |
"Add your default here" |
|
249 |
^ ((Smalltalk at: #'stx_libjava') packageDirectory / 'examples' / 'tomcat' |
|
250 |
/ 'apache-tomcat-7.0.27-src' / 'output' |
|
251 |
/ 'build') pathName |
|
1487 | 252 |
|
1488 | 253 |
"Created: / 08-12-2011 / 22:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
254 |
"Modified: / 13-12-2011 / 14:32:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
255 |
"Modified: / 07-05-2012 / 22:04:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
! |
|
257 |
||
258 |
classPath1 |
|
259 |
||
260 |
^ self catalinaHome , '/bin/bootstrap.jar' |
|
261 |
||
262 |
"Created: / 08-12-2011 / 22:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
263 |
! |
|
264 |
||
265 |
classPath2 |
|
266 |
||
267 |
^ self catalinaHome , '/lib/*.jar' |
|
268 |
||
269 |
"Created: / 08-12-2011 / 22:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
270 |
! |
|
271 |
||
272 |
sourcePath |
|
273 |
OperatingSystem getLoginName = 'm' ifTrue: [ |
|
274 |
^ '/home/m/Projects/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/java' |
|
275 |
]. |
|
276 |
^ '/home/jv/Projects/libjava/sources/libjava/branches/jk_new_structure/src/examples/tomcat/apache-tomcat-7.0.27-src/java' |
|
277 |
||
278 |
"Created: / 08-12-2011 / 23:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
279 |
"Modified: / 13-12-2011 / 14:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
280 |
"Modified: / 07-05-2012 / 22:05:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
281 |
! ! |
|
282 |
||
283 |
!JavaUtilities::Tomcat7x methodsFor:'initialization'! |
|
284 |
||
285 |
initializeVM |
|
286 |
||
287 |
Java flushAllJavaResources. |
|
288 |
Java initialize. |
|
289 |
JavaVM initializeVM. |
|
290 |
||
291 |
"Created: / 08-12-2011 / 00:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
292 |
! |
|
293 |
||
294 |
setup |
|
295 |
||
296 |
| catalinaHome java_lang_System | |
|
297 |
||
298 |
catalinaHome := self catalinaHome. |
|
299 |
catalinaHome asFilename exists ifFalse:[ |
|
300 |
self error:'Catalina home does not exist'. |
|
301 |
^self. |
|
302 |
]. |
|
303 |
||
304 |
Java addToClassPath: self classPath1. |
|
305 |
Java addToClassPath: self classPath2. |
|
306 |
Java addToSourcePath: self sourcePath. |
|
307 |
JavaVM booted ifFalse:[self initializeVM]. |
|
308 |
java_lang_System := Java classForName:'java.lang.System'. |
|
309 |
||
310 |
{ |
|
311 |
'java.util.logging.config.file'. catalinaHome , '/conf/logging.properties' . |
|
312 |
'java.util.logging.manager'. 'org.apache.juli.ClassLoaderLogManager' . |
|
313 |
'java.endorsed.dirs'. catalinaHome , '/endorsed' . |
|
314 |
'catalina.base'. catalinaHome . |
|
315 |
'catalina.home'. catalinaHome . |
|
316 |
'java.io.tmpdir'. catalinaHome , '/temp' . |
|
317 |
} pairWiseDo:[:key :value| |
|
318 |
java_lang_System perform: #'setProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;' |
|
319 |
with: (Java as_String: key) |
|
320 |
with: (Java as_String: value) |
|
321 |
]. |
|
322 |
||
323 |
"Created: / 18-04-2012 / 08:08:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
! ! |
|
325 |
||
326 |
!JavaUtilities::Tomcat7x methodsFor:'start/stop'! |
|
327 |
||
328 |
start |
|
329 |
||
330 |
self setup. |
|
331 |
||
332 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap') |
|
333 |
perform: #'main([Ljava/lang/String;)V' |
|
334 |
with: ((Java classForName:'java.lang.String') javaArrayClass with:(Java as_String:'start')) |
|
335 |
||
336 |
"Created: / 07-12-2011 / 23:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
337 |
! |
|
338 |
||
339 |
stop |
|
340 |
||
341 |
(Java classForName: 'org.apache.catalina.startup.Bootstrap') |
|
342 |
perform: #'main([Ljava/lang/String;)V' |
|
343 |
with: (String javaArrayClass with:(Java as_String:'stop')) |
|
344 |
||
345 |
"Created: / 08-12-2011 / 00:32:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
346 |
! ! |
|
1487 | 347 |
|
1242 | 348 |
!JavaUtilities class methodsFor:'documentation'! |
349 |
||
1864 | 350 |
version_HG |
351 |
||
352 |
^ '$Changeset: <not expanded> $' |
|
353 |
! |
|
354 |
||
1242 | 355 |
version_SVN |
1864 | 356 |
^ '§Id§' |
1242 | 357 |
! ! |