root/trunk/build/buildwar.xml

Revision 1920 (checked in by douglm, 5 years ago)

Further changes to dump/restore. Use new DumpEntity? code to handle dumping of collection (calendar) objects.

Resolve a significant performance problem with restoring of events. Took hours - now takes minutes.

Create and use a common class to maintain dump and restore counts.

Line 
1 <?xml version="1.0"?>
2
3 <!-- ===================================================================
4      This file is called by other build files to create web applications.
5
6      It is assumed that no changes will be made to this file. It should be
7      possible to make all changes needed by modifying the configuration
8      properties or a bedework.build.proeprties file
9
10      An unwrapped web application will be built in the temp directory
11      and a war and ear file will be left in the dist directory.
12
13      Properties which must be defined on entry, apart from those described
14      in the main build file are:
15     app.root.dir       Location of the root directory for the apps
16     app.sou.dir        Location of the application skeleton,
17     app.name           Name of the application. This wil be used to determine
18                        the name of the file containing the rest of the
19                        application properties, the directory we build in
20                        and the name of war and ear files.
21     cal.j2ee           Defined if this is a j2ee application
22     cal.j2ee.jboss     Defined if this is a jboss application
23     cal.strutsapp      Defined if this is a struts application
24      These should be defined in the build properties for the application.
25
26      It is possible to define any of the app.dest properties below to override
27      the location of destination files.
28
29      In the directory
30         ${apps.sou.dir}
31      we expect an application skeleton formatted like a web-application
32      For the purposes of this build it should contain a
33      structure like
34               war - docs    (contains jsp and html for this app)
35                     WEB-INF - struts-config.xml
36                               web.xml
37                               jboss-web.xml (for jboss only)
38
39      Authors: Mike Douglass
40      =================================================================== -->
41
42 <project name="bedework.buildwar" default="build" >
43   <import file="${build.dir}/buildfilters.xml" />
44
45   <target name="init" depends="init.common,init.j2ee,init.standalone" />
46
47   <target name="init.common">
48     <!-- Load the location of the libraries -->
49     <property file="${org.bedework.project.bedework}/build/libjars.properties" />
50
51     <!-- Destinations - where we build an unwrapped war -->
52     <property name="app.dest.war"
53               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
54     <property name="app.dest.docs"
55               location="${app.dest.war}/docs" />
56     <property name="app.dest.webinf"
57               location="${app.dest.war}/WEB-INF" />
58     <property name="app.dest.metainf"
59               location="${app.dest.war}/META-INF" />
60     <property name="app.dest.classes"
61               location="${app.dest.webinf}/classes" />
62     <property name="app.dest.properties"
63               location="${app.dest.classes}/properties/calendar" />
64
65     <!--temp web.xml location  -->
66     <property name="app.temp.web.xml"
67               location="${app.dest.webinf}/tempweb.xml" />
68
69     <!--final web.xml location  -->
70     <property name="app.dest.web.xml"
71               location="${app.dest.webinf}/web.xml" />
72
73     <property name="app.war.file"
74               location="${dist.home}/${propval.app.war.name}.war" />
75
76     <!-- default web.xml -->
77     <property name="propval.app.web.xml"
78               value="war/WEB-INF/web.xml" />
79
80               <!--
81     <property name="app.web.xml"
82               location="${propval.app.web.xml}" />
83               -->
84     <resolveFile name="app.web.xml"
85                  file="${propval.app.web.xml}"
86                  base="${app.sou.dir}"/>
87
88     <property name="app.sou.properties"
89               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
90   </target>
91
92   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
93
94     <property name="app.dest.lib"
95               location="${app.dest.webinf}/lib" />
96   </target>
97
98   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
99     <property name="app.dest.lib"
100               location="${org.bedework.temp.dir}/earlib" />
101   </target>
102
103   <target name="build" depends="init">
104     <echo message="**************************************************" />
105     <echo message=" * Building war ${propval.app.war.name}"/>
106     <echo message="**************************************************" />
107
108     <delete dir="${app.dest.war}" />
109
110     <!-- Add modifed login pages -->
111     <copy todir="${app.dest.docs}/login" failonerror="false" >
112       <fileset dir="${org.bedework.common.resources}/login" />
113       <filterset>
114         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
115       </filterset>
116     </copy>
117
118     <!-- ===============================================================
119          We copy 3 sets of properties.
120
121          First (for struts) are the servlet properties which ends up as
122               classes/servlet.properties
123          Next we copy in a set of generic property files and then with
124          overwrite we copy in a set of base specific files.
125
126          All are updated with new values.
127          =============================================================== -->
128
129     <available file="${app.sou.dir}/properties" type="dir"
130                property="org.bedework.properties.dir.exists" />
131
132     <available file="${app.sou.properties}" type="file"
133                property="org.bedework.servlet.properties.exists" />
134
135     <available file="${app.sou.dir}/war/docs" type="dir"
136                property="org.bedework.war.docs.exists" />
137
138     <antcall target="copy.properties" inheritRefs="true" />
139     <antcall target="copy.servlet.properties" inheritRefs="true" />
140     <antcall target="copy.war.docs" inheritRefs="true" />
141
142     <!-- Create the env.properties file -->
143     <mkdir dir="${app.dest.properties}" />
144
145     <copy tofile="${app.dest.properties}/env.properties"
146           file="${org.bedework.config.properties}" />
147
148     <copy tofile="${app.dest.properties}/options.xml"
149           file="${org.bedework.config.options}" >
150       <filterset>
151         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
152       </filterset>
153       <filterset refid="property.filters" />
154     </copy>
155
156     <!-- Make a temp copy of the web.xml file -->
157     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
158           overwrite="yes" />
159
160     <antcall target="struts-stuff" inheritRefs="true" />
161
162     <!-- Filter the temp copy of the web.xml file -->
163     <copy tofile="${app.dest.web.xml}"
164           file="${app.temp.web.xml}"
165           overwrite="yes" >
166       <filterset>
167         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
168       </filterset>
169       <filterset refid="property.filters" />
170     </copy>
171
172     <delete file="${app.temp.web.xml}" />
173
174     <!-- Add the contex root to the file. Note that newline is required -->
175     <echo file="${org.bedework.global.context.roots}" append="yes">
176 ${propval.app.war.name}.context=${propval.app.context.root}
177     </echo>
178
179     <!-- ===============================================================
180          Add hibernate jars and property files from calendar api.
181          =============================================================== -->
182
183     <copy todir="${app.dest.classes}">
184       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
185       <filterset refid="property.filters" />
186     </copy>
187
188     <copy todir="${app.dest.classes}">
189       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
190       <filterset refid="property.filters" />
191     </copy>
192
193     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}" />
194     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm-attrs}" />
195     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm}" />
196     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.cglib}" />
197     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dom4j}" />
198     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ehcache}" />
199     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.hibernate}" />
200     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jgroups}" />
201     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jta}" />
202
203     <antcall target="jboss-stuff" inheritRefs="true" />
204     <antcall target="bexchange-stuff" inheritRefs="true" />
205     <antcall target="domino-stuff" inheritRefs="true" />
206     <antcall target="google-stuff" inheritRefs="true" />
207
208     <!-- ===============================================================
209          Any jar files required
210          =============================================================== -->
211
212     <echo message="+++++++++++  bw-logging at ${org.bedework.appjar.bw-logging}" />
213     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-annotations}" />
214     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiaccess}" />
215     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiutil}" />
216     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-davio}" />
217     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-apiutil}" />
218     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcore}" />
219     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcorei}" />
220     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calenv}" />
221     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calfacade}" />
222     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvc}" />
223     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvci}" />
224     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-client}" />
225     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-icalendar}" />
226     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-logging}" />
227     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-mail}" />
228     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-appcommon}" />
229
230      <!-- any extra files-->
231     <copy todir="${app.dest.lib}" >
232       <fileset dir="${org.bedework.temp.extrajars.dir}" />
233     </copy>
234
235     <!-- Some more standard libs -->
236     <if>
237       <not>
238         <isset property="org.bedework.build.for.jboss"/>
239       </not>
240       <then>
241         <copy todir="${app.dest.lib}" file="${org.bedework.appjar.log4j}"/>
242       </then>
243     </if>
244     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-core}"/>
245     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-misc}"/>
246     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j}"/>
247     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-codec}"/>
248     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-collections}"/>
249     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-httpclient}"/>
250     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-lang}"/>
251     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-ssl}"/>
252
253     <!-- Mail related stuff -->
254     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activation}" />
255     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dsn}" />
256     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.imap}" />
257     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.mailapi}" />
258     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.pop3}" />
259     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.smtp}" />
260
261     <!-- add the jdbcdriver if defined
262          Disable this - shouldn't be adding jdbc drivers to the war file
263     <if>
264       <isset property="app.jdbcdriver.jar"/>
265       <then>
266         <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
267       </then>
268     </if>
269      -->
270
271     <!-- tomcat -->
272     <antcall target="add.tomcat" inheritRefs="true" />
273
274     <!-- build the war file -->
275     <mkdir dir="${dist.home}" />
276     <delete file="${app.war.file}" />
277
278     <war warfile="${app.war.file}"
279          webxml="${app.dest.web.xml}"
280          basedir="${app.dest.war}"
281          excludes="WEB-INF/web.xml" />
282   </target>
283
284   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
285     <property name="propval.app.tomcat.context.xml"
286               location="${app.sou.dir}/war/META-INF/context.xml" />
287     <resolveFile name="app.tomcat.context.xml"
288                  file="${propval.app.tomcat.context.xml}"
289                  base="${app.sou.dir}"/>
290
291     <copy tofile="${app.dest.metainf}/context.xml"
292           file="${app.tomcat.context.xml}"
293           overwrite="yes" >
294       <filterset refid="property.filters" />
295     </copy>
296   </target>
297
298   <target name="copy.properties" if="org.bedework.properties.dir.exists">
299     <!-- ===============================================================
300          Any property files we need for configuration, other than the
301          standard struts file, should be in the "${app.sou.dir}/properties
302          directory. They will be copied into the appropriate place for the
303          war and transformed by the above filter.
304          =============================================================== -->
305     <copy todir="${app.dest.properties}" overwrite="yes" >
306       <fileset dir="${app.sou.dir}/properties"
307                includes="*.properties"/>
308       <filterset refid="property.filters" />
309     </copy>
310   </target>
311
312   <target name="copy.servlet.properties">
313     <copy todir="${app.dest.classes}">
314       <fileset dir="${app.sou.dir}/war/WEB-INF/classes"
315                includes="*"/>
316       <filterset refid="property.filters" />
317     </copy>
318   </target>
319
320   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
321     <copy todir="${app.dest.docs}">
322       <fileset dir="${app.sou.dir}/war/docs" />
323     </copy>
324   </target>
325
326   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
327     <copy tofile="${app.dest.properties}/timezones.xml"
328           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
329   </target>
330
331   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
332     <copy tofile="${app.dest.properties}/timezones.xml"
333           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
334   </target>
335
336   <target name="google-stuff" if="org.bedework.build.caldav.google">
337     <copy todir="${app.dest.lib}">
338       <fileset dir="${google.dir}">
339         <include name="*.jar"/>
340       </fileset>
341     </copy>
342
343     <copy tofile="${app.dest.properties}/timezones.xml"
344           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
345   </target>
346
347   <!-- =================================================================
348        If this is a struts app the following gets executed.
349        We create an updated struts-config.xml file and add some jars.
350        ================================================================= -->
351
352   <target name="struts-stuff" if="org.bedework.strutsapp">
353     <!-- Copy a dummy startup file into the war. -->
354     <copy todir="${app.dest.war}">
355       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
356     </copy>
357
358     <copy todir="${app.dest.webinf}"
359           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
360
361     <mkdir  dir="${app.dest.webinf}/tlds"/>
362     <copy todir="${app.dest.webinf}/tlds" >
363       <fileset dir="${org.bedework.struts.tlds}">
364         <include name="*"/>
365       </fileset>
366     </copy>
367
368     <if>
369       <not>
370         <isset property="xalan.in.tomcat.common.endorsed" />
371       </not>
372       <then>
373         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
374       </then>
375     </if>
376
377     <if>
378       <isset property="org.bedework.global.portal.platform" />
379       <then>
380         <!-- Add common portlet files -->
381
382         <copy todir="${app.dest.lib}"
383               file="${org.bedework.appjar.portals-bridges-common}"/>
384         <copy todir="${app.dest.lib}"
385               file="${org.bedework.appjar.portals-bridges-struts-1.2.7}"/>
386
387         <!-- Use generic bedework portlet tld -->
388         <copy todir="${app.dest.webinf}/tlds"
389               overwrite="yes"
390               failonerror="no" >
391           <fileset dir="${app.root.dir}/resources/portlet" >
392             <include name="*.tld"/>
393           </fileset>
394         </copy>
395
396         <copy todir="${app.dest.webinf}"
397               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
398               overwrite="yes"
399               failonerror="no" />
400
401         <copy todir="${app.dest.webinf}"
402               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
403               overwrite="yes"
404               failonerror="no" >
405           <filterset refid="property.filters" />
406         </copy>
407
408         <!-- Add the portal bridge controller def -->
409         <replace file="${app.dest.webinf}/struts-config.xml">
410           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
411           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
412                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
413           </replacevalue>
414         </replace>
415
416         <antcall target="add.jetspeed2" inheritRefs="true" />
417         <antcall target="add.uportal2" inheritRefs="true" />
418         <antcall target="add.liferay4" inheritRefs="true" />
419       </then>
420     </if>
421
422     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.struts}"/>
423
424     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}"/>
425     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-beanutils}"/>
426     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-digester}"/>
427     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-fileupload}"/>
428     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-logging}"/>
429     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-validator}"/>
430     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jakarta-oro}"/>
431     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl}"/>
432     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl-standard}"/>
433   </target>
434
435   <!-- =================================================================
436        Jetspeed 2 modifications
437        ================================================================= -->
438
439   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
440     <copy todir="${app.dest.webinf}/tlds" >
441       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
442         <include name="*.tld"/>
443       </fileset>
444     </copy>
445   </target>
446
447   <!-- =================================================================
448        Uportal 2 modifications
449        ================================================================= -->
450
451   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
452     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.uportal}"/>
453
454     <!-- Add the portlet servlet mapping -->
455     <replace file="${app.temp.web.xml}">
456       <replacetoken><![CDATA[<!-- portlet servlet mapping here -->]]></replacetoken>
457       <replacevalue><![CDATA[<servlet-mapping>
458     <servlet-name>@PORTLET-NAME@</servlet-name>
459     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
460   </servlet-mapping>]]>
461       </replacevalue>
462     </replace>
463
464   </target>
465
466   <!-- =================================================================
467        Liferay 4 modifications
468        ================================================================= -->
469
470   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
471    <!-- Add liferay config files -->
472     <copy todir="${app.dest.webinf}" >
473       <fileset dir="${app.sou.dir}/war/WEB-INF" >
474         <include name="liferay*"/>
475       </fileset>
476       <filterset refid="property.filters" />
477     </copy>
478
479     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.liferay}"/>
480     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.liferay.util-bridges}"/>
481     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.liferay.util-java}"/>
482
483     <!-- Add the context params -->
484     <replace file="${app.temp.web.xml}">
485       <replacetoken><![CDATA[<!-- add context params here -->]]></replacetoken>
486       <replacevalue><![CDATA[<!-- add context params here -->
487
488   <context-param>
489     <param-name>company_id</param-name>
490     <param-value>@LIFERAY-COMPANY-ID@</param-value>
491   </context-param>]]>
492       </replacevalue>
493     </replace>
494
495     <!-- Add the portal listener -->
496     <replace file="${app.temp.web.xml}">
497       <replacetoken><![CDATA[<!-- add listeners here -->]]></replacetoken>
498       <replacevalue><![CDATA[<!-- add listeners here -->
499
500   <listener>
501     <listener-class>
502       @PORTAL-SERVLET-CONTEXT-LISTENER@
503     </listener-class>
504   </listener>]]>
505       </replacevalue>
506     </replace>
507
508     <!-- Add the portlet servlet definition -->
509     <replace file="${app.temp.web.xml}">
510       <replacetoken><![CDATA[<!-- add servlet definitions here -->]]></replacetoken>
511       <replacevalue><![CDATA[<!-- add servlet definitions here -->
512
513   <!-- Servlet definition for portlet use. -->
514   <servlet>
515     <servlet-name>@PORTLET-NAME@</servlet-name>
516     <display-name>@PORTLET-NAME@ Wrapper</display-name>
517     <servlet-class>@PORTLET-SERVLET-CLASS@</servlet-class>
518     <init-param>
519       <param-name>portlet-class</param-name>
520       <param-value>@PORTLET-CLASS@</param-value>
521     </init-param>
522     <init-param>
523       <param-name>portlet-guid</param-name>
524       <param-value>@CONTEXT-ROOT@.@PORTLET-NAME@</param-value>
525     </init-param>
526   </servlet>]]>
527       </replacevalue>
528     </replace>
529
530     <!-- Add the portlet servlet mapping -->
531     <replace file="${app.temp.web.xml}">
532       <replacetoken><![CDATA[<!-- add servlet mappings here -->]]></replacetoken>
533       <replacevalue><![CDATA[<!-- add servlet mappings here -->
534
535   <servlet-mapping>
536     <servlet-name>@PORTLET-NAME@</servlet-name>
537     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
538   </servlet-mapping>]]>
539       </replacevalue>
540     </replace>
541   </target>
542
543   <!-- =================================================================
544        If this is a j2ee app the following gets executed.
545        We create an uodated jboss-web.xml file (for jboss) and a ear
546        ================================================================= -->
547
548   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
549     <copy todir="${app.dest.webinf}"
550           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
551       <filterset refid="property.filters" />
552     </copy>
553
554     <if>
555       <isset property="propval.app.virtual.host" />
556       <then>
557         <replace file="${app.dest.webinf}/jboss-web.xml">
558           <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
559           <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
560           ]]>
561           </replacevalue>
562         </replace>
563         <replace file="${app.dest.webinf}/jboss-web.xml">
564           <replacefilter token="@VIRTUAL-HOST@" value="${propval.app.virtual.host}"/>
565         </replace>
566       </then>
567     </if>
568   </target>
569
570   <target name="build.ear" if="cal.j2ee">
571     <ant antfile="${buildear}"
572          inheritRefs="true" target="build" />
573   </target>
574 </project>
Note: See TracBrowser for help on using the browser.