blob: f396e666a6f4a0c3aa635d7078ab2d56c6f508f4 [file] [log] [blame]
Vinay Vishal57171472018-09-18 20:22:00 +05301<!--
2
3 Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
4
5 This program and the accompanying materials are made available under the
6 terms of the Eclipse Public License v. 2.0, which is available at
7 http://www.eclipse.org/legal/epl-2.0.
8
9 This Source Code may also be made available under the following Secondary
10 Licenses when the conditions for such availability set forth in the
11 Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12 version 2 with the GNU Classpath Exception, which is available at
13 https://www.gnu.org/software/classpath/license.html.
14
15 SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
17-->
18
19<!--
20 This is the top level build file that should be
21 imported into all the leaf level build files
22-->
23
24<!-- ================================================================ -->
25<!-- Targets to clean class files and jars files -->
26<!--
27Variables used:
28 ${build.classes.dir}
29 ${assemble.dir}
30-->
31<!-- ================================================================ -->
32<target name="clean-classes-common" depends="init-common">
33 <echo message="common.xml: Cleaning test source files: ${build.base.dir}"
34 level="verbose"/>
35 <delete dir="${build.base.dir}"/>
36</target>
37
38<target name="clean-jars-common" depends="init-common">
39 <delete dir="${assemble.dir}"/>
40</target>
41
42<target name="clean-common" depends="init-common">
43 <antcall target="clean-classes-common"/>
44 <antcall target="clean-jars-common"/>
45</target>
46
47<!-- ================================================================ -->
48<!-- Target to compile the java source files -->
49<!--
50Variables used:
51 ${build.classes.dir}
52 ${s1astest.classpath}
53 ${src}
54-->
55<!-- ================================================================ -->
56<target name="compile-common" depends="init-common">
57 <mkdir dir="${build.classes.dir}"/>
58 <echo message="common.xml: Compiling test source files" level="verbose"/>
59 <mkdir dir="${src}"/>
60 <javac srcdir="${src}"
61 destdir="${build.classes.dir}"
62 classpath="${s1astest.classpath}"
63 debug="on"
64 failonerror="true"/>
65</target>
66
67<!-- ================================================================ -->
68<!-- This is the external target war-common to be called up build files
69usage:
70<antcall target="war-common">
71<param name="war.classes" value="MyServlet.class,MyOtherServlet.class"/>
72</antcall>
73Assumption: All the static content is placed in webcontent directory
74
75Variables Used:
76 ${war.file}
77 ${build.classes.dir}
78 ${appname}
79 ${assemble.dir}
80 ${web.xml}
81 ${beans.xml}
82 ${tlds}
83 ${tagfiles}
84 ${APS_HOME}
85 ${webclient.war.files}
86 ${webclient.war.classes}
87-->
88<!-- ================================================================ -->
89
90<target name="webclient-war-common" if="hasWebclient" depends="init-common">
91 <mkdir dir="${assemble.dir}"/>
92 <antcall target="package-war-common">
93 <param name="war.classes" value="${build.classes.dir}"/>
94 <param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
95 </antcall>
96</target>
97
98<target name="webclient-wab-common" if="hasWebclient" depends="init-common">
99 <mkdir dir="${assemble.dir}"/>
100 <antcall target="package-wab-common">
101 <param name="war.classes" value="${build.classes.dir}"/>
102 <param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
103 </antcall>
104</target>
105
106
107<target name="publish-war-common" depends="init-common">
108 <mkdir dir="${build.webapps.dir}"/>
109 <copy file="${assemble.dir}/${appname}-web.war"
110 tofile="${build.webapps.dir}/${appname}.war"
111 overwrite="true" />
112</target>
113
114<target name="clean-webapps-common" depends="init-common">
115 <delete dir="${build.webapps.dir}" quiet="true" />
116</target>
117
118<target name="clear">
119 <delete file="${war.file}"/>
120</target>
121
122<target name="copy-tlds" if="tlds-exist" depends="clear,test-tlds-exist">
123 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/tlds"/>
124 <copy todir="${build.classes.dir}/tmp/WEB-INF/tlds" failonerror="false">
125 <fileset dir="${tlds}">
126 <include name="**/*.tld"/>
127 </fileset>
128 </copy>
129</target>
130
131<target name="copy-tagfiles" if="tagfiles-exist" depends="clear,test-tagfiles-exist">
132 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/tags"/>
133 <copy todir="${build.classes.dir}/tmp/WEB-INF/tags" failonerror="false">
134 <fileset dir="${tagfiles}">
135 <include name="**/*.tag"/>
136 <include name="**/*.tagx"/>
137 </fileset>
138 </copy>
139</target>
140
141<target name="package-war-common" depends="copy-tlds,copy-tagfiles">
142 <echo message="my build classes dir is:${build.classes.dir}" level="verbose"/>
143 <mkdir dir="${build.classes.dir}/tmp"/>
144 <mkdir dir="${build.classes.dir}/tmp/WEB-INF"/>
145 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/classes"/>
146 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/lib"/>
147 <mkdir dir="lib"/>
148 <copy file="${glassfish-web.xml}"
149 tofile="${build.classes.dir}/tmp/WEB-INF/glassfish-web.xml" failonerror="false"/>
150 <copy file="${sun-web.xml}"
151 tofile="${build.classes.dir}/tmp/WEB-INF/sun-web.xml" failonerror="false"/>
152 <copy file="${weblogic.xml}"
153 tofile="${build.classes.dir}/tmp/WEB-INF/weblogic.xml" failonerror="false"/>
154 <copy file="${glassfish-resources.xml}"
155 tofile="${build.classes.dir}/tmp/WEB-INF/glassfish-resources.xml" failonerror="false"/>
156 <copy todir="${build.classes.dir}/tmp/WEB-INF/lib" failonerror="false">
157 <fileset dir="lib">
158 <include name="**/*.jar"/>
159 <include name="**/*.zip"/>
160 </fileset>
161 </copy>
162 <copy file="${webservices.xml}"
163 tofile="${build.classes.dir}/tmp/WEB-INF/webservices.xml"
164 failonerror="false"/>
165 <copy file="${mappingfile.location}/${mappingfile.name}"
166 tofile="${build.classes.dir}/tmp/${mappingfile.name}"
167 failonerror="false"/>
168 <copy file="${wsdlfile.location}/${wsdlfile.name}"
169 tofile="${build.classes.dir}/tmp/WEB-INF/wsdl/${wsdlfile.name}"
170 failonerror="false"/>
171 <copy file="${tagPlugins.xml}"
172 tofile="${build.classes.dir}/tmp/WEB-INF/tagPlugins.xml"
173 failonerror="false"/>
174 <copy file="${web.xml}"
175 tofile="${build.classes.dir}/tmp/WEB-INF/web.xml"
176 failonerror="false"/>
177 <copy file="${persistence.xml}"
178 tofile="${build.classes.dir}/tmp/WEB-INF/classes/META-INF/persistence.xml"
179 failonerror="false"/>
180 <copy file="${beans.xml}"
181 tofile="${build.classes.dir}/tmp/WEB-INF/beans.xml"
182 failonerror="false"/>
183 <copy file="${context.xml}"
184 tofile="${build.classes.dir}/tmp/META-INF/context.xml" failonerror="false"/>
185 <copy file="${cdi-extension.service}"
186 tofile="${build.classes.dir}/tmp/WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension" failonerror="false"/>
187
188 <copy todir="${build.classes.dir}/tmp/WEB-INF/classes">
189 <fileset dir="${war.classes}">
190 <include name="**/*.class"/>
191 </fileset>
192 </copy>
193 <echo message="Creating war file ${war.file}" level="verbose"/>
194 <mkdir dir="${basedir}/docroot"/>
195 <jar jarfile="${war.file}" update="true">
196 <fileset dir="${build.classes.dir}/tmp" casesensitive="yes">
197 <include name="**/*class*"/>
198 </fileset>
199 <fileset dir="${basedir}/docroot" casesensitive="yes">
200 <include name="**/*.html"/>
201 <include name="**/*.HTML"/>
202 <include name="**/*.xhtml"/>
203 <include name="**/*.jsp"/>
204 <include name="**/*.jspx"/>
205 <include name="**/*.jspf"/>
206 <include name="**/*.gif"/>
207 <include name="**/*.do"/>
208 <include name="**/*.txt"/>
209 <include name="**/*.shtml"/>
210 <include name="**/*.jar"/>
211 <exclude name="**/*.java,**/*.xml,**/*.properties"/>
212 </fileset>
213 <fileset dir="${build.classes.dir}/tmp/" casesensitive="true">
214 <include name="WEB-INF/web.xml"/>
215 <include name="WEB-INF/glassfish-web.xml"/>
216 <include name="WEB-INF/glassfish-resources.xml"/>
217 <include name="WEB-INF/sun-web.xml"/>
218 <include name="WEB-INF/beans.xml"/>
219 <include name="WEB-INF/weblogic.xml"/>
220 <include name="WEB-INF/webservices.xml"/>
221 <include name="WEB-INF/tagPlugins.xml"/>
222 <include name="WEB-INF/lib/*"/>
223 <include name="WEB-INF/lib/extra/*"/>
224 <include name="WEB-INF/tlds/*"/>
225 <include name="WEB-INF/tags/*"/>
226 <include name="WEB-INF/wsdl/${wsdlfile.name}"/>
227 <include name="${mappingfile.name}"/>
228 <include name="META-INF/context.xml"/>
229 <include name="WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension"/>
230 <include name="WEB-INF/classes/META-INF/persistence.xml"/>
231 </fileset>
232 </jar>
233 <echo message="created war file ${war.file}" level="verbose"/>
234 <delete dir="${build.classes.dir}/tmp/WEB-INF" failonerror="false"/>
235 <echo message="my webclient war classes are:${webclient.war.classes}"
236 level="verbose"/>
237</target>
238
239<target name="package-wab-common" depends="copy-tlds,copy-tagfiles">
240 <echo message="my build classes dir is:${build.classes.dir}" level="verbose"/>
241 <mkdir dir="${build.classes.dir}/tmp"/>
242 <mkdir dir="${build.classes.dir}/tmp/WEB-INF"/>
243 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/classes"/>
244 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/lib"/>
245 <mkdir dir="${build.classes.dir}/tmp/WEB-INF/META-INF"/>
246 <mkdir dir="lib"/>
247 <copy file="${glassfish-web.xml}"
248 tofile="${build.classes.dir}/tmp/WEB-INF/glassfish-web.xml" failonerror="false"/>
249 <copy file="${sun-web.xml}"
250 tofile="${build.classes.dir}/tmp/WEB-INF/sun-web.xml" failonerror="false"/>
251 <copy file="${weblogic.xml}"
252 tofile="${build.classes.dir}/tmp/WEB-INF/weblogic.xml" failonerror="false"/>
253 <copy file="${glassfish-resources.xml}"
254 tofile="${build.classes.dir}/tmp/WEB-INF/glassfish-resources.xml" failonerror="false"/>
255 <copy todir="${build.classes.dir}/tmp/WEB-INF/lib" failonerror="false">
256 <fileset dir="lib">
257 <include name="**/*.jar"/>
258 <include name="**/*.zip"/>
259 </fileset>
260 </copy>
261 <copy file="${webservices.xml}"
262 tofile="${build.classes.dir}/tmp/WEB-INF/webservices.xml"
263 failonerror="false"/>
264 <copy file="${mappingfile.location}/${mappingfile.name}"
265 tofile="${build.classes.dir}/tmp/${mappingfile.name}"
266 failonerror="false"/>
267 <copy file="${wsdlfile.location}/${wsdlfile.name}"
268 tofile="${build.classes.dir}/tmp/WEB-INF/wsdl/${wsdlfile.name}"
269 failonerror="false"/>
270 <copy file="${tagPlugins.xml}"
271 tofile="${build.classes.dir}/tmp/WEB-INF/tagPlugins.xml"
272 failonerror="false"/>
273 <copy file="${web.xml}"
274 tofile="${build.classes.dir}/tmp/WEB-INF/web.xml"
275 failonerror="false"/>
276 <copy file="${persistence.xml}"
277 tofile="${build.classes.dir}/tmp/WEB-INF/classes/META-INF/persistence.xml"
278 failonerror="false"/>
279 <copy file="${beans.xml}"
280 tofile="${build.classes.dir}/tmp/WEB-INF/beans.xml"
281 failonerror="false"/>
282
283 <copy file="${bundle.descriptor}"
284 tofile="${build.classes.dir}/tmp/WEB-INF/classes/META-INF/MANIFEST.MF"
285 failonerror="false"/>
286 <copy file="${context.xml}"
287 tofile="${build.classes.dir}/tmp/META-INF/context.xml" failonerror="false"/>
288 <copy file="${cdi-extension.service}"
289 tofile="${build.classes.dir}/tmp/WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension" failonerror="false"/>
290
291 <copy todir="${build.classes.dir}/tmp/WEB-INF/classes">
292 <fileset dir="${war.classes}">
293 <include name="**/*.class"/>
294 </fileset>
295 </copy>
296 <echo message="Creating war file ${war.file}" level="verbose"/>
297 <mkdir dir="${basedir}/docroot"/>
298 <jar manifest="${bundle.descriptor}" jarfile="${war.file}" update="true">
299 <fileset dir="${build.classes.dir}/tmp" casesensitive="yes">
300 <include name="**/*class*"/>
301 </fileset>
302 <fileset dir="${basedir}/docroot" casesensitive="yes">
303 <include name="**/*.html"/>
304 <include name="**/*.HTML"/>
305 <include name="**/*.xhtml"/>
306 <include name="**/*.jsp"/>
307 <include name="**/*.jspx"/>
308 <include name="**/*.jspf"/>
309 <include name="**/*.gif"/>
310 <include name="**/*.do"/>
311 <include name="**/*.txt"/>
312 <include name="**/*.shtml"/>
313 <include name="**/*.jar"/>
314 <exclude name="**/*.java,**/*.xml,**/*.properties"/>
315 </fileset>
316 <fileset dir="${build.classes.dir}/tmp/" casesensitive="true">
317 <include name="WEB-INF/web.xml"/>
318 <include name="WEB-INF/glassfish-web.xml"/>
319 <include name="WEB-INF/glassfish-resources.xml"/>
320 <include name="WEB-INF/sun-web.xml"/>
321 <include name="WEB-INF/beans.xml"/>
322 <include name="WEB-INF/weblogic.xml"/>
323 <include name="WEB-INF/webservices.xml"/>
324 <include name="WEB-INF/tagPlugins.xml"/>
325 <include name="WEB-INF/lib/*"/>
326 <include name="WEB-INF/lib/extra/*"/>
327 <include name="WEB-INF/tlds/*"/>
328 <include name="WEB-INF/tags/*"/>
329 <include name="WEB-INF/wsdl/${wsdlfile.name}"/>
330 <include name="${mappingfile.name}"/>
331 <include name="META-INF/context.xml"/>
332 <include name="WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension"/>
333 <include name="WEB-INF/classes/META-INF/persistence.xml"/>
334 </fileset>
335 </jar>
336 <echo message="created WAB file ${war.file}" level="verbose"/>
337 <delete dir="${build.classes.dir}/tmp/WEB-INF" failonerror="false"/>
338 <echo message="my webclient WAB classes are:${webclient.war.classes}"
339 level="verbose"/>
340</target>
341
342
343<target name="test-tlds-exist">
344 <available file="${tlds}" property="tlds-exist"/>
345</target>
346
347<target name="test-tagfiles-exist">
348 <available file="${tagfiles}" property="tagfiles-exist"/>
349</target>
350
351<!-- ================================================================ -->
352<!-- Target to package the ejb application to jar file -->
353<!--
354Variables Used:
355 ${ejb.jar}
356 ${build.classes.dir}
357 ${ejb-jar.xml}
358 ${beans.xml}
359 ${persistence-orm.xml}
360 ${sun-ejb-jar.xml}
361 ${glassfish-ejb-jar.xml}
362 ${sun-cmp-mappings.xml}
363 ${metainf.dir}
364 ${ejbjar.files}
365 ${dbschema}
366-->
367<!-- ================================================================ -->
368<target name="package-ejbjar-common">
369 <delete file="${ejb.jar}"/>
370 <echo message="common.xml: Generating ejb-jar inside build directory"
371 level="verbose"/>
372 <mkdir dir="${build.classes.dir}/META-INF"/>
373 <copy file="${ejb-jar.xml}"
374 tofile="${build.classes.dir}/META-INF/ejb-jar.xml"
375 failonerror="false"/>
376 <copy file="${persistence-orm.xml}"
377 tofile="${build.classes.dir}/META-INF/persistence-orm.xml"
378 failonerror="false"/>
379 <copy file="${webservices.xml}"
380 tofile="${build.classes.dir}/META-INF/webservices.xml"
381 failonerror="false"/>
382 <copy file="${sun-ejb-jar.xml}"
383 tofile="${build.classes.dir}/META-INF/sun-ejb-jar.xml"
384 failonerror="false"/>
385 <copy file="${glassfish-ejb-jar.xml}"
386 tofile="${build.classes.dir}/META-INF/glassfish-ejb-jar.xml"
387 failonerror="false"/>
388 <copy file="${glassfish-resources.xml}"
389 tofile="${build.classes.dir}/META-INF/glassfish-resources.xml"
390 failonerror="false"/>
391 <copy file="${sun-cmp-mappings.xml}"
392 tofile="${build.classes.dir}/META-INF/sun-cmp-mappings.xml"
393 failonerror="false"/>
394 <copy file="${beans.xml}"
395 tofile="${build.classes.dir}/META-INF/beans.xml"
396 failonerror="false"/>
397 <copy file="${dbschema}" todir="${build.classes.dir}" failonerror="false"/>
398 <jar jarfile="${ejb.jar}" basedir="${ejbjar.files}" update="true"
399 includes ="${ejbjar.classes}">
400 <metainf dir="${build.classes.dir}/META-INF">
401 <include name="ejb-jar.xml"/>
402 <include name="persistence-orm.xml"/>
403 <include name="webservices.xml"/>
404 <include name="sun-ejb-jar.xml"/>
405 <include name="glassfish-resources.xml"/>
406 <include name="glassfish-ejb-jar.xml"/>
407 <include name="sun-cmp-mappings.xml"/>
408 <include name="beans.xml"/>
409 </metainf>
410 </jar>
411 <delete dir="${build.classes.dir}/META-INF" failonerror="false"/>
412 <delete file="${build.classes.dir}/*.dbschema" failonerror="false"/>
413</target>
414
415<!-- ================================================================ -->
416<!-- Target to package the appclient application to jar file -->
417<!--
418Variables Used:
419 ${appclient.jar}
420 ${appclientjar.classes}
421 ${appclientjar.files}
422 ${build.classes.dir}
423 ${application-client.xml}
424 ${sun-application-client.xml}
425-->
426<!-- ================================================================ -->
427<target name="package-appclientjar-common">
428 <delete file="${appclient.jar}"/>
429 <echo message="common.xml: Generating appclient-jar inside build directory"
430 level="verbose"/>
431 <mkdir dir="${build.classes.dir}/META-INF"/>
432 <copy file="${application-client.xml}"
433 tofile="${build.classes.dir}/META-INF/application-client.xml"
434 failonerror="false"/>
435 <copy file="${sun-application-client.xml}" tofile="${build.classes.dir}/META-INF/sun-application-client.xml"
436 failonerror="false"/>
437 <jar jarfile="${appclient.jar}" basedir="${appclientjar.files}"
438 update="true" includes ="${appclientjar.classes}"
439 manifest="./client/MANIFEST.MF">
440 <metainf dir="${build.classes.dir}/META-INF">
441 <include name="application-client.xml"/>
442 <include name="sun-application-client.xml"/>
443 </metainf>
444 </jar>
445</target>
446
447<!-- ================================================================ -->
448<!-- Target to create the ejb application jar file -->
449<!-- ================================================================ -->
450<target name="ejb-jar-common" depends="init-common">
451 <mkdir dir="${assemble.dir}"/>
452 <antcall target="package-ejbjar-common">
453 <param name="ejbjar.files" value="${build.classes.dir}"/>
454 <param name="ejb.jar" value="${assemble.dir}/${appname}-ejb.jar"/>
455 </antcall>
456</target>
457
458<!-- ================================================================ -->
459<!-- Target to create the appclient jar file -->
460<!-- ================================================================ -->
461<target name="appclient-jar-common" depends="init-common">
462 <mkdir dir="${assemble.dir}"/>
463 <antcall target="package-appclientjar-common">
464 <param name="appclientjar.files"
465 value="${build.classes.dir}"/>
466 <param name="appclient.jar"
467 value="${assemble.dir}/${appname}-client.jar"/>
468 </antcall>
469</target>
470
471<!-- ===== package par ===== -->
472<target name="package-persistence-common" depends="init-common" if="ejb30-persistence">
473 <echo message="CREATING Persistence archive: common.xml: ${build.classes.dir}, ${assemble.dir}"/>
474 <mkdir dir="${assemble.dir}"/>
475 <delete file="${assemble.dir}/${appname}-persistence.jar" failonerror="false"/>
476 <echo message="common.xml: Generating PAR inside build directory"/>
477 <mkdir dir="${build.classes.dir}/META-INF"/>
478 <copy file="${persistence.xml}" tofile="${build.classes.dir}/META-INF/persistence.xml" failonerror="false"/>
479 <copy file="${mapping.xml}" tofile="${build.classes.dir}/META-INF/entity-mapping.xml" failonerror="false"/>
480 <!-- make a jar -->
481 <jar jarfile="${assemble.dir}/${appname}-persistence.jar" basedir="${build.classes.dir}" update="true" includes ="**/*.class" excludes="**/*Local*.class,**/*Remote*.class,**/*Home*.class,**/*Bean*.class,**/*EJB*.class,**/*Exception.class">
482 <metainf dir="${build.classes.dir}/META-INF">
483 <include name="**/*.xml"/>
484 </metainf>
485 </jar>
486 <delete dir="${build.classes.dir}/META-INF" failonerror="false"/>
487</target>
488
489<!-- ================================================================ -->
490<!-- Target to assemble the ejb application to ear file -->
491<!-- ================================================================ -->
492<target name="build-ear-common" depends="fixFiles,package-persistence-common,ejb-jar-common,appclient-jar-common,webclient-war-common">
493 <delete file="${assemble.dir}/${appname}.ear"/>
494 <mkdir dir="${assemble.dir}"/>
495 <mkdir dir="${build.classes.dir}/META-INF"/>
496 <copy file="${sun-application.xml}" tofile="${build.classes.dir}/META-INF/sun-application.xml" failonerror="false"/>
497 <copy file="${application.xml}" tofile="${build.classes.dir}/META-INF/application.xml" failonerror="false"/>
498 <copy file="${glassfish-resources-ear.xml}" tofile="${build.classes.dir}/META-INF/glassfish-resources.xml" failonerror="false" filtering="true"/>
499 <jar jarfile="${assemble.dir}/${appname}App.ear">
500 <fileset dir="${assemble.dir}">
501 <include name="*.jar"/>
502 <include name="*.war"/>
503 </fileset>
504 <fileset dir="${build.classes.dir}">
505 <include name="META-INF/sun-application.xml"/>
506 <include name="META-INF/application.xml"/>
507 <include name="META-INF/glassfish-resources.xml"/>
508 </fileset>
509 <fileset dir="${env.APS_HOME}" includes="lib/reporter.jar"/>
510 </jar>
511</target>
512
513
514<!-- ================================================================ -->
515<!-- Target to assemble the ejb application to ear file -->
516<!-- ================================================================ -->
517<target name="ear-common" depends="fixFiles,init-common">
518 <delete file="${assemble.dir}/${appname}.ear"/>
519 <mkdir dir="${assemble.dir}"/>
520 <mkdir dir="${build.classes.dir}/META-INF"/>
521 <copy file="${sun-application.xml}" tofile="${build.classes.dir}/META-INF/sun-application.xml" failonerror="false"/>
522 <copy file="${glassfish-resources-ear.xml}" tofile="${build.classes.dir}/META-INF/glassfish-resources.xml" failonerror="false" filtering="true"/>
523 <ear earfile="${assemble.dir}/${appname}App.ear"
524 appxml="${application.xml}">
525 <fileset dir="${assemble.dir}">
526 <include name="*.jar"/>
527 <include name="*.war"/>
528 </fileset>
529 <fileset dir="${build.classes.dir}">
530 <include name="META-INF/sun-application.xml"/>
531 <include name="META-INF/glassfish-resources.xml"/>
532 </fileset>
533 <fileset dir="${env.APS_HOME}" includes="lib/reporter.jar"/>
534 </ear>
535</target>
536
537
538<!-- run Verifier on the ear file -->
539<target name="verifier" depends="init-common">
540 <echo message="Running verifier
541 ear file ${assemble.dir}/${appname}App.ear " level="verbose"/>
542 <antcall target="verifier-common">
543 <param name="verifier.command" value=" -n -rw "/>
544 <param name="operand.props" value="${assemble.dir}/${appname}App.ear"/>
545 </antcall>
546 <echo message="Validate the static check results" level="verbose"/>
547</target>
548
549<target name="verifier-common">
550 <echo message="Operand ${operand.props}" level="verbose"/>
551 <exec executable="${VERIFIER}" failonerror="true">
552 <arg line="${verifier.command} ${operand.props}" />
553 </exec>
554</target>
555
556<!-- ================================================================ -->
557<!-- Target to execute asadmin commands -->
558<!-- ================================================================ -->
559<target name="asadmin-common">
560 <echo message="Doing admin task ${admin.command}" level="verbose"/>
561 <echo message="Operand ${operand.props}" level="verbose"/>
562 <echo message="asadmin ${admin.command} ${as.props} ${operand.props}"/>
563 <exec executable="${ASADMIN}" failonerror="true">
564 <arg line="${admin.command} ${as.props} ${operand.props}" />
565 </exec>
566</target>
567
568<target name="asadmin-common-ignore-fail">
569 <echo message="Doing admin task ${admin.command} (ignore failures)"
570 level="verbose"/>
571 <echo message="Operand ${operand.props}" level="verbose"/>
572 <echo message="asadmin ${admin.command} ${as.props} ${operand.props}"/>
573 <exec executable="${ASADMIN}" failonerror="false">
574 <arg line="${admin.command} ${as.props} ${operand.props}" />
575 </exec>
576</target>
577
578
579<!-- Target to execute a batchfile of asadmin commands -->
580<!-- ================================================================ -->
581<target name="asadmin-batch-common">
582 <echo message="Doing admin batch task ${admin.command} --file"
583 level="verbose"/>
584<property name="user.password.file" value="asadminuserpassword.txt"/>
585<echo file="${user.password.file}" append="false">
586AS_ADMIN_USERPASSWORD=${password}
587AS_ADMIN_PASSWORD=${admin.password}
588AS_ADMIN_ADMINPASSWORD=${admin.password}
589AS_ADMIN_MASTERPASSWORD=${master.password}
590</echo>
591 <exec executable="${ASADMIN}" failonerror="true">
592 <arg line="--user ${admin.user} --passwordfile ${user.password.file} --host ${admin.host} --port ${admin.port} --echo=true --terse=true"/>
593 <arg line="multimode --file ${asadmin.file}" />
594 </exec>
595 <delete file="${user.password.file}" failonerror="false"/>
596</target>
597
598<!-- ================================================================ -->
599
600<!-- ================================================================ -->
601<!-- Target to create the user in file realm the AppServ -->
602<!-- ================================================================ -->
603<target name="create-user-common" depends="init-common">
604<property name="user.password.file" value="asadminuserpassword.txt"/>
605<echo file="${user.password.file}" append="false">
606AS_ADMIN_USERPASSWORD=${password}
607AS_ADMIN_PASSWORD=${admin.password}
608AS_ADMIN_ADMINPASSWORD=${admin.password}
609AS_ADMIN_MASTERPASSWORD=${master.password}
610</echo>
611 <exec executable="${ASADMIN}">
612 <arg line="create-file-user"/>
613 <arg line="--user ${admin.user} --passwordfile ${user.password.file} --host ${admin.host} --port ${admin.port} --echo=true --terse=true"/>
614 <arg line="--groups ${groups}"/>
615 <arg line="--authrealmname ${authrealmname}"/>
616 <arg line="--target ${appserver.instance.name}"/>
617 <arg line="${user}"/>
618 </exec>
619 <delete file="${user.password.file}" failonerror="false"/>
620</target>
621
622<!-- ================================================================ -->
623<!-- Target to delete the user in file realm the AppServ -->
624<!-- ================================================================ -->
625<target name="delete-user-common" depends="init-common">
626<echo message="Deleting user ${user} in file realm" level="verbose"/>
627<exec executable="${ASADMIN}">
628 <arg line="delete-file-user"/>
629 <arg line="${as.props}"/>
630 <arg line="--authrealmname ${authrealmname}"/>
631 <arg line="--target ${appserver.instance.name}"/>
632 <arg line="${user}"/>
633</exec>
634</target>
635
636<!-- ================================================================ -->
637<!-- J2EE Connector related targets -->
638<!-- ================================================================ -->
639
640<target name="create-connector-connpool-common"
641 depends="init-common, create-connector-connpool"/>
642
643<target name="create-connector-connpool" depends="init-common">
644 <property name="failonerror" value="false"/>
645 <property name="extra-params" value=""/>
646 <echo message="asadmin create-connector-connection-pool ${as.props} --raname ${ra.name} --connectiondefinition ${connection.defname} --target ${appserver.instance.name} ${connector.conpool.name}"/>
647 <exec executable="${ASADMIN}" failonerror="${failonerror}">
648 <arg line="create-connector-connection-pool"/>
649 <arg line="${as.props}"/>
650 <arg line="--raname ${ra.name}"/>
651 <arg line="${extra-params}"/>
652 <arg line="--connectiondefinition ${connection.defname}"/>
653 <arg line="--target ${appserver.instance.name}"/>
654 <arg line="${connector.conpool.name}"/>
655 </exec>
656</target>
657
658<target name="delete-connector-connpool-common" depends="init-common">
659 <echo message="asadmin delete-connector-connection-pool ${as.props} --cascade=true ${connector.conpool.name}"/>
660 <exec executable="${ASADMIN}" failonerror="false">
661 <arg line="delete-connector-connection-pool"/>
662 <arg line="${as.props}"/>
663 <arg line="--cascade=true"/>
664 <arg line="${connector.conpool.name}"/>
665 </exec>
666</target>
667
668<!-- create/delete Connector resource -->
669<target name="create-connector-resource-common" depends="init-common">
670 <property name="failonerror" value="false"/>
671 <echo message="asadmin create-connector-resource ${as.props} --poolname ${connector.conpool.name} --target ${appserver.instance.name} ${connector.jndi.name}"/>
672 <exec executable="${ASADMIN}" failonerror="${failonerror}">
673 <arg line="create-connector-resource"/>
674 <arg line="${as.props}"/>
675 <arg line="--poolname ${connector.conpool.name}"/>
676 <arg line="--target ${appserver.instance.name}"/>
677 <arg line="${connector.jndi.name}"/>
678 </exec>
679</target>
680
681<target name="delete-connector-resource-common" depends="init-common">
682 <echo message="asadmin delete-connector-resource ${as.props} ${connector.jndi.name}"/>
683 <exec executable="${ASADMIN}" failonerror="false">
684 <arg line="delete-connector-resource"/>
685 <arg line="${as.props}"/>
686 <arg line="${connector.jndi.name}"/>
687 </exec>
688</target>
689
690<!-- deploy/undeploy RAR files -->
691<target name="deploy-rar-common" depends="init-common">
692 <echo message="Deploying ${rarfile}" level="verbose"/>
693 <echo message="asadmin deploy ${as.props} --target ${appserver.instance.name} --force=${force} ${rarfile}"/>
694 <property name="force" value="false"/>
695 <property name="extra-params" value=""/>
696 <exec executable="${ASADMIN}" failonerror="false">
697 <arg line="deploy"/>
698 <arg line="${as.props}"/>
699 <arg line="${extra-params}"/>
700 <arg line="--force=${force}"/>
701 <arg line="--target ${appserver.instance.name}"/>
702 <arg line="${rarfile}"/>
703 </exec>
704 <echo message="Deploying ${rarfile} on ${appserver.instance.name}"/>
705</target>
706
707<target name="undeploy-rar-common" depends="init-common">
708 <echo message="Undeploying ${undeployrar}" level="verbose"/>
709 <echo message="asadmin undeploy ${as.props} --target ${appserver.instance.name} --cascade=${cascade} ${undeployrar}"/>
710 <property name="cascade" value="false"/>
711 <exec executable="${ASADMIN}" failonerror="false">
712 <arg line="undeploy"/>
713 <arg line="${as.props}"/>
714 <arg line="--cascade=${cascade}"/>
715 <arg line="--target ${appserver.instance.name}"/>
716 <arg line="${undeployrar}"/>
717 </exec>
718</target>
719
720<!-- ================================================================ -->
721<!-- Target to create JDBC connection pool -->
722<!-- ================================================================ -->
723<target name="create-jdbc-connpool-common" depends="init-common">
724<echo message="created jdbc connection pool ${jdbc.conpool.name}"
725 level="verbose"/>
726 <exec executable="${ASADMIN}" failonerror="false">
727 <arg line="create-jdbc-connection-pool"/>
728 <arg line="--datasourceclassname ${db.class}"/>
729 <arg line="--restype ${jdbc.resource.type}"/>
730 <arg line="--target ${appserver.instance.name}"/>
731 <arg line="${as.props}"/>
732 <arg line="${jdbc.conpool.name}"/>
733 </exec>
734 <antcall target="set-${db.type}-connpool-props"/>
735</target>
736
737<target name="create-jdbc-driver-connpool-common" depends="init-common">
738<echo message="created jdbc connection pool ${jdbc.conpool.name}"
739 level="verbose"/>
740 <property name="extra-params" value=""/>
741 <exec executable="${ASADMIN}" failonerror="false">
742 <arg line="create-jdbc-connection-pool"/>
743 <arg line="--driverclassname ${db.class}"/>
744 <arg line="--restype ${jdbc.resource.type}"/>
745 <arg line="${extra-params}"/>
746 <arg line="--target ${appserver.instance.name}"/>
747 <arg line="${as.props}"/>
748 <arg line="${jdbc.conpool.name}"/>
749 </exec>
750 <antcall target="set-${db.type}-driver-connpool-props"/>
751</target>
752
753<target name="set-pointbase-connpool-props">
754 <antcall target="asadmin-common-ignore-fail">
755 <param name="admin.command" value="set" />
756 <param name="operand.props"
757 value="${resources.dottedname.prefix}.jdbc-connection-pool.${jdbc.conpool.name}.property.DatabaseName=${db.url}"/>
758 </antcall>
759 <antcall target="asadmin-common-ignore-fail">
760 <param name="admin.command" value="set" />
761 <param name="operand.props"
762 value="${resources.dottedname.prefix}.jdbc-connection-pool.${jdbc.conpool.name}.property.User=${db.user}" />
763 </antcall>
764 <antcall target="asadmin-common-ignore-fail">
765 <param name="admin.command" value="set" />
766 <param name="operand.props"
767 value="${resources.dottedname.prefix}.jdbc-connection-pool.${jdbc.conpool.name}.property.Password=${db.pwd}" />
768 </antcall>
769</target>
770
771<target name="set-pointbase-driver-connpool-props">
772 <antcall target="asadmin-common-ignore-fail">
773 <param name="admin.command" value="set" />
774 <param name="operand.props"
775 value="${resources.dottedname.prefix}.jdbc-connection-pool.${jdbc.conpool.name}.property.URL=${db.url};user=${db.user};password=${db.pwd}"/>
776 </antcall>
777</target>
778
779<target name="set-derby-connpool-props">
780 <exec executable="${ASADMIN}" failonerror="false">
781 <arg line="set"/>
782 <arg line="${as.props}"/>
783 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.User=${db.user}"/>
784 </exec>
785 <exec executable="${ASADMIN}" failonerror="false">
786 <arg line="set"/>
787 <arg line="${as.props}"/>
788 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.Password=${db.pwd}"/>
789 </exec>
790 <exec executable="${ASADMIN}" failonerror="false">
791 <arg line="set"/>
792 <arg line="${as.props}"/>
793 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.driverType=4"/>
794 </exec>
795 <exec executable="${ASADMIN}" failonerror="false">
796 <arg line="set"/>
797 <arg line="${as.props}"/>
798 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.portNumber=${db.port}"/>
799 </exec>
800 <exec executable="${ASADMIN}" failonerror="false">
801 <arg line="set"/>
802 <arg line="${as.props}"/>
803 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.dataBaseName=${db.name}"/>
804 </exec>
805 <exec executable="${ASADMIN}" failonerror="false">
806 <arg line="set"/>
807 <arg line="${as.props}"/>
808 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.retrieveMessagesFromServerOnGetMessage=true"/>
809 </exec>
810 <exec executable="${ASADMIN}" failonerror="false">
811 <arg line="set"/>
812 <arg line="${as.props}"/>
813 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.create=true"/>
814 </exec>
815 <exec executable="${ASADMIN}" failonerror="false">
816 <arg line="set"/>
817 <arg line="${as.props}"/>
818 <arg line="domain.resources.jdbc-connection-pool.${jdbc.conpool.name}.property.serverName=${db.host}"/>
819 </exec>
820</target>
821
822<target name="set-derby-driver-connpool-props">
823 <antcall target="asadmin-common-ignore-fail">
824 <param name="admin.command" value="set" />
825 <param name="operand.props"
826 value="${resources.dottedname.prefix}.jdbc-connection-pool.${jdbc.conpool.name}.property.URL=${db.url};user=${db.user};password=${db.pwd}"/>
827 </antcall>
828</target>
829
830<!-- ================================================================ -->
831<!-- Target to delete JDBC connection-pool -->
832<!-- ================================================================ -->
833<target name="delete-jdbc-connpool-common" depends="init-common">
834<echo message="asadmin delete-jdbc-connection-pool ${as.props} --cascade=true --target ${appserver.instance.name} ${jdbc.conpool.name}"/>
835<exec executable="${ASADMIN}" failonerror="false">
836 <arg line="delete-jdbc-connection-pool"/>
837 <arg line="${as.props}"/>
838 <arg line="--cascade=true"/>
839 <arg line="--target ${appserver.instance.name}"/>
840 <arg line="${jdbc.conpool.name}"/>
841 </exec>
842 <echo message="cmd executed for ${appserver.instance.name}"/>
843</target>
844
845<!-- ================================================================ -->
846<!-- Target to create JDBC resource -->
847<!-- ================================================================ -->
848<target name="create-jdbc-resource-common" depends="init-common">
849<echo message="Creating jdbc resource pool ${jdbc.resource.name}"
850 level="verbose"/>
851 <echo message="asadmin create-jdbc-resource ${as.props} --connectionpoolid ${jdbc.conpool.name} --target ${appserver.instance.name} ${jdbc.resource.name}"/>
852 <exec executable="${ASADMIN}" failonerror="false">
853 <arg line="create-jdbc-resource"/>
854 <arg line="${as.props}"/>
855 <arg line="--connectionpoolid ${jdbc.conpool.name}"/>
856 <arg line="--target ${appserver.instance.name}"/>
857 <arg line="${jdbc.resource.name}"/>
858 </exec>
859 <echo message="cmd executed for ${appserver.instance.name}"/>
860</target>
861
862<!-- ================================================================ -->
863<!-- Target to delete JDBC resource -->
864<!-- ================================================================ -->
865<target name="delete-jdbc-resource-common" depends="init-common">
866<echo message="asadmin delete-jdbc-resource ${as.props} --target ${appserver.instance.name} ${jdbc.resource.name}"/>
867 <exec executable="${ASADMIN}" failonerror="false">
868 <arg line="delete-jdbc-resource"/>
869 <arg line="${as.props}"/>
870 <arg line="--target ${appserver.instance.name}"/>
871 <arg line="${jdbc.resource.name}"/>
872 </exec>
873 <echo message="cmd executed for ${appserver.instance.name}"/>
874</target>
875
876<!-- ================================================================ -->
877<!-- Target to deploy JDBC resources -->
878<!-- ================================================================ -->
879<target name="deploy-jdbc-common" depends="init-common">
880 <antcall target="create-jdbc-connpool-common" />
881 <antcall target="create-jdbc-resource-common" />
882</target>
883
884<target name="deploy-jdbc-driver-common" depends="init-common">
885 <antcall target="create-jdbc-driver-connpool-common" />
886 <antcall target="create-jdbc-resource-common" />
887</target>
888
889<!-- ================================================================ -->
890<!-- Target to undeploy JDBC resources -->
891<!-- ================================================================ -->
892<target name="undeploy-jdbc-common" depends="init-common">
893 <antcall target="delete-jdbc-resource-common" />
894 <antcall target="delete-jdbc-connpool-common" />
895</target>
896
897<!-- ================================================================ -->
898<!-- Target to create persistence resource -->
899<!-- ================================================================ -->
900<target name="create-persistence-resource-common" depends="init-common">
901<echo message="Creating pm resource at ${pm.resource.name}"
902 level="verbose"/>
903 <echo message="asadmin create-persistence-resource ${as.props} --target ${appserver.instance.name} ${pm.resource.name}"/>
904 <exec executable="${ASADMIN}" failonerror="false">
905 <arg line="create-persistence-resource"/>
906 <arg line="${as.props}"/>
907 <arg line="--port ${admin.port}"/>
908 <arg line="--target ${appserver.instance.name}"/>
909 <arg line="${pm.resource.name}"/>
910 </exec>
911 <echo message="Created ${pm.resource.name} --target ${appserver.instance.name}"/>
912 <antcall target="asadmin-common-ignore-fail">
913 <param name="admin.command" value="set"/>
914 <param name="operand.props"
915 value="${resources.dottedname.prefix}.persistence-manager-factory-resource.${pm.resource.name}.factory_class=${pm.factory.class}"/>
916 </antcall>
917 <antcall target="asadmin-common-ignore-fail">
918 <param name="admin.command" value="set" />
919 <param name="operand.props"
920 value="${resources.dottedname.prefix}.persistence-manager-factory-resource.${pm.resource.name}.jdbc_resource_jndi_name=${jdbc.resource.name}" />
921 </antcall>
922</target>
923
924<!-- ================================================================ -->
925<!-- Target to delete persistence resource -->
926<!-- ================================================================ -->
927<target name="delete-persistence-resource-common" depends="init-common">
928 <antcall target="asadmin-common-ignore-fail">
929 <param name="admin.command"
930 value="delete-persistence-resource
931 --target ${appserver.instance.name}" />
932 <param name="operand.props" value="${pm.resource.name}" />
933 </antcall>
934</target>
935
936<target name="execute-sql-common" depends="init-common">
937<echo message="Executing sql statement at ${basedir} from ${sql.file}"
938 level="verbose"/>
939 <sql
940 driver="${db.driver}"
941 url="${db.url}"
942 userid="${db.user}"
943 password="${db.pwd}"
944 src="${sql.file}"
945 onerror="continue"
946 print="yes"
947 classpath="${s1astest.classpath}"/>
948</target>
949
950
951<target name="execute-ejb-sql-common" depends="init-common">
952<echo message="Executing sql statement at ${basedir} from ${sql.file}"
953 level="verbose"/>
954 <sql
955 driver="${db.driver}"
956 url="jdbc:derby://localhost:1527/sun-appserv-samples;create=true;"
957 userid="APP"
958 password="APP"
959 src="${sql.file}"
960 onerror="continue"
961 print="yes"
962 output="${build.classes.dir}/setupDBTables.out"
963 classpath="${s1astest.classpath}" />
964</target>
965
966<!-- ================================================================ -->
967<!-- Target to create/delete javamail resources -->
968<!--
969 Properties required:
970 mailhost
971 fromaddress
972 debug
973 enabled
974 javamail.resource.name (e.g. mail/MySession)
975-->
976<!-- ================================================================ -->
977<target name="create-javamail-resource-common">
978 <exec executable="${ASADMIN}">
979 <arg line="create-javamail-resource"/>
980 <arg line="--port ${admin.port}"/>
981 <arg line="--mailhost ${mailhost}"/>
982 <arg line="--mailuser ${mailuser}"/>
983 <arg line="--fromaddress ${fromaddress}"/>
984 <arg line="--storeprotocol=imap"/>
985 <arg line="--storeprotocolclass=com.sun.mail.imap.IMAPStore"/>
986 <arg line="--transprotocol=smtp"/>
987 <arg line="--transprotocolclass=com.sun.mail.smtp.SMTPTransport"/>
988 <arg line="--debug=${debug}"/>
989 <arg line="--enabled=${enabled}"/>
990 <arg line="--target ${appserver.instance.name}"/>
991 <arg line="${as.props}"/>
992 <arg line="${javamail.resource.name}"/>
993 </exec>
994</target>
995
996<target name="delete-javamail-resource-common">
997 <exec executable="${ASADMIN}">
998 <arg line="delete-javamail-resource"/>
999 <arg line="--port ${admin.port}"/>
1000 <arg line="--target ${appserver.instance.name}"/>
1001 <arg line="${as.props}"/>
1002 <arg line="${javamail.resource.name}"/>
1003 </exec>
1004</target>
1005
1006<!-- ================================================================ -->
1007<!-- Target to create database table through SQL file -->
1008<!-- ================================================================ -->
1009<target name="create-sql-common" depends="init-common">
1010<echo message="creating tables from ${basedir}/sql/${db.create}"
1011 level="verbose"/>
1012 <sql
1013 driver="${db.driver}"
1014 url="${db.url}"
1015 userid="${db.user}"
1016 password="${db.pwd}"
1017 src="sql/${db.create}"
1018 onerror="continue"
1019 print="yes"
1020 output="${build.classes.dir}/setupDBTables.out"
1021 classpath="${s1astest.classpath}"
1022 />
1023</target>
1024
1025<!-- ================================================================ -->
1026<!-- Target to delete database table through SQL file -->
1027<!-- ================================================================ -->
1028<target name="delete-sql-common" depends="init-common">
1029<echo message="dropping tables from ${basedir}/sql/${db.drop}"
1030 level="verbose"/>
1031 <sql
1032 driver="${db.driver}"
1033 url="${db.url}"
1034 userid="${db.user}"
1035 password="${db.pwd}"
1036 src="sql/${db.drop}"
1037 onerror="continue"
1038 print="yes"
1039 output="${build.classes.dir}/setupDBTables.out"
1040 classpath="${s1astest.classpath}"
1041 />
1042</target>
1043
1044<!-- ======================================================= -->
1045<!-- Taget to create JMS Connection -->
1046<!-- ======================================================= -->
1047<target name="create-jms-connection-common" depends="init-common">
1048 <echo message="Creating JMS connection factory with name ${jms.factory.name}"
1049 level="verbose"/>
1050 <exec executable="${ASADMIN}">
1051 <arg line="create-jms-resource "/>
1052 <arg line="--restype ${jms.factory.type}"/>
1053 <arg line="${as.props}"/>
1054 <arg line="--target ${appserver.instance.name}"/>
1055 <arg line="${jms.factory.name}" />
1056 </exec>
1057</target>
1058
1059<!-- ======================================================= -->
1060<!-- Taget to delete JMS Connection -->
1061<!-- ======================================================= -->
1062<target name="delete-jms-connection-common" depends="init-common">
1063 <echo message="Delete JMS connection factory with name ${jms.factory.name}"
1064 level="verbose"/>
1065 <exec executable="${ASADMIN}">
1066 <arg line="delete-jms-resource "/>
1067 <arg line="${as.props}"/>
1068 <arg line="--target ${appserver.instance.name}"/>
1069 <arg line="${jms.factory.name}"/>
1070 </exec>
1071</target>
1072
1073<!-- JMS: create/delete Destination Resource Targets -->
1074<target name="create-jms-resource-common" depends="init-common">
1075 <echo message="Creating JMS resource with name ${jms.resource.name}"
1076 level="verbose"/>
1077
1078 <exec executable="${ASADMIN}">
1079 <arg line="create-jmsdest --desttype ${dest.type} "/>
1080 <arg line="${as.props}"/>
1081 <arg line="${dest.name}"/>
1082 </exec>
1083
1084 <exec executable="${ASADMIN}">
1085 <arg line="create-jms-resource "/>
1086 <arg line="--restype ${jms.resource.type}"/>
1087 <arg line="--property imqDestinationName=${dest.name}"/>
1088 <arg line="--target ${appserver.instance.name}"/>
1089 <arg line="${as.props}"/>
1090 <arg line="${jms.resource.name}"/>
1091 </exec>
1092</target>
1093
1094<target name="delete-jms-resource-common" depends="init-common">
1095 <echo message="Delete JMS resource with name ${jms.resource.name}"
1096 level="verbose"/>
1097
1098 <exec executable="${ASADMIN}">
1099 <arg line="delete-jms-resource "/>
1100 <arg line="--target ${appserver.instance.name}"/>
1101 <arg line="${as.props} ${jms.resource.name}"/>
1102 </exec>
1103
1104 <exec executable="${ASADMIN}">
1105 <arg line="delete-jmsdest --desttype ${dest.type} "/>
1106 <arg line="${as.props} ${dest.name}"/>
1107 </exec>
1108</target>
1109
1110<!-- deploy/undeploy JMS resources -->
1111<target name="deploy-jms-common" depends="init-common">
1112 <antcall target="create-jms-connection-common" />
1113 <antcall target="create-jms-resource-common" />
1114</target>
1115
1116<target name="undeploy-jms-common" depends="init-common">
1117 <antcall target="delete-jms-connection-common" />
1118 <antcall target="delete-jms-resource-common" />
1119</target>
1120
1121
1122<!-- run StaticCheck on the ear file -->
1123<target name="staticCheck-common" depends="init-common">
1124 <echo message="Running StaticCheck -b on
1125 ear file ${assemble.dir}/${appname}App.ear " level="verbose"/>
1126 <antcall target="verifier-common">
1127 <param name="static-check.command" value=" -b "/>
1128 <param name="operand.props" value="${assemble.dir}/${appname}App.ear"/>
1129 </antcall>
1130 <echo message="Validate the static check results" level="verbose"/>
1131</target>
1132
1133<target name="deploy-dir" depends="init-common">
1134 <echo message="Deploying files: ${assemble.dir}" level="verbose"/>
1135 <exec executable="${ASADMIN}" failonerror="false">
1136 <arg line="deploy"/>
1137 <arg line="${as.props}"/>
1138 <arg line="--contextroot ${contextroot}"/>
1139 <arg line="--target ${appserver.instance.name}"/>
1140 <arg line="--name ${appname}-web"/>
1141 <arg line="${assemble.dir}"/>
1142 </exec>
1143</target>
1144
1145<!-- deploy the applications in AppServ -->
1146<target name="deploy-common" depends="init-common">
1147 <antcall target="deploy-common-pe"/>
1148 <antcall target="deploy-common-ee"/>
1149</target>
1150
1151<target name="deploy-verify-common" depends="init-common">
1152 <antcall target="deploy-verify-common-pe"/>
1153 <antcall target="deploy-verify-common-ee"/>
1154</target>
1155
1156<target name="deploy-common-pe" depends="init-common" unless="ee">
1157 <property name="deployed.app" value="${assemble.dir}/${appname}App.ear"/>
1158 <property name="extra-params" value=""/>
1159 <exec executable="${ASADMIN}" failonerror="false">
1160 <arg line="deploy"/>
1161 <arg line="${as.props}"/>
1162 <arg line="${extra-params}"/>
1163 <arg line="--target ${appserver.instance.name}"/>
1164 <arg line="--retrieve ${assemble.dir}"/>
1165 <arg line="--libraries ${libraries}"/>
1166<!-- deployed.app defaults to ${assemble.dir}/${appname}App.ear defined in properties.xml-->
1167 <arg line="${deployed.app}"/>
1168 </exec>
1169 <echo message="Deployment on target server ${appserver.instance.name} successful"/>
1170 </target>
1171
1172<target name="deploy-common-ee" depends="init-common" if="ee">
1173 <echo message="Deploying in EE..."/>
1174 <property name="deployed.app" value="${assemble.dir}/${appname}App.ear"/>
1175 <exec executable="${ASADMIN}" failonerror="false">
1176 <arg line="deploy"/>
1177 <arg line="${as.props}"/>
1178 <arg line="--target ${appserver.instance.name}"/>
1179 <arg line="--retrieve ${assemble.dir}"/>
1180 <arg line="--libraries ${libraries}"/>
1181<!-- deployed.app defaults to ${assemble.dir}/${appname}App.ear defined in properties.xml-->
1182 <arg line="${deployed.app}"/>
1183 </exec>
1184 <echo message="Deployment on target server ${appserver.instance.name} successful"/>
1185</target>
1186
1187<target name="deploy-verify-common-pe" depends="init-common" unless="ee">
1188 <property name="deployed.app" value="${assemble.dir}/${appname}App.ear"/>
1189 <exec executable="${ASADMIN}" failonerror="false">
1190 <arg line="deploy"/>
1191 <arg line="${as.props}"/>
1192 <arg line="--verify=true"/>
1193 <arg line="--target ${appserver.instance.name}"/>
1194 <arg line="--retrieve ${assemble.dir}"/>
1195 <arg line="${deployed.app}"/>
1196 </exec>
1197 <echo message="Deployment on target server ${appserver.instance.name} successful"/>
1198 </target>
1199
1200<target name="deploy-verify-common-ee" depends="init-common" if="ee">
1201 <echo message="Deploying in EE..."/>
1202 <property name="deployed.app" value="${assemble.dir}/${appname}App.ear"/>
1203 <exec executable="${ASADMIN}" failonerror="false">
1204 <arg line="deploy"/>
1205 <arg line="${as.props}"/>
1206 <arg line="--verify=true"/>
1207 <arg line="--target ${appserver.instance.name}"/>
1208 <arg line="--retrieve ${assemble.dir}"/>
1209 <arg line="${deployed.app}"/>
1210 </exec>
1211 <echo message="Deployment on target server ${appserver.instance.name} successful"/>
1212</target>
1213
1214<!-- deploy the web application in AppServ -->
1215<target name="deploy-jsp-common" depends="init-common">
1216 <echo message="Deploying ${deploy.file} from ${basedir}." level="verbose"/>
1217 <property name="precompilejsp" value="true"/>
1218 <exec executable="${ASADMIN}" failonerror="true">
1219 <arg line="deploy"/>
1220 <arg line="${as.props}"/>
1221 <arg line="--precompilejsp=${precompilejsp}"/>
1222 <arg line="--upload true"/>
1223 <arg line="--retrieve ${assemble.dir}"/>
1224 <arg line="--target ${appserver.instance.name}"/>
1225 </exec>
1226</target>
1227
1228<target name="deploy-war-name" depends="init-common">
1229 <echo message="Deploying ${warname} from ${basedir}."
1230 level="verbose"/>
1231 <property name="force" value="false"/>
1232 <exec executable="${ASADMIN}" failonerror="false">
1233 <arg line="deploy"/>
1234 <arg line="${as.props}"/>
1235 <arg line="--contextroot ${contextroot}"/>
1236 <arg line="--precompilejsp=${precompilejsp}"/>
1237 <arg line="--force=${force}"/>
1238 <arg line="--upload=true"/>
1239 <arg line="--target ${appserver.instance.name}"/>
1240 <arg line="--libraries ${libraries}"/>
1241 <arg line="${warname}.war"/>
1242 </exec>
1243</target>
1244
1245<!-- deploy the standalone war in AppServ -->
1246<target name="deploy-war-common">
1247<antcall target ="deploy-war-commonpe"/>
1248<antcall target ="deploy-war-commonee"/>
1249</target>
1250
1251<target name="deploy-wab-common">
1252<antcall target ="deploy-wab-commonpe"/>
1253</target>
1254
1255<target name="deploy-wab-commonpe" depends="init-common" unless="ee">
1256 <echo message="Deploying WAB ${assemble.dir}/${appname}-web.war from ${basedir}."
1257 level="verbose"/>
1258 <property name="precompilejsp" value="true"/>
1259 <property name="force" value="false"/>
1260 <exec executable="${ASADMIN}" failonerror="false">
1261 <arg line="deploy"/>
1262 <arg line="${as.props}"/>
1263 <arg line="--precompilejsp=${precompilejsp}"/>
1264 <arg line="--force=${force}"/>
1265 <arg line="--upload=true"/>
1266 <arg line="--target ${appserver.instance.name}"/>
1267 <arg line="--libraries ${libraries}"/>
1268 <arg line="--type=osgi"/>
1269 <arg line="${assemble.dir}/${appname}-web.war"/>
1270 </exec>
1271</target>
1272
1273
1274
1275<target name="deploy-war-commonpe" depends="init-common" unless="ee">
1276 <echo message="Deploying ${assemble.dir}/${appname}-web.war from ${basedir}."
1277 level="verbose"/>
1278 <property name="precompilejsp" value="true"/>
1279 <property name="force" value="false"/>
1280 <exec executable="${ASADMIN}" failonerror="false">
1281 <arg line="deploy"/>
1282 <arg line="${as.props}"/>
1283 <arg line="--contextroot ${contextroot}"/>
1284 <arg line="--precompilejsp=${precompilejsp}"/>
1285 <arg line="--force=${force}"/>
1286 <arg line="--upload=true"/>
1287 <arg line="--target ${appserver.instance.name}"/>
1288 <arg line="--libraries ${libraries}"/>
1289 <arg line="${assemble.dir}/${appname}-web.war"/>
1290 </exec>
1291</target>
1292
1293<target name="deploy-war-commonee" if="ee">
1294 <property name="precompilejsp" value="true"/>
1295 <property name="force" value="false"/>
1296 <exec executable="${ASADMIN}" failonerror="false">
1297 <arg line="deploy"/>
1298 <arg line="${as.props}"/>
1299 <arg line="--type web"/>
1300 <arg line="--contextroot ${contextroot}"/>
1301 <arg line="--precompilejsp=${precompilejsp}"/>
1302 <arg line="--force=${force}"/>
1303 <arg line="--upload=true"/>
1304 <arg line="--target ${appserver.instance.name}"/>
1305 <arg line="--libraries ${libraries}"/>
1306 <arg line="${assemble.dir}/${appname}-web.war"/>
1307 </exec>
1308</target>
1309
1310<!-- deploy the standalone war in AppServ without specifying any
1311 contextroot argument, so that the context-root specified in
1312 sun-web.xml takes effect
1313-->
1314<target name="deploy-war-no-context-root" depends="init-common">
1315 <antcall target ="deploy-war-no-context-root-pe"/>
1316 <antcall target ="deploy-war-no-context-root-ee"/>
1317</target>
1318
1319<target name="deploy-war-no-context-root-pe" unless="ee">
1320 <exec executable="${ASADMIN}" failonerror="false">
1321 <arg line="deploy"/>
1322 <arg line="--user ${admin.user}"/>
1323 <arg line="--passwordfile ${admin.password.file}"/>
1324 <arg line="--host ${admin.host}"/>
1325 <arg line="--port ${admin.port}"/>
1326 <arg line="--upload=true"/>
1327 <arg line="--target ${appserver.instance.name}"/>
1328 <arg line="--libraries ${libraries}"/>
1329 <arg line="${assemble.dir}/${appname}-web.war"/>
1330 </exec>
1331</target>
1332
1333<target name="deploy-war-no-context-root-ee" if="ee">
1334 <exec executable="${ASADMIN}" failonerror="false">
1335 <arg line="deploy"/>
1336 <arg line="--user ${admin.user}"/>
1337 <arg line="--passwordfile ${admin.password.file}"/>
1338 <arg line="--host ${admin.host}"/>
1339 <arg line="--port ${admin.port}"/>
1340 <arg line="--type web"/>
1341 <arg line="--upload=true"/>
1342 <arg line="--target ${appserver.instance.name}"/>
1343 <arg line="--libraries ${libraries}"/>
1344 <arg line="${assemble.dir}/${appname}-web.war"/>
1345 </exec>
1346</target>
1347
1348<!-- deploy the standalone jar in AppServ -->
1349<target name="deploy-jar-common" depends="init-common">
1350 <exec executable="${ASADMIN}" failonerror="true">
1351 <arg line="deploy"/>
1352 <arg line="${as.props}"/>
1353 <arg line="--upload=true"/>
1354 <arg line="--target ${appserver.instance.name}"/>
1355 <arg line="${assemble.dir}/${appname}-ejb.jar"/>
1356 </exec>
1357</target>
1358
1359<!-- deploy the standalone jar in AppServ -->
1360<target name="deploy-client-common" depends="init-common">
1361 <exec executable="${ASADMIN}" failonerror="true">
1362 <arg line="deploy"/>
1363 <arg line="${as.props}"/>
1364 <arg line="--upload=true"/>
1365 <arg line="--retrieve ${assemble.dir}"/>
1366 <arg line="--target ${appserver.instance.name}"/>
1367 <arg line="${assemble.dir}/${appname}-client.jar"/>
1368 </exec>
1369</target>
1370
1371<target name="undeploy-war-name" depends="init-common">
1372 <property name="deployedapp.name" value="${warname}"/>
1373 <property name="extra-params" value=""/>
1374 <exec executable="${ASADMIN}" failonerror="false">
1375 <arg line="undeploy"/>
1376 <arg line="${as.props}"/>
1377 <arg line="--target ${appserver.instance.name}"/>
1378 <arg line="${extra-params}"/>
1379<!-- deployedapp.name defaults to {appname}App.declared in properties.xml-->
1380 <arg line="${deployedapp.name}"/>
1381 </exec>
1382</target>
1383
1384<!-- undeploy the applications in AppServ -->
1385<target name="undeploy-common" depends="init-common">
1386 <property name="deployedapp.name" value="${appname}App"/>
1387 <property name="extra-params" value=""/>
1388 <exec executable="${ASADMIN}" failonerror="false">
1389 <arg line="undeploy"/>
1390 <arg line="${as.props}"/>
1391<!--
1392<arg line=type ${apptype}/>
1393-->
1394 <arg line="--target ${appserver.instance.name}"/>
1395 <arg line="${extra-params}"/>
1396<!-- deployedapp.name defaults to {appname}App.declared in properties.xml-->
1397 <arg line="${deployedapp.name}"/>
1398 </exec>
1399</target>
1400
1401<!-- undeploy the standalone war in AppServ -->
1402<target name="undeploy-war-common" depends="init-common">
1403 <echo message="Undeploying warfile ${appname}-web from
1404 ${assemble.dir}/${appname}-web.war from ${basedir}." level="verbose"/>
1405 <exec executable="${ASADMIN}" failonerror="false">
1406 <arg line="undeploy"/>
1407 <arg line="${as.props}"/>
1408 <arg line="--target ${appserver.instance.name}"/>
1409 <arg line="${appname}-web"/>
1410 </exec>
1411</target>
1412
1413
1414<!-- undeploy the standalone war in AppServ -->
1415<target name="undeploy-jar-common" depends="init-common">
1416 <exec executable="${ASADMIN}" failonerror="false">
1417 <arg line="undeploy"/>
1418 <arg line="${as.props}"/>
1419 <arg line="--target ${appserver.instance.name}"/>
1420 <arg line="${appname}-ejb"/>
1421 </exec>
1422</target>
1423
1424<!-- undeploy the standalone client in AppServ -->
1425<target name="undeploy-client-common" depends="init-common">
1426 <exec executable="${ASADMIN}" failonerror="false">
1427 <arg line="undeploy"/>
1428 <arg line="${as.props}"/>
1429 <arg line="--target ${appserver.instance.name}"/>
1430 <arg line="${appname}-client"/>
1431 </exec>
1432</target>
1433
1434
1435<!-- run appclient in AppServ -->
1436<target name="runclient-common" depends="init-common">
1437 <echo message="appclient -client ${assemble.dir}/${appname}AppClient.jar -name ${appname}Client -textauth -user j2ee -password j2ee -xml ${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml ${appclient.application.args}"/>
1438 <exec executable="${APPCLIENT}" failonerror="false">
1439 <!-- set APPCPATH to include reporter.jar so that all app clients
1440 don't have to package the test framework in their apps -->
1441 <env key="APPCPATH" file="${env.APS_HOME}/lib/reporter.jar"/>
1442 <arg line="-client ${assemble.dir}/${appname}AppClient.jar"/>
1443 <arg line="-name ${appname}Client"/>
1444 <arg line="-textauth"/>
1445 <arg line="-user j2ee"/>
1446 <arg line="-password j2ee"/>
1447 <arg line="-xml ${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml"/>
1448 <arg line="${appclient.application.args}"/>
1449 </exec>
1450
1451<!-- confirming report generation... -->
1452 <antcall target="checkReporting-common">
1453 <param name="test.name" value="${appname}"/>
1454 <param name="test.description" value="${test.description}"/>
1455 <param name="test.count" value="${test.count}"/>
1456 </antcall>
1457</target>
1458
1459<!-- run web client in AppServ -->
1460<target name="runwebclient-common" depends="init-common">
1461 <echo message="Running Web Test from ${basedir}" level="verbose"/>
1462 <echo message="http host: ${http.host}" level="verbose"/>
1463 <echo message="http port: ${http.port}" level="verbose"/>
1464 <java
1465 fork="on" failonerror="false"
1466 classpath="${env.APS_HOME}/lib/webtest.jar:${s1astest.classpath}"
1467 classname="com.sun.ejte.ccl.webrunner.webtest.WebTest">
1468 <arg value="script.txt"/>
1469 <arg value="${http.host}"/>
1470 <arg value="${http.port}"/>
1471 <arg value="appserv-tests"/>
1472 <arg value="${testsuite.id}"/>
1473 </java>
1474</target>
1475
1476<!-- prepare Pointbase servers -->
1477<target name="preparePB" depends="init-common">
1478 <echo message="Starting Pointbase servers" level="verbose"/>
1479 <copy file="${env.APS_HOME}/lib/pointbase.ini"
1480 tofile="${db.dir}/pointbase.ini"/>
1481 <replace file="${db.dir}/pointbase.ini" token="@@@" value="${db.dir}"/>
1482</target>
1483
1484<!-- start/stop Pointbase servers -->
1485<target name="startPB" depends="preparePB">
1486 <java classname="com.pointbase.net.netServer"
1487 classpath="${db.classpath}" fork="true" spawn="true">
1488 <arg line="/port:9092"/>
1489 <arg line="/pointbase.ini=${db.dir}/pointbase.ini"/>
1490 <arg line="/noconsole"/>
1491 </java>
1492 <java classname="com.pointbase.net.netServer"
1493 classpath="${db.classpath}" fork="true" spawn="true">
1494 <arg line="/port:9093"/>
1495 <arg line="/pointbase.ini=${db.dir}/pointbase.ini"/>
1496 <arg line="/noconsole"/>
1497 </java>
1498</target>
1499
1500<!-- target name="startPB" depends="preparePB">
1501 <parallel>
1502 <java classname="com.pointbase.net.netServer"
1503 classpath="${db.classpath}" failonerror="false" fork="true">
1504 <arg line="/port:9092"/>
1505 <arg line="/pointbase.ini=${db.dir}/pointbase.ini"/>
1506 </java>
1507 <java classname="com.pointbase.net.netServer"
1508 classpath="${db.classpath}" failonerror="true" fork="true">
1509 <arg line="/port:9093"/>
1510 <arg line="/pointbase.ini=${db.dir}/pointbase.ini"/>
1511 </java>
1512 </parallel>
1513</target -->
1514
1515<!-- start Derby Database -->
1516<target name="startDerby">
1517 <condition property="darwin">
1518 <os name="Mac OS X"/>
1519 </condition>
1520 <antcall target="startDerbyNonMac"/>
1521 <antcall target="startDerbyMac"/>
1522</target>
1523
1524<target name="startDerbyNonMac" depends="init-common" unless="darwin">
1525 <echo message="StaRTing Derby DB servers in the Network Mode"/>
1526 <parallel>
1527 <java classname="org.apache.derby.drda.NetworkServerControl"
1528 classpath="${db.classpath}" fork="true" spawn="true">
1529 <arg line="-h localhost -p 1527 start"/>
1530 </java>
1531 <java classname="org.apache.derby.drda.NetworkServerControl"
1532 classpath="${db.classpath}" fork="true" spawn="true">
1533 <arg line="-h localhost -p 1528 start"/>
1534 </java>
1535 </parallel>
1536</target>
1537
1538<target name="startDerbyMac" depends="init-common" if="darwin">
1539 <echo message="StaRTing Derby DB servers in the Network Mode"/>
1540 <parallel>
1541 <java classname="org.apache.derby.drda.NetworkServerControl"
1542 classpath="${db.classpath}" fork="true" spawn="true">
1543 <sysproperty key="derby.storage.fileSyncTransactionLog" value="true"/>
1544 <arg line="-h localhost -p 1527 start"/>
1545 </java>
1546 <java classname="org.apache.derby.drda.NetworkServerControl"
1547 classpath="${db.classpath}" fork="true" spawn="true">
1548 <sysproperty key="derby.storage.fileSyncTransactionLog" value="true"/>
1549 <arg line="-h localhost -p 1528 start"/>
1550 </java>
1551 </parallel>
1552</target>
1553
1554<!-- start Derby Database -->
1555<target name="stopDerby" depends="init-common">
1556 <echo message="Stopping Derby DB servers ..."/>
1557 <parallel>
1558 <java classname="org.apache.derby.drda.NetworkServerControl"
1559 classpath="${db.classpath}" failonerror="true" fork="true">
1560 <arg line="-h localhost -p 1527 shutdown"/>
1561 </java>
1562 <java classname="org.apache.derby.drda.NetworkServerControl"
1563 classpath="${db.classpath}" failonerror="true" fork="true">
1564 <arg line="-h localhost -p 1528 shutdown"/>
1565 </java>
1566 </parallel>
1567</target>
1568
1569<target name="pb">
1570 <echo message="So you are using pointbase ... !"/>
1571 <property file="${env.APS_HOME}/config/pointbase.properties"/>
1572</target>
1573
1574<!-- setup IMQ for RI Build -->
1575<target name="setup-mq-common" depends="init-common">
1576 <echo message="Executing Datastore setup for S1MQ. Required only for RI"
1577 level="verbose"/>
1578 <echo message="${IMQDBMGR} -javahome ${java.home}
1579 -b ${admin.domain}_${appserver.instance.name} create all"
1580 level="verbose"/>
1581 <exec executable="${IMQDBMGR}" failonerror="true">
1582 <arg line="-javahome ${java.home} -b ${admin.domain}_${appserver.instance.name} create all" />
1583 </exec>
1584</target>
1585
1586<target name="import-wsdl" depends="init-common">
1587 <mkdir dir="${build.classes.dir}"/>
1588 <exec executable="${WSCOMPILE}">
1589<!--
1590 <arg line="-classpath ${s1astest.classpath}"/>
1591-->
1592 <arg line="-classpath ${build.classes.dir}"/>
1593 <arg line="-import"/>
1594 <arg line="-source 1.1.2"/>
1595 <arg line="-keep"/>
1596 <arg line="-d "/>
1597 <arg path="${build.classes.dir}"/>
1598 <!--
1599 <arg line="-s "/>
1600 <arg path="${basedir}/gensource"/>
1601 -->
1602 <arg line="-mapping ${build.classes.dir}/${mapping.file}"/>
1603 <arg line="${config-wsdl.file}"/>
1604 </exec>
1605</target>
1606
1607<!-- Confirm Report Generation -->
1608
1609<target name="checkReporting-common">
1610 <available file="RepRunConf.txt" type="file" property="isReported"/>
1611 <antcall target="confirmReportPresent-common"/>
1612 <antcall target="confirmMissingReport-common"/>
1613</target>
1614
1615<target name="confirmReportPresent-common" if="isReported">
1616 <echo message="file RepRunConf.txt is present."/>
1617 <echo message="Test seems to be reported fine"/>
1618 <delete file="RepRunConf.txt"/>
1619</target>
1620
1621<target name="confirmMissingReport-common" unless="isReported">
1622 <echo message="file RepRunConf.txt is missing!!!"/>
1623 <echo message="Test does not seem to have been reported"/>
1624 <echo message="Adding status 'did not run' into report..."/>
1625 <java classname="com.sun.ejte.ccl.reporter.ReporterClient">
1626 <classpath>
1627 <pathelement location="${env.APS_HOME}/lib/reporter.jar"/>
1628 <pathelement location="."/>
1629 </classpath>
1630 <arg value="${test.name}"/>
1631 <arg value="${test.description}"/>
1632 <arg value="${test.count}"/>
1633 </java>
1634 <delete file="RepRunConf.txt"/>
1635</target>
1636
1637
1638<!-- usage -->
1639<target name="usage-common">
1640 <echo>
1641 ant clean Remove all classes files
1642 ant build Build the application
1643 ant deploy Deploy the ear files to S1AS
1644 ant run Run the application
1645 ant undeploy Undeploy the ear files from S1AS
1646 ant usage Display this message
1647 </echo>
1648</target>
1649
1650
1651<!-- EE Targets 8.1 -->
1652<!--Added Feb 5th 2004 by Deepa Singh -->
1653<target name="ee" depends="ee-common">
1654 <echo message="So you are using Enterprise Edition"/>
1655 <property name="ee" value="Enterprise Edition"/>
1656 <property file="${env.APS_HOME}/eeconfig/ee-config.properties"/>
1657 <loadfile property="target-server-port" srcFile="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml"/>
1658 <condition property="orbPortSet" value="true">
1659 <contains string="${target-server-port}" substring="${orb.port}"/>
1660 </condition>
1661 <antcall target="change-orb-port"/>
1662</target>
1663
1664<target name="change-orb-port" unless="orbPortSet">
1665 <echo message="changing orb port from the default [3700] to ${orb.port}"/>
1666 <replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml" token="3700" value="${orb.port}"/>
1667</target>
1668
1669
1670<target name="restart-instance">
1671 <echo message="Restarting remote server instance,until this gets fixed"/>
1672 <exec executable="${ASADMIN}" failonerror="false">
1673 <arg line="stop-instance"/>
1674 <arg line="${as.props}"/>
1675 <arg line="${appserver.instance.name}"/>
1676 </exec>
1677 <sleep seconds="30"/>
1678 <exec executable="${ASADMIN}" failonerror="false">
1679 <arg line="start-instance"/>
1680 <arg line="${as.props}"/>
1681 <arg line="${appserver.instance.name}"/>
1682 </exec>
1683</target>
1684
1685<target name="testTimer" depends="init-common">
1686
1687<echo message="creating timer table from ${env.APS_HOME}/lib/ejbtimer_${db.type}.sql"/>
1688 <sql
1689 driver="${db.driver}"
1690 url="${db.url}"
1691 userid="${db.user}"
1692 password="${db.pwd}"
1693 src="${env.APS_HOME}/lib/ejbtimer_${db.type}.sql"
1694 onerror="continue"
1695 print="yes"
1696 classpath="${s1astest.classpath}"/>
1697
1698</target>
1699
1700<target name="setupTimer" depends="init-common" if="ee">
1701 <exec executable="${ASADMIN}" failonerror="false">
1702 <arg line="create-resource-ref"/>
1703 <arg line="${as.props}"/>
1704 <arg line="--target server"/>
1705 <arg line="${jdbc.resource.name}"/>
1706 </exec>
1707 <antcall target="asadmin-common-ignore-fail">
1708 <param name="admin.command" value="set" />
1709 <param name="operand.props"
1710 value="${appserver.instance.name}-config.ejb-container.ejb-timer-service.timer-datasource=${jdbc.resource.name}"/>
1711 </antcall>
1712
1713 <echo message="creating timer table from ${env.APS_HOME}/lib/ejbtimer_{db.type}.sql"/>
1714 <sql
1715 driver="${db.driver}"
1716 url="${db.url}"
1717 userid="${db.user}"
1718 password="${db.pwd}"
1719 src="${env.APS_HOME}/lib/ejbtimer_${db.type}.sql"
1720 onerror="continue"
1721 print="yes"
1722 classpath="${s1astest.classpath}"/>
1723
1724 <antcall target="restart-instance"/>
1725</target>
1726
1727<target name="unsetupTimer" depends="init-common" if="ee">
1728 <exec executable="${ASADMIN}" failonerror="false">
1729 <arg line="delete-resource-ref"/>
1730 <arg line="${as.props}"/>
1731 <arg line="--target server"/>
1732 <arg line="${jdbc.resource.name}"/>
1733 </exec>
1734 <exec executable="${ASADMIN}" failonerror="false">
1735 <arg line="unset"/>
1736 <arg line="${appserver.instance.name}-config.ejb-container.ejb-timer-service.timer-datasource"/>
1737 </exec>
1738
1739 <echo message="dropping timer table from ${env.APS_HOME}/lib/ejbtimer_${db.type}_drop.sql"/>
1740 <sql
1741 driver="${db.driver}"
1742 url="${db.url}"
1743 userid="${db.user}"
1744 password="${db.pwd}"
1745 src="${env.APS_HOME}/lib/ejbtimer_${db.type}_drop.sql"
1746 onerror="continue"
1747 print="yes"
1748 classpath="${s1astest.classpath}"/>
1749</target>
1750
1751<target name="prepare-truststore-common" depends="init-common">
1752 <property name="truststore.db.file" location="${build.base.dir}/cacerts.jks"/>
1753 <property name="cert.rfc.file" location="${build.base.dir}/${cert.nickname}.rfc"/>
1754
1755 <delete quiet="true" file="${truststore.db.file}"/>
1756 <delete quiet="true" file="${cert.rfc.file}"/>
1757
1758 <!--
1759 Determine if we need to use the certutil or the keytool command to
1760 access the certificate keystore
1761 -->
1762 <property name="certutil.db.dir" location="${admin.domain.dir}/${admin.domain}/config"/>
1763 <condition property="use.certutil">
1764 <and>
1765 <or>
1766 <available file="${env.S1AS_HOME}/lib/certutil"/>
1767 <available file="${env.S1AS_HOME}/lib/certutil.exe"/>
1768 </or>
1769 <available file="${certutil.db.dir}/cert8.db"/>
1770 <available file="${certutil.db.dir}/key3.db"/>
1771 <available file="${certutil.db.dir}/secmod.db"/>
1772 </and>
1773 </condition>
1774 <antcall target="prepare-truststore-certutil-common"/>
1775 <antcall target="prepare-truststore-keytool-common"/>
1776</target>
1777
1778<target name="prepare-truststore-certutil-common" depends="init-common" if="use.certutil">
1779 <exec executable="${env.S1AS_HOME}/lib/certutil" failonerror="true" output="${cert.rfc.file}">
1780 <!--
1781 LD_LIBRARY_PATH is needed on Unix platforms and should have no
1782 effect on Windows
1783 -->
1784 <env key="LD_LIBRARY_PATH" path="${env.S1AS_HOME}/lib"/>
1785 <arg line="-L -n '${cert.nickname}' -a"/>
1786 <arg value="-d"/>
1787 <arg file="${certutil.db.dir}"/>
1788 </exec>
1789 <exec executable="${java.home}/bin/keytool" failonerror="true">
1790 <arg line="-import -trustcacerts -alias '${cert.nickname}' -storepass '${ssl.password}' -noprompt"/>
1791 <arg value="-file"/>
1792 <arg file="${cert.rfc.file}"/>
1793 <arg value="-keystore"/>
1794 <arg file="${truststore.db.file}"/>
1795 </exec>
1796</target>
1797
1798
1799<target name="prepare-truststore-keytool-common" depends="init-common" unless="use.certutil">
1800 <copy file="${admin.domain.dir}/${admin.domain}/config/cacerts.jks" tofile="${truststore.db.file}"/>
1801</target>
1802
1803
1804<target name="prepare-keystore-common" depends="init-common">
1805 <property name="keystore.db.file" location="${build.base.dir}/keystore.jks"/>
1806 <delete quiet="true" file="${keystore.db.file}"/>
1807 <copy file="${admin.domain.dir}/${admin.domain}/config/keystore.jks" tofile="${keystore.db.file}" failonerror="false"/>
1808</target>
1809
1810<target name="get-version-common" depends="init-common">
1811 <exec executable="${ASADMIN}" failonerror="false" outputproperty="appserver.version">
1812 <arg line="version"/>
1813 <arg line="${as.props}"/>
1814 <arg line="--verbose"/>
1815 </exec>
1816 <condition property="platform" value="true">
1817 <contains string="${appserver.version}" substring="Platform" casesensitive="false"/>
1818 </condition>
1819 <condition property="enterprise" value="true">
1820 <contains string="${appserver.version}" substring="Enterprise" casesensitive="false"/>
1821 </condition>
1822 <antcall target="platform-common"/>
1823 <antcall target="enterprise-common"/>
1824</target>
1825
1826<target name="platform-common" if="platform">
1827 <echo message="This is Platform Version***"/>
1828</target>
1829
1830<target name="enterprise-common" if="enterprise">
1831 <echo message="This is Enterprise Version***"/>
1832</target>
1833
1834<target name="create-PermSize" depends="init-common">
1835 <echo message="asadmin create-jvm-options ${as.props} -- -XX:MaxPermSize=${jvm.maxpermsize}"/>
1836 <exec executable="${ASADMIN}" failonerror="false">
1837 <arg line="create-jvm-options"/>
1838 <arg line="${as.props}"/>
1839 <arg line="--target ${appserver.instance.name}"/>
1840 <arg line="-- -XX\:MaxPermSize=${jvm.maxpermsize}"/>
1841 </exec>
1842</target>
1843
1844 <target name="restart-server">
1845 <antcall target="stop-server"/>
1846 <sleep seconds="5"/>
1847 <antcall target="start-server"/>
1848
1849 </target>
1850
1851 <target name="stop-server" depends="setOSConditions">
1852 <antcall target="stop-server-unix"/>
1853 <antcall target="stop-server-windows"/>
1854 </target>
1855
1856 <target name="stop-server-unix" if="isUnix">
1857 <echo message="stopping server on unix ..."/>
1858 <exec executable="${env.S1AS_HOME}/bin/asadmin">
1859 <arg value="stop-domain"/>
1860 </exec>
1861 <sleep seconds="10"/>
1862 </target>
1863
1864 <target name="stop-server-windows" if="isWindows">
1865 <echo message="Stopping server on windows ..."/>
1866 <exec executable="cmd">
1867 <arg value="/c"/>
1868 <arg value="${env.S1AS_HOME}\bin\asadmin.bat"/>
1869 <arg value="stop-domain"/>
1870 </exec>
1871 <sleep seconds="5"/>
1872 </target>
1873
1874 <target name="start-server" depends="setOSConditions">
1875
1876 <echo>+-----------------------------+</echo>
1877 <echo>| |</echo>
1878 <echo>| S T A R T I N G GLASSFISH |</echo>
1879 <echo>| in Felix mode |</echo>
1880 <echo>| |</echo>
1881 <echo>+-----------------------------+</echo>
1882
1883 <antcall target="start-server-unix"/>
1884 <antcall target="start-server-windows"/>
1885 </target>
1886
1887 <target name="start-server-unix" if="isUnix">
1888 <exec executable="${env.S1AS_HOME}/bin/asadmin">
1889 <env key="GlassFish_Platform" value="Felix"/>
1890 <arg value="start-domain"/>
1891 </exec>
1892 <sleep seconds="10"/>
1893 </target>
1894
1895 <target name="start-server-windows" if="isWindows">
1896 <exec executable="cmd" spawn="true">
1897 <env key="GlassFish_Platform" value="Felix"/>
1898 <arg value="/c"/>
1899 <arg value="${env.S1AS_HOME}\bin\asadmin.bat"/>
1900 <arg value="start-domain"/>
1901 </exec>
1902 <sleep seconds="5"/>
1903 </target>
1904
1905 <target name="create-jvm-options" depends="init-common">
1906 <exec executable="${ASADMIN}">
1907 <arg line="create-jvm-options"/>
1908 <arg line="--user ${admin.user} --host ${admin.host} --port ${admin.port} --echo=true --terse=true"/>
1909 <arg line="${option}"/>
1910 </exec>
1911 <echo message="REQUIRED TO RESTART SERVER......."/>
1912 </target>
1913
1914 <target name="delete-jvm-options" depends="init-common">
1915 <exec executable="${ASADMIN}">
1916 <arg line="delete-jvm-options"/>
1917 <arg line="--user ${admin.user} --host ${admin.host} --port ${admin.port} --echo=true --terse=true"/>
1918 <arg line="${option}"/>
1919 </exec>
1920 <echo message="REQUIRED TO RESTART SERVER......."/>
1921 </target>
1922
1923<!-- ================================================================ -->
1924<!-- Target to Flush connection pool -->
1925<!-- ================================================================ -->
1926<target name="flush-connpool-common" depends="init-common">
1927<echo message="Flush connection pool ${jdbc.conpool.name}"
1928 level="verbose"/>
1929 <exec executable="${ASADMIN}" failonerror="false">
1930 <arg line="flush-connection-pool"/>
1931 <arg line="${as.props}"/>
1932 <arg line="${jdbc.conpool.name}"/>
1933 </exec>
1934</target>
1935
1936<!-- ================================================================ -->
1937<!-- Target to generate a neat Html report -->
1938<!-- ================================================================ -->
1939<target name="dev-report" depends="init-common">
1940 <java classname="com.sun.appserv.test.util.results.HtmlReportProducer" fork="true" failonerror="false"
1941 classpath="${env.APS_HOME}/lib/reportbuilder.jar">
1942 <arg value="${env.APS_HOME}/test_results.xml"/>
1943 </java>
1944</target>
1945
1946