VirtualBox

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

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

webservice: changes to allow for supporting IDisplay and other interfaces: suppress only methods with [ptr] args, not entire interfaces that use them; better error reporting in jax-ws generator; use common table in include file for type conversions; make takeScreenShotSlow() use dir=return instead of dir=out for one output arg

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