java/sql-vyuka/nbproject/ant-deploy.xml
changeset 79 aa8c8f51b0cc
parent 74 48066e753dd6
child 87 5fff85c7f980
     1.1 --- a/java/sql-vyuka/nbproject/ant-deploy.xml	Wed Feb 08 13:15:23 2012 +0100
     1.2 +++ b/java/sql-vyuka/nbproject/ant-deploy.xml	Wed Feb 08 13:16:13 2012 +0100
     1.3 @@ -3,6 +3,7 @@
     1.4      <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
     1.5          <property file="${deploy.ant.properties.file}" />
     1.6          <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
     1.7 +        <available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
     1.8          <available file="${deploy.ant.resource.dir}" property="has.setup"/>
     1.9          <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.10          <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
    1.11 @@ -23,8 +24,34 @@
    1.12          <xmlproperty file="${temp.sun.web}" validate="false">
    1.13          </xmlproperty>    
    1.14          <delete file="${temp.sun.web}"/>
    1.15 -        <property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
    1.16 -        <property name="deploy.context.root.argument" value="?contextroot=${sun-web-app.context-root}"/>
    1.17 +        <condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
    1.18 +            <isset property="sun-web-app.context-root"/>
    1.19 +        </condition>
    1.20 +        <condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
    1.21 +            <isset property="sun-web-app.context-root"/>
    1.22 +        </condition>
    1.23 +    </target>
    1.24 +    <target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
    1.25 +        <tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
    1.26 +        <copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
    1.27 +        <!-- The doctype triggers resolution which can fail -->
    1.28 +        <replace file="${temp.gf.web}">
    1.29 +            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
    1.30 +            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
    1.31 +        </replace>
    1.32 +        <replace file="${temp.gf.web}">
    1.33 +            <replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
    1.34 +            <replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
    1.35 +        </replace>
    1.36 +        <xmlproperty file="${temp.gf.web}" validate="false">
    1.37 +        </xmlproperty>
    1.38 +        <delete file="${temp.gf.web}"/>
    1.39 +        <condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
    1.40 +            <isset property="glassfish-web-app.context-root"/>
    1.41 +        </condition>
    1.42 +        <condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
    1.43 +            <isset property="glassfish-web-app.context-root"/>
    1.44 +        </condition>
    1.45      </target>
    1.46      <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
    1.47          <property name="deploy.context.root.argument" value=""/>
    1.48 @@ -33,7 +60,6 @@
    1.49          <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
    1.50          <mkdir dir="${gfv3.resources.dir}"/>
    1.51          <mkdir dir="${gfv3.resources.dir}/META-INF"/>
    1.52 -        <property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
    1.53          <copy todir="${gfv3.resources.dir}/META-INF">
    1.54              <fileset dir="${deploy.ant.resource.dir}"/>
    1.55          </copy>
    1.56 @@ -42,19 +68,44 @@
    1.57          </jar>
    1.58          <delete dir="${gfv3.resources.dir}"/>
    1.59      </target>
    1.60 -    <target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
    1.61 +    <target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
    1.62 +        <antcall target="-deploy-without-pw"/>
    1.63 +        <antcall target="-deploy-with-pw"/>
    1.64 +    </target>
    1.65 +
    1.66 +    <target name="-deploy-without-pw" unless="gfv3.password">
    1.67          <echo message="Deploying ${deploy.ant.archive}"/>
    1.68          <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.69          <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
    1.70 -        <get src="${gfv3.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}?force=true?name=${ant.project.name}"
    1.71 +        <get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
    1.72              dest="${gfv3.results.file}"/>
    1.73          <delete file="${gfv3.results.file}"/>    
    1.74      </target>
    1.75 +    <target name="-deploy-with-pw" if="gfv3.password">
    1.76 +        <echo message="Deploying ${deploy.ant.archive}"/>
    1.77 +        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.78 +        <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
    1.79 +        <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
    1.80 +            dest="${gfv3.results.file}"/>
    1.81 +        <delete file="${gfv3.results.file}"/>
    1.82 +    </target>
    1.83      <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
    1.84 +        <antcall target="-undeploy-without-pw"/>
    1.85 +        <antcall target="-undeploy-with-pw"/>
    1.86 +    </target>
    1.87 +
    1.88 +    <target name="-undeploy-without-pw" unless="gfv3.password">
    1.89          <echo message="Undeploying ${deploy.ant.archive}"/>
    1.90          <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.91 -        <get src="${gfv3.url}/__asadmin/undeploy?name=${ant.project.name}"
    1.92 +        <get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
    1.93              dest="${gfv3.results.file}"/>
    1.94          <delete file="${gfv3.results.file}"/>    
    1.95      </target>
    1.96 +    <target name="-undeploy-with-pw" if="gfv3.password">
    1.97 +        <echo message="Undeploying ${deploy.ant.archive}"/>
    1.98 +        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    1.99 +        <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
   1.100 +            dest="${gfv3.results.file}"/>
   1.101 +        <delete file="${gfv3.results.file}"/>
   1.102 +    </target>
   1.103  </project>