<document>
  <header>
    <product>resin-ee</product>
    <resin-2.0>$ee/ejb-ref/java-binding-draft-spec.xtp</resin-2.0>
    <title>Hessian/Burlap Java Binding Draft Spec</title>
<date>December 02, 2003</date>
  </header>

  <body>
    <summary/>


<section title="Introduction">

<p>Burlap and Hessian use type names in two contexts:</p>
<ul>
<li>as &lt;type> values for lists and objects.
<li>as mangled names for method overloading
</ul>

<p>The mapping from a language's types to the Burlap/Hessian names
is necessarily language dependent, but designed for cross-language use.</p>

</section>

<section title="Java to Burlap/Hessian">

<p>The mapping of specific Java types to Burlap/Hessian is relatively
straightforward.  A Java implementation will also use this mapping when
it's parsing and knows the type of the object.  Contrast that with the Burlap to Java mapping.  Note that XML DOM is mapped to a string.</p>

<deftable>
<tr><th width='50%'>Java<th>Burlap
<tr><td>null<td>null
<tr><td>String<td>string
<tr><td>boolean<td>boolean
<tr><td>byte<td>int
<tr><td>short<td>int
<tr><td>int<td>int
<tr><td>long<td>long
<tr><td>float<td>double
<tr><td>double<td>double
<tr><td>char<td>string
<tr><td>Boolean<td>boolean
<tr><td>Byte<td>int
<tr><td>Short<td>int
<tr><td>Integer<td>int
<tr><td>Long<td>long
<tr><td>Float<td>double
<tr><td>Double<td>double
<tr><td>Character<td>string
</deftable>

<deftable>
<tr><th width='50%'>Java<th>Burlap
<tr><td>String<td>string
<tr><td>StringBuffer<td>string
<tr><td>char[]<td>string
<tr><td>org.w3c.dom.Node<td>string
<tr><td>byte[]<td>base64
<tr><td>Object[]<td>[object
</deftable>

<deftable>
<tr><th width='50%'>Java<th>Burlap
<tr><td>Date<td>date
<tr><td>List<td>list
<tr><td>Vector<td>list
<tr><td>Map<td>map
<tr><td>HashMap<td>map
<tr><td>Hashtable<td>map
<tr><td>Object<td>map (with serialization)
<tr><td>EJBHome<td>remote (using HomeHandle)
<tr><td>EJBObject<td>remote (using Handle)
</deftable>

<note>Some of these conversions are lossy.  For example, a Byte object
serialized and then deserialized will become an Integer.  This is the
price paid working with other languages.</note>

</section>

<section title="Method overloading">

<p>Java-based servers typically expose three overloaded methods:</p>
<ul>
<li>The simple method name, which corresponds to the shorted overloaded method.
<li>The method name with the number of arguments appended, e.g. add__2.
<li>The method name with the Burlap/Hessian types, e.g. add_int_int
</ul>

<p>In this case, all of "add" , "add__2", and "add_int_int" will map to
the same method.  The client will use whichever is appropriate to
its capabilities.  For example, many scripting languages can only handle
the number of arguments as a mangling technique.</p>

</section>

<section title='Burlap to Java'>

<p>In several cases, a Java parser may know nothing about the
expected type.  For example, an method's argument might be
Object or the serialized data may be in a Vector, or a client may
not specify the type for a &lt;map>.</p>

<deftable>
<tr><th width='50%'>Burlap<th>Java
<tr><td>null<td>null
<tr><td>boolean<td>Boolean
<tr><td>int<td>Integer
<tr><td>double<td>Double
<tr><td>string<td>String
<tr><td>date<td>Date
<tr><td>base64<td>byte []
<tr><td>list<td>ArrayList
<tr><td>map<td>HashMap
</deftable>

</section>

<section title='Changes'>

<section title="v3 changes (2001-12-27)">

<ul>
<li>Change ;ejbid= to ?ejbid=
</ul>

</section>

<section title="v2 changes">

<ul>
<li>Change SML-RPC to Burlap
</ul>

</section>

</section>
  </body>
</document>
