websrv-php.xsl revision bb97689fe2a180cbf0c76ce0b346055dc10da93d
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:stylesheet version = '1.0'
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync xmlns:vbox="http://www.virtualbox.org/">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<!--
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync websrv-php.xsl:
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync XSLT stylesheet that generates vboxServiceWrappers.php from
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync VirtualBox.xidl. This PHP file represents our
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync web service API. Depends on WSDL file for actual SOAP bindings.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
ff48d61b8f3cc4acbe0615d5fcb3dbb28f154347vboxsync Contributed by James Lucas (mjlucas at eng.uts.edu.au).
ff48d61b8f3cc4acbe0615d5fcb3dbb28f154347vboxsync
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync Copyright (C) 2009 Sun Microsystems, Inc.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync This file is part of VirtualBox Open Source Edition (OSE), as
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync available from http://www.virtualbox.org. This file is free software;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync you can redistribute it and/or modify it under the terms of the GNU
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync General Public License (GPL) as published by the Free Software
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync Foundation, in version 2 as it comes in the "COPYING" file of the
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync VirtualBox OSE distribution. VirtualBox OSE is distributed in the
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync Clara, CA 95054 USA or visit http://www.sun.com if you need
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync additional information or have any questions.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync-->
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:output
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync method="text"
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync version="1.0"
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync encoding="utf-8"
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync indent="no"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:include href="websrv-shared.inc.xsl" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:variable name="G_setSuppressedInterfaces"
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync select="//interface[@wsmap='suppress']" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="emitOutParam">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="type" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="value" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="safearray" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:choose>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='wstring' or $type='uuid'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">string</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='boolean'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">bool</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='long' or $type='unsigned long' or $type='long long' or $type='short' or $type='unsigned short' or $type='unsigned long long' or $type='result'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">int</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='double' or $type='float'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">float</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='octet'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">octet</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$type='$unknown'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitObject">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type">VBox_ManagedObject</xsl:with-param>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:otherwise>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitObject">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type" select="$type" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="$value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="$safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:otherwise>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:choose>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync</xsl:template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync<xsl:template name="emitObject">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="type" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="safearray" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:choose>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$safearray='yes'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:text>new </xsl:text><xsl:value-of select="$type" />Collection ($this->connection, (array)<xsl:value-of select="$value"/><xsl:text>)</xsl:text>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:otherwise>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:text>new </xsl:text><xsl:value-of select="$type" /> ($this->connection, <xsl:value-of select="$value"/><xsl:text>)</xsl:text>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:otherwise>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:choose>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync</xsl:template>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync<xsl:template name="emitPrimitive">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="type" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="value" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:param name="safearray" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:choose>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:when test="$safearray='yes'">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:text>(array)</xsl:text><xsl:value-of select="$value"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:when>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:otherwise>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:text>(</xsl:text><xsl:value-of select="$type" /><xsl:text>)</xsl:text><xsl:value-of select="$value"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:otherwise>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="emitGetAttribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="ifname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrtype" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrsafearray" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="fname"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function <xsl:value-of select="$fname"/>() {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request = new stdClass();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request->_this = $this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $response = $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request));
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>return </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="emitOutParam">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="type" select="$attrtype" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="value" select="concat('$response->','returnval')" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="safearray" select="@safearray"/>
e0b91e4f93fb43371374df4aeb636dffea336056vboxsync </xsl:call-template><xsl:text>;</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="emitSetAttribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="ifname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrtype" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="attrsafearray" />
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:variable name="fname"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function <xsl:value-of select="$fname"/>($value) {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync $request = new stdClass();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request->_this = $this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync if (is_int($value) || is_string($value) || is_bool($value)) {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request-><xsl:value-of select="$attrname"/> = $value;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync else
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request-><xsl:value-of select="$attrname"/> = $value->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request));
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="interface">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:variable name="extends"><xsl:value-of select="@extends" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync/**
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Generated VBoxWebService Interface Wrapper
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync*/
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync</xsl:text>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:choose>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')">
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:value-of select="concat('class ', $ifname, ' extends VBox_ManagedObject {&#10;')" />
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync </xsl:when>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:when test="//interface[@name=$extends]">
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:value-of select="concat('class ', $ifname, ' extends ', $extends, ' {&#10;')" />
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync </xsl:when>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync </xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="method">
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync <xsl:if test="not((param[@type=($G_setSuppressedInterfaces/@name)])
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync or (param[@mod='ptr']))" >
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync <xsl:call-template name="method">
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync <xsl:with-param name="wsmap" select="$wsmap" />
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync </xsl:call-template>
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="attribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:when>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:otherwise>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:when test="@readonly='yes'">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:when>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:otherwise>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:otherwise>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <!-- aa) get method: emit request and result -->
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="emitGetAttribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="ifname" select="$ifname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="attrname" select="$attrname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="attrtype" select="$attrtype" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:call-template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <!-- bb) emit a set method if the attribute is read/write -->
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="not($attrreadonly='yes')">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="emitSetAttribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="ifname" select="$ifname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="attrname" select="$attrname" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="attrtype" select="$attrtype" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:call-template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:otherwise>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:choose>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="collection">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync/**
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Generated VBoxWebService Managed Object Collection
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*/</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsyncclass <xsl:value-of select="$ifname"/>Collection extends VBox_ManagedObjectCollection {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync protected $_interfaceName = "<xsl:value-of select="$ifname"/>";
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="interfacestruct">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync/**
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Generated VBoxWebService Struct
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*/</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsyncclass <xsl:value-of select="$ifname"/> extends VBox_Struct {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="attribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync protected $<xsl:value-of select="@name"/>;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync public function __construct($connection, $values) {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync $this->connection = $connection;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="attribute">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync $this-><xsl:value-of select="@name"/> = $values-><xsl:value-of select="@name"/><xsl:text>;</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="attribute">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function <xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>() {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:text>return </xsl:text>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:call-template name="emitOutParam">
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="type" select="@type" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="value" select="concat('$this->',@name)" />
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync <xsl:with-param name="safearray" select="@safearray"/>
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync </xsl:call-template>;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync<xsl:template name="structcollection">
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:text>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync/**
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync* Generated VBoxWebService Struct Collection
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync*/</xsl:text>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncclass <xsl:value-of select="$ifname"/>Collection extends VBox_StructCollection {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_interfaceName = "<xsl:value-of select="$ifname"/>";
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync}
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync</xsl:template>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="genreq">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="wsmap" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>$request = new stdClass()</xsl:text>;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="$wsmap='managed'">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request->_this = $this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="param[@dir='in']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request-><xsl:value-of select="@name" /> = $arg_<xsl:value-of select="@name" /><xsl:text>;</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $response = $this->connection->__soapCall('<xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>', array((array)$request));
e0b91e4f93fb43371374df4aeb636dffea336056vboxsync <!-- return needs to be the first one -->
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync return <xsl:if test="param[@dir='out']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>array(</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="param[@dir='return']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="emitOutParam">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="type" select="@type" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="value" select="concat('$response->','returnval')" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="safearray" select="@safearray"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:call-template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="../param[@dir='out']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>, </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="param[@dir='out']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="not(position()=1)">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>, </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="emitOutParam">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="type" select="@type" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="value" select="concat('$response->',@name)" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:with-param name="safearray" select="@safearray"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:call-template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="param[@dir='out']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>)</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync <xsl:text>;&#10;</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="method" >
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:param name="wsmap" />
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function <xsl:value-of select="@name"/><xsl:text>(</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="param[@dir='in']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:if test="not(position()=1)">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>, </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:if>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:value-of select="concat('$arg_',@name)"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each><xsl:text>) { &#10; </xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="genreq"><xsl:with-param name="wsmap" select="$wsmap" /></xsl:call-template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text> }&#10;</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template name="enum">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync/**
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Generated VBoxWebService ENUM
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*/</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsyncclass <xsl:value-of select="@name"/> extends VBox_Enum {
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync public $NameMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')"><xsl:value-of select="@value"/> => '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>);
d616d445d74ff474716e9c5105c9d8d52abaac20vboxsync public $ValueMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')">'<xsl:value-of select="@name"/>' => <xsl:value-of select="@value"/><xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync<xsl:template name="enumcollection">
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:text>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync/**
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync* Generated VBoxWebService Enum Collection
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync*/</xsl:text>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncclass <xsl:value-of select="$ifname"/>Collection extends VBox_EnumCollection {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_interfaceName = "<xsl:value-of select="$ifname"/>";
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync}
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync</xsl:template>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:template match="/">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync<xsl:text>&lt;?php
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync/*
5a830ff4499e2a4221c717c199bbf29ee388a128vboxsync* Copyright (C) 2009 Sun Microsystems, Inc.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* This file is part of VirtualBox Open Source Edition (OSE), as
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* available from http://www.virtualbox.org. This file is free software;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* you can redistribute it and/or modify it under the terms of the GNU
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* General Public License (GPL) as published by the Free Software
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Foundation, in version 2 as it comes in the "COPYING" file of the
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* Clara, CA 95054 USA or visit http://www.sun.com if you need
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* additional information or have any questions.
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync* This file is autogenerated from VirtualBox.xidl, DO NOT EDIT!
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync*/
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsyncclass VBox_ManagedObject
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync{
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync protected $connection;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync protected $handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function __construct($soap, $handle = null)
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $this->connection = $soap;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $this->handle = $handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __toString()
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync return (string)$this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __set($attr, $value)
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $methodName = "set" . $attr;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync if (method_exists($this, $methodName))
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $this->$methodName($value);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync else
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync throw new Exception("Attribute does not exist");
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __get($attr)
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $methodName = "get" . $attr;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync if (method_exists($this, $methodName))
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync return $this->$methodName();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync else
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync throw new Exception("Attribute does not exist");
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function getHandle()
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync return $this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync public function cast($class)
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync if (is_subclass_of($class, 'VBox_ManagedObject'))
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync return new $class($this->connection, $this->handle);
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync }
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync throw new Exception('Cannot cast VBox_ManagedObject to non-child class VBox_ManagedObject');
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync }
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function releaseRemote()
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync try
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
e0b91e4f93fb43371374df4aeb636dffea336056vboxsync $request = new stdClass();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $request->_this = $this->handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $this->connection->__soapCall('IManagedObjectRef_release', array((array)$request));
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync } catch (Exception $ex) {}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncabstract class VBox_Collection implements ArrayAccess, Iterator, Countable {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_connection;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_values;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_objects;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_interfaceName;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function __construct($soap, array $values = array()) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_connection = $soap;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_values = $values;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_soapToObject();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected function _soapToObject() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_objects = array();
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync foreach($this->_values as $value)
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_objects[] = new $this->_interfaceName($this->_connection, $value);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync /** ArrayAccess Functions **/
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function offsetSet($offset, $value) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync if ($value instanceof $this->_interfaceName)
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync if ($offset)
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_objects[$offset] = $value;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync else
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_objects[] = $value;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync else
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync throw new Exception("Value must be a instance of " . $this->_interfaceName);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function offsetExists($offset) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return isset($this->_objects[$offset]);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function offsetUnset($offset) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync unset($this->_objects[$offset]);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function offsetGet($offset) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return isset($this->_objects[$offset]) ? $this->_objects[$offset] : null;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync /** Iterator Functions **/
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function rewind() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync reset($this->_objects);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function current() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return current($this->_objects);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function key() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return key($this->_objects);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function next() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return next($this->_objects);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function valid() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return ($this->current() !== false);
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync /** Countable Functions **/
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync public function count() {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return count($this->_objects);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync}
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncclass VBox_ManagedObjectCollection extends VBox_Collection {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_interfaceName = 'VBox_ManagedObject';
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync // Result is undefined if this is called AFTER any call to VBox_Collection::offsetSet or VBox_Collection::offsetUnset
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function setInterfaceName($interface) {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync if (!is_subclass_of($interface, 'VBox_ManagedObject'))
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync throw new Exception('Cannot set collection interface to non-child class of VBox_ManagedObject');
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_interfaceName = $interface;
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_soapToObject();
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsyncabstract class VBox_Struct {
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync protected $connection;
e804c5028b8dfc11990922d2fdbf40ad3db6d66cvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __get($attr)
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync $methodName = "get" . $attr;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync if (method_exists($this, $methodName))
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync return $this->$methodName();
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync else
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync throw new Exception("Attribute does not exist");
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncabstract class VBox_StructCollection extends VBox_Collection {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync public function __construct($soap, array $values = array())
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync if (!(array_values($values) === $values))
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $values = array((object)$values); //Fix for when struct return value only contains one list item (e.g. one medium attachment)
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync parent::__construct($soap, $values);
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync }
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync}
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsyncabstract class VBox_Enum {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync protected $_handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __construct($connection, $handle)
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync if (is_string($handle))
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_handle = $this->ValueMap[$handle];
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync else
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync $this->_handle = $handle;
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync public function __toString()
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync return (string)$this->NameMap[$this->_handle];
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync }
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync}
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsyncabstract class VBox_EnumCollection extends VBox_Collection {
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync}
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:text>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="//interface[@wsmap='managed' or @wsmap='global']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="interface"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="collection"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="//interface[@wsmap='struct']">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="interfacestruct"/>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:call-template name="structcollection"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:for-each select="//enum">
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync <xsl:call-template name="enum"/>
bb97689fe2a180cbf0c76ce0b346055dc10da93dvboxsync <xsl:call-template name="enumcollection"/>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync </xsl:for-each>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:template>
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync
92eb6e9fc8a36d83ad72344227a488a99945db52vboxsync</xsl:stylesheet>