New Account Helpful Tips
  Common Project - BDA
  Editing the install.xml
Added by Steven Saksa, last edited by Steven Saksa on Feb 17, 2009  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Editing the install.xml

This page will provide both and overview of the file in addition to pointing out things you may want to edit, information about things you may want to edit will be in bold.
Follow the following links for greater details about properties and macros.
If you are not using one of the targets you should remove it, you can always cut and paste it from the templates in the future if you plan to use it.
  • This section sets the property file load order. If the environment specific file does not exist the build will fail.
    • Load environment
    • Load local.properties
    • Load project.properties
    • Load ${properties.file} (environment specific)
      <!-- Properties file related properties and tasks -->
      	<property environment="env" />
      	<property file="local.properties"/>
      	<property file="project.properties"/>
      	<property name="properties.file" value="${basedir}/install.properties"/>
      	<echo message="Using properties file of ${properties.file}."/>
      	<available file="${properties.file}" property="properties.file.exists" />
      	<fail unless="properties.file.exists" message="The properties.file ${properties.file} does not exist, please make sure that you pass in an accurate file name with the 'ant -Dproperties.file=somepath/somefile', otherwise the build will fail."/>
      	<replaceregexp file="${properties.file}" byline="true" match="^([\w\d.]+)=(.*[\w\d\/\{\}\\]+)[ \t]+\r*$" replace="\1=\2"/>
      	<replaceregexp file="${properties.file}" byline="true" match="^([\w\d.]+)=[ \t]+(.*[\w\d\/\{\}\\]+)\r*$" replace="\1=\2"/>
      	<property file="${properties.file}" />
      	<property name="env.name" value="local"/>
  • The section is used to set directory properties built on top of the platform specific base directory. This allows the same property to be used on multiple platforms.
    <!-- Set application.base.path based on platform -->
    	<condition property="application.base.path" value="${application.base.path.linux}">
    		<or>
    			<os family="unix" />
    			<os family="mac" />
    		</or>
    	</condition>
    	<condition property="application.base.path" value="${application.base.path.windows}">
    		<os family="windows" />
    	</condition>
    	<echo message="application.base.path=${application.base.path}"/>
    	<property name="jboss.home" value="${application.base.path}/${jboss.relative.path}"/>
  • This setups a temporary directory that is used to make sure the Liquibase changelog file runs from a constant directory to work around a design issue.
    <!--OS Temp dir -->
    	<condition property="os.temp.dir" value="/tmp">
    		<or>
    			<os family="unix" />
    			<os family="mac" />
    		</or>
    	</condition>
    	<condition property="os.temp.dir" value="c:/temp">
    		<os family="windows" />
    	</condition>
    	<property name="project.name" value="petstore"/>
  • Working directories
    <!-- Generic properties -->
    	<property name="log.dir" value="${basedir}/logs" />
    	<property name="working.dir" value="${basedir}/working" />
    	<property name="temp.dir" value="${working.dir}/temp" />
    	<!-- Install Time properties -->
  • These properties define source and destination directories within the distribution. Later steps copy things from the source directory to destination directory with filtering enabled.
    <!-- Source and target directories -->
    	<property name="bda-utils.dir" value="bda-utils" />
    	<property name="tools.dir" value="${basedir}/${tools.dist.relative.dir}" />
    	<property name="common.dir.src" value="${basedir}/${common.dist.relative.dir}" />
    	<property name="common.dir.dest" value="${working.dir}/${common.dist.relative.dir}" />
    	<property name="db.dir.src" value="${basedir}/${db.dist.relative.dir}" />
    	<property name="db.dir.dest" value="${working.dir}/${db.dist.relative.dir}" />
    	<property name="db-install.dir.dest" value="${working.dir}/${db-install.dist.relative.dir}" />
    	<property name="db-upgrade.dir.dest" value="${working.dir}/${db-upgrade.dist.relative.dir}" />
    	<property name="jboss-conf.dir.src" value="${basedir}/${jboss-conf.dist.relative.dir}" />
    	<property name="jboss-conf.dir.dest" value="${working.dir}/${jboss-conf.dist.relative.dir}" />
  • These properties define the location of jboss binding/service template files, they should not need to be changed for most processes.
    <!-- Jboss binding configurtion related properties -->
    	<property name="jboss.binding.template.location" value="${bda-utils.dir}/resource/${jboss.template.relative.dir}/bindings.xml"/>
    	<property name="jboss.service.template.location" value="${bda-utils.dir}/resource/${jboss.template.relative.dir}/jboss-service.xml"/>
  • These properties are related to the deployment of the application.
    <!-- *-ds.xml and WAR -->
    	<property name="petstore-webapp.dir.dist" value="${basedir}/${petstore-webapp.dist.relative.dir}" />
    	<property name="petstore-webapp.ds.file" value="petstore-ds.xml" />
    	<property name="petstore-webapp.war.file" value="petstore-webapp.war" />
  • *The code below conditionally defines variables about database based on database type. This same code is in the build.xml. *
    <!-- petstore-webapp can use either Oracle or MySQL or PostgreSQL as its database platform, this is controled by the database.type property.  Based on the value of this property sent several variables for use during install -->
    	<switch value="${database.type}">
    		<case value="oracle">
    			<property name="database.dialect" value="org.hibernate.dialect.OracleDialect"/>
    			<property name="database.driver.file" value="${bda-utils.dir}/ojdbc14-10.2.0.3.0.jar"/>
    			<property name="database.driver" value="oracle.jdbc.driver.OracleDriver"/>
    			<property name="database.schema" value="${database.name}"/>
    		</case>
    		<case value="mysql">
    			<property name="database.dialect" value="org.hibernate.dialect.MySQLDialect"/>
    			<property name="database.driver.file" value="${bda-utils.dir}/mysql-connector-java-5.0.5.jar"/>
    			<property name="database.driver" value="com.mysql.jdbc.Driver"/>
    			<property name="database.schema" value="${database.name}"/>
    		</case>
    		<case value="postgresql">
    			<property name="database.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
    			<property name="database.driver.file" value="${bda-utils.dir}/postgresql-jdbc3-8.3-603.jar"/>
    			<property name="database.driver" value="org.postgresql.Driver"/>
    			<property name="database.schema" value="public"/>
    		</case>
    		<default>
    			<fail message="Invalid database type ${database.type}"/>
    		</default>
    	</switch>
    	<path id="jdbc.driver.classpath">
    		<pathelement location="${database.driver.file}"/>
    	</path>
  • This code block checks if the ds file exists for use by future targets.
    <!-- Read db configs from existing ds.xml if it exists for use in upgrade installs, if already set in properties file values from properties file will be used -->
    	<available file="${jboss.home}/server/${jboss.server.name}/deploy/${petstore-webapp.ds.file}" property="ds.exists"/>
    	<if>
    		<isset property="ds.exists"/>
    		<then>
    		</then>
    		<else>
    			<echo message="Warning- could not find ${jboss.home}/server/${jboss.server.name}/deploy/${petstore-webapp.ds.file}"/>
    		</else>
    	</if>
  • This code block parses the properties.file value for install or upgrade, it then sets properties.template.file to use.
    <!-- figure out whether to use install-properties.template or upgrade-proprties.template based on the name of the properties file -->
    	<propertyregex property="properties.file.type"
    		input="${properties.file}"
    		regexp=".*(install|upgrade).*"
    		select="\1"     
    		/>              
    	<echo message="Properties file type = ${properties.file.type}"/>
    	<switch value="${properties.file.type}">
    		<case value="install">
    			<property name="properties.template.file" value="install-properties.template" />
    		</case>         
    		<case value="upgrade">
    			<property name="properties.template.file" value="upgrade-properties.template" />
    		</case>         
    		<default>       
    			<fail message="Property file name must include 'install' or 'upgrade' so it can be determined which properties template should be used. If you are not certain include 'upgrade' in the name of your proeprties file."/>
    		</default>      
    	</switch>
  • This code block starts logging
    <!-- Start logging --> 
    	<property name="install-logs.dir" location="${application.base.path}/change-logs"/>
    	<mkdir dir="${install-logs.dir}"/>
    	<tstamp>
    		<format property="install.time" pattern="yyyy-MM-dd-HH-mm" />
    	</tstamp>
    	<record name="${install-logs.dir}/install-${install.time}.log" action="start"/>
  • These targets clean up the application server. It moves the existing installation to a backup directory, keeps backup.count number of backups. These backups are used by the install:post target to produce a diff report of the new install with the old install. This diff report can be used to see what changed between installations.
    <target name="install:clean" description="Removes all files from the local filesystem" depends="
    		install:clean:jboss
    		">
    	</target>
    	<target name="install:clean:jboss" unless="exclude.jboss">
    		<sleep seconds="5" />
    		<property name="backup.count" value="5"/>
    		<if>
    			<not>
    				<equals arg1="${exclude.jboss.backup}" arg2="true"/>
    			</not>
    			<then>
    				<!-- Jboss backup, do not compress until install is finished -->
    				<property name="backup.jboss.base.dir" location="${application.base.path}/backup/jboss"/>
    		
    				<!-- So these directories won't be included in the backup, they are not needed to use jboss -->
    				<delete dir="${jboss.home}/server/${jboss.server.name}/work"/>
    				<delete dir="${jboss.home}/server/${jboss.server.name}/tmp"/>
    		
    				<backup-dir
    					src.dir="${jboss.home}"
    					backup.base.dir="${backup.jboss.base.dir}"
    					backup.count="${backup.count}"
    					/>
    			</then>
    		</if>
    		<delete dir="${jboss.home}"/>
    	</target>
  • This target does many tasks.
    • Calculates the jboss.ssl.port based on jboss.server.port + 363, the way that the bindings file deals with ports.
    • Defines a filter set or all properties that included other properties (like database.url=jdbc:mysql://${database.server}:${database.port}/${database.name}) to allow these to be filtered properties. When you use copy and filter files the properties inside other properties do not expand (@database.url@ would be replaced with jdbc:mysql://${database.server}:${database.port}/${database.name} instead of jdbc:mysql/localhost:3306/mydb). Once properties are loaded into memory, property references inside properties are expanded so jdbc:mysql://${database.server}:${database.port}/${database.name} would actually be jdbc:mysql/localhost:3306/mydb in memory. Therefore when we define a filterset based on the in memory variables and use that as the first filter in a copy with filters.
    • We then copy the common folder from the source to the destination with filtering enabled. The filterset is the first filter in use then ${properties.file} the project.properties.
      <target name="install:init" description="Does directory management to initialize install">
      		<math result="jboss.ssl.port" operand1="${jboss.server.port}" operation="+" operand2="363" datatype="int"/>
      		<filterset id="embedded.filterset">
      			<filter token="application.base.path" value="${application.base.path}"/>
      			<filter token="application.url" value="${application.url}"/>
      			<filter token="database.url" value="${database.url}"/>
      			<filter token="database.user" value="${database.user}"/>
      			<filter token="database.password" value="${database.password}"/>
      			<filter token="database.system.url" value="${database.system.url}"/>
      			<!-- added internal properties that may be used in a filtered copy -->
      			<filter token="database.driver" value="${database.driver}"/>
      			<!-- added for liquibase -->
      			<filter token="db-upgrade.run.dir" value="${db-upgrade.dir.dest}/${database.type}"/>
      			<filter token="jboss.home" value="${jboss.home}"/>
      			<filter token="database.dialect" value="${database.dialect}"/>
      			<filter token="hibernate.cfg.file.path" value="${hibernate.cfg.file.path}"/>
      		</filterset>
      	
      		<property name="db.prop.list" value="database.url,database.user,database.password,database.name"/>
      		<echo  message="Checking if database properties exist: ${db.prop.list}"/>
      		<properties-exist properties.list="${db.prop.list}"/>
      		<mkdir dir="${working.dir}" />
      		<delete dir="${working.dir}"/>
      		<mkdir dir="${working.dir}" />
      		<!-- Copy files to ensure values containing variables are expanded, such properties are stored in embedded.filterset and then copy with filter files -->
      		<copy todir="${common.dir.dest}" filtering="true">
      			<fileset dir="${common.dir.src}">
      				<include name="**/*"/>
      			</fileset>
      			<filterset refid="embedded.filterset"/>
      			<filterset>
      				<filtersfile file="${properties.file}"/>
      				<filtersfile file="project.properties"/>
      			</filterset>
      		</copy> 
      	</target>
  • Copies the database files from a source to a destination with filtering enabled to allow expansion of embedded properties. It also copies the liquibase change log to the os.temp.dir.
    <target name="install:database:prep" description="Copies db files with filtering" unless="exclude.database" depends="install:init">
    		<echoproperties prefix="database"/>
    		<copy todir="${db.dir.dest}" filtering="true">
    			<fileset dir="${db.dir.src}">
    				<include name="**/*"/>
    			</fileset>
    			<filterset refid="embedded.filterset"/>
    			<filterset>
    				<filtersfile file="${properties.file}"/>
    				<filtersfile file="project.properties"/>
    			</filterset>
    		</copy>
    		<mkdir dir="${os.temp.dir}/${project.name}"/>
    		<copy todir="${os.temp.dir}/${project.name}" filtering="true" flatten="true" overwrite="true">
    			<fileset dir="${db.dir.dest}">
    				<include name="**/db-upgrade.xml"/>
    			</fileset>
    		</copy>
    	</target>
  • Calls the database-install macro. A conditional is added to make sure that the macro is called with different arguments. Because sql scripts with postgresql and oracle often include programmatic structures like procedures and triggers. The default statement separator is ;. These programmatic structures include "s". Therefore JDBC gets confused and generates syntax errors. So instead of using ";" as delimiter we can use "/" on an empty line. This is the format we recommend for Oracle and PostgreSQL.
  • Once the database-install is complete we call the database-upgrade macro. This takes the database from the baseline to the current incarnation.
    <target name="install:database" description="Runs datbase creation scripts then calls uprade database." unless="exclude.database"
    		depends="
    		install:init,
    		install:database:prep
    		">
    		<!-- Drop all schema objects or re-create the db -->
    		<database-clean/>
    		<!-- Run baseline scripts stored in db.install.create.${database.type}.file.list variable -->
    		<switch value="${database.type}">
    			<case value="oracle">
    				<database-install
    					db.install.create.file.list="${db.install.create.oracle.file.list}"
    					sql.delimiter="/"
    					sql.delimitertype="row"
    					/>
    			</case>
    			<case value="postgresql">
    				<database-install
    					db.install.create.file.list="${db.install.create.postgresql.file.list}"
    					sql.delimiter="/"
    					sql.delimitertype="row"
    					/>
    			</case>
    			<case value="mysql">
    				<database-install
    					db.install.create.file.list="${db.install.create.mysql.file.list}"
    					/>
    			</case>
    		</switch>
    		<database-upgrade
    			database.changelog.file="${os.temp.dir}/${project.name}/db-upgrade.xml"
    			/>
    		<database-tag/>
    	</target>
  • Calls the macro for installing binaries.
    <target name="install:jboss:binaries" description="Install JBoss binaries" unless="exclude.jboss">
    		<jboss-install-binaries
    			/>
    	</target>
  • This target installs the application into JBoss, copying archive and library files as needed. It also does some clean up to make sure the server starts up with no errors. You will have to customize this for your install requirements.
    <target name="install:jboss:petstore-webapp" description="Deploy petstore-webapp and common libraries to jboss installation" unless="exclude.jboss">
    		<!-- added to ensure working.dirs are fresh for our install -->
    		<delete dir="${jboss.home}/server/${jboss.server.name}/tmp"/>
    		<delete dir="${jboss.home}/server/${jboss.server.name}/work"/>
    		<move file="${jboss.home}/server/${jboss.server.name}/log/server.log" tofile="${jboss.home}/server/${jboss.server.name}/log/server/log.${install.time}" failonerror="false"/>
    		<copy file="${petstore-webapp.dir.dist}/${petstore-webapp.war.file}" todir="${jboss.home}/server/${jboss.server.name}/deploy" overwrite="true" />
    		<!--  Many NCI applications require clm for csm, so you can point this to where you have the version you want to use
    		<copy file="${bda-utils.dir}/clm-3.2.jar" todir="${jboss.home}/server/${jboss.server.name}/lib" overwrite="true" />
    		-->
    		<copy file="${database.driver.file}" todir="${jboss.home}/server/${jboss.server.name}/lib" overwrite="true" />
    	</target>
  • This target copies and manipulates configuration files that are not part of JBoss, like ds.xml files. You will have to customize this for your install requirements.
    <target name="install:jboss:petstore-webapp:configure" description="Configure petstore-webapp application, copies over externalized properties or configurations that are not part of the jboss configuration" unless="exclude.jboss">
    		<!-- copy over any other files you may need to configure your application -->
    		
    		<!-- copy datasource file -->
    		<copy file="${jboss-conf.dir.dest}/${petstore-webapp.ds.file}" todir="${jboss.home}/server/${jboss.server.name}/deploy" overwrite="true" />
    		<!-- copy JBoss-web.xml file -->
    		<!--
    		<copy file="${jboss-conf.dir.dest}/${jboss.web.xml.file}" todir="${jboss.home}/server/${jboss.server.name}/deploy" overwrite="true" />
    		-->
    	</target>
  • This target is sample of how you might add an appender or category to the existing JBOSS_HOME/server/SERVER_NAME/conf/log4j.xml. Delete or comment out comments if you don't want to alter the log4j configuration.
    <target name="install:jboss:configure:log4j" description="Configure custom entries in system wide log4j" unless="exclude.jboss" >
    		<echo message="Configuring Log4J"/>
    		<property name="log4j.file.name" value="log4j.xml"/>
    		<copy file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}" tofile="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}.pre"/>
    		<replaceregexp file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}"
    			byline="true"
    			match="^(&lt;!DOCTYPE.*)"
    			replace="&lt;!-- \1 --&gt;"
    			/>
    		<!--<copy file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}" tofile="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}.1"/>-->
    		<xmltask source="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}"
    			dest="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}">
    			<xmlcatalog refid="installer.catalog"/>
    			<remove path="/log4j:configuration/appender[@name='TestAppender']"/>
    			<insert path="/log4j:configuration">
    				<![CDATA[
    				<appender name="TestAppender" class="org.jboss.logging.appender.RollingFileAppender">
    					<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    					<param name="File" value="${jboss.server.log.dir}/testAppender.log"/>
    					<param name="Append" value="false"/>
    					<param name="MaxFileSize" value="${log4j.maxFileSize}"/>
    					<!--<param name="MaxBackupIndex" value="${log4j.maxDays}"/>-->
    					<layout class="org.apache.log4j.PatternLayout">
    						<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    					</layout>           
    				</appender>
    				]]>
    			</insert>
    			<remove path="/log4j:configuration/category[@name='org.nih.nci']"/>
    			<insert path="/log4j:configuration">
    				<![CDATA[
    				<category name="org.nih.nci">
    					<priority value="${log4j.level}"/>
    				</category>
    				]]>
    			</insert>
    		</xmltask>
    		<!--<copy file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}" tofile="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}.2"/>-->
    		<validate-log4j
    			log4j.file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}"
    			/>                              
    		<replaceregexp file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}"
    			byline="true"
    			match="^&lt;!-- (&lt;!DOCTYPE.*) --&gt;"
    			replace="\1"
    			/>
    		<!--<copy file="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}" tofile="${jboss.home}/server/${jboss.server.name}/conf/${log4j.file.name}.post"/>-->
    	</target>
  • This target calls the JBoss configuration target and macro. If you wanted to configure multiple copies of JBoss you can copy this target and call the macro with with many attributes (there are many attributes refer to the api for details).
    <target name="install:jboss:configure" description="Configure JBoss (bindings, login-config.xml, ect)" unless="exclude.jboss"
    		depends="
    			install:jboss:configure:log4j	
    			">
    		<!-- Calls the following macros
    			jboss-bindings - configures ports for jboss
    			jboss-login-config - sets up authentication
    			secure-jboss-console - adds password to jboss console apps
    			jboss-update-shutdown - updates shutdown.jar with correct jndi port so no args need to used 4 shutdown
    			appserver-ssl-configure -  enables ssl
    			appserver-configure-external-hostname - configures jboss for use through a reverse proxy
    			grid-secure-configure-connector - configures secure grid
    		-->
    		<!-- Use below if you are defining all the ports in your install.xml not the NCICB port configuraitons-->
    		<jboss-configure
    			jboss.server.ports.name="bda-ports"
    			jboss.server.binding.template.location="${bda-utils.resource.dir}/template-binding.xml"
    			/>
    		<!-- Default values for all attributes if you are using standard NCICB port configurations
    		<jboss-configure
    			/>
    			-->
    	</target>
  • These targets stop and start jboss.
    <target name="install:jboss:stop" description="Stops jboss" unless="exclude.jboss">
    		<if>
    			<isset property="jboss.exists"/>
    			<then>
    				<jboss-stop-jboss jboss.server.jndi.port="${jboss.server.jndi.port}"/>
    			</then>
    		</if>
    	</target>
    	<target name="install:jboss:start" description="Starts jboss" unless="exclude.jboss">
    		<if>
    			<not>
    				<isset property="exclude.start.servers"/>
    			</not>
    			<then>
    				<jboss-start-jboss />
    				<sleep seconds="15"/>
    			</then>
    		</if>
    	</target>
  • These targets call pre and post install macros.
    • Check property values
    • Check connectivity to or existence of resources
    • Check version of resources
      <target name="install:validation:pre-install" description="Runs pre-install validation checks bda-utils">
      		<validate-pre-install
      			ant.check.version="${ant.minimum.version}"
      			java.check.version.major="${java.major.version}"
      			java.check.version.minor="${java.minor.version}"
      			database.version="${mysql.minimum.version}"
      			/>
      	</target>
      	<target name="install:validation:pre-install:ports" description="Checks to see if configured ports are listenting and fails buld, meant to be run after jboss:stop">
      		<validate-ports-preinstall />
      	</target>
      	<target name="install:validation:post-install" description="Run post-install checks from bda-utils">
      		<if>
      			<not>
      				<isset property="exclude.start.servers"/>
      			</not>
      			<then>
      				<validate-post-install />
      			</then>
      		</if>
      	</target>
  • Wrapper target for for installing JBoss, see dependent targets for details.
    <target name="install:jboss" description="Wrapper scripts that calls all required targets to install the jboss container" unless="exclude.jboss"
    		depends="
    		install:validation:pre-install,
    		install:jboss:stop,
    		install:validation:pre-install:ports,
    		install:clean:jboss,
    		install:init,
    		install:jboss:binaries,
    		install:jboss:petstore-webapp:re-configure,
    		install:jboss:petstore-webapp,
    		install:jboss:petstore-webapp:configure,
    		install:jboss:configure,
    		install:post,
    		install:jboss:start
    		" >
    	</target>
  • Wrapper target for for installing everything, see dependent targets for details.
    <target name="install" description="Installs and configures JBOSS, creates database, and deploys application" 
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		install:validation:pre-install:ports,
     		install:clean,
     		install:init,
     		install:database,
     		install:jboss,
     		install:post,
     		install:jboss:start,
     		install:validation:post-install
    		">
    	</target>
  • This target cleans up application archives with install time values. This is necessary because with a distribution based installer it is possible to have different build time and install time properties. So let's say you had a file in your archive like jndi.properties. In that file you have information like the hostname and jndi.port.number. Now at build time your jndi.port.number 1099. But at install time the user decides they would like the jndi.port.number to be 31099. Since this file is embedded in the archive you would need to extract the archive to be able to modify that file, re-archive it and deploy that archive. That is what this target is for. Included is sample of what you want to do. You may want to copy in a template with filtering or update the file with xmltask or replaceregexp.
    <target name="install:jboss:petstore-webapp:re-configure" description="Update contents of artifacts if not all properties have been externalized, by extracting artifact, modify it as needed and re-archive it." unless="exclude.jboss">
    		<!-- This is only required if configuration files are not externalized, below is a sample of what you may do.
    		<delete dir="${working.dir}/petstore-webapp"/>
    		<unzip src="${petstore-webapp.dir.dist}/${petstore-webapp.war.file}" dest="${working.dir}/petstore-webapp"/>
    		<copy todir="${working.dir}/petstore-webapp/WEB-INF/classes" file="${jboss-conf.dir.dest}/hibernate.cfg.xml"/>
    		
    		<move file="${petstore-webapp.dir.dist}/${petstore-webapp.war.file}" tofile="${petstore-webapp.dir.dist}/${petstore-webapp.war.file}.orig"/>
    		<war destfile="${petstore-webapp.dir.dist}/${petstore-webapp.war.file}" compress="false" webxml="${working.dir}/petstore-webapp/WEB-INF/web.xml" >
    			<fileset dir="${working.dir}/petstore-webapp">
    				<include name="*/**" />
    			</fileset>
    		</war>  
    		-->
    	</target>
  • These wrapper targets are used to point to the wrapper targets for the desired Upgrade Path (see this link)
    <target name="upgrade:jboss" description="Wrapper target to call all targets required to upgrade jboss container." unless="exclude.jboss" depends="upgrade-ncm:jboss">
    	</target>
    	<target name="upgrade" description="Upgrades JBoss and Database" depends="upgrade-ncm">
    	</target>
    	<target name="upgrade-with-dbinstall" description="Upgrades JBoss and Database" depends="upgrade-ncm:with-dbinstall">
    	</target>
  • These wrapper targets use the Disposable Application Container (DAC) upgrade path. See dependent targets for details of the steps.
    <target name="upgrade-dac:jboss" description="Wrapper target to call all targets required to upgrade jboss container." unless="exclude.jboss"
    		depends="
    		install:validation:pre-install,
    		install:jboss:stop,
    		install:validation:pre-install:ports,
    		install:clean:jboss,
    		install:init,
    		install:jboss:binaries,
    		install:jboss:configure,
    		install:jboss:petstore-webapp:re-configure,
    		install:jboss:petstore-webapp,
    		install:jboss:petstore-webapp:configure,
    		install:post:jboss,
    		install:jboss:start
    		">
    	</target>
    	<target name="upgrade-dac" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		upgrade:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
    	<target name="upgrade-dac:with-dbinstall" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		install:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
  • These wrapper targets use the Container Modification(CM) upgrade path. See dependent targets for details of the steps.
    <target name="upgrade-cm:jboss" description="Wrapper target to call all targets required to upgrade jboss container." unless="exclude.jboss"
    		depends="
    		install:validation:pre-install,
    		install:jboss:stop,
    		install:validation:pre-install:ports,
    		install:init,
    		install:jboss:configure,
    		install:jboss:petstore-webapp:re-configure,
    		install:jboss:petstore-webapp,
    		install:jboss:petstore-webapp:configure,
    		install:post:jboss,
    		install:jboss:start
    		">
    	</target>
    	<target name="upgrade-cm" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		upgrade:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
    	<target name="upgrade-cm:with-dbinstall" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		install:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
  • These wrapper targets use the No Container Modification (NCM) upgrade path. See dependent targets for details of the steps.
    <target name="upgrade-ncm:jboss" description="Wrapper target to call all targets required to upgrade jboss container." unless="exclude.jboss"
    		depends="
    		install:validation:pre-install,
    		install:jboss:stop,
    		install:validation:pre-install:ports,
    		install:init,
    		install:jboss:petstore-webapp:re-configure,
    		install:jboss:petstore-webapp,
    		install:jboss:petstore-webapp:configure,
    		install:post:jboss,
    		install:jboss:start
    		">
    	</target>
    	<target name="upgrade-ncm" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		upgrade:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
    	<target name="upgrade-ncm:with-dbinstall" description="Upgrades JBoss and Database"
    		depends="
    		install:validation:pre-install,
     		install:jboss:stop,
     		upgrade:init,
     		install:init,
     		install:database,
     		upgrade:jboss,
     		install:validation:post-install
    		">
    	</target>
  • These targets call the macros that are related to Liquibase.
    <target name="upgrade:database" description="Upgrades database using BDA Datbase Upgrade process." unless="exclude.database"
    		depends="
    		upgrade:init,
    		install:init,
    		install:database:prep
    		">
    		<database-upgrade
    			database.changelog.file="${os.temp.dir}/${project.name}/db-upgrade.xml"
    			/>
    		<database-tag/>
    	</target>
    	<target name="upgrade:database:tag" description="Tags current state of database with a tag to allow for rollback of database to previous versions." unless="exclude.database"
    		depends="
    		upgrade:init,
    		install:init,
    		install:database:prep
    		">
    		<database-tag/>
    	</target>
    	<target name="upgrade:database:rollback" description="Rolls back database to previous tagged version using rollback scripts." unless="exclude.database"
    		depends="
    		upgrade:init,
    		install:init,
    		install:database:prep
    		">
    		<database-rollback/>
    	</target>
  • This target can read the database and ldap properties from the ds.xml and login-config.xml. If the database or ldap properties are not set they will be set by the macros otherwise the build will fail.
    <target name="upgrade:init">
    		<jboss-read-dbconfig
    			jboss.ds-xml.file="${petstore-webapp.ds.file}"
    			/>
    		<jboss-read-ldapconfig
    			/>
    	</target>
  • This target produces a change report between this and the previous install.
    <target name="install:post" depends="
    		install:post:jboss
    		">
    	</target>
    	<target name="install:post:jboss" unless="exclude.jboss">
    		<if>
    			<not>
    				<equals arg1="${exclude.jboss.backup}" arg2="true"/>
    			</not>
    			<then>
    				<property name="changelogFile" location="${install-logs.dir}/chagneLog-${install.time}.txt"/>
    				<property name="compare1.dir" location="${backup.jboss.base.dir}/backup/${jboss.relative.path}"/>
    				<property name="compare2.dir" location="${jboss.home}"/>
    				<report-dir-diff
    					dir1="${compare1.dir}"
    					dir2="${compare2.dir}"
    					reportFile="${changelogFile}"
    					/>
    				<!-- Copy app server logs -->
    				<mkdir dir="${jboss.home}/server/${jboss.server.name}/log"/>
    				<mkdir dir="${backup.jboss.base.dir}/backup/${jboss.relative.path}/server/${jboss.server.name}/log"/>
    				<!-- so the logs wont be included in the zip -->
    				<move todir="${jboss.home}/server/${jboss.server.name}/log">
    					<fileset dir="${backup.jboss.base.dir}/backup/${jboss.relative.path}/server/${jboss.server.name}/log">
    						<include name="*"/>
    					</fileset>
    				</move>
    		
    				<!-- Compress backup and cleanup -->
    				<mkdir dir="${backup.jboss.base.dir}/backup1"/>
    				<zip destfile="${backup.jboss.base.dir}/backup1/${jboss.relative.path}.zip" basedir="${backup.jboss.base.dir}/backup" />
    				<delete dir="${backup.jboss.base.dir}/backup"/>
    			</then>
    		</if>
    	</target>


CONTACT US PRIVACY NOTICE DISCLAIMER ACCESSIBILITY APPLICATION SUPPORT
National Cancer Institute Department of Health and Human Services National Institutes of Health USA.gov