blob: 6bb5c88f85f7da1be7ce3f6fe463564d7d67dc16 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project name="v2-targets" default="all" basedir=".">
<property name="war.file.ext" value="${war.file}.war"/>
<property name="deployed.app" value=""/>
<property name="as.props"
value="--user ${admin.user} --passwordfile ${admin.password.file} --echo=true --terse=true --port=${admin.port}"/>
<!--<echo file="${admin.password.file}" append="false">
AS_ADMIN_PASSWORD=${admin.password}
AS_ADMIN_ADMINPASSWORD=${admin.password}
AS_ADMIN_MASTERPASSWORD=${master.password}</echo>-->
<!--<target name="setup" unless="bInitialised">
<echo message="${config.dir}"/>
<echo message="${config.dir}/${admin.password.file}"/>
<replace file="${config.dir}/${admin.password.file}" token="@@ADMIN_PASSWORD@@" value="${admin.password}"/>
<replace file="${config.dir}/${admin.password.file}" token="@@ADMIN_PASSWORD@@" value="${admin.password}"/>
<replace file="${config.dir}/${admin.password.file}" token="@@ADMIN_MASTER_PASSWORD@@" value="${master.password}"/>
<property name="bInitialised" value=""/>
</target>-->
<target name="deploy-v2-impl">
<echo message="${deployed.app}"/>
<echo message="Please set property ${deployed.app} before calling this target"/>
<echo message="glassfish.home is ${glassfish.home}"/>
<echo message="deploying in v2 mode"/>
<echo message="./${war.file.ext}"/>
<echo message="OS is ${os.name}"/>
<record name="deploy.output" action="start"/>
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg value="deploy"/>
<arg line="${as.props}"/>
<arg line="${deployed.app}"/>
</exec>
<exec executable="${glassfish.home}/bin/asadmin" osfamily="unix">
<arg value="deploy"/>
<arg line="${as.props}"/>
<arg line="${deployed.app}"/>
</exec>
<echo message="URL of deployed app : http://${glassfish.http.host}:${glassfish.http.port}/${contextroot}"/>
<record name="deploy.output" action="stop"/>
</target>
<target name="undeploy-v2-impl">
<echo message="undeploying in v3 mode"/>
<echo message="./${war.file.ext}"/>
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg line="undeploy"/>
<arg line="${war.file}"/>
</exec>
<exec executable="${glassfish.home}/bin/asadmin" osfamily="unix">
<arg value="undeploy"/>
<arg value="${war.file}"/>
</exec>
</target>
<target name="start-server">
<echo message="${as.props}"/>
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg line="start-domain"/>
<arg line="--user ${admin.user}"/>
<arg line="--passwordfile ${admin.password.file} "/>
<arg line="${admin.domain}"/>
</exec>
<exec executable="${glassfish.home}/bin/asadmin" osfamily="unix">
<arg line="start-domain"/>
<arg line="${as.props}"/>
<arg line="${admin.domain}"/>
</exec>
</target>
<target name="stop-server">
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg line="stop-domain"/>
<arg line="${as.props}"/>
<arg line="${admin.domain}"/>
</exec>
<exec executable="${glassfish.home}/bin/asadmin" osfamily="unix">
<arg line="stop-domain"/>
<arg line="${as.props}"/>
<arg line="${admin.domain}"/>
</exec>
</target>
<target name="create-jdbc-connpool">
<property name="jdbc.conpool.name" value="sample-derby-pool"/>
<echo message="created jdbc connection pool ${jdbc.conpool.name}"
level="verbose"/>
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg line="create-jdbc-connection-pool"/>
<arg line="--datasourceclassname ${db.class}"/>
<arg line="--restype ${jdbc.resource.type}"/>
<arg line="--target ${appserver.instance.name}"/>
<arg line="${as.props}"/>
<arg line="${jdbc.conpool.name}"/>
</exec>
</target>
<!-- ================================================================ -->
<!-- Target to create JDBC resource -->
<!-- ================================================================ -->
<target name="create-jdbc-resource">
<echo message="Creating jdbc resource pool ${jdbc.resource.name}"
level="verbose"/>
<echo message="asadmin create-jdbc-resource ${as.props} --connectionpoolid ${jdbc.conpool.name} --target ${appserver.instance.name} ${jdbc.resource.name}"/>
<exec executable="cmd" osfamily="Windows">
<arg value="/c"/>
<arg value="${glassfish.home}/bin/asadmin.bat"/>
<arg line="create-jdbc-resource"/>
<arg line="${as.props}"/>
<arg line="--port ${admin.port}"/>
<arg line="--connectionpoolid ${jdbc.conpool.name}"/>
<arg line="--target ${appserver.instance.name}"/>
<arg line="${jdbc.resource.name}"/>
</exec>
<echo message="cmd executed for ${appserver.instance.name}"/>
</target>
</project>