249
248
<xsl:with-param name="forceelem" select="'yes'" />
250
249
</xsl:call-template>
252
<xsl:value-of select="concat('Helper.wrap(',$elemtype, '.class, port, ', $value,')')"/>
252
<xsl:when test="$isstruct">
253
<xsl:variable name="javagettertype">
254
<xsl:call-template name="typeIdl2Java">
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="$safearray" />
259
<xsl:with-param name="forceelem" select="'yes'" />
262
<xsl:value-of select="concat('Helper.wrap2(',$elemtype, '.class, ', $javagettertype, '.class, port, ', $value,')')"/>
265
<xsl:value-of select="concat('Helper.wrap(',$elemtype, '.class, port, ', $value,')')"/>
255
270
<xsl:variable name="gluetype">
261
276
<xsl:with-param name="safearray" select="$safearray" />
262
277
</xsl:call-template>
264
<!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then -->
265
<xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" />
280
<xsl:when test="$isstruct">
281
<xsl:value-of select="concat('(', $value, ' != null) ? new ', $gluetype, '(', $value,', port) : null')" />
284
<!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then -->
285
<xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" />
297
<xsl:template name="genStructWrapper">
298
<xsl:param name="ifname" select="@name" />
300
<xsl:value-of select="concat(' private ', $G_virtualBoxPackage,'.',$ifname, ' real; ')"/>
301
<xsl:value-of select="' private VboxPortType port; '"/>
303
<xsl:value-of select="concat(' public ', $ifname, '(', $G_virtualBoxPackage,'.',$ifname,' real, VboxPortType port) { this.real = real; this.port = port; } ')"/>
304
<xsl:for-each select="attribute">
305
<xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
306
<xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
307
<xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
308
<xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
310
<xsl:when test="$attrreadonly='yes'">
311
<xsl:value-of select="concat(' // read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, ' ')" />
315
<xsl:value-of select="concat(' // read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, ' ')" />
319
<!-- emit getter method -->
320
<xsl:variable name="gettername">
322
<!-- Stupid, but boolean getters called isFoo(), not getFoo() -->
323
<xsl:when test="$attrtype = 'boolean'">
324
<xsl:variable name="capsname">
325
<xsl:call-template name="capitalize">
326
<xsl:with-param name="str" select="$attrname" />
329
<xsl:value-of select="concat('is', $capsname)" />
332
<xsl:call-template name="makeGetterName">
333
<xsl:with-param name="attrname" select="$attrname" />
338
<xsl:variable name="gluegettertype">
339
<xsl:call-template name="typeIdl2Glue">
340
<xsl:with-param name="ifname" select="$ifname" />
341
<xsl:with-param name="method" select="$gettername" />
342
<xsl:with-param name="name" select="$attrname" />
343
<xsl:with-param name="type" select="$attrtype" />
344
<xsl:with-param name="safearray" select="@safearray" />
347
<xsl:variable name="javagettertype">
348
<xsl:call-template name="typeIdl2Java">
349
<xsl:with-param name="ifname" select="$ifname" />
350
<xsl:with-param name="method" select="$gettername" />
351
<xsl:with-param name="name" select="$attrname" />
352
<xsl:with-param name="type" select="$attrtype" />
353
<xsl:with-param name="safearray" select="@safearray" />
356
<xsl:value-of select="concat(' public ', $gluegettertype, ' ', $gettername, '() { ')" />
357
<xsl:value-of select="concat(' ', $javagettertype, ' retVal = real.', $gettername, '(); ')" />
358
<xsl:variable name="wrapped">
359
<xsl:call-template name="cookOutParam">
360
<xsl:with-param name="ifname" select="$ifname" />
361
<xsl:with-param name="method" select="$gettername" />
362
<xsl:with-param name="value" select="'retVal'" />
363
<xsl:with-param name="idltype" select="$attrtype" />
364
<xsl:with-param name="safearray" select="@safearray" />
367
<xsl:value-of select="concat(' return ', $wrapped, '; ')" />
368
<xsl:text> } </xsl:text>
275
375
<xsl:template name="emitArgInMethodImpl">
276
376
<xsl:param name="paramname" select="@name" />
277
377
<xsl:param name="paramtype" select="@type" />
530
public static <T1, T2> List<T1> wrap2(Class<T1> wrapperClass1, Class<T2> wrapperClass2, VboxPortType pt, List<T2> thisPtrs) {
532
if(thisPtrs==null) return Collections.emptyList();
534
Constructor<T1> c = wrapperClass1.getConstructor(wrapperClass2, VboxPortType.class);
535
List<T1> ret = new ArrayList<T1>(thisPtrs.size());
536
for (T2 thisPtr : thisPtrs) {
537
ret.add(c.newInstance(thisPtr,pt));
540
} catch (NoSuchMethodException e) {
541
throw new AssertionError(e);
542
} catch (InstantiationException e) {
543
throw new AssertionError(e);
544
} catch (IllegalAccessException e) {
545
throw new AssertionError(e);
546
} catch (InvocationTargetException e) {
547
throw new AssertionError(e);
431
551
public static <T extends IUnknown> List<String> unwrap(List<T> thisPtrs) {
432
552
if (thisPtrs==null) return Collections.emptyList();
601
721
public void connect(String url)
603
723
this.port = pool.getPort();
605
726
((BindingProvider)port).getRequestContext().
606
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
607
} catch (Throwable t) {
727
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
728
} catch (Throwable t) {
608
729
if (this.port != null)
609
730
pool.releasePort(this.port);
610
731
// we have to throw smth derived from RuntimeException
611
732
throw new WebServiceException(t);
615
736
public void connect(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
617
738
this.port = pool.getPort();
620
((BindingProvider)port).getRequestContext();
621
if (requestContext != null)
741
((BindingProvider)port).getRequestContext();
742
if (requestContext != null)
622
743
((BindingProvider)port).getRequestContext().putAll(requestContext);
624
if (responseContext != null)
745
if (responseContext != null)
625
746
((BindingProvider)port).getResponseContext().putAll(responseContext);
627
((BindingProvider)port).getRequestContext().
748
((BindingProvider)port).getRequestContext().
628
749
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
629
} catch (Throwable t) {
750
} catch (Throwable t) {
630
751
if (this.port != null)
631
752
pool.releasePort(port);
632
753
// we have to throw smth derived from RuntimeException
809
930
<xsl:variable name="wsmap" select="@wsmap" />
810
931
<xsl:variable name="wscpp" select="@wscpp" />
812
<xsl:if test="not($wsmap='suppress') and not($wsmap='struct') and not ($wsmap='global')">
933
<xsl:if test="not($wsmap='suppress') and not ($wsmap='global')">
813
934
<xsl:call-template name="startFile">
814
935
<xsl:with-param name="file" select="concat($filename, '.java')" />
815
936
</xsl:call-template>
817
938
<xsl:text>import java.math.BigInteger; </xsl:text>
818
939
<xsl:text>import java.util.List; </xsl:text>
819
<xsl:text>import java.util.UUID; </xsl:text>
820
940
<xsl:text>import javax.xml.ws.Holder; </xsl:text>
821
941
<xsl:text>import javax.xml.ws.WebServiceException; </xsl:text>
824
944
<xsl:when test="$wsmap='struct'">
826
945
<xsl:value-of select="concat('public class ', $ifname, ' { ')" />
946
<xsl:call-template name="genStructWrapper">
947
<xsl:with-param name="name" select="$ifname" />
832
952
<xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
834
954
<xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')">