about summary refs log tree commit diff stats
path: root/client/trunk/nbproject/jnlp-impl.xml
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-08-14 00:10:22 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-08-14 00:10:22 +0000
commit6069e787991de587979306af768738945046ff94 (patch)
tree804f826eb7af0132b5305fa492097c0726d8db48 /client/trunk/nbproject/jnlp-impl.xml
parent63cd2b169354de68ab878b53a043d5b9efa75183 (diff)
downloadinstadisc-6069e787991de587979306af768738945046ff94.tar.gz
instadisc-6069e787991de587979306af768738945046ff94.tar.bz2
instadisc-6069e787991de587979306af768738945046ff94.zip
Client: Added Java Web Start support
This has been discovered to be a much better way of Java distributation. Because of this, the loader script is no longer necessary.
Diffstat (limited to 'client/trunk/nbproject/jnlp-impl.xml')
-rw-r--r--client/trunk/nbproject/jnlp-impl.xml456
1 files changed, 456 insertions, 0 deletions
diff --git a/client/trunk/nbproject/jnlp-impl.xml b/client/trunk/nbproject/jnlp-impl.xml new file mode 100644 index 0000000..92eb364 --- /dev/null +++ b/client/trunk/nbproject/jnlp-impl.xml
@@ -0,0 +1,456 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6
7
8The contents of this file are subject to the terms of either the GNU
9General Public License Version 2 only ("GPL") or the Common
10Development and Distribution License("CDDL") (collectively, the
11"License"). You may not use this file except in compliance with the
12License. You can obtain a copy of the License at
13http://www.netbeans.org/cddl-gplv2.html
14or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15specific language governing permissions and limitations under the
16License. When distributing the software, include this License Header
17Notice in each file and include the License file at
18nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19particular file as subject to the "Classpath" exception as provided
20by Sun in the GPL Version 2 section of the License file that
21accompanied this code. If applicable, add the following below the
22License Header, with the fields enclosed by brackets [] replaced by
23your own identifying information:
24"Portions Copyrighted [year] [name of copyright owner]"
25
26Contributor(s):
27
28The Original Software is NetBeans. The Initial Developer of the Original
29Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30Microsystems, Inc. All Rights Reserved.
31
32If you wish your version of this file to be governed by only the CDDL
33or only the GPL Version 2, indicate your decision by adding
34"[Contributor] elects to include this software in this distribution
35under the [CDDL or GPL Version 2] license." If you do not indicate a
36single choice of license, a recipient has the option to distribute
37your version of this file under either the CDDL, the GPL Version 2 or
38to extend the choice of license to its licensees as provided above.
39However, if you add GPL Version 2 code and therefore, elected the GPL
40Version 2 license, then the option applies only if the new code is
41made subject to such option by the copyright holder.
42-->
43
44<project name="jnlp-impl" default="default" basedir="..">
45
46 <property name="master.jnlp.file" location="master.jnlp"/>
47 <property name="launch.jnlp.file" value="launch.jnlp"/>
48 <property name="jnlp.dest.dir" location="dist"/>
49
50 <!-- helper file to create list of arguments, etc. -->
51 <property name="helper.file" location="helper.txt"/>
52
53 <target name="default">
54 <echo message="Default target is not set."/>
55 </target>
56
57 <!-- Main target -->
58
59 <target name="jnlp" depends="-init-check,-test-jnlp-enabled" if="is.jnlp.enabled">
60 <delete file="dist/lib/javaws.jar" failonerror="false"/>
61 <antcall target="generate-jnlp"/>
62 </target>
63
64 <!-- Generate master -->
65
66 <target name="-check-for-master.jnlp">
67 <available file="${master.jnlp.file}" property="master.jnlp.exists"/>
68 </target>
69 <target name="jnlp-init-generate-master" depends="-check-for-master.jnlp" unless="master.jnlp.exists">
70 <echo file="${master.jnlp.file}" encoding="UTF-8"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
71<jnlp spec="1.0+" codebase="$${jnlp.codebase}" href="launch.jnlp">
72 <information>
73 <title>$${APPLICATION.TITLE}</title>
74 <vendor>$${APPLICATION.VENDOR}</vendor>
75 <description>$${APPLICATION.DESC}</description>
76 <description kind="short">$${APPLICATION.DESC.SHORT}</description>
77 <homepage href="$${APPLICATION.HOMEPAGE}"/>
78<!--$${JNLP.ICONS}-->
79<!--$${JNLP.OFFLINE.ALLOWED}-->
80 </information>
81<!--$${JNLP.SECURITY}-->
82 <resources>
83<!--$${JNLP.RESOURCES.RUNTIME}-->
84<!--$${JNLP.RESOURCES.MAIN.JAR}-->
85<!--$${JNLP.RESOURCES.JARS}-->
86 </resources>
87 <security>
88 <all-permissions/>
89 </security>
90 <application-desc main-class="$${jnlp.main.class}">
91<!--$${JNLP.APPLICATION.ARGS}-->
92 </application-desc>
93</jnlp>
94]]></echo>
95 </target>
96
97 <!-- Initial check -->
98
99 <target name="-init-check">
100 <fail unless="application.title" message="Must set application title."/>
101 <fail unless="application.vendor" message="Must set application vendor."/>
102 </target>
103
104 <!-- Icons -->
105
106 <target name="-init-icons" depends="-preinit-icons,-set-icon-elem,-set-splash-elem">
107 <property name="jnlp.icon.elem" value=""/>
108 <property name="application.splash.elem" value=""/>
109 <property name="icon.separator" value=""/>
110 <property name="jnlp.icons.value" value="${jnlp.icon.elem}${icon.separator}${application.splash.elem}"/>
111 </target>
112 <target name="-preinit-icons" depends="-copy-app-icon,-copy-app-splash"/>
113 <target name="-copy-app-icon" if="jnlp.icon" depends="-get-app-icon-name">
114 <copy file="${jnlp.icon}" todir="${jnlp.dest.dir}" failonerror="false"/>
115 <available file="${jnlp.dest.dir}${file.separator}${jnlp.icon.name}" property="jnlp.icon.copied"/>
116 </target>
117 <target name="-copy-app-splash" if="application.splash" depends="-get-app-splash-name">
118 <copy file="${application.splash}" todir="${jnlp.dest.dir}" failonerror="false"/>
119 <available file="${jnlp.dest.dir}${file.separator}${application.splash.name}" property="application.splash.copied"/>
120 </target>
121 <target name="-get-app-icon-name" if="jnlp.icon">
122 <dirname file="${jnlp.icon}" property="jnlp.icon.basedir"/>
123 <pathconvert property="jnlp.icon.name" setonempty="false">
124 <path location="${jnlp.icon}"/>
125 <map from="${jnlp.icon.basedir}${file.separator}" to=""/>
126 </pathconvert>
127 </target>
128 <target name="-get-app-splash-name" if="application.splash">
129 <dirname file="${application.splash}" property="application.splash.basedir"/>
130 <pathconvert property="application.splash.name" setonempty="false">
131 <path location="${application.splash}"/>
132 <map from="${application.splash.basedir}${file.separator}" to=""/>
133 </pathconvert>
134 </target>
135 <target name="-set-icon-elem" if="jnlp.icon.copied">
136 <property name="jnlp.icon.elem" value=' &lt;icon href="${jnlp.icon.name}" kind="default"/&gt;'/>
137 </target>
138 <target name="-set-splash-elem" if="application.splash.copied" depends="-set-icon-elem">
139 <property name="application.splash.elem" value=' &lt;icon href="${application.splash.name}" kind="splash"/&gt;'/>
140 <condition property="icon.separator" value="${line.separator}">
141 <isset property="jnlp.icon.elem"/>
142 </condition>
143 </target>
144
145 <!-- Offline-Allowed -->
146
147 <target name="-init-offline" if="offline.allowed.set" depends="-preinit-offline">
148 <property name="jnlp.offline.allowed.value" value=" &lt;offline-allowed/&gt;"/>
149 </target>
150 <target name="-preinit-offline">
151 <condition property="offline.allowed.set">
152 <equals arg1="${jnlp.offline-allowed}" arg2="true" trim="true"/>
153 </condition>
154 </target>
155
156 <!-- Descriptions -->
157
158 <target name="-init-descriptions" depends="-descriptions-props-check,-init-desc-value,-init-desc-value-short">
159 <property name="application.desc.value" value="${application.title}"/>
160 <property name="application.desc.short.value" value="${application.title}"/>
161 </target>
162 <target name="-descriptions-props-check">
163 <condition property="application.desc.set">
164 <and>
165 <isset property="application.desc"/>
166 <not>
167 <equals arg1="${application.desc}" arg2="" trim="true"/>
168 </not>
169 </and>
170 </condition>
171 <condition property="application.desc.short.set">
172 <and>
173 <isset property="application.desc.short"/>
174 <not>
175 <equals arg1="${application.desc.short}" arg2="" trim="true"/>
176 </not>
177 </and>
178 </condition>
179 </target>
180 <target name="-init-desc-value" if="application.desc.set">
181 <property name="application.desc.value" value="${application.desc}"/>
182 </target>
183 <target name="-init-desc-value-short" if="application.desc.short.set">
184 <property name="application.desc.short.value" value="${application.desc.short}"/>
185 </target>
186
187 <!-- Security -->
188
189 <target name="-init-security" depends="-check-signing-possible" if="jnlp.signed.true+signjarstask.available">
190 <property name="jnlp.security" value=" &lt;security&gt;${line.separator} &lt;all-permissions/&gt;${line.separator} &lt;/security&gt;"/>
191 </target>
192 <target name="-security-props-check">
193 <condition property="jnlp.signed.true">
194 <istrue value="${jnlp.signed}"/>
195 </condition>
196 </target>
197 <target name="-jnlp-init-keystore" depends="-jnlp-init-keystore-props,-check-keystore-exists" unless="jnlp.signjar.keystore.exists">
198 <echo message="${application.vendor}" file="${helper.file}"/>
199 <loadfile property="application.vendor.filtered" srcfile="${helper.file}">
200 <filterchain>
201 <deletecharacters chars=","/>
202 </filterchain>
203 </loadfile>
204 <delete file="${helper.file}"/>
205 <property name="jnlp.signjar.vendor" value="CN=${application.vendor.filtered}"/>
206 <echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
207 <genkey dname="${jnlp.signjar.vendor}" alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}"
208 storepass="${jnlp.signjar.storepass}" keypass="${jnlp.signjar.keypass}"/>
209 </target>
210 <target name="-check-keystore-exists">
211 <available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
212 </target>
213 <target name="-jnlp-init-keystore-props">
214 <property name="jnlp.signjar.keystore" value="${basedir}/build/nb-jws.ks"/>
215 <property name="jnlp.signjar.storepass" value="storepass"/>
216 <property name="jnlp.signjar.keypass" value="keypass"/>
217 <property name="jnlp.signjar.alias" value="nb-jws"/>
218 </target>
219
220 <!-- Generating JNLP file -->
221
222 <target name="generate-jnlp" depends="jnlp-init-generate-master,-init-codebase,-init-resources-runtime,-init-security,-init-resources-jars,-init-application-args,-init-icons,-init-offline,-init-descriptions,jnlp-init-notinited">
223 <copy file="${master.jnlp.file}" tofile="${jnlp.dest.dir}/${launch.jnlp.file}__" overwrite="true" encoding="UTF-8">
224 <filterchain>
225 <replacestring from="$${jnlp.codebase}" to="${jnlp.codebase.value}"/>
226 <replacestring from="&lt;!--$${JNLP.ICONS}--&gt;" to="${jnlp.icons.value}"/>
227 <replacestring from="&lt;!--$${JNLP.SECURITY}--&gt;" to="${jnlp.security}"/>
228 <replacestring from="&lt;!--$${JNLP.OFFLINE.ALLOWED}--&gt;" to="${jnlp.offline.allowed.value}"/>
229 <replacestring from="&lt;!--$${JNLP.RESOURCES.RUNTIME}--&gt;" to="${jnlp.resources.runtime.value}"/>
230 <replacestring from="&lt;!--$${JNLP.RESOURCES.MAIN.JAR}--&gt;" to="${jnlp.resources.main.jar.value}"/>
231 <replacestring from="&lt;!--$${JNLP.RESOURCES.JARS}--&gt;" to="${jnlp.resources.jars.value}"/>
232 <replacestring from="&lt;!--$${JNLP.APPLICATION.ARGS}--&gt;" to="${jnlp.application.args.value}"/>
233 <replacestring from="$${APPLICATION.TITLE}" to="${application.title}"/>
234 <replacestring from="$${APPLICATION.VENDOR}" to="${application.vendor}"/>
235 <replacestring from="$${APPLICATION.DESC}" to="${application.desc.value}"/>
236 <replacestring from="$${APPLICATION.DESC.SHORT}" to="${application.desc.short.value}"/>
237 <replacestring from="$${APPLICATION.HOMEPAGE}" to="${application.homepage}"/>
238 <replacestring from="$${jnlp.main.class}" to="${main.class}"/>
239 </filterchain>
240 </copy>
241 <antcall target="-strip-empty-lines"/>
242 <antcall target="-generate-html-page"/>
243 </target>
244 <target name="jnlp-init-notinited">
245 <property name="jnlp.security" value=""/>
246 <property name="jnlp.offline.allowed.value" value=""/>
247 <property name="application.homepage" value=""/>
248 <property name="jnlp.application.args.value" value=""/>
249 </target>
250 <target name="-strip-empty-lines">
251 <move file="${jnlp.dest.dir}/${launch.jnlp.file}__" tofile="${jnlp.dest.dir}/${launch.jnlp.file}" overwrite="true" encoding="UTF-8">
252 <filterchain>
253 <linecontainsregexp>
254 <regexp pattern=".+"/>
255 </linecontainsregexp>
256 </filterchain>
257 </move>
258 </target>
259
260 <!-- Codebase processing -->
261
262 <target name="-init-codebase" depends="-codebase-props-check,-init-non-user-codebase,-init-user-codebase"/>
263 <target name="-codebase-props-check">
264 <condition property="local.codebase">
265 <or>
266 <not>
267 <isset property="jnlp.codebase.type"/>
268 </not>
269 <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
270 </or>
271 </condition>
272 <condition property="non.user.codebase">
273 <or>
274 <not>
275 <isset property="jnlp.codebase.type"/>
276 </not>
277 <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
278 <equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/>
279 </or>
280 </condition>
281 <condition property="user.codebase">
282 <equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/>
283 </condition>
284 </target>
285 <target name="-init-non-user-codebase" if="non.user.codebase">
286 <property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/>
287 </target>
288 <target name="-init-user-codebase" if="user.codebase">
289 <property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/>
290 </target>
291
292 <!-- j2se resources -->
293
294 <target name="-init-resources-runtime" depends="-init-runtime-props">
295 <property name="run.jvmargs.value" value=""/>
296 <property name="initial-heap-size.value" value=""/>
297 <property name="max-heap-size.value" value=""/>
298 <property name="jnlp.resources.runtime.value"
299 value=' &lt;j2se version="${javac.target}+"${initial-heap-size.value}${max-heap-size.value}${run.jvmargs.value}/&gt;'/>
300 </target>
301 <target name="-init-runtime-props" depends="-runtime-props-check,-init-run-jvmargs-value,-init-initial-heap-size-value,-init-max-heap-size-value"/>
302 <target name="-runtime-props-check">
303 <condition property="run.jvmargs.set">
304 <and>
305 <isset property="run.jvmargs"/>
306 <not>
307 <equals arg1="${run.jvmargs}" arg2="" trim="true"/>
308 </not>
309 </and>
310 </condition>
311 <condition property="jnlp.initial-heap-size.set">
312 <and>
313 <isset property="jnlp.initial-heap-size"/>
314 <not>
315 <equals arg1="${jnlp.initial-heap-size}" arg2="" trim="true"/>
316 </not>
317 </and>
318 </condition>
319 <condition property="jnlp.max-heap-size.set">
320 <and>
321 <isset property="jnlp.max-heap-size"/>
322 <not>
323 <equals arg1="${jnlp.max-heap-size}" arg2="" trim="true"/>
324 </not>
325 </and>
326 </condition>
327 </target>
328 <target name="-init-run-jvmargs-value" if="run.jvmargs.set">
329 <property name="run.jvmargs.value" value=' java-vm-args="${run.jvmargs}"'/>
330 </target>
331 <target name="-init-initial-heap-size-value" if="jnlp.initial-heap-size.set">
332 <property name="initial-heap-size.value" value=' initial-heap-size="${jnlp.initial-heap-size}"'/>
333 </target>
334 <target name="-init-max-heap-size-value" if="jnlp.max-heap-size.set">
335 <property name="max-heap-size.value" value=' max-heap-size="${jnlp.max-heap-size}"'/>
336 </target>
337
338 <!-- JAR resources -->
339
340 <target name="-init-resources-jars" depends="-preinit-resources-unsigned-jars,-preinit-resources-signed-jars,-preinit-resources-main-jar"/>
341 <target name="-preinit-resources-unsigned-jars" depends="-exclude-javaws-from-cp,-check-signing-possible" unless="jnlp.signed.true+signjarstask.available">
342 <pathconvert pathsep="${line.separator}" property="jnlp.resources.jars.value">
343 <path path="${run.classpath.without.javaws.jar}"/>
344 <mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
345 to=' &lt;jar href="lib/\1" download="eager"/&gt;'/>
346 </pathconvert>
347 </target>
348 <target name="-preinit-resources-main-jar">
349 <pathconvert pathsep="${line.separator}" property="jnlp.resources.main.jar.value">
350 <path location="${dist.jar}"/>
351 <mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
352 to=' &lt;jar href="\1" main="true" download="eager"/&gt;'/>
353 </pathconvert>
354 </target>
355 <target name="-exclude-javaws-from-cp">
356 <pathconvert property="path.element.to.be.removed">
357 <path path="${run.classpath}"/>
358 <mapper type="regexp" from="(^.*[/\\]javaws.jar)" to="\1"/>
359 </pathconvert>
360 <pathconvert property="run.classpath.without.javaws.jar">
361 <path path="${run.classpath}"/>
362 <map from="${path.element.to.be.removed}" to=""/>
363 </pathconvert>
364 </target>
365 <target name="-check-task-available">
366 <condition property="signjarstask.available">
367 <isset property="netbeans.home"/>
368 </condition>
369 </target>
370 <target name="-check-signing-possible" depends="-security-props-check,-check-task-available">
371 <condition property="jnlp.signed.true+signjarstask.available">
372 <and>
373 <isset property="jnlp.signed.true"/>
374 <isset property="signjarstask.available"/>
375 </and>
376 </condition>
377 </target>
378 <target name="-unavailable-task-warning" depends="-check-task-available" unless="signjarstask.available">
379 <echo message="Signtask is not available, jar files will not be signed. Task is available only when running inside NetBeans IDE."/>
380 </target>
381 <target name="-preinit-resources-signed-jars" depends="-unavailable-task-warning,-sign-jars" if="jnlp.signed.true+signjarstask.available">
382 <property name="jnlp.resources.jars.value" value="${jnlp.signed.jars}${jnlp.components}"/>
383 </target>
384 <target name="-sign-jars" depends="-jnlp-init-keystore,-check-signing-possible" if="jnlp.signed.true+signjarstask.available">
385 <jnlpsignjars keystore="${jnlp.signjar.keystore}" storepass="${jnlp.signjar.storepass}"
386 keypass="${jnlp.signjar.keypass}" alias="${jnlp.signjar.alias}" mainjar="${dist.jar}" destdir="dist"
387 codebase="${jnlp.codebase.value}" signedjarsprop="jnlp.signed.jars"
388 componentsprop="jnlp.components">
389 <fileset dir="dist/lib">
390 <include name="*.jar"/>
391 </fileset>
392 </jnlpsignjars>
393 </target>
394
395 <!-- Application arguments -->
396
397 <target name="-init-application-args" if="application.args">
398 <echo message="${application.args}" file="${helper.file}"/>
399 <loadfile srcfile="${helper.file}" property="jnlp.application.args.value">
400 <filterchain>
401 <tokenfilter delimoutput="\n">
402 <stringtokenizer/>
403 <replaceregex pattern="(.+)" replace=" &lt;argument&gt;\1&lt;/argument&gt;"/>
404 </tokenfilter>
405 </filterchain>
406 </loadfile>
407 <delete file="${helper.file}"/>
408 </target>
409
410 <!-- Running/Debugging -->
411
412 <target name="jws-run" depends="jar,-verify-jnlp-enabled,-verify-codebase" description="Start javaws execution">
413 <exec executable="${java.home}/bin/javaws">
414 <arg file="${jnlp.dest.dir}/${launch.jnlp.file}"/>
415 </exec>
416 </target>
417 <target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee"
418 description="Debug javaws project in IDE"/>
419 <target name="-debug-javaws-debuggee">
420 <exec executable="${java.home}/bin/javaws">
421 <env key="JAVAWS_VM_ARGS" value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
422 <arg file="${jnlp.dest.dir}/${launch.jnlp.file}"/>
423 </exec>
424 </target>
425 <target name="-verify-codebase" depends="-codebase-props-check" unless="local.codebase">
426 <fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution."/>
427 </target>
428 <target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled">
429 <fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/>
430 </target>
431
432 <!-- Test JNLP enabled-->
433
434 <target name="-test-jnlp-enabled">
435 <condition property="is.jnlp.enabled">
436 <equals arg1="${jnlp.enabled}" arg2="true" casesensitive="false" trim="true"/>
437 </condition>
438 </target>
439
440 <!-- Generate simple HTML test page -->
441
442 <target name="-generate-html-page">
443 <echo file="${jnlp.dest.dir}/launch.html"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
444<html>
445 <head>
446 <title>Test page for launching the application via JNLP</title>
447 </head>
448 <body>
449 <h3>Test page for launching the application via JNLP</h3>
450 <a href="launch.jnlp">Launch the application</a>
451 </body>
452</html>
453]]></echo>
454 </target>
455
456</project>