VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/glue-jaxws.xsl@ 20851

Last change on this file since 20851 was 20851, checked in by vboxsync, 16 years ago

Webservice: handle NULL pointer object arguments in methods and return values correctly, both in raw webservice and OO JAX-WS wrappers

  • Property svn:eol-style set to native
File size: 50.1 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 websrv-jax-ws.xsl:
5 XSLT stylesheet that generates virtualbox.java from
6 VirtualBox.xidl. This generated Java code contains
7 a Java wrapper that allows client code to use the
8 webservice in an object-oriented way.
9
10 Copyright (C) 2006-2008 Sun Microsystems, Inc.
11
12 This file is part of VirtualBox Open Source Edition (OSE), as
13 available from http://www.virtualbox.org. This file is free software;
14 you can redistribute it and/or modify it under the terms of the GNU
15 General Public License (GPL) as published by the Free Software
16 Foundation, in version 2 as it comes in the "COPYING" file of the
17 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
20 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21 Clara, CA 95054 USA or visit http://www.sun.com if you need
22 additional information or have any questions.
23-->
24
25<xsl:stylesheet
26 version="1.0"
27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
29 xmlns:exsl="http://exslt.org/common"
30 extension-element-prefixes="exsl">
31
32 <xsl:output method="text"/>
33
34 <xsl:strip-space elements="*"/>
35
36<!-- - - - - - - - - - - - - - - - - - - - - - -
37 global XSLT variables
38 - - - - - - - - - - - - - - - - - - - - - - -->
39
40<xsl:variable name="G_xsltFilename" select="'glue-jaxws.xsl'" />
41<!-- Keep in sync with VBOX_JAVA_PACKAGE in webservices/Makefile.kmk -->
42<xsl:variable name="G_virtualBoxPackage" select="concat('org.virtualbox',$G_vboxApiSuffix)" />
43<xsl:variable name="G_virtualBoxPackage2" select="concat('com.sun.xml.ws.commons.virtualbox',$G_vboxApiSuffix)" />
44<xsl:variable name="G_virtualBoxWsdl" select="concat(concat('&quot;vboxwebService',$G_vboxApiSuffix), '.wsdl&quot;')" />
45
46<xsl:include href="websrv-shared.inc.xsl" />
47
48<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
49 quick lookup -->
50<xsl:variable name="G_setSuppressedInterfaces"
51 select="//interface[@wsmap='suppress']" />
52
53
54<xsl:template name="fileheader">
55 <xsl:param name="name" />
56 <xsl:text>/**
57 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
58 *
59 * This file is part of a free software library; you can redistribute
60 * it and/or modify it under the terms of the GNU Lesser General
61 * Public License version 2.1 as published by the Free Software
62 * Foundation and shipped in the "COPYING.LIB" file with this library.
63 * The library is distributed in the hope that it will be useful,
64 * but WITHOUT ANY WARRANTY of any kind.
65 *
66 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
67 * any license choice other than GPL or LGPL is available it will
68 * apply instead, Sun elects to use only the Lesser General Public
69 * License version 2.1 (LGPLv2) at this time for any software where
70 * a choice of LGPL license versions is made available with the
71 * language indicating that LGPLv2 or any later version may be used,
72 * or where a choice of which version of the LGPL is applied is
73 * otherwise unspecified.
74 *
75 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
76 * Clara, CA 95054 USA or visit http://www.sun.com if you need
77 * additional information or have any questions.
78 *
79</xsl:text>
80 <xsl:value-of select="concat(' * ',$name)"/>
81<xsl:text>
82 *
83 * DO NOT EDIT! This is a generated file.
84 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
85 * Generator: src/VBox/Main/webservice/glue-jaxws.xsl
86 */
87
88</xsl:text>
89</xsl:template>
90
91<xsl:template name="fullClassName">
92 <xsl:param name="name" />
93 <xsl:param name="origname" />
94 <xsl:param name="collPrefix" />
95 <xsl:variable name="coll" select="//collection[@name=$name]" />
96 <xsl:choose>
97 <xsl:when test="//collection[@name=$name]">
98 <!-- for collections and safearrays we return element type -->
99 <xsl:call-template name="fullClassName">
100 <xsl:with-param name="name" select="concat($collPrefix,//collection[@name=$name]/@type)" />
101 <xsl:with-param name="origname" select="//collection[@name=$name]/@type" />
102 <xsl:with-param name="collPrefix" select="$collPrefix" />
103 </xsl:call-template>
104 <!-- <xsl:value-of select="concat('org.virtualbox.', concat($collPrefix,//collection[@name=$name]/@type))" /> -->
105 </xsl:when>
106 <xsl:when test="//enum[@name=$name] or //enum[@name=$origname]">
107 <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
108 </xsl:when>
109 <xsl:when test="$collPrefix and //interface[@name=$origname]/@wsmap='managed'">
110 <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
111 </xsl:when>
112 <xsl:when test="//interface[@name=$name]/@wsmap='struct' or //interface[@name=$origname]/@wsmap='struct'">
113 <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
114 </xsl:when>
115 <xsl:otherwise>
116 <xsl:value-of select="concat($G_virtualBoxPackage2, concat('.', $name))" />
117 </xsl:otherwise>
118 </xsl:choose>
119</xsl:template>
120
121<!--
122 typeIdl2Glue: converts $type into a type as used by the java glue code.
123 For example, for an XIDL IMachineCollection, this will return
124 "List<com.sun.xml.ws.commons.virtualbox.IMachine>".
125 -->
126<xsl:template name="typeIdl2Glue">
127 <xsl:param name="ifname" />
128 <xsl:param name="method" />
129 <xsl:param name="name" />
130 <xsl:param name="type" />
131 <xsl:param name="safearray" />
132 <xsl:param name="forceelem" />
133
134 <xsl:variable name="needarray" select="($safearray='yes' or //collection[@name=$type]) and not($forceelem='yes')" />
135
136 <xsl:if test="$needarray">
137 <xsl:value-of select="'List&lt;'" />
138 </xsl:if>
139
140 <xsl:choose>
141 <xsl:when test="$type='wstring'">String</xsl:when>
142 <xsl:when test="$type='boolean'">Boolean</xsl:when>
143<!-- <xsl:when test="$type='double'">double</xsl:when> -->
144<!-- <xsl:when test="$type='float'">float</xsl:when> -->
145 <!-- <xsl:when test="$type='octet'">byte</xsl:when> -->
146<!-- <xsl:when test="$type='short'">short</xsl:when> -->
147 <xsl:when test="$type='unsigned short'">Integer</xsl:when>
148 <xsl:when test="$type='long'">Integer</xsl:when>
149 <xsl:when test="$type='long long'">Long</xsl:when>
150 <xsl:when test="$type='unsigned long'">Long</xsl:when>
151 <xsl:when test="$type='unsigned long long'">BigInteger</xsl:when>
152 <xsl:when test="$type='result'">Long</xsl:when>
153 <xsl:when test="$type='uuid'">UUID</xsl:when>
154 <!-- not a standard type: then it better be one of the types defined in the XIDL -->
155 <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
156 <xsl:otherwise>
157 <xsl:call-template name="fullClassName">
158 <xsl:with-param name="name" select="$type" />
159 <xsl:with-param name="collPrefix" select="''"/>
160 </xsl:call-template>
161 </xsl:otherwise>
162 <!-- <xsl:otherwise> -->
163<!-- <xsl:call-template name="fatalError"> -->
164<!-- <xsl:with-param name="msg" select="concat('typeIdl2Glue: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; is not supported.')" /> -->
165<!-- </xsl:call-template> -->
166<!-- </xsl:otherwise> -->
167 </xsl:choose>
168
169 <xsl:if test="$needarray">
170 <xsl:value-of select="'&gt;'" />
171 </xsl:if>
172</xsl:template>
173
174<!--
175 typeIdl2Java: converts $type into a type as used by the JAX-WS backend.
176 For example, for an XIDL IMachineCollection, this will return
177 "ArrayOfIMachine".
178 -->
179<xsl:template name="typeIdl2Java">
180 <xsl:param name="ifname" />
181 <xsl:param name="method" />
182 <xsl:param name="name" />
183 <xsl:param name="type" />
184 <xsl:param name="safearray" />
185
186 <xsl:if test="$safearray">
187 <xsl:value-of select="'List&lt;'" />
188 </xsl:if>
189
190 <xsl:choose>
191 <xsl:when test="$type='wstring'">String</xsl:when>
192 <xsl:when test="$type='boolean'">Boolean</xsl:when>
193 <!-- <xsl:when test="$type='double'">double</xsl:when> -->
194 <!-- <xsl:when test="$type='float'">float</xsl:when> -->
195 <!-- <xsl:when test="$type='octet'">byte</xsl:when> -->
196 <!-- <xsl:when test="$type='short'">short</xsl:when> -->
197 <xsl:when test="$type='unsigned short'">int</xsl:when>
198 <xsl:when test="$type='long'">Integer</xsl:when>
199 <xsl:when test="$type='long long'">Long</xsl:when>
200 <xsl:when test="$type='unsigned long'">Long</xsl:when>
201 <xsl:when test="$type='unsigned long long'">BigInteger</xsl:when>
202 <xsl:when test="$type='result'">Long</xsl:when>
203 <xsl:when test="$type='uuid'">String</xsl:when>
204 <xsl:when test="$type='$unknown'">String</xsl:when>
205 <xsl:when test="//interface[@name=$type]/@wsmap='managed'">String</xsl:when>
206 <xsl:otherwise>
207 <xsl:call-template name="fullClassName">
208 <xsl:with-param name="name" select="$type" />
209 <xsl:with-param name="collPrefix" select="'ArrayOf'"/>
210 </xsl:call-template>
211 </xsl:otherwise>
212 <!-- <xsl:otherwise> -->
213<!-- <xsl:call-template name="fatalError"> -->
214<!-- <xsl:with-param name="msg" select="concat('typeIdl2Java: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; is not supported.')" /> -->
215<!-- </xsl:call-template> -->
216<!-- </xsl:otherwise> -->
217 </xsl:choose>
218 <xsl:if test="$safearray">
219 <xsl:value-of select="'&gt;'" />
220 </xsl:if>
221</xsl:template>
222
223<xsl:template name="cookOutParam">
224 <xsl:param name="ifname"/>
225 <xsl:param name="methodname"/>
226 <xsl:param name="value"/>
227 <xsl:param name="idltype"/>
228 <xsl:param name="safearray"/>
229 <xsl:choose>
230 <xsl:when test="$idltype='uuid'">
231 <xsl:choose>
232 <xsl:when test="$safearray">
233 <xsl:value-of select="concat('Helper.uuidWrap(',$value,')')" />
234 </xsl:when>
235 <xsl:otherwise>
236 <xsl:value-of select="concat('UUID.fromString(',$value,')')" />
237 </xsl:otherwise>
238 </xsl:choose>
239 </xsl:when>
240 <xsl:when test="//collection[@name=$idltype]">
241 <xsl:variable name="elemtype">
242 <xsl:call-template name="typeIdl2Glue">
243 <xsl:with-param name="ifname" select="$ifname" />
244 <xsl:with-param name="method" select="$methodname" />
245 <xsl:with-param name="name" select="$value" />
246 <xsl:with-param name="type" select="$idltype" />
247 <xsl:with-param name="forceelem" select="'yes'" />
248 </xsl:call-template>
249 </xsl:variable>
250 <xsl:choose>
251 <xsl:when test="contains($elemtype, $G_virtualBoxPackage)">
252 <xsl:value-of select="concat($value,'.getArray()')" />
253 </xsl:when>
254 <xsl:otherwise>
255 <xsl:value-of select="concat('Helper.wrap(', $elemtype, '.class, port, ((',
256 $value,' == null)? null : ',$value,'.getArray()))')" />
257 </xsl:otherwise>
258 </xsl:choose>
259 </xsl:when>
260 <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
261 <xsl:choose>
262 <xsl:when test="//interface[@name=$idltype]/@wsmap='struct' and $safearray='yes'">
263 <xsl:value-of select="concat('/* 2 */', $value)" />
264 </xsl:when>
265 <xsl:when test="//interface[@name=$idltype]/@wsmap='struct'">
266 <xsl:value-of select="$value" />
267 </xsl:when>
268 <xsl:when test="$safearray='yes'">
269 <xsl:variable name="elemtype">
270 <xsl:call-template name="typeIdl2Glue">
271 <xsl:with-param name="ifname" select="$ifname" />
272 <xsl:with-param name="method" select="$methodname" />
273 <xsl:with-param name="name" select="$value" />
274 <xsl:with-param name="type" select="$idltype" />
275 <xsl:with-param name="safearray" select="'no'" />
276 <xsl:with-param name="forceelem" select="'yes'" />
277 </xsl:call-template>
278 </xsl:variable>
279 <xsl:value-of select="concat('Helper.wrap(',$elemtype, '.class, port, ', $value,')')"/>
280 </xsl:when>
281 <xsl:otherwise>
282 <xsl:variable name="gluetype">
283 <xsl:call-template name="typeIdl2Glue">
284 <xsl:with-param name="ifname" select="$ifname" />
285 <xsl:with-param name="method" select="$methodname" />
286 <xsl:with-param name="name" select="$value" />
287 <xsl:with-param name="type" select="$idltype" />
288 <xsl:with-param name="safearray" select="$safearray" />
289 </xsl:call-template>
290 </xsl:variable>
291 <!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then -->
292 <xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" />
293 </xsl:otherwise>
294 </xsl:choose>
295 </xsl:when>
296 <xsl:otherwise>
297 <xsl:value-of select="$value"/>
298 </xsl:otherwise>
299 </xsl:choose>
300</xsl:template>
301
302<xsl:template name="emitArgInMethodImpl">
303 <xsl:param name="paramname" select="@name" />
304 <xsl:param name="paramtype" select="@type" />
305 <!-- per-argument special type handling -->
306 <xsl:choose>
307 <xsl:when test="//interface[@name=$paramtype] or $paramtype='$unknown'">
308 <xsl:choose>
309 <xsl:when test="@dir='out'">
310 <xsl:value-of select="concat('tmp', $paramname)" />
311 </xsl:when>
312 <xsl:otherwise>
313 <xsl:choose>
314 <xsl:when test="@safearray='yes'">
315 <xsl:value-of select="concat('Helper.unwrap(',$paramname,')')"/>
316 </xsl:when>
317 <xsl:otherwise>
318 <xsl:value-of select="concat('((', $paramname, ' == null)?null:', $paramname, '.getRef())')" />
319 </xsl:otherwise>
320 </xsl:choose>
321 </xsl:otherwise>
322 </xsl:choose>
323 </xsl:when>
324 <xsl:when test="$paramtype='uuid'">
325 <xsl:value-of select="concat($paramname, '.toString()')" />
326 </xsl:when>
327 <xsl:otherwise>
328 <xsl:value-of select="$paramname" />
329 </xsl:otherwise>
330 </xsl:choose>
331 <xsl:if test="not(position()=last())">
332 <xsl:text>, </xsl:text>
333 </xsl:if>
334</xsl:template>
335
336<xsl:template name="startFile">
337 <xsl:param name="file" />
338
339 <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $file, '&quot;&#10;&#10;')" />
340 <xsl:call-template name="fileheader">
341 <xsl:with-param name="name" select="$file" />
342 </xsl:call-template>
343package <xsl:value-of select="$G_virtualBoxPackage2" />;
344
345import <xsl:value-of select="$G_virtualBoxPackage" />.VboxPortType;
346import <xsl:value-of select="$G_virtualBoxPackage" />.VboxService;
347import <xsl:value-of select="$G_virtualBoxPackage" />.InvalidObjectFaultMsg;
348import <xsl:value-of select="$G_virtualBoxPackage" />.RuntimeFaultMsg;
349import javax.xml.ws.WebServiceException;
350</xsl:template>
351
352<xsl:template name="endFile">
353 <xsl:param name="file" />
354 <xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $file, '&quot;&#10;&#10;')" />
355</xsl:template>
356
357<!-- - - - - - - - - - - - - - - - - - - - - - -
358 root match
359 - - - - - - - - - - - - - - - - - - - - - - -->
360
361<xsl:template match="/idl">
362 <xsl:if test="not($G_vboxApiSuffix)">
363 <xsl:call-template name="fatalError">
364 <xsl:with-param name="msg" select="'G_vboxApiSuffix must be given'" />
365 </xsl:call-template>
366 </xsl:if>
367 <xsl:call-template name="startFile">
368 <xsl:with-param name="file" select="'IUnknown.java'" />
369 </xsl:call-template>
370
371 <xsl:text><![CDATA[
372public class IUnknown
373{
374 protected String _this; /* almost final, could only be set in finalizer */
375 protected final VboxPortType port;
376
377 public IUnknown(String _this, VboxPortType port)
378 {
379 this._this = _this;
380 this.port = port;
381 }
382
383 public final String getRef()
384 {
385 return _this;
386 }
387
388 public final VboxPortType getRemoteWSPort()
389 {
390 return port;
391 }
392
393 public synchronized void releaseRemote() throws WebServiceException
394 {
395 if (_this == null) {
396 return;
397 }
398 try {
399 port.iManagedObjectRefRelease(_this);
400 _this = null;
401 } catch (InvalidObjectFaultMsg e) {
402 throw new WebServiceException(e);
403 } catch (RuntimeFaultMsg e) {
404 throw new WebServiceException(e);
405 }
406 }
407
408 /*
409 protected void finalize()
410 {
411 try {
412 releaseRemote();
413 } catch (WebServiceException e) {
414 }
415 } */
416
417 // may need to support some sort of QueryInterface, to make this class useable
418 // not only as common baseclass
419}
420]]></xsl:text>
421
422 <xsl:call-template name="endFile">
423 <xsl:with-param name="file" select="'IUnknown.java'" />
424 </xsl:call-template>
425
426 <xsl:call-template name="startFile">
427 <xsl:with-param name="file" select="'Helper.java'" />
428 </xsl:call-template>
429
430<xsl:text><![CDATA[
431
432import java.util.List;
433import java.util.ArrayList;
434import java.util.Collections;
435import java.util.UUID;
436import java.lang.reflect.Constructor;
437import java.lang.reflect.InvocationTargetException;
438
439class Helper {
440 public static <T> List<T> wrap(Class<T> wrapperClass, VboxPortType pt, List<String> thisPtrs) {
441 try {
442 if(thisPtrs==null) return Collections.emptyList();
443
444 Constructor<T> c = wrapperClass.getConstructor(String.class, VboxPortType.class);
445 List<T> ret = new ArrayList<T>(thisPtrs.size());
446 for (String thisPtr : thisPtrs) {
447 ret.add(c.newInstance(thisPtr,pt));
448 }
449 return ret;
450 } catch (NoSuchMethodException e) {
451 throw new AssertionError(e);
452 } catch (InstantiationException e) {
453 throw new AssertionError(e);
454 } catch (IllegalAccessException e) {
455 throw new AssertionError(e);
456 } catch (InvocationTargetException e) {
457 throw new AssertionError(e);
458 }
459 }
460
461 public static List<UUID> uuidWrap(List<String> uuidVals) {
462 List<UUID> ret = new ArrayList<UUID>(uuidVals.size());
463 for (String uuid : uuidVals) {
464 ret.add(UUID.fromString(uuid));
465 }
466 return ret;
467 }
468
469 public static <T extends IUnknown> List<String> unwrap(List<T> thisPtrs) {
470 if (thisPtrs==null) return Collections.emptyList();
471
472 List<String> ret = new ArrayList<String>();
473 for (T obj : thisPtrs) {
474 ret.add(obj.getRef());
475 }
476 return ret;
477 }
478}
479]]></xsl:text>
480
481 <xsl:call-template name="endFile">
482 <xsl:with-param name="file" select="'Helper.java'" />
483 </xsl:call-template>
484
485 <xsl:call-template name="startFile">
486 <xsl:with-param name="file" select="'IWebsessionManager.java'" />
487 </xsl:call-template>
488
489
490import java.net.URL;
491import java.math.BigInteger;
492import java.util.List;
493import java.util.Map;
494import java.util.HashMap;
495import java.util.UUID;
496import javax.xml.namespace.QName;
497import javax.xml.ws.BindingProvider;
498import javax.xml.ws.Holder;
499import javax.xml.ws.WebServiceException;
500
501class PortPool
502{
503 private final static String wsdlFile = <xsl:value-of select="$G_virtualBoxWsdl" />;
504
505 <xsl:text><![CDATA[
506 private Map<VboxPortType, Integer> known;
507 private boolean initStarted;
508 private VboxService svc;
509
510 PortPool(boolean usePreinit)
511 {
512 known = new HashMap<VboxPortType, Integer>();
513
514 if (usePreinit)
515 {
516 new Thread(new Runnable()
517 {
518 public void run()
519 {
520 // need to sync on something else but 'this'
521 synchronized (known)
522 {
523 initStarted = true;
524 known.notify();
525 }
526
527 preinit();
528 }
529 }).start();
530
531 synchronized (known)
532 {
533 while (!initStarted)
534 {
535 try {
536 known.wait();
537 } catch (InterruptedException e) {
538 break;
539 }
540 }
541 }
542 }
543 }
544
545 private synchronized void preinit()
546 {
547 VboxPortType port = getPort();
548 releasePort(port);
549 }
550
551 synchronized VboxPortType getPort()
552 {
553 VboxPortType port = null;
554 for (VboxPortType cur: known.keySet())
555 {
556 if (known.get(cur) == 0)
557 {
558 port = cur;
559 break;
560 }
561 }
562
563 if (port == null)
564 {
565 if (svc == null) {
566 URL wsdl = PortPool.class.getClassLoader().getResource(wsdlFile);
567 if (wsdl == null)
568 throw new LinkageError(wsdlFile+" not found, but it should have been in the jar");
569 svc = new VboxService(wsdl,
570 new QName("http://www.virtualbox.org/Service",
571 "vboxService"));
572 }
573 port = svc.getVboxServicePort();
574 }
575 known.put(port, new Integer(1));
576 return port;
577 }
578
579 synchronized void releasePort(VboxPortType port)
580 {
581 Integer val = known.get(port);
582 if (val == null || val == 0)
583 {
584 // know you not
585 return;
586 }
587 known.put(port, val - 1);
588 }
589}
590
591public class IWebsessionManager {
592
593 private static PortPool pool = new PortPool(true);
594 protected VboxPortType port;
595
596 public IWebsessionManager(URL url)
597 {
598 connect(url);
599 }
600
601 public IWebsessionManager(String url)
602 {
603 connect(url);
604 }
605
606 public IWebsessionManager(URL url, Map<String, Object> requestContext, Map<String, Object> responseContext)
607 {
608 connect(url.toExternalForm(), requestContext, responseContext);
609 }
610
611 public IWebsessionManager(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
612 {
613 connect(url, requestContext, responseContext);
614 }
615
616 public void connect(URL url)
617 {
618 connect(url.toExternalForm());
619 }
620
621 public void connect(String url)
622 {
623 this.port = pool.getPort();
624 ((BindingProvider)port).getRequestContext().
625 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
626 }
627
628 public void connect(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
629 {
630 this.port = pool.getPort();
631
632 ((BindingProvider)port).getRequestContext();
633 if (requestContext != null)
634 ((BindingProvider)port).getRequestContext().putAll(requestContext);
635
636 if (responseContext != null)
637 ((BindingProvider)port).getResponseContext().putAll(responseContext);
638
639 ((BindingProvider)port).getRequestContext().
640 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
641 }
642
643
644 public void disconnect(IVirtualBox refIVirtualBox)
645 {
646 logoff(refIVirtualBox);
647 pool.releasePort(port);
648 }
649
650 public void cleanupUnused()
651 {
652 System.gc();
653 Runtime.getRuntime().runFinalization();
654 }
655
656 /* method IWebsessionManager::logon(
657 [in] wstring username,
658 [in] wstring password,
659 [return] IVirtualBox return)
660 */
661 public IVirtualBox logon(String username, String password) {
662 try {
663 String retVal = port.iWebsessionManagerLogon(username, password);
664 return new IVirtualBox(retVal, port);
665 } catch (InvalidObjectFaultMsg e) {
666 throw new WebServiceException(e);
667 } catch (RuntimeFaultMsg e) {
668 throw new WebServiceException(e);
669 }
670 }
671
672 /* method IWebsessionManager::getSessionObject(
673 [in] IVirtualBox refIVirtualBox,
674 [return] ISession return)
675 */
676 public ISession getSessionObject(IVirtualBox refIVirtualBox) {
677 try {
678 String retVal = port.iWebsessionManagerGetSessionObject(((refIVirtualBox == null)?null:refIVirtualBox.getRef()));
679 return new ISession(retVal, port);
680 } catch (InvalidObjectFaultMsg e) {
681 throw new WebServiceException(e);
682 } catch (RuntimeFaultMsg e) {
683 throw new WebServiceException(e);
684 }
685 }
686
687 /* method IWebsessionManager::logoff(
688 [in] IVirtualBox refIVirtualBox)
689 */
690 public void logoff(IVirtualBox refIVirtualBox) {
691 try {
692 port.iWebsessionManagerLogoff(((refIVirtualBox == null)?null:refIVirtualBox.getRef()));
693 } catch (InvalidObjectFaultMsg e) {
694 throw new WebServiceException(e);
695 } catch (RuntimeFaultMsg e) {
696 throw new WebServiceException(e);
697 }
698 }
699}
700]]></xsl:text>
701 <xsl:call-template name="endFile">
702 <xsl:with-param name="file" select="'IWebsessionManager.java'" />
703 </xsl:call-template>
704
705 <xsl:text>// ######## COLLECTIONS&#10;&#10;</xsl:text>
706
707 <xsl:for-each select="//collection">
708 <xsl:variable name="type" select="@type" />
709 <xsl:variable name="arrayoftype" select="concat('ArrayOf', @type)" />
710 <xsl:variable name="filename" select="$arrayoftype" />
711
712 <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $filename, '.java&quot;&#10;&#10;')" />
713
714 <xsl:call-template name="startFile">
715 <xsl:with-param name="file" select="concat($filename, '.java')" />
716 </xsl:call-template>
717
718 <xsl:text>import java.util.ArrayList;&#10;</xsl:text>
719 <xsl:text>import java.util.List;&#10;</xsl:text>
720 <xsl:text>import javax.xml.bind.annotation.XmlAccessType;&#10;</xsl:text>
721 <xsl:text>import javax.xml.bind.annotation.XmlAccessorType;&#10;</xsl:text>
722 <xsl:text>import javax.xml.bind.annotation.XmlType;&#10;&#10;</xsl:text>
723
724 <xsl:text>@XmlAccessorType(XmlAccessType.FIELD)&#10;</xsl:text>
725 <xsl:value-of select="concat('@XmlType(name = &quot;', $arrayoftype, '&quot;, propOrder = {&#10;')" />
726 <xsl:text> "array"&#10;</xsl:text>
727 <xsl:text>})&#10;&#10;</xsl:text>
728 <xsl:value-of select="concat('public class ', $arrayoftype, ' {&#10;&#10;')" />
729
730 <xsl:text> protected List&lt;String&gt; array;&#10;&#10;</xsl:text>
731
732 <xsl:text> public List&lt;String&gt; getArray() {&#10;</xsl:text>
733 <xsl:text> if (array == null) {&#10;</xsl:text>
734 <xsl:text> array = new ArrayList&lt;String&gt;();&#10;</xsl:text>
735 <xsl:text> }&#10;</xsl:text>
736 <xsl:text> return this.array;&#10;</xsl:text>
737 <xsl:text> }&#10;&#10;</xsl:text>
738 <xsl:text>}&#10;</xsl:text>
739 <xsl:call-template name="endFile">
740 <xsl:with-param name="file" select="concat($filename, '.java')" />
741 </xsl:call-template>
742
743 </xsl:for-each>
744
745 <xsl:text>// ######## ENUMS&#10;&#10;</xsl:text>
746
747 <xsl:for-each select="//enum">
748 <xsl:variable name="enumname" select="@name" />
749 <xsl:variable name="filename" select="$enumname" />
750
751 <xsl:call-template name="startFile">
752 <xsl:with-param name="file" select="concat($filename, '.java')" />
753 </xsl:call-template>
754
755 <xsl:text>import javax.xml.bind.annotation.XmlEnum;&#10;</xsl:text>
756 <xsl:text>import javax.xml.bind.annotation.XmlEnumValue;&#10;</xsl:text>
757 <xsl:text>import javax.xml.bind.annotation.XmlType;&#10;&#10;</xsl:text>
758
759 <xsl:value-of select="concat('@XmlType(name = &quot;', $enumname, '&quot;)&#10;')" />
760 <xsl:text>@XmlEnum&#10;</xsl:text>
761 <xsl:value-of select="concat('public enum ', $enumname, ' {&#10;&#10;')" />
762 <xsl:for-each select="const">
763 <xsl:variable name="enumconst" select="@name" />
764 <xsl:value-of select="concat(' @XmlEnumValue(&quot;', $enumconst, '&quot;)&#10;')" />
765 <xsl:value-of select="concat(' ', $enumconst, '(&quot;', $enumconst, '&quot;)')" />
766 <xsl:choose>
767 <xsl:when test="not(position()=last())">
768 <xsl:text>,&#10;</xsl:text>
769 </xsl:when>
770 <xsl:otherwise>
771 <xsl:text>;&#10;</xsl:text>
772 </xsl:otherwise>
773 </xsl:choose>
774 </xsl:for-each>
775
776 <xsl:text>&#10;</xsl:text>
777 <xsl:text> private final String value;&#10;&#10;</xsl:text>
778
779 <xsl:value-of select="concat(' ', $enumname, '(String v) {&#10;')" />
780 <xsl:text> value = v;&#10;</xsl:text>
781 <xsl:text> }&#10;&#10;</xsl:text>
782
783 <xsl:text> public String value() {&#10;</xsl:text>
784 <xsl:text> return value;&#10;</xsl:text>
785 <xsl:text> }&#10;&#10;</xsl:text>
786
787 <xsl:value-of select="concat(' public static ', $enumname, ' fromValue(String v) {&#10;')" />
788 <xsl:value-of select="concat(' for (', $enumname, ' c: ', $enumname, '. values()) {&#10;')" />
789 <xsl:text> if (c.value.equals(v)) {&#10;</xsl:text>
790 <xsl:text> return c;&#10;</xsl:text>
791 <xsl:text> }&#10;</xsl:text>
792 <xsl:text> }&#10;</xsl:text>
793 <xsl:text> throw new IllegalArgumentException(v);&#10;</xsl:text>
794 <xsl:text> }&#10;&#10;</xsl:text>
795
796 <xsl:text>}&#10;&#10;</xsl:text>
797
798 <xsl:call-template name="endFile">
799 <xsl:with-param name="file" select="concat($filename, '.java')" />
800 </xsl:call-template>
801
802 </xsl:for-each>
803
804 <xsl:text>// ######## INTERFACES &#10;&#10;</xsl:text>
805
806 <xsl:for-each select="//interface">
807 <xsl:variable name="ifname" select="@name" />
808 <xsl:variable name="filename" select="$ifname" />
809 <xsl:variable name="wsmap" select="@wsmap" />
810 <xsl:variable name="wscpp" select="@wscpp" />
811
812 <xsl:if test="not($wsmap='suppress') and not($wsmap='struct') and not ($wsmap='global')">
813 <xsl:call-template name="startFile">
814 <xsl:with-param name="file" select="concat($filename, '.java')" />
815 </xsl:call-template>
816
817 <xsl:text>import java.math.BigInteger;&#10;</xsl:text>
818 <xsl:text>import java.util.List;&#10;</xsl:text>
819 <xsl:text>import java.util.UUID;&#10;</xsl:text>
820 <xsl:text>import javax.xml.ws.Holder;&#10;</xsl:text>
821 <xsl:text>import javax.xml.ws.WebServiceException;&#10;</xsl:text>
822
823 <xsl:choose>
824 <xsl:when test="$wsmap='struct'">
825
826 <xsl:value-of select="concat('public class ', $ifname, ' {&#10;&#10;')" />
827
828 </xsl:when>
829
830 <xsl:otherwise>
831
832 <xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
833 <xsl:choose>
834 <xsl:when test="($extends = '$unknown') or ($extends = '$dispatched')">
835 <xsl:value-of select="concat('public class ', $ifname, ' extends IUnknown {&#10;&#10;')" />
836 </xsl:when>
837 <xsl:when test="//interface[@name=$extends]">
838 <xsl:value-of select="concat('public class ', $ifname, ' extends ', $extends, ' {&#10;&#10;')" />
839 </xsl:when>
840 <xsl:otherwise>
841 <xsl:call-template name="fatalError">
842 <xsl:with-param name="msg" select="concat('Interface generation: interface &quot;', $ifname, '&quot; has invalid &quot;extends&quot; value ', $extends, '.')" />
843 </xsl:call-template>
844 </xsl:otherwise>>
845 </xsl:choose>
846
847 <!-- interface (class) constructor -->
848 <xsl:value-of select="concat(' public static ', $ifname, ' cast(IUnknown other) {&#10;')" />
849 <xsl:value-of select="concat(' return new ', $ifname,
850 '(other.getRef(), other.getRemoteWSPort());&#10; }&#10;&#10;')"/>
851 <xsl:value-of select="concat(' public ', $ifname, '(String _this, VboxPortType port) {&#10;')" />
852 <xsl:text> super(_this,port);&#10;</xsl:text>
853 <xsl:text> }&#10;</xsl:text>
854
855 <!-- attributes -->
856 <xsl:for-each select="attribute">
857 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
858 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
859 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
860 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
861
862 <xsl:choose>
863 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
864 <xsl:value-of select="concat('&#10; // Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype, '&#10;')" />
865 </xsl:when>
866 <xsl:otherwise>
867 <xsl:choose>
868 <xsl:when test="@readonly='yes'">
869 <xsl:value-of select="concat('&#10; // read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
870 </xsl:when>
871 <xsl:otherwise>
872 <xsl:value-of select="concat('&#10; // read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
873 </xsl:otherwise>
874 </xsl:choose>
875 <!-- emit getter method -->
876 <xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
877 <xsl:variable name="jaxwsGetter"><xsl:call-template name="makeJaxwsMethod"><xsl:with-param name="ifname" select="$ifname" /><xsl:with-param name="methodname" select="$gettername" /></xsl:call-template></xsl:variable>
878 <xsl:variable name="gluegettertype">
879 <xsl:call-template name="typeIdl2Glue">
880 <xsl:with-param name="ifname" select="$ifname" />
881 <xsl:with-param name="method" select="$gettername" />
882 <xsl:with-param name="name" select="$attrname" />
883 <xsl:with-param name="type" select="$attrtype" />
884 <xsl:with-param name="safearray" select="@safearray" />
885 </xsl:call-template>
886 </xsl:variable>
887 <xsl:variable name="javagettertype">
888 <xsl:call-template name="typeIdl2Java">
889 <xsl:with-param name="ifname" select="$ifname" />
890 <xsl:with-param name="method" select="$gettername" />
891 <xsl:with-param name="name" select="$attrname" />
892 <xsl:with-param name="type" select="$attrtype" />
893 <xsl:with-param name="safearray" select="@safearray" />
894 </xsl:call-template>
895 </xsl:variable>
896 <xsl:value-of select="concat(' public ', $gluegettertype, ' ', $gettername, '() {&#10;')" />
897 <xsl:text> try {&#10;</xsl:text>
898 <xsl:value-of select="concat(' ', $javagettertype, ' retVal = port.', $jaxwsGetter, '(_this);&#10;')" />
899 <xsl:variable name="wrapped">
900 <xsl:call-template name="cookOutParam">
901 <xsl:with-param name="ifname" select="$ifname" />
902 <xsl:with-param name="method" select="$gettername" />
903 <xsl:with-param name="value" select="'retVal'" />
904 <xsl:with-param name="idltype" select="$attrtype" />
905 <xsl:with-param name="safearray" select="@safearray" />
906 </xsl:call-template>
907 </xsl:variable>
908 <xsl:value-of select="concat(' return ', $wrapped, ';&#10;')" />
909 <xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
910 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
911 <xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
912 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
913 <xsl:text> }&#10;</xsl:text>
914 <xsl:text> }&#10;</xsl:text>
915 <xsl:if test="not(@readonly='yes')">
916 <!-- emit setter -->
917 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
918 <xsl:variable name="jaxwsSetter"><xsl:call-template name="makeJaxwsMethod"><xsl:with-param name="ifname" select="$ifname" /><xsl:with-param name="methodname" select="$settername" /></xsl:call-template></xsl:variable>
919 <xsl:variable name="javasettertype">
920 <xsl:call-template name="typeIdl2Java">
921 <xsl:with-param name="ifname" select="$ifname" />
922 <xsl:with-param name="method" select="$settername" />
923 <xsl:with-param name="name" select="$attrname" />
924 <xsl:with-param name="type" select="$attrtype" />
925 </xsl:call-template>
926 </xsl:variable>
927 <xsl:value-of select="concat(' public void ', $settername, '(', $javasettertype, ' value) {&#10;')" />
928 <xsl:text> try {&#10;</xsl:text>
929 <xsl:value-of select="concat(' port.', $jaxwsSetter, '(_this, value);&#10;')" />
930 <xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
931 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
932 <xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
933 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
934 <xsl:text> }&#10;</xsl:text>
935 <xsl:text> }&#10;</xsl:text>
936 </xsl:if>
937 </xsl:otherwise>
938 </xsl:choose>
939 </xsl:for-each> <!-- attribute -->
940
941 <!-- emit real methods -->
942 <xsl:for-each select="method">
943 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
944 <xsl:variable name="portArg">
945 <xsl:if test="not($wsmap='global')">
946 <xsl:value-of select="'_this'"/>
947 </xsl:if>
948 </xsl:variable>
949
950 <!-- method header: return value "int", method name, soap arguments -->
951 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
952 <xsl:choose>
953 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
954 <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
955 </xsl:when>
956 <xsl:otherwise>
957 <xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
958 <xsl:variable name="fHasOutParms" select="param[@dir='out']" />
959
960 <xsl:value-of select="concat('&#10; /* method ', $ifname, '::', $methodname, '(')" />
961 <xsl:for-each select="param">
962 <xsl:value-of select="concat('&#10; [', @dir, '] ', @type, ' ', @name)" />
963 <xsl:if test="@safearray='yes'">
964 <xsl:text>[]</xsl:text>
965 </xsl:if>
966 <xsl:if test="not(position()=last())">
967 <xsl:text>,</xsl:text>
968 </xsl:if>
969 </xsl:for-each>
970 <xsl:text>)&#10; */&#10;</xsl:text>
971 <!-- method implementation -->
972 <xsl:variable name="returnidltype" select="param[@dir='return']/@type" />
973 <xsl:variable name="returnidlsafearray" select="param[@dir='return']/@safearray" />
974 <xsl:variable name="returngluetype">
975 <xsl:choose>
976 <xsl:when test="$returnidltype">
977 <xsl:call-template name="typeIdl2Glue">
978 <xsl:with-param name="ifname" select="$ifname" />
979 <xsl:with-param name="method" select="$methodname" />
980 <xsl:with-param name="name" select="@name" />
981 <xsl:with-param name="type" select="$returnidltype" />
982 <xsl:with-param name="safearray" select="param[@dir='return']/@safearray" />
983 </xsl:call-template>
984 </xsl:when>
985 <xsl:otherwise>
986 <xsl:text>void</xsl:text>
987 </xsl:otherwise>
988 </xsl:choose>
989 </xsl:variable>
990 <xsl:value-of select="concat(' public ', $returngluetype, ' ', $methodname, '(')" />
991 <!-- make a set of all parameters with in and out direction -->
992 <xsl:variable name="paramsinout" select="param[@dir='in' or @dir='out']" />
993 <xsl:for-each select="exsl:node-set($paramsinout)">
994 <xsl:variable name="paramgluetype">
995 <xsl:call-template name="typeIdl2Glue">
996 <xsl:with-param name="ifname" select="$ifname" />
997 <xsl:with-param name="method" select="$methodname" />
998 <xsl:with-param name="name" select="@name" />
999 <xsl:with-param name="type" select="@type" />
1000 <xsl:with-param name="safearray" select="@safearray" />
1001 </xsl:call-template>
1002 </xsl:variable>
1003 <xsl:choose>
1004 <xsl:when test="@dir='out'">
1005 <xsl:value-of select="concat('Holder&lt;', $paramgluetype, '&gt; ', @name)" />
1006 </xsl:when>
1007 <xsl:otherwise>
1008 <xsl:value-of select="concat($paramgluetype, ' ', @name)" />
1009 </xsl:otherwise>
1010 </xsl:choose>
1011 <xsl:if test="not(position()=last())">
1012 <xsl:text>, </xsl:text>
1013 </xsl:if>
1014 </xsl:for-each>
1015 <xsl:text>) {&#10;</xsl:text>
1016 <xsl:text> try {&#10;</xsl:text>
1017 <xsl:if test="param[@dir='out']">
1018 <xsl:for-each select="param[@dir='out']">
1019 <xsl:variable name="paramtype" select="@type" />
1020 <xsl:if test="//interface[@name=$paramtype] or $paramtype='$unknown'">
1021 <xsl:choose>
1022 <xsl:when test="@safearray='yes'">
1023 <xsl:value-of select="concat(' Holder&lt;List&lt;String&gt;&gt; tmp', @name, ' = new Holder&lt;List&lt;String&gt;&gt;(); &#10;')" />
1024 </xsl:when>
1025 <xsl:otherwise>
1026 <xsl:value-of select="concat(' Holder&lt;String&gt; tmp', @name, ' = new Holder&lt;String&gt;(); &#10;')" />
1027 </xsl:otherwise>
1028 </xsl:choose>
1029 </xsl:if>
1030 </xsl:for-each>
1031 </xsl:if>
1032
1033 <xsl:text> </xsl:text>
1034
1035 <!-- make the function call: first have a stack variable for the return value, if any -->
1036 <!-- XSLT doesn't allow variable override in inner blocks -->
1037 <xsl:variable name="retValValue">
1038 <xsl:choose>
1039 <xsl:when test="param[@dir='out']">
1040 <xsl:value-of select="'retVal.value'"/>
1041 </xsl:when>
1042 <xsl:otherwise>
1043 <xsl:value-of select="'retVal'"/>
1044 </xsl:otherwise>
1045 </xsl:choose>
1046 </xsl:variable>
1047
1048 <xsl:if test="$returnidltype">
1049 <xsl:variable name="javarettype">
1050 <xsl:call-template name="typeIdl2Java">
1051 <xsl:with-param name="ifname" select="$ifname" />
1052 <xsl:with-param name="method" select="$methodname" />
1053 <xsl:with-param name="name" select="@name" />
1054 <xsl:with-param name="type" select="$returnidltype" />
1055 <xsl:with-param name="safearray" select="$returnidlsafearray" />
1056 </xsl:call-template>
1057 </xsl:variable>
1058 <xsl:choose>
1059 <xsl:when test="param[@dir='out']">
1060 <!-- create a new object for return value -->
1061 <xsl:value-of select="
1062 concat('Holder&lt;', $javarettype, '&gt;',
1063 ' ', 'retVal = new Holder&lt;', $javarettype,
1064 '&gt;();&#xa; ')"/>
1065 </xsl:when>
1066 <xsl:otherwise>
1067 <xsl:value-of select="$javarettype"/>
1068 <xsl:text> retVal = </xsl:text>
1069 </xsl:otherwise>
1070 </xsl:choose>
1071 </xsl:if>
1072 <!-- function name and arguments -->
1073 <xsl:variable name="jaxwsmethod"><xsl:call-template name="makeJaxwsMethod"><xsl:with-param name="ifname" select="$ifname" /><xsl:with-param name="methodname" select="$methodname" /></xsl:call-template></xsl:variable>
1074 <xsl:value-of select="concat('port.', $jaxwsmethod, '(', $portArg)" />
1075 <xsl:if test="$paramsinout and not($portArg='')">
1076 <xsl:text>, </xsl:text>
1077 </xsl:if>
1078 <!-- jax-ws has an oddity: if both out params and a return value exist, then the return value is moved to the function's argument list... -->
1079 <xsl:choose>
1080 <xsl:when test="param[@dir='out'] and param[@dir='return']">
1081 <xsl:for-each select="param">
1082 <xsl:choose>
1083 <xsl:when test="@dir='return'">
1084 <xsl:text>retVal</xsl:text>
1085 </xsl:when>
1086 <xsl:otherwise>
1087 <xsl:call-template name="emitArgInMethodImpl">
1088 <xsl:with-param name="paramname" select="@name" />
1089 <xsl:with-param name="paramtype" select="@type" />
1090 </xsl:call-template>
1091 </xsl:otherwise>
1092 </xsl:choose>
1093 </xsl:for-each>
1094 </xsl:when>
1095 <xsl:otherwise>
1096 <xsl:for-each select="$paramsinout">
1097 <xsl:call-template name="emitArgInMethodImpl">
1098 <xsl:with-param name="paramname" select="@name" />
1099 <xsl:with-param name="paramtype" select="@type" />
1100 </xsl:call-template>
1101 </xsl:for-each>
1102 </xsl:otherwise>
1103 </xsl:choose>
1104 <xsl:text>);&#10;</xsl:text>
1105 <!-- now copy temp out parameters to their actual destination -->
1106 <xsl:for-each select="param[@dir='out']">
1107 <xsl:variable name="paramtype" select="@type" />
1108 <xsl:if test="//interface[@name=$paramtype] or $paramtype='$unknown'">
1109 <xsl:variable name="paramname" select="@name" />
1110 <xsl:variable name="wrapped">
1111 <xsl:call-template name="cookOutParam">
1112 <xsl:with-param name="ifname" select="$ifname" />
1113 <xsl:with-param name="method" select="$methodname" />
1114 <xsl:with-param name="value" select="concat('tmp',@name,'.value')" />
1115 <xsl:with-param name="idltype" select="@type" />
1116 <xsl:with-param name="safearray" select="@safearray" />
1117 </xsl:call-template>
1118 </xsl:variable>
1119 <xsl:value-of select="concat(' ',$paramname,'.value = ',
1120 $wrapped,';&#10;')"/>
1121 </xsl:if>
1122 </xsl:for-each>
1123 <!-- next line with return + glue type -->
1124 <xsl:if test="$returnidltype">
1125 <xsl:variable name="retval">
1126 <xsl:call-template name="cookOutParam">
1127 <xsl:with-param name="ifname" select="$ifname" />
1128 <xsl:with-param name="method" select="$methodname" />
1129 <xsl:with-param name="value" select="$retValValue" />
1130 <xsl:with-param name="idltype" select="$returnidltype" />
1131 <xsl:with-param name="safearray" select="$returnidlsafearray" />
1132 </xsl:call-template>
1133 </xsl:variable>
1134 <xsl:value-of select="concat(' return ', $retval, ';&#10;')"/>
1135 </xsl:if>
1136 <xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
1137 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
1138 <xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
1139 <xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
1140 <xsl:text> }&#10;</xsl:text>
1141 <xsl:text> }&#10;</xsl:text>
1142 </xsl:otherwise>
1143 </xsl:choose>
1144 </xsl:for-each>
1145
1146 </xsl:otherwise>
1147 </xsl:choose>
1148 <!-- end of class -->
1149 <xsl:text>}&#10;</xsl:text>
1150 <xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $filename, '.java&quot;&#10;&#10;')" />
1151 <xsl:call-template name="endFile">
1152 <xsl:with-param name="file" select="concat($filename, '.java')" />
1153 </xsl:call-template>
1154 </xsl:if>
1155 </xsl:for-each>
1156
1157<!-- <xsl:apply-templates /> -->
1158</xsl:template>
1159
1160<!-- - - - - - - - - - - - - - - - - - - - - - -
1161 if
1162 - - - - - - - - - - - - - - - - - - - - - - -->
1163
1164<!--
1165 * ignore all |if|s except those for WSDL target
1166-->
1167<xsl:template match="if">
1168 <xsl:if test="@target='wsdl'">
1169 <xsl:apply-templates/>
1170 </xsl:if>
1171</xsl:template>
1172
1173<!-- - - - - - - - - - - - - - - - - - - - - - -
1174 cpp
1175 - - - - - - - - - - - - - - - - - - - - - - -->
1176
1177<xsl:template match="cpp">
1178<!-- ignore this -->
1179</xsl:template>
1180
1181<!-- - - - - - - - - - - - - - - - - - - - - - -
1182 library
1183 - - - - - - - - - - - - - - - - - - - - - - -->
1184
1185<xsl:template match="library">
1186 <xsl:apply-templates />
1187</xsl:template>
1188
1189<!-- - - - - - - - - - - - - - - - - - - - - - -
1190 class
1191 - - - - - - - - - - - - - - - - - - - - - - -->
1192
1193<xsl:template match="module/class">
1194<!-- TODO swallow for now -->
1195</xsl:template>
1196
1197<!-- - - - - - - - - - - - - - - - - - - - - - -
1198 enum
1199 - - - - - - - - - - - - - - - - - - - - - - -->
1200
1201<xsl:template match="enum">
1202</xsl:template>
1203
1204<!-- - - - - - - - - - - - - - - - - - - - - - -
1205 const
1206 - - - - - - - - - - - - - - - - - - - - - - -->
1207
1208<!--
1209<xsl:template match="const">
1210 <xsl:apply-templates />
1211</xsl:template>
1212-->
1213
1214<!-- - - - - - - - - - - - - - - - - - - - - - -
1215 desc
1216 - - - - - - - - - - - - - - - - - - - - - - -->
1217
1218<xsl:template match="desc">
1219<!-- TODO swallow for now -->
1220</xsl:template>
1221
1222<!-- - - - - - - - - - - - - - - - - - - - - - -
1223 note
1224 - - - - - - - - - - - - - - - - - - - - - - -->
1225
1226<xsl:template match="note">
1227<!-- TODO -->
1228 <xsl:apply-templates />
1229</xsl:template>
1230
1231<!-- - - - - - - - - - - - - - - - - - - - - - -
1232 interface
1233 - - - - - - - - - - - - - - - - - - - - - - -->
1234
1235<xsl:template match="interface">
1236
1237</xsl:template>
1238
1239
1240</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette