glue-jaxws.xsl revision 8e2911e5309f5dff976cc7ac17d832d4ee2cdca3
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<?xml version="1.0"?>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<!--
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync websrv-jax-ws.xsl:
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync XSLT stylesheet that generates virtualbox.java from
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync VirtualBox.xidl. This generated Java code contains
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync a Java wrapper that allows client code to use the
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync webservice in an object-oriented way.
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync Copyright (C) 2008-2009 Sun Microsystems, Inc.
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync This file is part of VirtualBox Open Source Edition (OSE), as
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync available from http://www.virtualbox.org. This file is free software;
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync you can redistribute it and/or modify it under the terms of the GNU
010ad423d45c61ef874fa1602d46459a798b54d2vboxsync General Public License (GPL) as published by the Free Software
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync Foundation, in version 2 as it comes in the "COPYING" file of the
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync Clara, CA 95054 USA or visit http://www.sun.com if you need
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync additional information or have any questions.
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync-->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:stylesheet
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync version="1.0"
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync xmlns:xsd="http://www.w3.org/2001/XMLSchema"
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync xmlns:exsl="http://exslt.org/common"
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync extension-element-prefixes="exsl">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:output method="text"/>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:strip-space elements="*"/>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync global XSLT variables
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync - - - - - - - - - - - - - - - - - - - - - - -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:variable name="G_xsltFilename" select="'glue-jaxws.xsl'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<!-- Keep in sync with VBOX_JAVA_PACKAGE in webservices/Makefile.kmk -->
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync<xsl:variable name="G_virtualBoxPackage" select="concat('org.virtualbox',$G_vboxApiSuffix)" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:variable name="G_virtualBoxPackage2" select="concat('com.sun.xml.ws.commons.virtualbox',$G_vboxApiSuffix)" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<xsl:variable name="G_virtualBoxWsdl" select="concat(concat('&quot;vboxwebService',$G_vboxApiSuffix), '.wsdl&quot;')" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<xsl:include href="websrv-shared.inc.xsl" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync quick lookup -->
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<xsl:variable name="G_setSuppressedInterfaces"
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync select="//interface[@wsmap='suppress']" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="fileheader">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="name" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:text>/**
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync * Copyright (C) 2008-2009 Sun Microsystems, Inc.
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync *
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync * This file is part of a free software library; you can redistribute
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync * it and/or modify it under the terms of the GNU Lesser General
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync * Public License version 2.1 as published by the Free Software
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * Foundation and shipped in the "COPYING.LIB" file with this library.
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * The library is distributed in the hope that it will be useful,
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * but WITHOUT ANY WARRANTY of any kind.
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync *
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * any license choice other than GPL or LGPL is available it will
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * apply instead, Sun elects to use only the Lesser General Public
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * License version 2.1 (LGPLv2) at this time for any software where
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * a choice of LGPL license versions is made available with the
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * language indicating that LGPLv2 or any later version may be used,
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * or where a choice of which version of the LGPL is applied is
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * otherwise unspecified.
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync *
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync * additional information or have any questions.
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync *
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:text>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat(' * ',$name)"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:text>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync *
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync * DO NOT EDIT! This is a generated file.
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync * Generator: src/VBox/Main/webservice/glue-jaxws.xsl
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync */
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync</xsl:text>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync</xsl:template>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<!-- Emits the fully prefixed class name, if necessary, of the given type. This dies
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync if $name is not defined in XIDL; in other words, do not call this for built-in types. -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="fullClassName">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:param name="name" />
c83b72ede860a1be6bdd520f7d13619b0791c1advboxsync <xsl:param name="origname" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:param name="collPrefix" />
c83b72ede860a1be6bdd520f7d13619b0791c1advboxsync <xsl:variable name="coll" select="//collection[@name=$name]" />
c83b72ede860a1be6bdd520f7d13619b0791c1advboxsync <xsl:choose>
c83b72ede860a1be6bdd520f7d13619b0791c1advboxsync <xsl:when test="//collection[@name=$name]">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <!-- for collections and safearrays we return element type -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="fullClassName">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="concat($collPrefix,//collection[@name=$name]/@type)" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="origname" select="//collection[@name=$name]/@type" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="collPrefix" select="$collPrefix" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <!-- <xsl:value-of select="concat('org.virtualbox.', concat($collPrefix,//collection[@name=$name]/@type))" /> -->
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="//enum[@name=$name] or //enum[@name=$origname]">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$collPrefix and //interface[@name=$origname]/@wsmap='managed'">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:when>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:when test="//interface[@name=$name]">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="concat($G_virtualBoxPackage2, concat('.', $name))" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:when>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:otherwise>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:call-template name="fatalError">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="msg" select="concat('fullClassName: Type &quot;', $name, '&quot; is not supported.')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<!--
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync typeIdl2Glue: converts $type into a type as used by the java glue code.
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync For example, for an XIDL IMachineCollection, this will return
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync "List<com.sun.xml.ws.commons.virtualbox.IMachine>".
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync -->
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync<xsl:template name="typeIdl2Glue">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="method" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="name" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:param name="type" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:param name="safearray" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:param name="forceelem" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="needarray" select="($safearray='yes' or //collection[@name=$type]) and not($forceelem='yes')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:if test="$needarray">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="'List&lt;'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:if>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <!-- look up Java type from IDL type from table array in websrv-shared.inc.xsl -->
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:variable name="javatypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@javaname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="string-length($javatypefield)">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="$javatypefield" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:when>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <!-- not a standard type: then it better be one of the types defined in the XIDL -->
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:otherwise>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:call-template name="fullClassName">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:with-param name="name" select="$type" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:with-param name="collPrefix" select="''"/>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:call-template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:otherwise>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:choose>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:if test="$needarray">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="'&gt;'" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:if>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync</xsl:template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<!--
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync typeIdl2Java: converts $type into a type as used by the JAX-WS backend.
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync For example, for an XIDL IMachineCollection, this will return
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync "ArrayOfIMachine".
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="typeIdl2Java">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="method" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="name" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="type" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="safearray" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="forceelem" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="needarray" select="($safearray='yes') and not($forceelem='yes')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:if test="$needarray">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="'List&lt;'" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:if>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <!-- look up Java type from IDL type from table array in websrv-shared.inc.xsl -->
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:variable name="javatypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@javaname" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="string-length($javatypefield)">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="$javatypefield" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$type='$unknown'">String</xsl:when>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:when test="//interface[@name=$type]/@wsmap='struct'">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat($G_virtualBoxPackage, '.', $type)" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="//interface[@name=$type]/@wsmap='managed'">String</xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="fullClassName">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$type" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="collPrefix" select="'ArrayOf'"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:if test="$needarray">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="'&gt;'" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync </xsl:if>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="cookOutParam">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="ifname"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="methodname"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="value"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="idltype"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="safearray"/>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:variable name="isstruct"
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync select="//interface[@name=$idltype]/@wsmap='struct'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="//collection[@name=$idltype]">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="elemtype">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="typeIdl2Glue">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$methodname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$value" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="type" select="$idltype" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:with-param name="forceelem" select="'yes'" />
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:call-template>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:variable>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync <xsl:choose>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync <xsl:when test="contains($elemtype, $G_virtualBoxPackage)">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:value-of select="concat($value,'.getArray()')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('Helper.wrap(', $elemtype, '.class, port, ((',
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync $value,' == null)? null : ',$value,'.getArray()))')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$safearray='yes'">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="elemtype">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="typeIdl2Glue">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$methodname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$value" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="type" select="$idltype" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="safearray" select="'no'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="forceelem" select="'yes'" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:call-template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$isstruct">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="javagettertype">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:call-template name="typeIdl2Java">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="method" select="$methodname" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="name" select="$value" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="type" select="$idltype" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="safearray" select="$safearray" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="forceelem" select="'yes'" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync </xsl:call-template>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('Helper.wrap2(',$elemtype, '.class, ', $javagettertype, '.class, port, ', $value,')')"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:value-of select="concat('Helper.wrap(',$elemtype, '.class, port, ', $value,')')"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="gluetype">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="typeIdl2Glue">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$methodname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$value" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="type" select="$idltype" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="safearray" select="$safearray" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$isstruct">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('(', $value, ' != null) ? new ', $gluetype, '(', $value,', port) : null')" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:when>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync <xsl:otherwise>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync <!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then -->
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync <xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" />
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:otherwise>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:choose>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:otherwise>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:choose>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="$value"/>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="genStructWrapper">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="ifname" select="@name" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat(' private ', $G_virtualBoxPackage,'.',$ifname, ' real;&#10;')"/>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="' private VboxPortType port;&#10;&#10;'"/>
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:value-of select="concat(' public ', $ifname, '(', $G_virtualBoxPackage,'.',$ifname,' real, VboxPortType port) {&#10; this.real = real; &#10; this.port = port; &#10; }&#10;')"/>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:for-each select="attribute">
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:choose>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:when test="$attrreadonly='yes'">
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:value-of select="concat('&#10; // read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync </xsl:when>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:otherwise>
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsync <xsl:value-of select="concat('&#10; // read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
a1e68eac9a1478fd1957826cb4bd631f808b7cc0vboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <!-- emit getter method -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="gettername">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <!-- Stupid, but boolean getters called isFoo(), not getFoo() -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="$attrtype = 'boolean'">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="capsname">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="capitalize">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="str" select="$attrname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('is', $capsname)" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="makeGetterName">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="attrname" select="$attrname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="gluegettertype">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="typeIdl2Glue">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$gettername" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$attrname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="type" select="$attrtype" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="safearray" select="@safearray" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="javagettertype">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="typeIdl2Java">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$gettername" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="name" select="$attrname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="type" select="$attrtype" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="safearray" select="@safearray" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat(' public ', $gluegettertype, ' ', $gettername, '() {&#10;')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat(' ', $javagettertype, ' retVal = real.', $gettername, '();&#10;')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:variable name="wrapped">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="cookOutParam">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="ifname" select="$ifname" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="method" select="$gettername" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="value" select="'retVal'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="idltype" select="$attrtype" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="safearray" select="@safearray" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:call-template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:variable>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat(' return ', $wrapped, ';&#10;')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:text> }&#10;</xsl:text>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:for-each>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
eac18a2a75654a71176720265be9d2e77658481fvboxsync</xsl:template>
eac18a2a75654a71176720265be9d2e77658481fvboxsync
eac18a2a75654a71176720265be9d2e77658481fvboxsync
eac18a2a75654a71176720265be9d2e77658481fvboxsync<xsl:template name="emitArgInMethodImpl">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:param name="paramname" select="@name" />
eac18a2a75654a71176720265be9d2e77658481fvboxsync <xsl:param name="paramtype" select="@type" />
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <!-- per-argument special type handling -->
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:choose>
eac18a2a75654a71176720265be9d2e77658481fvboxsync <xsl:when test="//interface[@name=$paramtype] or $paramtype='$unknown'">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:choose>
eac18a2a75654a71176720265be9d2e77658481fvboxsync <xsl:when test="@dir='out'">
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync <xsl:value-of select="concat('tmp', $paramname)" />
eac18a2a75654a71176720265be9d2e77658481fvboxsync </xsl:when>
eac18a2a75654a71176720265be9d2e77658481fvboxsync <xsl:otherwise>
eac18a2a75654a71176720265be9d2e77658481fvboxsync <xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:when test="@safearray='yes'">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('Helper.unwrap(',$paramname,')')"/>
eac18a2a75654a71176720265be9d2e77658481fvboxsync </xsl:when>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('((', $paramname, ' == null)?null:', $paramname, '.getRef())')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:otherwise>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:choose>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:when>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:otherwise>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="$paramname" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:otherwise>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:choose>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:if test="not(position()=last())">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:text>, </xsl:text>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync </xsl:if>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync</xsl:template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="startFile">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="file" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $file, '&quot;&#10;&#10;')" />
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:call-template name="fileheader">
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsync <xsl:with-param name="name" select="$file" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
1acf60ed9c490056043f7bfa524f2de1a431ab10vboxsyncpackage <xsl:value-of select="$G_virtualBoxPackage2" />;
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsync
3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbcavboxsyncimport <xsl:value-of select="$G_virtualBoxPackage" />.VboxPortType;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsyncimport <xsl:value-of select="$G_virtualBoxPackage" />.VboxService;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsyncimport <xsl:value-of select="$G_virtualBoxPackage" />.InvalidObjectFaultMsg;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsyncimport <xsl:value-of select="$G_virtualBoxPackage" />.RuntimeFaultMsg;
a05a2534a4aeaed368d626a462d856c0d352c97dvboxsyncimport javax.xml.ws.WebServiceException;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template name="endFile">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:param name="file" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $file, '&quot;&#10;&#10;')" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync</xsl:template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync root match
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync - - - - - - - - - - - - - - - - - - - - - - -->
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync<xsl:template match="/idl">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:if test="not($G_vboxApiSuffix)">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="fatalError">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="msg" select="'G_vboxApiSuffix must be given'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:if>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:call-template name="startFile">
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:with-param name="file" select="'IUnknown.java'" />
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync </xsl:call-template>
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync <xsl:text><![CDATA[
d0eec04539061d14a7e51f492aea90fa5394615fvboxsyncpublic class IUnknown
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync{
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync protected String _this; /* almost final, could only be set in finalizer */
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync protected final VboxPortType port;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync public IUnknown(String _this, VboxPortType port)
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync this._this = _this;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync this.port = port;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync }
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync public final String getRef()
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync return _this;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync }
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync public final VboxPortType getRemoteWSPort()
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync return port;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync }
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync public synchronized void releaseRemote() throws WebServiceException
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync if (_this == null) {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync return;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync }
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync try {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync port.iManagedObjectRefRelease(_this);
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync _this = null;
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync } catch (InvalidObjectFaultMsg e) {
d0eec04539061d14a7e51f492aea90fa5394615fvboxsync throw new WebServiceException(e);
} catch (RuntimeFaultMsg e) {
throw new WebServiceException(e);
}
}
/*
protected void finalize()
{
try {
releaseRemote();
} catch (WebServiceException e) {
}
} */
// may need to support some sort of QueryInterface, to make this class useable
// not only as common baseclass
}
]]></xsl:text>
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="'IUnknown.java'" />
</xsl:call-template>
<xsl:call-template name="startFile">
<xsl:with-param name="file" select="'Helper.java'" />
</xsl:call-template>
<xsl:text><![CDATA[
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
class Helper {
public static <T> List<T> wrap(Class<T> wrapperClass, VboxPortType pt, List<String> thisPtrs) {
try {
if(thisPtrs==null) return Collections.emptyList();
Constructor<T> c = wrapperClass.getConstructor(String.class, VboxPortType.class);
List<T> ret = new ArrayList<T>(thisPtrs.size());
for (String thisPtr : thisPtrs) {
ret.add(c.newInstance(thisPtr,pt));
}
return ret;
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
} catch (InstantiationException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {
throw new AssertionError(e);
}
}
public static <T1, T2> List<T1> wrap2(Class<T1> wrapperClass1, Class<T2> wrapperClass2, VboxPortType pt, List<T2> thisPtrs) {
try {
if(thisPtrs==null) return Collections.emptyList();
Constructor<T1> c = wrapperClass1.getConstructor(wrapperClass2, VboxPortType.class);
List<T1> ret = new ArrayList<T1>(thisPtrs.size());
for (T2 thisPtr : thisPtrs) {
ret.add(c.newInstance(thisPtr,pt));
}
return ret;
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
} catch (InstantiationException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {
throw new AssertionError(e);
}
}
public static <T extends IUnknown> List<String> unwrap(List<T> thisPtrs) {
if (thisPtrs==null) return Collections.emptyList();
List<String> ret = new ArrayList<String>();
for (T obj : thisPtrs) {
ret.add(obj.getRef());
}
return ret;
}
}
]]></xsl:text>
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="'Helper.java'" />
</xsl:call-template>
<xsl:call-template name="startFile">
<xsl:with-param name="file" select="'IWebsessionManager.java'" />
</xsl:call-template>
import java.net.URL;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceException;
class PortPool
{
private final static String wsdlFile = <xsl:value-of select="$G_virtualBoxWsdl" />;
<xsl:text><![CDATA[
private Map<VboxPortType, Integer> known;
private boolean initStarted;
private VboxService svc;
PortPool(boolean usePreinit)
{
known = new HashMap<VboxPortType, Integer>();
if (usePreinit)
{
new Thread(new Runnable()
{
public void run()
{
// need to sync on something else but 'this'
synchronized (known)
{
initStarted = true;
known.notify();
}
preinit();
}
}).start();
synchronized (known)
{
while (!initStarted)
{
try {
known.wait();
} catch (InterruptedException e) {
break;
}
}
}
}
}
private synchronized void preinit()
{
VboxPortType port = getPort();
releasePort(port);
}
synchronized VboxPortType getPort()
{
VboxPortType port = null;
int ttl = 0;
for (VboxPortType cur: known.keySet())
{
int value = known.get(cur);
if ((value & 0x10000) == 0)
{
port = cur;
ttl = value & 0xffff;
break;
}
}
if (port == null)
{
if (svc == null) {
URL wsdl = PortPool.class.getClassLoader().getResource(wsdlFile);
if (wsdl == null)
throw new LinkageError(wsdlFile+" not found, but it should have been in the jar");
svc = new VboxService(wsdl,
new QName("http://www.virtualbox.org/Service",
"vboxService"));
}
port = svc.getVboxServicePort();
// reuse this object 0x10 times
ttl = 0x10;
}
// mark as used
known.put(port, new Integer(0x10000 | ttl));
return port;
}
synchronized void releasePort(VboxPortType port)
{
Integer val = known.get(port);
if (val == null || val == 0)
{
// know you not
return;
}
int v = val;
int ttl = v & 0xffff;
// decrement TTL, and throw away port if used too much times
if (--ttl <= 0)
{
known.remove(port);
}
else
{
v = ttl; // set new TTL and clear busy bit
known.put(port, v);
}
}
}
public class IWebsessionManager {
private static PortPool pool = new PortPool(true);
protected VboxPortType port;
public IWebsessionManager(URL url)
{
connect(url);
}
public IWebsessionManager(String url)
{
connect(url);
}
public IWebsessionManager(URL url, Map<String, Object> requestContext, Map<String, Object> responseContext)
{
connect(url.toExternalForm(), requestContext, responseContext);
}
public IWebsessionManager(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
{
connect(url, requestContext, responseContext);
}
public void connect(URL url)
{
connect(url.toExternalForm());
}
public void connect(String url)
{
this.port = pool.getPort();
try {
((BindingProvider)port).getRequestContext().
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
} catch (Throwable t) {
if (this.port != null)
pool.releasePort(this.port);
// we have to throw smth derived from RuntimeException
throw new WebServiceException(t);
}
}
public void connect(String url, Map<String, Object> requestContext, Map<String, Object> responseContext)
{
this.port = pool.getPort();
try {
((BindingProvider)port).getRequestContext();
if (requestContext != null)
((BindingProvider)port).getRequestContext().putAll(requestContext);
if (responseContext != null)
((BindingProvider)port).getResponseContext().putAll(responseContext);
((BindingProvider)port).getRequestContext().
put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
} catch (Throwable t) {
if (this.port != null)
pool.releasePort(port);
// we have to throw smth derived from RuntimeException
throw new WebServiceException(t);
}
}
public void disconnect(IVirtualBox refIVirtualBox)
{
try {
logoff(refIVirtualBox);
} finally {
if (this.port != null) {
pool.releasePort(this.port);
this.port = null;
}
}
}
public void cleanupUnused()
{
System.gc();
Runtime.getRuntime().runFinalization();
}
/* method IWebsessionManager::logon(
[in] wstring username,
[in] wstring password,
[return] IVirtualBox return)
*/
public IVirtualBox logon(String username, String password) {
try {
String retVal = port.iWebsessionManagerLogon(username, password);
return new IVirtualBox(retVal, port);
} catch (InvalidObjectFaultMsg e) {
throw new WebServiceException(e);
} catch (RuntimeFaultMsg e) {
throw new WebServiceException(e);
}
}
/* method IWebsessionManager::getSessionObject(
[in] IVirtualBox refIVirtualBox,
[return] ISession return)
*/
public ISession getSessionObject(IVirtualBox refIVirtualBox) {
try {
String retVal = port.iWebsessionManagerGetSessionObject(((refIVirtualBox == null)?null:refIVirtualBox.getRef()));
return new ISession(retVal, port);
} catch (InvalidObjectFaultMsg e) {
throw new WebServiceException(e);
} catch (RuntimeFaultMsg e) {
throw new WebServiceException(e);
}
}
/* method IWebsessionManager::logoff(
[in] IVirtualBox refIVirtualBox)
*/
public void logoff(IVirtualBox refIVirtualBox) {
try {
port.iWebsessionManagerLogoff(((refIVirtualBox == null)?null:refIVirtualBox.getRef()));
} catch (InvalidObjectFaultMsg e) {
throw new WebServiceException(e);
} catch (RuntimeFaultMsg e) {
throw new WebServiceException(e);
}
}
}
]]></xsl:text>
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="'IWebsessionManager.java'" />
</xsl:call-template>
<xsl:text>// ######## COLLECTIONS&#10;&#10;</xsl:text>
<xsl:for-each select="//collection">
<xsl:variable name="type" select="@type" />
<xsl:variable name="arrayoftype" select="concat('ArrayOf', @type)" />
<xsl:variable name="filename" select="$arrayoftype" />
<xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $filename, '.java&quot;&#10;&#10;')" />
<xsl:call-template name="startFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
<xsl:text>import java.util.ArrayList;&#10;</xsl:text>
<xsl:text>import java.util.List;&#10;</xsl:text>
<xsl:text>import javax.xml.bind.annotation.XmlAccessType;&#10;</xsl:text>
<xsl:text>import javax.xml.bind.annotation.XmlAccessorType;&#10;</xsl:text>
<xsl:text>import javax.xml.bind.annotation.XmlType;&#10;&#10;</xsl:text>
<xsl:text>@XmlAccessorType(XmlAccessType.FIELD)&#10;</xsl:text>
<xsl:value-of select="concat('@XmlType(name = &quot;', $arrayoftype, '&quot;, propOrder = {&#10;')" />
<xsl:text> "array"&#10;</xsl:text>
<xsl:text>})&#10;&#10;</xsl:text>
<xsl:value-of select="concat('public class ', $arrayoftype, ' {&#10;&#10;')" />
<xsl:text> protected List&lt;String&gt; array;&#10;&#10;</xsl:text>
<xsl:text> public List&lt;String&gt; getArray() {&#10;</xsl:text>
<xsl:text> if (array == null) {&#10;</xsl:text>
<xsl:text> array = new ArrayList&lt;String&gt;();&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> return this.array;&#10;</xsl:text>
<xsl:text> }&#10;&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>// ######## ENUMS&#10;&#10;</xsl:text>
<xsl:for-each select="//enum">
<xsl:variable name="enumname" select="@name" />
<xsl:variable name="filename" select="$enumname" />
<xsl:call-template name="startFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
<xsl:text>import javax.xml.bind.annotation.XmlEnum;&#10;</xsl:text>
<xsl:text>import javax.xml.bind.annotation.XmlEnumValue;&#10;</xsl:text>
<xsl:text>import javax.xml.bind.annotation.XmlType;&#10;&#10;</xsl:text>
<xsl:value-of select="concat('@XmlType(name = &quot;', $enumname, '&quot;)&#10;')" />
<xsl:text>@XmlEnum&#10;</xsl:text>
<xsl:value-of select="concat('public enum ', $enumname, ' {&#10;&#10;')" />
<xsl:for-each select="const">
<xsl:variable name="enumconst" select="@name" />
<xsl:value-of select="concat(' @XmlEnumValue(&quot;', $enumconst, '&quot;)&#10;')" />
<xsl:value-of select="concat(' ', $enumconst, '(&quot;', $enumconst, '&quot;)')" />
<xsl:choose>
<xsl:when test="not(position()=last())">
<xsl:text>,&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>;&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
<xsl:text> private final String value;&#10;&#10;</xsl:text>
<xsl:value-of select="concat(' ', $enumname, '(String v) {&#10;')" />
<xsl:text> value = v;&#10;</xsl:text>
<xsl:text> }&#10;&#10;</xsl:text>
<xsl:text> public String value() {&#10;</xsl:text>
<xsl:text> return value;&#10;</xsl:text>
<xsl:text> }&#10;&#10;</xsl:text>
<xsl:value-of select="concat(' public static ', $enumname, ' fromValue(String v) {&#10;')" />
<xsl:value-of select="concat(' for (', $enumname, ' c: ', $enumname, '. values()) {&#10;')" />
<xsl:text> if (c.value.equals(v)) {&#10;</xsl:text>
<xsl:text> return c;&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> throw new IllegalArgumentException(v);&#10;</xsl:text>
<xsl:text> }&#10;&#10;</xsl:text>
<xsl:text>}&#10;&#10;</xsl:text>
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
</xsl:for-each>
<xsl:text>// ######## INTERFACES &#10;&#10;</xsl:text>
<xsl:for-each select="//interface">
<xsl:variable name="ifname" select="@name" />
<xsl:variable name="filename" select="$ifname" />
<xsl:variable name="wsmap" select="@wsmap" />
<xsl:variable name="wscpp" select="@wscpp" />
<xsl:if test="not($wsmap='suppress') and not ($wsmap='global')">
<xsl:call-template name="startFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
<xsl:text>import java.math.BigInteger;&#10;</xsl:text>
<xsl:text>import java.util.List;&#10;</xsl:text>
<xsl:text>import javax.xml.ws.Holder;&#10;</xsl:text>
<xsl:text>import javax.xml.ws.WebServiceException;&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$wsmap='struct'">
<xsl:value-of select="concat('public class ', $ifname, ' {&#10;&#10;')" />
<xsl:call-template name="genStructWrapper">
<xsl:with-param name="name" select="$ifname" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
<xsl:choose>
<xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')">
<xsl:value-of select="concat('public class ', $ifname, ' extends IUnknown {&#10;&#10;')" />
</xsl:when>
<xsl:when test="//interface[@name=$extends]">
<xsl:value-of select="concat('public class ', $ifname, ' extends ', $extends, ' {&#10;&#10;')" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('Interface generation: interface &quot;', $ifname, '&quot; has invalid &quot;extends&quot; value ', $extends, '.')" />
</xsl:call-template>
</xsl:otherwise>>
</xsl:choose>
<!-- interface (class) constructor -->
<xsl:value-of select="concat(' public static ', $ifname, ' cast(IUnknown other) {&#10;')" />
<xsl:value-of select="concat(' return new ', $ifname,
'(other.getRef(), other.getRemoteWSPort());&#10; }&#10;&#10;')"/>
<xsl:value-of select="concat(' public ', $ifname, '(String _this, VboxPortType port) {&#10;')" />
<xsl:text> super(_this,port);&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<!-- attributes -->
<xsl:for-each select="attribute">
<xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
<xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
<xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
<xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
<xsl:choose>
<xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
<xsl:value-of select="concat('&#10; // Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype, '&#10;')" />
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@readonly='yes'">
<xsl:value-of select="concat('&#10; // read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('&#10; // read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype, '&#10;')" />
</xsl:otherwise>
</xsl:choose>
<!-- emit getter method -->
<xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<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>
<xsl:variable name="gluegettertype">
<xsl:call-template name="typeIdl2Glue">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$gettername" />
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="javagettertype">
<xsl:call-template name="typeIdl2Java">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$gettername" />
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(' public ', $gluegettertype, ' ', $gettername, '() {&#10;')" />
<xsl:text> try {&#10;</xsl:text>
<xsl:value-of select="concat(' ', $javagettertype, ' retVal = port.', $jaxwsGetter, '(_this);&#10;')" />
<xsl:variable name="wrapped">
<xsl:call-template name="cookOutParam">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$gettername" />
<xsl:with-param name="value" select="'retVal'" />
<xsl:with-param name="idltype" select="$attrtype" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(' return ', $wrapped, ';&#10;')" />
<xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:if test="not(@readonly='yes')">
<!-- emit setter -->
<xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<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>
<xsl:variable name="javasettertype">
<xsl:call-template name="typeIdl2Java">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$settername" />
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(' public void ', $settername, '(', $javasettertype, ' value) {&#10;')" />
<xsl:text> try {&#10;</xsl:text>
<xsl:value-of select="concat(' port.', $jaxwsSetter, '(_this, value);&#10;')" />
<xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> <!-- attribute -->
<!-- emit real methods -->
<xsl:for-each select="method">
<xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
<xsl:variable name="portArg">
<xsl:if test="not($wsmap='global')">
<xsl:value-of select="'_this'"/>
</xsl:if>
</xsl:variable>
<!-- method header: return value "int", method name, soap arguments -->
<!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
<xsl:choose>
<xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
or (param[@mod='ptr'])" >
<xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
<xsl:variable name="fHasOutParms" select="param[@dir='out']" />
<xsl:value-of select="concat('&#10; /* method ', $ifname, '::', $methodname, '(')" />
<xsl:for-each select="param">
<xsl:value-of select="concat('&#10; [', @dir, '] ', @type, ' ', @name)" />
<xsl:if test="@safearray='yes'">
<xsl:text>[]</xsl:text>
</xsl:if>
<xsl:if test="not(position()=last())">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)&#10; */&#10;</xsl:text>
<!-- method implementation -->
<xsl:variable name="returnidltype" select="param[@dir='return']/@type" />
<xsl:variable name="returnidlsafearray" select="param[@dir='return']/@safearray" />
<xsl:variable name="returngluetype">
<xsl:choose>
<xsl:when test="$returnidltype">
<xsl:call-template name="typeIdl2Glue">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="$returnidltype" />
<xsl:with-param name="safearray" select="param[@dir='return']/@safearray" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>void</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat(' public ', $returngluetype, ' ', $methodname, '(')" />
<!-- make a set of all parameters with in and out direction -->
<xsl:variable name="paramsinout" select="param[@dir='in' or @dir='out']" />
<xsl:for-each select="exsl:node-set($paramsinout)">
<xsl:variable name="paramgluetype">
<xsl:call-template name="typeIdl2Glue">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="@dir='out'">
<xsl:value-of select="concat('Holder&lt;', $paramgluetype, '&gt; ', @name)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($paramgluetype, ' ', @name)" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>) {&#10;</xsl:text>
<xsl:text> try {&#10;</xsl:text>
<xsl:if test="param[@dir='out']">
<xsl:for-each select="param[@dir='out']">
<xsl:variable name="paramtype" select="@type" />
<xsl:if test="//interface[@name=$paramtype] or $paramtype='$unknown'">
<xsl:choose>
<xsl:when test="@safearray='yes'">
<xsl:value-of select="concat(' Holder&lt;List&lt;String&gt;&gt; tmp', @name, ' = new Holder&lt;List&lt;String&gt;&gt;(); &#10;')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(' Holder&lt;String&gt; tmp', @name, ' = new Holder&lt;String&gt;(); &#10;')" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:text> </xsl:text>
<!-- make the function call: first have a stack variable for the return value, if any -->
<!-- XSLT doesn't allow variable override in inner blocks -->
<xsl:variable name="retValValue">
<xsl:choose>
<xsl:when test="param[@dir='out']">
<xsl:value-of select="'retVal.value'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'retVal'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$returnidltype">
<xsl:variable name="javarettype">
<xsl:call-template name="typeIdl2Java">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="$returnidltype" />
<xsl:with-param name="safearray" select="$returnidlsafearray" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="param[@dir='out']">
<!-- create a new object for return value -->
<xsl:value-of select="
concat('Holder&lt;', $javarettype, '&gt;',
' ', 'retVal = new Holder&lt;', $javarettype,
'&gt;();&#xa; ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$javarettype"/>
<xsl:text> retVal = </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- function name and arguments -->
<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>
<xsl:value-of select="concat('port.', $jaxwsmethod, '(', $portArg)" />
<xsl:if test="$paramsinout and not($portArg='')">
<xsl:text>, </xsl:text>
</xsl:if>
<!-- 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... -->
<xsl:choose>
<xsl:when test="param[@dir='out'] and param[@dir='return']">
<xsl:for-each select="param">
<xsl:choose>
<xsl:when test="@dir='return'">
<xsl:text>retVal</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="emitArgInMethodImpl">
<xsl:with-param name="paramname" select="@name" />
<xsl:with-param name="paramtype" select="@type" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$paramsinout">
<xsl:call-template name="emitArgInMethodImpl">
<xsl:with-param name="paramname" select="@name" />
<xsl:with-param name="paramtype" select="@type" />
</xsl:call-template>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:text>);&#10;</xsl:text>
<!-- now copy temp out parameters to their actual destination -->
<xsl:for-each select="param[@dir='out']">
<xsl:variable name="paramtype" select="@type" />
<xsl:if test="//interface[@name=$paramtype] or $paramtype='$unknown'">
<xsl:variable name="paramname" select="@name" />
<xsl:variable name="wrapped">
<xsl:call-template name="cookOutParam">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="value" select="concat('tmp',@name,'.value')" />
<xsl:with-param name="idltype" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(' ',$paramname,'.value = ',
$wrapped,';&#10;')"/>
</xsl:if>
</xsl:for-each>
<!-- next line with return + glue type -->
<xsl:if test="$returnidltype">
<xsl:variable name="retval">
<xsl:call-template name="cookOutParam">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="value" select="$retValValue" />
<xsl:with-param name="idltype" select="$returnidltype" />
<xsl:with-param name="safearray" select="$returnidlsafearray" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(' return ', $retval, ';&#10;')"/>
</xsl:if>
<xsl:text> } catch (InvalidObjectFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> } catch (RuntimeFaultMsg e) {&#10;</xsl:text>
<xsl:text> throw new WebServiceException(e);&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<!-- end of class -->
<xsl:text>}&#10;</xsl:text>
<xsl:value-of select="concat('&#10;// ##### ENDFILE &quot;', $filename, '.java&quot;&#10;&#10;')" />
<xsl:call-template name="endFile">
<xsl:with-param name="file" select="concat($filename, '.java')" />
</xsl:call-template>
</xsl:if>
</xsl:for-each>
<!-- <xsl:apply-templates /> -->
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
if
- - - - - - - - - - - - - - - - - - - - - - -->
<!--
* ignore all |if|s except those for WSDL target
-->
<xsl:template match="if">
<xsl:if test="@target='wsdl'">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
cpp
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="cpp">
<!-- ignore this -->
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
library
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="library">
<xsl:apply-templates />
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
class
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="module/class">
<!-- TODO swallow for now -->
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
enum
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="enum">
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
const
- - - - - - - - - - - - - - - - - - - - - - -->
<!--
<xsl:template match="const">
<xsl:apply-templates />
</xsl:template>
-->
<!-- - - - - - - - - - - - - - - - - - - - - - -
desc
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="desc">
<!-- TODO swallow for now -->
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
note
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="note">
<!-- TODO -->
<xsl:apply-templates />
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
interface
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="interface">
</xsl:template>
</xsl:stylesheet>