VirtualBox

Changeset 38796 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 19, 2011 5:11:11 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74091
Message:

Main/glue: Add javadoc comments to the java glue code, use them to generate a documentation jar file. Add an OSGi compliant manifest file to the webservice jar.

Location:
trunk/src/VBox/Main
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r38788 r38796  
    917917              --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
    918918              --stringparam G_vboxGlueStyle mscom              \
     919              --stringparam G_vboxDirPrefix ""                 \
    919920              -o $(VBOX_JMSCOM_GEN)/java/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
    920921        $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JMSCOM_GEN)/java/merged.file $(VBOX_JMSCOM_GEN)/java
  • trunk/src/VBox/Main/glue/glue-java.xsl

    r37457 r38796  
    1111        VirtualBox.xidl.
    1212
    13      Copyright (C) 2010 Oracle Corporation
     13     Copyright (C) 2010-2011 Oracle Corporation
    1414
    1515     This file is part of VirtualBox Open Source Edition (OSE), as
     
    4343<xsl:include href="../webservice/websrv-shared.inc.xsl" />
    4444
     45<xsl:strip-space elements="*"/>
     46
    4547<xsl:template name="fileheader">
    4648  <xsl:param name="name" />
    47   <xsl:text>/**
    48  *  Copyright (C) 2010 Oracle Corporation
     49  <xsl:text>/*
     50 *  Copyright (C) 2010-2011 Oracle Corporation
    4951 *
    5052 *  This file is part of VirtualBox Open Source Edition (OSE), as
     
    7274  <xsl:param name="package" />
    7375
    74   <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $file, '&quot;&#10;&#10;')" />
     76  <xsl:value-of select="concat('&#10;// ##### BEGINFILE &quot;', $G_vboxDirPrefix, $file, '&quot;&#10;&#10;')" />
    7577  <xsl:call-template name="fileheader">
    7678    <xsl:with-param name="name" select="$file" />
     
    9193
    9294    <xsl:when test="$G_vboxGlueStyle='jaxws'">
    93       <xsl:value-of select="       'import javax.xml.ws.*;&#10;'" />
     95      <xsl:value-of select="'import javax.xml.ws.*;&#10;'" />
    9496    </xsl:when>
    9597
     
    107109</xsl:template>
    108110
     111
     112<xsl:template name="string-replace">
     113  <xsl:param name="haystack"/>
     114  <xsl:param name="needle"/>
     115  <xsl:param name="replacement"/>
     116  <xsl:choose>
     117    <xsl:when test="contains($haystack,$needle)">
     118      <xsl:value-of select="substring-before($haystack,$needle)"/>
     119      <xsl:value-of select="$replacement"/>
     120      <xsl:call-template name="string-replace">
     121        <xsl:with-param name="haystack" select="substring-after($haystack,$needle)"/>
     122        <xsl:with-param name="needle" select="$needle"/>
     123        <xsl:with-param name="replacement" select="$replacement"/>
     124      </xsl:call-template>
     125    </xsl:when>
     126    <xsl:otherwise>
     127      <xsl:value-of select="$haystack"/>
     128    </xsl:otherwise>
     129  </xsl:choose>
     130</xsl:template>
     131
     132<!-- descriptions -->
     133
     134<xsl:template match="*/text()">
     135  <!-- TODO: strip out @c/@a for now. long term solution is changing that to a
     136       tag in the xidl file, and translate it when generating doxygen etc. -->
     137  <xsl:variable name="rep1">
     138    <xsl:call-template name="string-replace">
     139      <xsl:with-param name="haystack" select="."/>
     140      <xsl:with-param name="needle" select="'@c'"/>
     141      <xsl:with-param name="replacement" select="''"/>
     142    </xsl:call-template>
     143  </xsl:variable>
     144
     145  <xsl:variable name="rep2">
     146    <xsl:call-template name="string-replace">
     147      <xsl:with-param name="haystack" select="$rep1"/>
     148      <xsl:with-param name="needle" select="'@a'"/>
     149      <xsl:with-param name="replacement" select="''"/>
     150    </xsl:call-template>
     151  </xsl:variable>
     152
     153  <xsl:variable name="rep3">
     154    <xsl:call-template name="string-replace">
     155      <xsl:with-param name="haystack" select="$rep2"/>
     156      <xsl:with-param name="needle" select="'@todo'"/>
     157      <xsl:with-param name="replacement" select="'TODO'"/>
     158    </xsl:call-template>
     159  </xsl:variable>
     160
     161  <xsl:value-of select="$rep3"/>
     162</xsl:template>
     163
     164<!--
     165 *  all sub-elements that are not explicitly matched are considered to be
     166 *  html tags and copied w/o modifications
     167-->
     168<xsl:template match="desc//*">
     169  <xsl:variable name="tagname" select="local-name()"/>
     170  <xsl:value-of select="concat('&lt;',$tagname,'&gt;')"/>
     171  <xsl:apply-templates/>
     172  <xsl:value-of select="concat('&lt;/',$tagname,'&gt;')"/>
     173</xsl:template>
     174
     175<xsl:template name="emit_refsig">
     176  <xsl:param name="context"/>
     177  <xsl:param name="identifier"/>
     178
     179  <xsl:choose>
     180    <xsl:when test="//enum[@name=$context]/const[@name=$identifier]">
     181      <xsl:value-of select="$identifier"/>
     182    </xsl:when>
     183    <xsl:when test="//interface[@name=$context]/method[@name=$identifier]">
     184      <xsl:value-of select="$identifier"/>
     185      <xsl:text>(</xsl:text>
     186      <xsl:for-each select="//interface[@name=$context]/method[@name=$identifier]/param">
     187        <xsl:if test="@dir!='return'">
     188          <xsl:if test="position() > 1">
     189            <xsl:text>,</xsl:text>
     190          </xsl:if>
     191          <xsl:choose>
     192            <xsl:when test="@dir='out'">
     193              <xsl:text>Holder</xsl:text>
     194            </xsl:when>
     195            <xsl:otherwise>
     196              <xsl:call-template name="typeIdl2Glue">
     197                <xsl:with-param name="type" select="@type"/>
     198                <xsl:with-param name="safearray" select="@safearray"/>
     199                <xsl:with-param name="skiplisttype" select="'yes'"/>
     200              </xsl:call-template>
     201            </xsl:otherwise>
     202          </xsl:choose>
     203        </xsl:if>
     204      </xsl:for-each>
     205      <xsl:text>)</xsl:text>
     206    </xsl:when>
     207    <xsl:when test="//interface[@name=$context]/attribute[@name=$identifier]">
     208      <xsl:call-template name="makeGetterName">
     209        <xsl:with-param name="attrname" select="$identifier" />
     210      </xsl:call-template>
     211      <xsl:text>()</xsl:text>
     212    </xsl:when>
     213    <xsl:otherwise>
     214      <xsl:call-template name="fatalError">
     215        <xsl:with-param name="msg" select="concat('unknown reference destination in @see/@link: context=',$context,' identifier=',$identifier)" />
     216      </xsl:call-template>
     217    </xsl:otherwise>
     218  </xsl:choose>
     219</xsl:template>
     220
     221<!--
     222 *  link
     223-->
     224<xsl:template match="desc//link">
     225  <xsl:text>{@link </xsl:text>
     226  <xsl:apply-templates select="." mode="middle"/>
     227  <xsl:text>}</xsl:text>
     228</xsl:template>
     229
     230<xsl:template match="link" mode="middle">
     231  <xsl:variable name="linktext">
     232    <xsl:value-of select="translate(@to,'_','#')"/>
     233  </xsl:variable>
     234  <xsl:choose>
     235    <xsl:when test="substring($linktext,1,1)='#'">
     236      <xsl:variable name="context">
     237        <xsl:choose>
     238          <xsl:when test="local-name(../..)='interface' or local-name(../..)='enum'">
     239            <xsl:value-of select="../../@name"/>
     240          </xsl:when>
     241          <xsl:when test="local-name(../../..)='interface' or local-name(../../..)='enum'">
     242            <xsl:value-of select="../../../@name"/>
     243          </xsl:when>
     244          <xsl:when test="local-name(../../../..)='interface' or local-name(../../../..)='enum'">
     245            <xsl:value-of select="../../../../@name"/>
     246          </xsl:when>
     247          <xsl:when test="local-name(../../../../..)='interface' or local-name(../../../../..)='enum'">
     248            <xsl:value-of select="../../../../../@name"/>
     249          </xsl:when>
     250          <xsl:when test="local-name(../../../../../..)='interface' or local-name(../../../../../..)='enum'">
     251            <xsl:value-of select="../../../../../../@name"/>
     252          </xsl:when>
     253          <xsl:otherwise>
     254            <xsl:call-template name="fatalError">
     255              <xsl:with-param name="msg" select="concat('cannot determine context for identifier ',$linktext)" />
     256            </xsl:call-template>
     257          </xsl:otherwise>
     258        </xsl:choose>
     259      </xsl:variable>
     260      <xsl:variable name="linkname">
     261        <xsl:value-of select="substring($linktext,2)"/>
     262      </xsl:variable>
     263      <xsl:text>#</xsl:text>
     264      <xsl:call-template name="emit_refsig">
     265        <xsl:with-param name="context" select="$context"/>
     266        <xsl:with-param name="identifier" select="$linkname"/>
     267      </xsl:call-template>
     268    </xsl:when>
     269    <xsl:when test="contains($linktext,'::')">
     270      <xsl:variable name="context">
     271        <xsl:value-of select="substring-before($linktext,'::')"/>
     272      </xsl:variable>
     273      <xsl:variable name="linkname">
     274        <xsl:value-of select="substring-after($linktext,'::')"/>
     275      </xsl:variable>
     276      <xsl:value-of select="concat($G_virtualBoxPackage,'.',$context,'#')"/>
     277      <xsl:call-template name="emit_refsig">
     278        <xsl:with-param name="context" select="$context"/>
     279        <xsl:with-param name="identifier" select="$linkname"/>
     280      </xsl:call-template>
     281    </xsl:when>
     282    <xsl:otherwise>
     283      <xsl:value-of select="concat($G_virtualBoxPackage,'.',$linktext)"/>
     284    </xsl:otherwise>
     285  </xsl:choose>
     286</xsl:template>
     287<!--
     288 *  note
     289-->
     290<xsl:template match="desc/note">
     291  <xsl:if test="not(@internal='yes')">
     292    <xsl:text>&#10;NOTE: </xsl:text>
     293    <xsl:apply-templates/>
     294    <xsl:text>&#10;</xsl:text>
     295  </xsl:if>
     296</xsl:template>
     297
     298<!--
     299 *  see
     300-->
     301<xsl:template match="desc/see">
     302  <!-- TODO: quirk in our xidl file: only one <see> tag with <link> nested
     303       into it, translate this to multiple @see lines and strip the rest.
     304       Should be replaced in the xidl by multiple <see> without nested tag  -->
     305  <xsl:text>&#10;</xsl:text>
     306  <xsl:apply-templates match="link"/>
     307</xsl:template>
     308
     309<xsl:template match="desc/see/text()"/>
     310
     311<xsl:template match="desc/see/link">
     312  <xsl:text>@see </xsl:text>
     313  <xsl:apply-templates select="." mode="middle"/>
     314  <xsl:text>&#10;</xsl:text>
     315</xsl:template>
     316
     317<!--
     318 *  common comment prologue (handles group IDs)
     319-->
     320<xsl:template match="desc" mode="begin">
     321  <xsl:param name="id" select="@group | preceding::descGroup[1]/@id"/>
     322  <xsl:text>/**&#10;</xsl:text>
     323  <xsl:if test="$id">
     324    <xsl:value-of select="concat(' @ingroup ',$id,'&#10;')"/>
     325  </xsl:if>
     326</xsl:template>
     327
     328<!--
     329 *  common middle part of the comment block
     330-->
     331<xsl:template match="desc" mode="middle">
     332  <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
     333  <xsl:apply-templates select="note"/>
     334  <xsl:apply-templates select="see"/>
     335</xsl:template>
     336
     337<!--
     338 *  result part of the comment block
     339-->
     340<xsl:template match="desc" mode="results">
     341  <xsl:if test="result">
     342    <xsl:text>&#10;Expected result codes:&#10;</xsl:text>
     343    <xsl:text>&lt;table&gt;&#10;</xsl:text>
     344    <xsl:for-each select="result">
     345      <xsl:text>&lt;tr&gt;</xsl:text>
     346      <xsl:choose>
     347        <xsl:when test="ancestor::library/result[@name=current()/@name]">
     348          <xsl:value-of select="concat('&lt;td&gt;@link ::',@name,' ',@name,'&lt;/td&gt;')"/>
     349        </xsl:when>
     350        <xsl:otherwise>
     351          <xsl:value-of select="concat('&lt;td&gt;',@name,'&lt;/td&gt;')"/>
     352        </xsl:otherwise>
     353      </xsl:choose>
     354      <xsl:text>&lt;td&gt;</xsl:text>
     355      <xsl:apply-templates select="text() | *[not(self::note or self::see or
     356                                                  self::result)]"/>
     357      <xsl:text>&lt;/td&gt;&lt;tr&gt;&#10;</xsl:text>
     358    </xsl:for-each>
     359    <xsl:text>&lt;/table&gt;&#10;</xsl:text>
     360  </xsl:if>
     361</xsl:template>
     362
     363<!--
     364 *  translates the string to uppercase
     365-->
     366<xsl:template name="uppercase">
     367  <xsl:param name="str" select="."/>
     368  <xsl:value-of select="
     369    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
     370  "/>
     371</xsl:template>
     372
     373<!--
     374 *  comment for interfaces
     375-->
     376<xsl:template match="desc" mode="interface">
     377  <xsl:apply-templates select="." mode="begin"/>
     378  <xsl:apply-templates select="." mode="middle"/>
     379  <xsl:text>&#10;Interface ID: &lt;tt&gt;{</xsl:text>
     380  <xsl:call-template name="uppercase">
     381    <xsl:with-param name="str" select="../@uuid"/>
     382  </xsl:call-template>
     383  <xsl:text>}&lt;/tt&gt;&#10;*/&#10;</xsl:text>
     384</xsl:template>
     385
     386<!--
     387 *  comment for attribute getters
     388-->
     389<xsl:template match="desc" mode="attribute_get">
     390  <xsl:apply-templates select="." mode="begin"/>
     391  <xsl:apply-templates select="text() | *[not(self::note or self::see or self::result)]"/>
     392  <xsl:apply-templates select="." mode="results"/>
     393  <xsl:apply-templates select="note"/>
     394  <xsl:text>&#10;@return </xsl:text>
     395  <xsl:call-template name="typeIdl2Glue">
     396    <xsl:with-param name="type" select="../@type"/>
     397    <xsl:with-param name="safearray" select="../@safearray"/>
     398  </xsl:call-template>
     399  <xsl:text>&#10;</xsl:text>
     400  <xsl:apply-templates select="see"/>
     401  <xsl:text>&#10;*/&#10;</xsl:text>
     402</xsl:template>
     403
     404<!--
     405 *  comment for attribute setters
     406-->
     407<xsl:template match="desc" mode="attribute_set">
     408  <xsl:apply-templates select="." mode="begin"/>
     409  <xsl:apply-templates select="text() | *[not(self::note or self::see or self::result)]"/>
     410  <xsl:apply-templates select="." mode="results"/>
     411  <xsl:apply-templates select="note"/>
     412  <xsl:text>&#10;@param value </xsl:text>
     413  <xsl:call-template name="typeIdl2Glue">
     414    <xsl:with-param name="type" select="../@type"/>
     415    <xsl:with-param name="safearray" select="../@safearray"/>
     416  </xsl:call-template>
     417  <xsl:text>&#10;</xsl:text>
     418  <xsl:apply-templates select="see"/>
     419  <xsl:text>&#10;*/&#10;</xsl:text>
     420</xsl:template>
     421
     422<!--
     423 *  comment for methods
     424-->
     425<xsl:template match="desc" mode="method">
     426  <xsl:apply-templates select="." mode="begin"/>
     427  <xsl:apply-templates select="text() | *[not(self::note or self::see or self::result)]"/>
     428  <xsl:for-each select="../param">
     429    <xsl:apply-templates select="desc"/>
     430  </xsl:for-each>
     431  <xsl:apply-templates select="." mode="results"/>
     432  <xsl:apply-templates select="note"/>
     433  <xsl:apply-templates select="../param/desc/note"/>
     434  <xsl:apply-templates select="see"/>
     435  <xsl:text>&#10;*/&#10;</xsl:text>
     436</xsl:template>
     437
     438<!--
     439 *  comment for method parameters
     440-->
     441<xsl:template match="method/param/desc">
     442  <xsl:if test="text() | *[not(self::note or self::see)]">
     443    <xsl:choose>
     444      <xsl:when test="../@dir='return'">
     445        <xsl:text>&#10;@return </xsl:text>
     446      </xsl:when>
     447      <xsl:otherwise>
     448        <xsl:text>&#10;@param </xsl:text>
     449        <xsl:value-of select="../@name"/>
     450        <xsl:text> </xsl:text>
     451      </xsl:otherwise>
     452    </xsl:choose>
     453    <xsl:apply-templates select="text() | *[not(self::note or self::see)]"/>
     454    <xsl:text>&#10;</xsl:text>
     455  </xsl:if>
     456</xsl:template>
     457
     458<!--
     459 *  comment for enums
     460-->
     461<xsl:template match="desc" mode="enum">
     462  <xsl:apply-templates select="." mode="begin"/>
     463  <xsl:apply-templates select="." mode="middle"/>
     464  <xsl:text>&#10;Interface ID: &lt;tt&gt;{</xsl:text>
     465  <xsl:call-template name="uppercase">
     466    <xsl:with-param name="str" select="../@uuid"/>
     467  </xsl:call-template>
     468  <xsl:text>}&lt;/tt&gt;&#10;*/&#10;</xsl:text>
     469</xsl:template>
     470
     471<!--
     472 *  comment for enum values
     473-->
     474<xsl:template match="desc" mode="enum_const">
     475  <xsl:apply-templates select="." mode="begin"/>
     476  <xsl:apply-templates select="." mode="middle"/>
     477  <xsl:text>&#10;*/&#10;</xsl:text>
     478</xsl:template>
     479
     480<!--
     481 *  ignore descGroups by default (processed in /idl)
     482-->
     483<xsl:template match="descGroup"/>
     484
     485
     486
     487<!-- actual code generation -->
     488
    109489<xsl:template name="genEnum">
    110490  <xsl:param name="enumname" />
     
    116496  </xsl:call-template>
    117497
     498  <xsl:apply-templates select="desc" mode="enum"/>
    118499  <xsl:value-of select="concat('public enum ', $enumname, ' {&#10;&#10;')" />
    119500  <xsl:for-each select="const">
     501    <xsl:apply-templates select="desc" mode="enum_const"/>
    120502    <xsl:variable name="enumconst" select="@name" />
    121503    <xsl:value-of select="concat('    ', $enumconst, '(', @value, ')')" />
     
    164546<xsl:template name="startExcWrapper">
    165547
    166   <xsl:value-of select="   '      try {&#10;'" />
     548  <xsl:value-of select="'      try {&#10;'" />
    167549
    168550</xsl:template>
     
    247629  <xsl:param name="safearray" />
    248630  <xsl:param name="forceelem" />
     631  <xsl:param name="skiplisttype" />
    249632
    250633  <xsl:variable name="needarray" select="($safearray='yes') and not($forceelem='yes')" />
     
    252635
    253636  <xsl:if test="($needlist)">
    254     <xsl:value-of select="'List&lt;'" />
     637    <xsl:value-of select="'List'" />
     638    <xsl:if test="not($skiplisttype='yes')">
     639      <xsl:value-of select="'&lt;'" />
     640    </xsl:if>
    255641  </xsl:if>
    256642
    257   <!-- look up Java type from IDL type from table array in websrv-shared.inc.xsl -->
    258   <xsl:variable name="javatypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@javaname" />
    259 
    260   <xsl:choose>
    261     <xsl:when test="string-length($javatypefield)">
    262       <xsl:value-of select="$javatypefield" />
    263     </xsl:when>
    264     <!-- not a standard type: then it better be one of the types defined in the XIDL -->
    265     <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
    266     <xsl:otherwise>
    267       <xsl:call-template name="fullClassName">
    268         <xsl:with-param name="name" select="$type" />
    269         <xsl:with-param name="collPrefix" select="''"/>
    270       </xsl:call-template>
    271     </xsl:otherwise>
    272   </xsl:choose>
     643  <xsl:if test="not($needlist) or not($skiplisttype='yes')">
     644    <!-- look up Java type from IDL type from table array in websrv-shared.inc.xsl -->
     645    <xsl:variable name="javatypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@javaname" />
     646
     647    <xsl:choose>
     648      <xsl:when test="string-length($javatypefield)">
     649        <xsl:value-of select="$javatypefield" />
     650      </xsl:when>
     651      <!-- not a standard type: then it better be one of the types defined in the XIDL -->
     652      <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
     653      <xsl:otherwise>
     654        <xsl:call-template name="fullClassName">
     655          <xsl:with-param name="name" select="$type" />
     656          <xsl:with-param name="collPrefix" select="''"/>
     657        </xsl:call-template>
     658      </xsl:otherwise>
     659    </xsl:choose>
     660  </xsl:if>
    273661
    274662  <xsl:choose>
    275663    <xsl:when test="($needlist)">
    276       <xsl:value-of select="'&gt;'" />
     664      <xsl:if test="not($skiplisttype='yes')">
     665        <xsl:value-of select="'&gt;'" />
     666      </xsl:if>
    277667    </xsl:when>
    278668    <xsl:when test="($needarray)">
     
    14271817        </xsl:choose>
    14281818      </xsl:variable>
     1819      <xsl:apply-templates select="desc" mode="method"/>
    14291820      <xsl:value-of select="concat('    public ', $returngluetype, ' ', $methodname, '(')" />
    14301821      <xsl:variable name="paramsinout" select="param[@dir='in' or @dir='out']" />
     
    18672258      <xsl:otherwise>
    18682259        <!-- emit getter method -->
     2260        <xsl:apply-templates select="desc" mode="attribute_get"/>
    18692261        <xsl:variable name="gettername">
    18702262          <xsl:call-template name="makeGetterName">
     
    19092301        <xsl:if test="not(@readonly='yes')">
    19102302          <!-- emit setter method -->
     2303          <xsl:apply-templates select="desc" mode="attribute_set"/>
    19112304          <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
    19122305          <xsl:variable name="unwrapped">
     
    19622355  </xsl:call-template>
    19632356
    1964    <xsl:text>import java.util.List;&#10;</xsl:text>
    1965 
    1966     <xsl:choose>
    1967         <xsl:when test="($wsmap='struct') and ($G_vboxGlueStyle='jaxws')">
    1968           <xsl:value-of select="concat('public class ', $ifname, ' {&#10;&#10;')" />
    1969           <xsl:call-template name="genStructWrapperJaxws">
    1970             <xsl:with-param name="ifname" select="$ifname" />
     2357  <xsl:text>import java.util.List;&#10;&#10;</xsl:text>
     2358
     2359  <xsl:apply-templates select="desc" mode="interface"/>
     2360
     2361  <xsl:choose>
     2362    <xsl:when test="($wsmap='struct') and ($G_vboxGlueStyle='jaxws')">
     2363      <xsl:value-of select="concat('public class ', $ifname, ' {&#10;&#10;')" />
     2364      <xsl:call-template name="genStructWrapperJaxws">
     2365        <xsl:with-param name="ifname" select="$ifname" />
     2366      </xsl:call-template>
     2367    </xsl:when>
     2368
     2369    <xsl:otherwise>
     2370      <xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
     2371      <xsl:choose>
     2372        <xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')">
     2373          <xsl:value-of select="concat('public class ', $ifname, ' extends IUnknown {&#10;&#10;')" />
     2374        </xsl:when>
     2375        <xsl:when test="//interface[@name=$extends]">
     2376          <xsl:value-of select="concat('public class ', $ifname, ' extends ', $extends, ' {&#10;&#10;')" />
     2377        </xsl:when>
     2378        <xsl:otherwise>
     2379          <xsl:call-template name="fatalError">
     2380            <xsl:with-param name="msg" select="concat('Interface generation: interface &quot;', $ifname, '&quot; has invalid &quot;extends&quot; value ', $extends, '.')" />
    19712381          </xsl:call-template>
    1972         </xsl:when>
    1973 
    1974         <xsl:otherwise>
    1975           <xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
    1976           <xsl:choose>
    1977             <xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')">
    1978               <xsl:value-of select="concat('public class ', $ifname, ' extends IUnknown {&#10;&#10;')" />
    1979             </xsl:when>
    1980             <xsl:when test="//interface[@name=$extends]">
    1981               <xsl:value-of select="concat('public class ', $ifname, ' extends ', $extends, ' {&#10;&#10;')" />
    1982             </xsl:when>
    1983             <xsl:otherwise>
    1984               <xsl:call-template name="fatalError">
    1985                 <xsl:with-param name="msg" select="concat('Interface generation: interface &quot;', $ifname, '&quot; has invalid &quot;extends&quot; value ', $extends, '.')" />
    1986               </xsl:call-template>
    1987             </xsl:otherwise>
    1988           </xsl:choose>
    1989           <xsl:call-template name="genIfaceWrapper">
    1990              <xsl:with-param name="ifname" select="$ifname" />
    1991            </xsl:call-template>
    19922382        </xsl:otherwise>
    1993     </xsl:choose>
    1994 
    1995     <!-- end of class -->
    1996     <xsl:value-of select="'}&#10;'" />
    1997 
    1998     <xsl:call-template name="endFile">
    1999       <xsl:with-param name="file" select="$filename" />
    2000     </xsl:call-template>
     2383      </xsl:choose>
     2384      <xsl:call-template name="genIfaceWrapper">
     2385        <xsl:with-param name="ifname" select="$ifname" />
     2386      </xsl:call-template>
     2387    </xsl:otherwise>
     2388  </xsl:choose>
     2389
     2390  <!-- end of class -->
     2391  <xsl:value-of select="'}&#10;'" />
     2392
     2393  <xsl:call-template name="endFile">
     2394    <xsl:with-param name="file" select="$filename" />
     2395  </xsl:call-template>
    20012396
    20022397</xsl:template>
     
    20762471
    20772472<xsl:template name="emitHandwritten">
    2078 
    2079  <xsl:call-template name="startFile">
    2080     <xsl:with-param name="file" select="'Holder.java'" />
    2081     <xsl:with-param name="package" select="$G_virtualBoxPackage" />
    2082   </xsl:call-template>
    2083 
    2084  <xsl:text><![CDATA[
    2085 public class Holder<T>
    2086 {
    2087    public T value;
    2088 
    2089    public Holder()
    2090    {
    2091    }
    2092    public Holder(T value)
    2093    {
    2094        this.value = value;
    2095    }
    2096 }
    2097 ]]></xsl:text>
    2098 
    2099  <xsl:call-template name="endFile">
    2100    <xsl:with-param name="file" select="'Holder.java'" />
    2101  </xsl:call-template>
    21022473
    21032474<xsl:call-template name="startFile">
  • trunk/src/VBox/Main/webservice/Makefile.kmk

    r38228 r38796  
    77
    88#
    9 # Copyright (C) 2006-2010 Oracle Corporation
     9# Copyright (C) 2006-2011 Oracle Corporation
    1010#
    1111# This file is part of VirtualBox Open Source Edition (OSE), as
     
    155155PATH_TARGET_WEBTEST           := $(VBOXWEB_OUT_DIR)/webtest
    156156
     157# the original XIDL file (has to include documentation as we need it):
     158VBOXWEB_IDL_SRC_ORIG          := $(VBOX_XIDL_FILE_SRC)
    157159# platform-specific XIDL file generated from $(VBOXWEB_IDL_SRC):
    158 VBOXWEB_IDL_SRC_ORIG          := $(VBOX_XIDL_FILE)
    159 # the original XIDL file:
    160160VBOXWEB_IDL_SRC               := $(VBOXWEB_OUT_DIR)/VirtualBox.xidl
    161161
     
    305305#
    306306VBOX_JWS_JAR     = $(VBoxJWs-inst-jar_0_OUTDIR)/vboxjws.jar
     307VBOX_JWSDOC_JAR  = $(VBoxJWs-inst-jar_0_OUTDIR)/vboxjws-doc.jar
     308VBOX_JWSSRC_JAR  = $(VBoxJWs-inst-jar_0_OUTDIR)/vboxjws-src.jar
    307309VBOX_JWS_TARGET := $(PATH_TARGET)/vboxjws-gen
    308310VBOX_JWS_GEN     = $(VBOX_JWS_TARGET)/jwsgen
    309311VBOX_JWS_JDEST  := $(VBOX_JWS_TARGET)/jdest
     312VBOX_JWSDOC_JDEST  := $(VBOX_JWS_TARGET)/jdest-doc
    310313VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue
    311314VBOX_JAXLIB_DIR    := $(PATH_ROOT)/src/VBox/Main/webservice/jaxlibs
     
    314317VBoxJWs-inst-jar_MODE = a+r,u+w
    315318VBoxJWs-inst-jar_SOURCES = \
    316         $(VBOX_JWS_JAR)
     319        $(VBOX_JWS_JAR) \
     320        $(VBOX_JWSDOC_JAR) \
     321        $(VBOX_JWSSRC_JAR)
    317322VBoxJWs-inst-jar_CLEAN = \
    318323        $(VBOX_JWS_JAR) \
     324        $(VBOX_JWSDOC_JAR) \
     325        $(VBOX_JWSSRC_JAR) \
    319326        $(VBOX_JWS_GEN)/jwsglue.list \
     327        $(VBOX_JWSDOC_JDEST)/package-list \
    320328        $(wildcard \
    321                 $(VBOX_JWS_GEN)/java/*.java \
    322                 $(VBOX_JWS_GEN)/java/jws/*/*/*/*.java \
     329                $(VBOX_JWS_GEN)/java/*/*/*.java \
     330            $(VBOX_JWS_GEN)/java/*/*/*/*.java \
    323331                $(VBOX_JWS_JDEST)/*.class \
    324332                $(VBOX_JWS_JDEST)/*/*.class \
    325333                $(VBOX_JWS_JDEST)/*/*/*.class \
    326334                $(VBOX_JWS_JDEST)/*/*/*/*.class \
     335                $(VBOX_JWSDOC_JDEST)/*.html \
     336                $(VBOX_JWSDOC_JDEST)/*.css \
     337                $(VBOX_JWSDOC_JDEST)/*/*.gif \
     338                $(VBOX_JWSDOC_JDEST)/*/*/*.html \
     339                $(VBOX_JWSDOC_JDEST)/*/*/*/*.html \
    327340        )
    328 VBoxJWs-inst-jar_BLDDIRS += $(VBOX_JWS_GEN)/java $(VBOX_JWS_GEN)/java/jws
    329 
    330 $(VBOX_JWS_GEN)/jwsglue.list:  \
    331                 $(VBOX_XIDL_FILE)    \
    332                 $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \
    333                 $(VBOX_FILESPLIT)    \
     341VBoxJWs-inst-jar_BLDDIRS += $(VBOX_JWS_GEN)/java
     342
     343$(VBOX_JWS_GEN)/jwsglue.list: \
     344                $(VBOXWEB_IDL_SRC_ORIG) \
     345                $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \
     346                $(VBOX_FILESPLIT) \
    334347                $(VBOXWEBSERVICE_WSDL) \
    335348                $(VBOXWEB_WSDL) \
    336                 | $(VBOX_JWS_GEN)/java/jws/
     349                | $(VBOX_JWS_GEN)/java/
    337350        $(call MSG_L1,Generating JAX-WS Java glue files from XIDL)
    338         $(RM) -f $(wildcard $(VBOX_JWS_GEN)/java/*.java) $(wildcard $(VBOX_JWS_GEN)/java/jws/*/*/*/*.java)
     351        $(RM) -f $(wildcard $(VBOX_JWS_GEN)/java/*/*/*.java) $(wildcard $(VBOX_JWS_GEN)/java/*/*/*/*.java)
    339352        $(QUIET)$(VBOX_XSLTPROC) \
    340353              --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
    341354              --stringparam G_vboxGlueStyle jaxws              \
    342               -o $(VBOX_JWS_GEN)/java/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
    343         $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JWS_GEN)/java/merged.file $(VBOX_JWS_GEN)/java
     355              --stringparam G_vboxDirPrefix org/virtualbox$(VBOX_API_SUFFIX)/ \
     356              -o $(VBOX_JWS_GEN)/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
     357        $(QUIET)$(MKDIR) -p $(VBOX_JWS_GEN)/java/org/virtualbox$(VBOX_API_SUFFIX)
     358        $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JWS_GEN)/merged.file $(VBOX_JWS_GEN)/java
    344359        $(call MSG_GENERATE,,$@,JAX-WS for Java 1.6 bindings using $(VBOXWEBSERVICE_WSDL))
    345         $(VBOX_WSIMPORT) -Xnocompile -p $(VBOX_JAVA_PACKAGE).jaxws -d $(VBOX_JWS_GEN)/java/jws $(VBOXWEBSERVICE_WSDL)
    346         $(QUIET)echo $(VBOX_JWS_GEN)/java/*.java > $@
    347         $(QUIET)echo $(VBOX_JWS_GEN)/java/jws/*/*/*/*.java >> $@
    348 
    349 $$(VBOX_JWS_JAR): $(VBOX_JWS_GEN)/jwsglue.list $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) | $$(dir $$@)
     360        $(VBOX_WSIMPORT) -Xnocompile -p $(VBOX_JAVA_PACKAGE).jaxws -d $(VBOX_JWS_GEN)/java $(VBOXWEBSERVICE_WSDL)
     361        $(QUIET)echo $(VBOX_JWS_GEN)/java/*/*/*.java > $@
     362        $(QUIET)echo $(VBOX_JWS_GEN)/java/*/*/*/*.java >> $@
     363
     364$$(VBOX_JWS_JAR): $(VBOX_JWS_GEN)/jwsglue.list $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $(VBOX_JWS_GEN)/MANIFEST.MF | $$(dir $$@)
    350365        $(call MSG_TOOL,javac,$(notdir $@),jwsgen.list,)
    351366        $(QUIET)$(RM) -Rf $(VBOX_JWS_JDEST)
     
    358373        $(QUIET)$(CP) -f $(VBOXWEB_WSDL) $(VBOX_JWS_JDEST)/vboxweb$(VBOX_API_SUFFIX).wsdl
    359374        $(call MSG_LINK,$(notdir $@),$@)
    360         $(VBOX_JAR) cf $@ -C $(VBOX_JWS_JDEST) .
     375        $(VBOX_JAR) cf $@ $(VBOX_JWS_GEN)/MANIFEST.MF -C $(VBOX_JWS_JDEST) .
     376
     377$(VBOX_JWS_GEN)/MANIFEST.MF: $(VBOX_PATH_WEBSERVICE)/MANIFEST.MF.in
     378        $(QUIET)$(RM) -f -- $@
     379        $(QUIET)$(MKDIR) -p $(VBOX_JWS_GEN)
     380        $(QUIET)$(SED) \
     381                -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/' \
     382                -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/' \
     383                -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/' \
     384                -e 's/@VBOX_API_SUFFIX@/$(VBOX_API_SUFFIX)/' \
     385                <  $< >  $@
     386
     387$$(VBOX_JWSDOC_JAR): $(VBOX_JWS_GEN)/jwsglue.list $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $$(VBOX_JWS_JAR) | $$(dir $$@)
     388        $(call MSG_TOOL,javadoc,$(notdir $@),jwsgen.list,)
     389        $(QUIET)$(RM) -Rf $(VBOX_JWSDOC_JDEST)
     390        $(QUIET)$(MKDIR) -p $(VBOX_JWSDOC_JDEST)
     391        $(call MSG_L1,Generating javadoc html documentation)
     392        $(VBOX_JAVADOC) $(VBOX_JAVADOC_OPTS) -quiet \
     393                @$(VBOX_JWS_GEN)/jwsglue.list \
     394                -d $(VBOX_JWSDOC_JDEST)
     395        $(call MSG_LINK,$(notdir $@),$@)
     396        $(VBOX_JAR) cf $@ -C $(VBOX_JWSDOC_JDEST) .
     397
     398$$(VBOX_JWSSRC_JAR): $$(VBOX_JWS_JAR) | $$(dir $$@)
     399        $(call MSG_LINK,$(notdir $@),$@)
     400        $(VBOX_JAR) cf $@ -C $(VBOX_JWS_GEN)/java .
    361401
    362402 endif # VBOX_WITH_JWS
  • trunk/src/VBox/Main/webservice/platform-xidl.xsl

    r33540 r38796  
    99        sections are resolved (for easier processing).
    1010
    11      Copyright (C) 2006-2010 Oracle Corporation
     11     Copyright (C) 2006-2011 Oracle Corporation
    1212
    1313     This file is part of VirtualBox Open Source Edition (OSE), as
     
    6262    ignore everything we don't need
    6363    -->
    64 <xsl:template match="cpp|class|enumerator|desc|note">
     64<xsl:template match="cpp|class|enumerator">
    6565</xsl:template>
    6666
    6767<!--
    6868    and keep the rest intact (including all attributes)
     69
     70    NOTE: this drops class and everything in it, which I left unchanged
     71    since the other xslt scripts blow up badly.
    6972    -->
    70 <xsl:template match="library|module|enum|const|interface|attribute|collection|method|param">
     73<xsl:template match="library|module|enum|const|interface|attribute|collection|method|param|result">
    7174  <xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
     75</xsl:template>
     76
     77<!--
     78    keep those completely unchanged, including child nodes (including all
     79    attributes)
     80    -->
     81<xsl:template match="descGroup|desc|note">
     82  <xsl:copy-of select="."/>
    7283</xsl:template>
    7384
Note: See TracChangeset for help on using the changeset viewer.

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