java/nekurak.net-ws/nbproject/ant-deploy.xml
changeset 140 0f2df9746a2c
child 142 44ef544460ca
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/nekurak.net-ws/nbproject/ant-deploy.xml	Sun Jun 13 17:20:20 2010 +0200
     1.3 @@ -0,0 +1,60 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project default="-deploy-ant" basedir=".">
     1.6 +    <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
     1.7 +        <property file="${deploy.ant.properties.file}" />
     1.8 +        <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
     1.9 +        <available file="${deploy.ant.resource.dir}" property="has.setup"/>
    1.10 +        <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.11 +        <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
    1.12 +    </target>
    1.13 +    
    1.14 +    <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
    1.15 +        <tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
    1.16 +        <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
    1.17 +        <!-- The doctype triggers resolution which can fail -->
    1.18 +        <replace file="${temp.sun.web}">
    1.19 +            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
    1.20 +            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
    1.21 +        </replace>
    1.22 +        <replace file="${temp.sun.web}">
    1.23 +            <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
    1.24 +            <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
    1.25 +        </replace>
    1.26 +        <xmlproperty file="${temp.sun.web}" validate="false">
    1.27 +        </xmlproperty>    
    1.28 +        <delete file="${temp.sun.web}"/>
    1.29 +        <property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
    1.30 +        <property name="deploy.context.root.argument" value="?contextroot=${sun-web-app.context-root}"/>
    1.31 +    </target>
    1.32 +    <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
    1.33 +        <property name="deploy.context.root.argument" value=""/>
    1.34 +    </target>
    1.35 +    <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
    1.36 +        <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
    1.37 +        <mkdir dir="${gfv3.resources.dir}"/>
    1.38 +        <mkdir dir="${gfv3.resources.dir}/META-INF"/>
    1.39 +        <property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
    1.40 +        <copy todir="${gfv3.resources.dir}/META-INF">
    1.41 +            <fileset dir="${deploy.ant.resource.dir}"/>
    1.42 +        </copy>
    1.43 +        <jar destfile="${deploy.ant.archive}" update="true">
    1.44 +            <fileset dir="${gfv3.resources.dir}"/>
    1.45 +        </jar>
    1.46 +        <delete dir="${gfv3.resources.dir}"/>
    1.47 +    </target>
    1.48 +    <target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
    1.49 +        <echo message="Deploying ${deploy.ant.archive}"/>
    1.50 +        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.51 +        <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
    1.52 +        <get src="${gfv3.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}?force=true?name=${ant.project.name}"
    1.53 +            dest="${gfv3.results.file}"/>
    1.54 +        <delete file="${gfv3.results.file}"/>    
    1.55 +    </target>
    1.56 +    <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
    1.57 +        <echo message="Undeploying ${deploy.ant.archive}"/>
    1.58 +        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.59 +        <get src="${gfv3.url}/__asadmin/undeploy?name=${ant.project.name}"
    1.60 +            dest="${gfv3.results.file}"/>
    1.61 +        <delete file="${gfv3.results.file}"/>    
    1.62 +    </target>
    1.63 +</project>