build.xml
001 <?xml version="1.0" encoding="UTF-8"?>
002 <project name="medrec ear" default="build">
003 
004   <property environment="env" />
005 
006   <property file="../medrec.properties"/>
007 
008   <property name="build.compiler" value="${compiler}" />
009 
010   <property name="adminwebapp" value="adminWebApp"/>
011   <property name="mainwebapp" value="mainWebApp"/>
012   <property name="patientwebapp" value="patientWebApp"/>
013   <property name="webservices" value="webServices"/>
014 
015   <!-- this is the src directory out of which when combined
016        with the build directory is a wls formatted ear -->
017   <property name="medrec.ear.src.dir" value="." />
018 
019   <!-- this is the build directory for the wls formatted ear -->
020   <property name="dest.dir" value="${medrec.ear.wlcompile.build.dir}" />
021 
022   <!-- This is an archived J2EE formatted ear, combining
023        the build and src elements of the medrec ear -->
024   <property name="ear.file" value="${medrec.ear.file}" />
025 
026   <!-- This is an exploded J2EE formatted ear, combining
027        the build and src elements of the medrec ear -->
028   <property name="ear.exploded.dir" value="${medrec.ear.exploded.dir}" />
029 
030   <!-- these all apply to the src and build directory for wls formatted ear -->
031   <property name="app-inf.dest.classes" value="${dest.dir}/APP-INF/classes"/>
032   <property name="app-inf.dest.lib" value="${dest.dir}/APP-INF/lib"/>
033   <property name="app-inf.src.classes" value="${medrec.ear.src.dir}/APP-INF/classes"/>
034   <property name="app-inf.src.lib" value="${medrec.ear.src.dir}/APP-INF/lib"/>
035 
036   <!-- Web Service WLS Ant task definitions -->
037   <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />
038 
039   <target name="banner">
040     <echo>+---------------------------------------+</echo>
041     <echo>+        Building MedRec Ear            +</echo>
042     <echo>+---------------------------------------+</echo>
043   </target>
044 
045   <!-- build and deploy application -->
046   <target name="all" depends="clean, build" />
047   <target name="stage" depends="clean, build, exploded.ear"/>
048   <target name="stage.prod" depends="clean, build, ear"/>
049 
050   <target name="prepare">
051     <!--Setup the directories for the ear level -->
052     <mkdir dir="${app-inf.dest.classes}"/>
053     <mkdir dir="${app-inf.dest.lib}"/>
054     <mkdir dir="${app-inf.src.classes}"/>
055     <mkdir dir="${app-inf.src.lib}"/>
056 
057     <!-- Copy libs for ear level -->
058     <!-- MedRec jars -->
059     <copy file="${exceptions.classpath}" todir="${app-inf.dest.lib}" />
060     <copy file="${utils.classpath}" todir="${app-inf.dest.lib}" />
061     <copy file="${value.classpath}" todir="${app-inf.dest.lib}" />
062     <copy file="${common.web.classpath}" todir="${app-inf.dest.lib}" />
063     <copy file="${listeners.classpath}" todir="${app-inf.dest.lib}" />
064     <!-- 3rd-party jars -->
065     <copy file="${log.classpath}" todir="${app-inf.dest.lib}" />
066     <copy todir="${app-inf.dest.lib}">
067       <fileset dir="${struts.lib.dir}/" includes="commons-*.jar"/>
068     </copy>
069     <copy todir="${app-inf.dest.lib}">
070       <fileset dir="${struts.lib.dir}/" includes="sslext.jar"/>
071     </copy>
072     <copy file="${struts.classpath}" todir="${app-inf.dest.lib}" />
073     <antcall target="compile.schema"/>
074   </target>
075 
076   <taskdef name="ejbgen"
077     classname="com.bea.wls.ejbgen.ant.EJBGenAntTask" />
078   
079   <!-- builds entire application -->
080   <target name="build" depends="build.split.dir, build.ws, appc.splitdir"/>
081 
082   <!-- build split-dir components -->
083   <target name="build.split.dir" depends="banner, prepare">
084     <!-- Build worker components first -->
085     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
086                includes="entityEjbs, mainWebApp">
087       <ejbgen source="${sourceVersion}"/>
088       <javac deprecation="${deprecation}" />
089       <javac debug="${debug}" debugLevel="${debugLevel}" />
090     </wlcompile>
091     <!-- Build worker components first -->
092     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
093                includes="sessionEjbs, patientWebApp">
094       <ejbgen source="${sourceVersion}"/>
095       <javac deprecation="${deprecation}" />
096       <javac debug="${debug}" debugLevel="${debugLevel}" />
097     </wlcompile>
098     <!-- Build worker components first -->
099     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
100                includes="xml"
101                classpath="${java.class.path};${app-inf.dest.lib}/${xbeans.medrectypes.jar};${dest.dir}/sessionEjbs">
102       <ejbgen source="${sourceVersion}"/>
103       <javac deprecation="${deprecation}" />
104       <javac debug="${debug}" debugLevel="${debugLevel}" />
105     </wlcompile>
106     <!-- Build more dependent components -->
107     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
108                includes="mdbEjbs, adminWebApp">
109       <ejbgen source="${sourceVersion}"/>
110       <javac deprecation="${deprecation}" />
111       <javac debug="${debug}" debugLevel="${debugLevel}" />
112     </wlcompile>
113   </target>
114 
115   <!-- build mail mdbean -->
116   <target name="build.mail.ejb" description="build mail mdbean">
117     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="mailEjb">
118       <ejbgen source="${sourceVersion}"/>
119       <javac deprecation="${deprecation}" />
120       <javac debug="${debug}" debugLevel="${debugLevel}" />
121     </wlcompile>
122   </target>
123 
124   <!-- build entity ejbs -->
125   <target name="build.entity.ejbs" description="build entity ejbs">
126     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="entityEjbs">
127       <ejbgen source="${sourceVersion}"/>
128       <javac deprecation="${deprecation}" />
129       <javac debug="${debug}" debugLevel="${debugLevel}" />
130     </wlcompile>
131   </target>
132 
133   <!-- build session ejbs
134        classpath is required due to entity ejbs ejbgen nature -->
135   <target name="build.session.ejbs" description="build session ejbs">
136     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="sessionEjbs">
137       <ejbgen source="${sourceVersion}"/>
138       <javac deprecation="${deprecation}" />
139       <javac debug="${debug}" debugLevel="${debugLevel}" />
140     </wlcompile>
141   </target>
142 
143   <!-- build registration mdbean
144        classpath is required due to session ejbs ejbgen nature -->
145   <target name="build.registration.ejb" description="build registration mdbean">
146     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="registrationEjb">
147       <ejbgen source="${sourceVersion}"/>
148       <javac deprecation="${deprecation}" />
149       <javac debug="${debug}" debugLevel="${debugLevel}" />
150     </wlcompile>
151   </target>
152 
153   <!-- build xml processing and parser
154        classpath is required due to session ejbs ejbgen nature -->
155   <target name="build.medrec.xml" description="build xml processing and parser">
156     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
157                classpath="${app-inf.dest.lib}/${xbeans.medrectypes.jar};${java.class.path};${dest.dir}/sessionEjbs"
158                includes="xml">
159       <javac deprecation="${deprecation}" />
160       <javac debug="${debug}" debugLevel="${debugLevel}" />
161     </wlcompile>
162   </target>
163 
164   <!-- build web service
165        classpath is required due to session ejbs ejbgen nature -->
166   <target name="build.web.services" description="build web services">
167     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
168       includes="webServices">
169       <ejbgen source="${sourceVersion}"/>
170       <javac deprecation="${deprecation}" />
171       <javac debug="${debug}" debugLevel="${debugLevel}" />
172     </wlcompile>
173   </target>
174 
175   <!-- build main webapp -->
176   <target name="build.main.webapp" description="build main webapp">
177     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
178                includes="mainWebApp">
179       <javac deprecation="${deprecation}" />
180       <javac debug="${debug}" debugLevel="${debugLevel}" />
181     </wlcompile>
182   </target>
183 
184   <!-- build admin webapp
185        classpath is required due to session ejbs ejbgen nature -->
186   <target name="build.admin.webapp" description="build admin webapp" depends="prepare">
187     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="adminWebApp">
188       <javac deprecation="${deprecation}" />
189       <javac debug="${debug}" debugLevel="${debugLevel}" />
190     </wlcompile>
191   </target>
192 
193   <!-- build patient webapp
194        classpath is required due to session ejbs ejbgen nature -->
195   <target name="build.patient.webapp" description="build patient webapp" depends="prepare">
196     <wlcompile srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}" includes="patientWebApp">
197       <javac deprecation="${deprecation}" />
198       <javac debug="${debug}" debugLevel="${debugLevel}" />
199     </wlcompile>
200   </target>
201 
202   <!-- The servicegen Ant task takes as input an EJB JAR file or list of Java
203   classes, and creates all the needed Web service components and packages them
204   into a deployable EAR file.-->
205   <target name="build.ws" description="" depends="build.sync.ws, build.async.reliable.ws"/>
206 
207   <!-- build synchronous WS -->
208   <target name="build.sync.ws">
209     <jwsc
210       srcdir="${basedir}/webServices/com/bea/medrec/webservices"
211       sourcepath="${basedir}/webServices"
212       destdir="${dest.dir}"
213       applicationXml="${src.dir}/medrecEar/META-INF/application.xml"
214       classpath="${java.class.path};${dest.dir}/webServices;${dest.dir}/sessionEjbs;${dest.dir}/APP-INF/lib/value.jar;${dest.dir}/APP-INF/lib/utils.jar;${dest.dir}/APP-INF/lib/${log.jar}"
215       keepGenerated="true"
216       deprecation="${deprecation}"
217       debug="${debug}" 
218       verbose="false">
219         <jws file="MedRecWebServices.java" explode="true"/>
220     </jwsc>
221   </target>
222 
223   <!-- build relialbe, asynchronous WS -->
224   <target name="build.async.reliable.ws">
225     <jwsc
226       srcdir="${basedir}/webServices/com/bea/medrec/webservices"
227       sourcepath="${basedir}/webServices"
228       destdir="${dest.dir}"
229       applicationXml="${src.dir}/medrecEar/META-INF/application.xml"
230       classpath="${java.class.path};${dest.dir}/webServices;${dest.dir}/sessionEjbs;${dest.dir}/APP-INF/lib/value.jar;${dest.dir}/APP-INF/lib/utils.jar;${dest.dir}/APP-INF/lib/${log.jar}"
231       keepGenerated="true"
232       deprecation="${deprecation}"
233       debug="${debug}" 
234       verbose="false">
235         <jws file="MedRecRMWebServices.java" explode="true"/>
236     </jwsc>
237   </target>
238 
239   <target name="appc.splitdir">
240     <wlappc source="${dest.dir}"/>
241   </target>
242 
243   <!-- deploys entire application -->
244   <target name="deploy.medrec.ear"
245     description="Deploy build/medrecEar to WebLogic on ${wls.admin.server.host}:${wls.admin.server.port} .">
246     <!-- "url" is not required, but the default url is iiop://${wls.admin.server.host}:${wls.admin.server.port} -->
247     <wldeploy
248       user="${wls.username}"
249       password="${wls.password}"
250       adminurl="t3://${wls.admin.server.host}:${wls.admin.server.port}"
251       action="deploy"
252       name="${medrec.ear.display.name}" 
253       source="${dest.dir}"
254       targets="${medrec.server.name}"
255       submoduletargets="MedRecJMSServer@MedRecAppScopedJMS@MedRecJMSServer"
256       securityModel="CustomRolesAndPolicies"/>
257   </target>
258 
259   <target name="redeploy.medrec.ear"
260     description="Redeploy build/medrecEar to WebLogic on ${wls.admin.server.host}:${wls.admin.server.port}.">
261     <!-- "url" is not required, but the default url is iiop://${wls.admin.server.host}:${wls.admin.server.port} -->
262     <wldeploy
263       user="${wls.username}"
264       password="${wls.password}"
265       adminurl="t3://${wls.admin.server.host}:${wls.admin.server.port}"
266       action="redeploy"
267       name="${medrec.ear.display.name}"
268       targets="${medrec.server.name}"
269       submoduletargets="MedRecJMSServer@MedRecAppScopedJMS@MedRecJMSServer"
270       securityModel="CustomRolesAndPolicies"/>
271   </target>
272 
273   <!-- package the application as J2EE formatted archived .ear -->
274   <target name="ear">
275     <mkdir dir="${dist.dir}"/>
276     <wlpackage srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
277       toFile="${ear.file}" />
278   </target>
279 
280   <!-- package the application a J2EE formatted exploded ear -->
281   <target name="exploded.ear">
282     <wlpackage srcdir="${medrec.ear.src.dir}" destdir="${dest.dir}"
283       toDir="${ear.exploded.dir}" />
284   </target>
285 
286   <target name="clean" depends="clean.ear,clean.exploded.ear,clean.prepare">
287     <delete dir="${dest.dir}" />
288   </target>
289 
290   <target name="clean.ear">
291     <delete file="${ear.file}"/>
292   </target>
293 
294   <target name="clean.exploded.ear">
295     <delete dir="${ear.exploded.dir}"/>
296   </target>
297 
298   <target name="clean.prepare">
299     <delete dir="${app-inf.dest.classes}"/>
300     <delete dir="${app-inf.dest.lib}"/>
301     <delete dir="${app-inf.src.classes}"/>
302     <delete file="${medrec.ear.src.dir}/sessionEjbs_client.jar"/>
303   </target>
304 
305   <target name="compile.schema">
306     <taskdef name="xmlbean" classname="com.bea.xbean.tool.XMLBean"/>
307     <copy file="${medrec.ear.src.dir}/adminWebApp/MedRecSchema.xsd"
308         toDir="${medrec.ear.src.dir}/xml/xsd"/>
309     <copy file="${medrec.ear.src.dir}/adminWebApp/medrec.xsdconfig"
310         toDir="${medrec.ear.src.dir}/xml/xsd"/>
311     <xmlbean
312       destfile="${app-inf.dest.lib}/${xbeans.medrectypes.jar}"
313       classpath="${dest.dir}/sessionEjbs;${utils.classpath};${exceptions.classpath};${java.class.path}"
314       failonerror="true">
315       <fileset dir="${medrec.ear.src.dir}/xml/xsd" includes="**/*.xsd*"/>
316     </xmlbean>
317 
318   </target>
319 
320 </project>