java/nekurak.net-web/nbproject/ant-deploy.xml
changeset 0 b85f351aa5e5
child 6 e6581bb3c4a3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/nekurak.net-web/nbproject/ant-deploy.xml	Sat Dec 19 18:17:39 2009 +0100
     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="sjsas" property="sjsas.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.11 +        <echo message="AS_ADMIN_PASSWORD=${sjsas.password}" file="${sjsas.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="sjsas" 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="${sjsas.url}${sun-web-app.context-root}"/>
    1.30 +    </target>
    1.31 +    <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
    1.32 +        <tempfile prefix="sjsas" property="sjsas.resources.dir" destdir="${java.io.tmpdir}"/>
    1.33 +        <mkdir dir="${sjsas.resources.dir}"/>
    1.34 +        <mkdir dir="${sjsas.resources.dir}/META-INF"/>
    1.35 +        <property name="sjsas.resources.file" value="${sjsas.resources.dir}/META-INF/sun-resources.xml"/>
    1.36 +        <copy todir="${sjsas.resources.dir}/META-INF">
    1.37 +            <fileset dir="${deploy.ant.resource.dir}"/>
    1.38 +        </copy>
    1.39 +        <jar destfile="${deploy.ant.archive}" update="true">
    1.40 +            <fileset dir="${sjsas.resources.dir}"/>
    1.41 +        </jar>
    1.42 +        <delete dir="${sjsas.resources.dir}"/>
    1.43 +    </target>
    1.44 +    <target name="-deploy-ant" depends="-parse-sun-web,-add-resources" if="deploy.ant.enabled">
    1.45 +        <echo message="Deploying ${deploy.ant.archive}"/>
    1.46 +        <taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask"
    1.47 +                 classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
    1.48 +        <sun-appserv-deploy user="${sjsas.username}"
    1.49 +                passwordfile="${sjsas.password.file}"
    1.50 +                host="${sjsas.host}" port="${sjsas.port}"
    1.51 +                file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
    1.52 +        <delete file="${sjsas.password.file}"/>
    1.53 +    </target>
    1.54 +    <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
    1.55 +        <taskdef name="sun-appserv-undeploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.UndeployTask"
    1.56 +                 classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
    1.57 +        <sun-appserv-undeploy user="${sjsas.username}"
    1.58 +                passwordfile="${sjsas.password.file}"
    1.59 +                host="${sjsas.host}" port="${sjsas.port}"
    1.60 +                file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
    1.61 +        <delete file="${sjsas.password.file}"/>
    1.62 +    </target>
    1.63 +</project>