| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Copyright (c) 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 |
| |
| --> |
| |
| <!-- |
| Set up properties for which javaws image to execute and for the |
| javaws wait option. (This option is currently broken in javaws on |
| Windows so we do not want to use it on that platform.) |
| --> |
| <condition property="os.isWindows" value="true"> |
| <os family="windows"/> |
| </condition> |
| |
| <condition property="javaws.cmd" value="${java.home}/bin/javaws.exe"> |
| <os family="windows"/> |
| </condition> |
| <condition property="javaws.cmd" value="${java.home}/bin/javaws"> |
| <not> |
| <os family="windows"/> |
| </not> |
| </condition> |
| |
| <condition property="javaws.waitOption" value="-wait"> |
| <not> |
| <os family="windows"/> |
| </not> |
| </condition> |
| |
| <condition property="javaws.waitOption" value="-wait"> |
| <os family="windows"/> |
| </condition> |
| |
| |
| <!-- runjws macro |
| |
| Attributes on the <runjws> invocation that can/must be passed in by the caller: |
| args |
| list of the values to be passed to the app client via the URL's query string. |
| |
| To use a different delimiter, pass argdelimiter with the value set to |
| the delimiter you want to use. |
| |
| argdelimiter |
| the character which separates arguments in the args value |
| |
| urlpath |
| the path part of the URL to be used in invoking the app client |
| |
| There is no default value. When you deploy a stand-alone |
| app client, the default path the app server will recognize is the |
| module ID of the app client. In tests, this is often ${appname}-client. |
| For an embedded app client, the default path the app server will |
| recognize is |
| |
| ${module ID of the Java EE app}/${URI to the appclient jar} |
| |
| The URI to the app client jar is the text value of the <java> element |
| for this app client in the ear's application.xml. |
| |
| keeptempfiles |
| |
| pass "true" to retain temporary files created to run the client; default is "false" |
| |
| sunaccdir |
| sunaccname |
| |
| define these to point to the glassfish-acc.xml directory and the file within that |
| directory to be used when invoking the client - these default to |
| ${env.S1AS_HOME}/domains/${admin.domain}/config and glassfish-acc.xml |
| |
| resultproperty |
| the name of an ant property to be set with the completion status |
| of the javaws invocation. The default is the property name "result." |
| |
| --> |
| |
| <macrodef name="run-jws"> |
| <attribute name="urlpath"/> |
| <attribute name="sunaccdir" default="${env.S1AS_HOME}/domains/${admin.domain}/config"/> |
| <attribute name="sunaccname" default="glassfish-acc.xml"/> |
| <attribute name="args" default=""/> |
| <attribute name="argdelimiter" default=" "/> |
| <attribute name="resultproperty" default="result"/> |
| <attribute name="keeptempfiles" default="false"/> |
| |
| <sequential> |
| |
| |
| <!-- |
| The next few lines convert the caller's argument list into a |
| form suitable as a query string in a URL, with arg= preceding |
| each of the caller's arguments - which is what the Java Web Start |
| feature code expects. The result is in a property that is |
| used in the one of the <exec> <arg> elements. |
| --> |
| <tempfile destdir="${build.classes.dir}" prefix="args" suffix=".tmp" property="argstemp.tmp"/> |
| <echo file="${argstemp.tmp}">@{args}</echo> |
| <replace file="${argstemp.tmp}" token="@{argdelimiter}" value="&arg="/> |
| <loadfile property="user.args.part.of.url" srcfile="${argstemp.tmp}"/> |
| |
| <condition property="user.args.introducer" value=""> |
| <equals arg1="" arg2="@{args}" trim="true"/> |
| </condition> |
| <condition property="user.args.introducer" value="&arg="> |
| <not> |
| <isset property="user.args.introducer"/> |
| </not> |
| </condition> |
| |
| |
| <!-- |
| Create a platform-neutral representation for the sunacc.xml file. |
| --> |
| <neutralize property="glassfish-acc.xml.neutral" file="@{sunaccdir}/@{sunaccname}"/> |
| |
| <property name="url" value="http://${http.host}:${http.port}@{urlpath}?arg=-xml&arg=${glassfish-acc.xml.neutral}${user.args.introducer}${user.args.part.of.url}"/> |
| <echo level="verbose">URL is ${url}</echo> |
| <exec executable="${javaws.cmd}" |
| resultproperty="@{resultproperty}" |
| failonerror="false" |
| output="${build.classes.dir}/javaws.log" |
| > |
| <arg value="${javaws.waitOption}"/> <!-- Ask Java Web Start to wait until the client finished before exiting --> |
| <arg value="${url}"/> |
| </exec> |
| |
| <condition property="discard.temp.files"> |
| <isfalse value="@{keeptempfiles}"/> |
| </condition> |
| <antcall target="delete.runjws.temp.files"/> |
| |
| </sequential> |
| </macrodef> |
| |
| <target name="delete.runjws.temp.files" if="discard.temp.files"> |
| <delete file="${argstemp.tmp}" quiet="true"/> |
| </target> |
| |
| <macrodef name="neutralize" > |
| <attribute name="property"/> |
| <attribute name="file"/> |
| <attribute name="id" default="junk.id"/> |
| <sequential> |
| <pathconvert targetos="unix" property="@{property}"> |
| <path id="@{id}"> |
| <fileset file="@{file}"/> |
| </path> |
| </pathconvert> |
| </sequential> |
| </macrodef> |
| |