aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ic/doc/src/ch_java.xml
blob: a733adaf65c043a88cd02f9179ce0917ac696a6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1999</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>IDL to Java language Mapping</title>
    <prepared></prepared>
    <docno></docno>
    <date>98-09-24</date>
    <rev>A</rev>
    <file>ch_java.xml</file>
  </header>

  <section>
    <title>Introduction</title>
    <p>This chapter describes the mapping of OMG IDL constructs to the Java
      programming language for the generation of native Java - Erlang  
      communication. </p>
    <p>This language mapping defines the following:</p>
    <list type="bulleted">
      <item>
        <p>All OMG IDL basic types</p>
      </item>
      <item>
        <p>All OMG IDL constructed types</p>
      </item>
      <item>
        <p>References to constants defined in OMG IDL</p>
      </item>
      <item>
        <p>Invocations of operations, including passing of
          parameters and receiving of result</p>
      </item>
      <item>
        <p>Access to attributes</p>
      </item>
    </list>
  </section>

  <section>
    <title>Specialties in the Mapping</title>

    <section>
      <title>Names Reserved by the Compiler</title>
      <p>The IDL compiler reserves all identifiers starting with
        <c>OE_</c> and <c>oe_</c> for internal use.</p>
    </section>
  </section>

  <section>
    <title>Basic OMG IDL Types</title>
    <p>The mapping of basic types are according to the standard. All basic types have 
      a special Holder class.</p>
    <table>
      <row>
        <cell align="left" valign="middle">OMG IDL type</cell>
        <cell align="left" valign="middle">Java type</cell>
      </row>
      <row>
        <cell align="left" valign="middle">float</cell>
        <cell align="left" valign="middle">float</cell>
      </row>
      <row>
        <cell align="left" valign="middle">double</cell>
        <cell align="left" valign="middle">double</cell>
      </row>
      <row>
        <cell align="left" valign="middle">short</cell>
        <cell align="left" valign="middle">short</cell>
      </row>
      <row>
        <cell align="left" valign="middle">unsigned short</cell>
        <cell align="left" valign="middle">short</cell>
      </row>
      <row>
        <cell align="left" valign="middle">long</cell>
        <cell align="left" valign="middle">int</cell>
      </row>
      <row>
        <cell align="left" valign="middle">long long</cell>
        <cell align="left" valign="middle">long</cell>
      </row>
      <row>
        <cell align="left" valign="middle">unsigned long</cell>
        <cell align="left" valign="middle">long</cell>
      </row>
      <row>
        <cell align="left" valign="middle">unsigned long long</cell>
        <cell align="left" valign="middle">long</cell>
      </row>
      <row>
        <cell align="left" valign="middle">char</cell>
        <cell align="left" valign="middle">char</cell>
      </row>
      <row>
        <cell align="left" valign="middle">wchar</cell>
        <cell align="left" valign="middle">char</cell>
      </row>
      <row>
        <cell align="left" valign="middle">boolean</cell>
        <cell align="left" valign="middle">boolean</cell>
      </row>
      <row>
        <cell align="left" valign="middle">octet</cell>
        <cell align="left" valign="middle">octet</cell>
      </row>
      <row>
        <cell align="left" valign="middle">string</cell>
        <cell align="left" valign="middle">java.lang.String</cell>
      </row>
      <row>
        <cell align="left" valign="middle">wstring</cell>
        <cell align="left" valign="middle">java.lang.String</cell>
      </row>
      <row>
        <cell align="left" valign="middle">any</cell>
        <cell align="left" valign="middle">Any</cell>
      </row>
      <row>
        <cell align="left" valign="middle">long double</cell>
        <cell align="left" valign="middle">Not supported</cell>
      </row>
      <row>
        <cell align="left" valign="middle">Object</cell>
        <cell align="left" valign="middle">Not supported</cell>
      </row>
      <row>
        <cell align="left" valign="middle">void</cell>
        <cell align="left" valign="middle">void</cell>
      </row>
      <tcaption>OMG IDL basic types</tcaption>
    </table>
  </section>

  <section>
    <title>Constructed OMG IDL Types</title>
    <p>All constructed types are according to the standard with three (3) major exceptions.</p>
    <p></p>
    <list type="bulleted">
      <item>
        <p>The IDL Exceptions are not implemented in this Java mapping.</p>
        <p></p>
      </item>
      <item>
        <p>The functions used for read/write to streams, defined in <c>Helper</c> functions
          are named unmarshal (instead for read) and marshal (instead for write).  </p>
        <p></p>
      </item>
      <item>
        <p>The streams used in <c>Helper</c> functions are <c>OtpInputStream</c> for 
          input and <c>OtpOutputStream</c> for output.</p>
        <p></p>
      </item>
    </list>
  </section>

  <section>
    <title>Mapping for Constants</title>
    <p>Constants are mapped according to the standard.</p>
  </section>

  <section>
    <title>Invocations of Operations</title>
    <p>Operation invocation is implemented according to the standard.
      The implementation is in the class <c><![CDATA[_<nterfacename>Stub.java]]></c> which implements 
      the interface in <c><![CDATA[<nterfacename>.java]]></c>.</p>
    <code type="none">
test._iStub client;

client.op(10);
    </code>

    <section>
      <title>Operation Implementation</title>
      <p>The server is implemented through extension of the class 
        <c><![CDATA[_<nterfacename>ImplBase.java]]></c> and implementation of all the methods in the 
        interface.</p>
      <code type="none">
public class server extends test._iImplBase {
  
  public void op(int i) throws java.lang.Exception {
    System.out.println("Received call op()");
    o.value = i;
    return i;
  }

}
      </code>
    </section>
  </section>

  <section>
    <title>Exceptions</title>
    <p>While exception mapping is not implemented, the stubs will
      generate some Java exceptions in case of operation failure.
      No exceptions are propagated through the communication.</p>
  </section>

  <section>
    <title>Access to Attributes</title>
    <p>Attributes are supported according to the standard.</p>
  </section>

  <section>
    <title>Summary of Argument/Result Passing for Java</title>
    <p>All types (<c>in</c>, <c>out</c> or <c>inout</c>) of user defined parameters are supported
      in the Java mapping. This is also the case in the Erlang mappings but <em>not</em> in the C 
      mapping. <c>inout</c> parameters are not supported in the C mapping so if you are going to 
      do calls to or from a C program <c>inout</c> cannot be used in the IDL specifications.</p>
    <p><c>out</c> and <c>inout</c> parameters must be of Holder types. There is a jar file ( <c>ic.jar</c>) 
      with Holder classes for the basic types in the <c>ic</c> application. This library is in the directory
      <c><![CDATA[$OTPROOT/lib/ic_<version number>/priv]]></c>.</p>
  </section>

  <section>
    <title>Communication Toolbox</title>
    <p>The generated client and server stubs use the classes
      defined in the <c>jinterface</c> package to communicate 
      with other nodes.
      The most important classes are :</p>
    <list type="bulleted">
      <item>
        <p><c>OtpInputStream</c> which is the stream class used for incoming message storage</p>
        <p></p>
      </item>
      <item>
        <p><c>OtpOutputStream</c> which is the stream class used for outgoing message storage</p>
        <p></p>
      </item>
      <item>
        <p><c>OtpErlangPid</c> which is the process identification class used to identify processes inside
          a java node.</p>
        <p>The recommended constructor function for the OtpErlangPid is 
          <c>OtpErlangPid(String node, int id, int serial, int creation)</c> where :</p>
        <p></p>
        <list type="bulleted">
          <item>
            <p><c>String node</c>, is the name of the node where this process runs.</p>
            <p></p>
          </item>
          <item>
            <p><c>int id</c>, is the identification number for this identity.</p>
            <p></p>
          </item>
          <item>
            <p><c>int serial</c>, internal information, must be an 18-bit integer.</p>
            <p></p>
          </item>
          <item>
            <p><c>int creation</c>, internal information, must have value in range 0..3.</p>
            <p></p>
          </item>
        </list>
      </item>
      <item>
        <p><c>OtpConnection</c> which is used to define a connection between nodes.</p>
        <p>While the connection object is stub side constructed in client stubs, it is
          returned after calling the <c>accept</c> function from an OtpErlangServer object
          in server stubs.
          The following methods used for node connection :</p>
        <p></p>
        <list type="bulleted">
          <item>
            <p><c>OtpInputStream receiveBuf()</c>, which returns the incoming streams that
              contain the message arrived.</p>
            <p></p>
          </item>
          <item>
            <p><c>void sendBuf(OtpErlangPid client, OtpOutputStream reply)</c>, which sends
              a reply message (in an OtpOutputStream form) to the client node.</p>
            <p></p>
          </item>
          <item>
            <p><c>void close()</c>, which closes a connection.</p>
            <p></p>
          </item>
        </list>
      </item>
      <item>
        <p><c>OtpServer</c> which is used to define a server node.</p>
        <p>The recommended constructor function for the OtpServer is :</p>
        <p></p>
        <list type="bulleted">
          <item>
            <p><c>OtpServer(String node, String cookie)</c>. where :</p>
            <p></p>
            <list type="bulleted">
              <item>
                <p><c>node</c> is the requested name for the new java node, 
                  represented as a String object.</p>
                <p></p>
              </item>
              <item>
                <p><c>cookie</c> is the requested cookie name for the new java node, 
                  represented as a String object.</p>
                <p></p>
              </item>
            </list>
          </item>
        </list>
        <p>The following methods used for node registration and connection acceptance :</p>
        <p></p>
        <list type="bulleted">
          <item>
            <p><c>boolean publishPort()</c>, which registers the server node to <c>epmd</c> daemon.</p>
            <p></p>
          </item>
          <item>
            <p><c>OtpConnection accept()</c>, which waits for a connection and returns the 
              OtpConnection object which is unique for each client node.</p>
            <p></p>
          </item>
        </list>
      </item>
    </list>
  </section>

  <section>
    <title>The Package com.ericsson.otp.ic</title>
    <p>The package <seealso marker="java/com/ericsson/otp/ic/package-summary">com.ericsson.otp.ic</seealso> 
      contains a number of java classes specially designed for the IC generated java-back-ends :</p>
    <list type="bulleted">
      <item>
        <p>Standard java classes defined through OMG-IDL java mapping :</p>
        <list type="bulleted">
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/BooleanHolder">BooleanHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/ByteHolder">ByteHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/CharHolder">CharHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/ShortHolder">ShortHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/IntHolder">IntHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/LongHolder">LongHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/FloatHolder">FloatHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/DoubleHolder">DoubleHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/StringHolder">StringHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Any">Any</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/AnyHelper">AnyHelper</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/AnyHolder">AnyHolder</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/TypeCode">TypeCode</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/TCKind">TCKind</seealso></p>
            <p></p>
          </item>
        </list>
      </item>
      <item>
        <p>Implementation-dependant classes :</p>
        <list type="bulleted">
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Environment">Environment</seealso></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Holder">Holder</seealso></p>
            <p></p>
          </item>
        </list>
      </item>
      <item>
        <p>Erlang compatibility classes :</p>
        <list type="bulleted">
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Pid">Pid</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/PidHelper">PidHelper</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/PidHolder">PidHolder</seealso></p>
            <p>The Pid class originates from <c>OtpErlangPid</c> and is used to 
              represent the Erlang built-in <c>pid</c> type, a process's identity.
              PidHelper and PidHolder are helper respectively holder classes for Pid.</p>
            <p></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Ref">Ref</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/RefHelper">RefHelper</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/RefHolder">RefHolder</seealso></p>
            <p>The Ref class originates from <c>OtpErlangRef</c> and is used to 
              represent the Erlang built-in <c>ref</c> type, an Erlang reference.
              RefHelper and RefHolder are helper respectively holder classes for Ref.</p>
            <p></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Port">Port</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/PortHelper">PortHelper</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/PortHolder">PortHolder</seealso></p>
            <p>The Port class originates from <c>OtpErlangPort</c> and is used to 
              represent the Erlang built-in <c>port</c> type, an Erlang port.
              PortHelper and PortHolder are helper respectively holder classes for Port.</p>
            <p></p>
          </item>
          <item>
            <p><seealso marker="java/com/ericsson/otp/ic/Term">Term</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/TermHelper">TermHelper</seealso>,
              <seealso marker="java/com/ericsson/otp/ic/TermHolder">TermHolder</seealso></p>
            <p>The Term class originates from <c>Any</c> and is used to 
              represent the Erlang built-in <c>term</c> type, an Erlang term.
              TermHelper and TermHolder are helper respectively holder classes for Term.</p>
            <p></p>
          </item>
        </list>
        <p>To use the Erlang build-in classes, you will have to include the file <c>erlang.idl</c>
          located under <c>$OTPROOT/lib/ic/include</c>.</p>
      </item>
    </list>
  </section>

  <section>
    <title>The Term Class</title>
    <p>The <c>Term</c> class is intended to represent the Erlang term generic type.
      It extends the <c>Any</c> class and it is basically used in the same way as
      in the Any type.</p>
    <p>The big difference between Term and Any is the use of <c>guard</c> methods
      instead of <c>TypeCode</c> to determine the data included in the Term.
      This is especially true when the Term's value class cannot be 
      determined at compilation time. The guard methods found in Term :</p>
    <list type="bulleted">
      <item>
        <p><c>boolean isAtom()</c> returns <c>true</c> if the Term is an OtpErlangAtom, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isConstant()</c> returns <c>true</c> if the Term is neither an OtpErlangList nor an OtpErlangTuple, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isFloat()</c> returns <c>true</c> if the Term is an OtpErlangFloat, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isInteger()</c> returns <c>true</c> if the Term is an OtpErlangInt, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isList()</c> returns <c>true</c> if the Term is an OtpErlangList, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isString()</c> returns <c>true</c> if the Term is an OtpErlangString, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isNumber()</c> returns <c>true</c> if the Term is an OtpErlangInteger or an OtpErlangFloat, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isPid()</c> returns <c>true</c> if the Term is an OtpErlangPid or Pid, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isPort()</c> returns <c>true</c> if the Term is an OtpErlangPort or Port, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isReference()</c> returns <c>true</c> if the Term is an OtpErlangRef, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isTuple()</c> returns <c>true</c> if the Term is an OtpErlangTuple, <c>false</c> otherwise</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean isBinary()</c> returns <c>true</c> if the Term is an OtpErlangBinary, <c>false</c> otherwise</p>
        <p></p>
      </item>
    </list>
  </section>

  <section>
    <title>Stub File Types</title>
    <p>For each interface, three (3) stub/skeleton files are generated :</p>
    <list type="bulleted">
      <item>
        <p>A java interface file, named after the idl interface.</p>
        <p></p>
      </item>
      <item>
        <p>A client stub file, named after the convention  <c><![CDATA[_< interface name >Stub]]></c> 
          which implements the java interface. Example : <c>_stackStub</c>.java</p>
        <p></p>
      </item>
      <item>
        <p>A server stub file, named after the convention  <c><![CDATA[_< interface name >ImplBase]]></c> 
          which implements the java interface. Example : <c>_stackImplBase</c>.java</p>
        <p></p>
      </item>
    </list>
  </section>

  <section>
    <title>Client Stub Initialization, Methods Exported</title>
    <p>The recommended constructor function for client stubs accepts four (4) parameters :</p>
    <p></p>
    <list type="bulleted">
      <item>
        <p><c>String selfNode</c>, the node identification name to be used in the new
          client node.</p>
        <p></p>
      </item>
      <item>
        <p><c>String peerNode</c>, the node identification name where the client process is running.</p>
        <p></p>
      </item>
      <item>
        <p><c>String cookie</c>, the cookie to be used.</p>
        <p></p>
      </item>
      <item>
        <p><c>Object server</c>, where the java Object can be one of:</p>
        <p></p>
        <list type="bulleted">
          <item>
            <p><c>OtpErlangPid</c>, the server's process identity under the node where the server 
              process is running.</p>
            <p></p>
          </item>
          <item>
            <p><c>String</c>, the server's registered name under the node where the server 
              process is running.</p>
            <p></p>
          </item>
        </list>
      </item>
    </list>
    <p>The methods exported from the generated client stub are :</p>
    <p></p>
    <list type="bulleted">
      <item>
        <p><c>void __disconnect()</c>, which disconnects the server connection.</p>
        <p></p>
      </item>
      <item>
        <p><c>void __reconnect()</c>, which disconnects the server connection if open,
          and then connects to the same peer.</p>
        <p></p>
      </item>
      <item>
        <p><c>void __stop()</c>, which sends the standard stop termination call.
          When connected to an Erlang server, the server will be terminated.
          When connected to a java server, this will set a stop flag that 
          denotes that the server must be terminated.</p>
        <p></p>
      </item>
      <item>
        <p><c>com.ericsson.otp.erlang.OtpErlangRef __getRef()</c>, will return the message reference
          received from a server that denotes which call it is referring to.
          This is useful when building asynchronous clients.</p>
        <p></p>
      </item>
      <item>
        <p><c>java.lang.Object __server()</c>, which returns the server for the current connection.</p>
        <p></p>
      </item>
    </list>
  </section>

  <section>
    <title>Server Skeleton Initialization, Server Stub Implementation, Methods Exported</title>
    <p>The constructor function for server skeleton accepts no parameters.</p>
    <p>The server skeleton file contains a server <c>switch</c> which
      decodes messages from the input stream and calls implementation
      (<c>callback</c>) functions.
      As the server skeleton is declared <c>abstract</c>, the application 
      programmer will have to create a stub class that <c>extends</c> the
      skeleton file. In this class, all operations defined in the interface
      class, generated under compiling the idl file, are implemented.</p>
    <p>The server skeleton file exports the following methods:</p>
    <p></p>
    <list type="bulleted">
      <item>
        <p><c>OtpOutputStrem invoke(OtpInputStream request)</c>, where the input
          stream <c>request</c> is unmarshalled, the implementation function is called
          and a reply stream is marshalled.</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean __isStopped()</c>, which returns true if a stop message is received.
          The implementation of the stub should always check if such a message is received
          and terminate if so.</p>
        <p></p>
      </item>
      <item>
        <p><c>boolean __isStopped(com.ericsson.otp.ic.Environment)</c>, which returns true if 
          a stop message is received for a certain Environment and Connection.
          The implementation of the stub should always check if such a message is received
          and terminate if so.</p>
        <p></p>
      </item>
      <item>
        <p><c>OtpErlangPid __getCallerPid()</c>, which returns the caller identity for the latest call.</p>
        <p></p>
      </item>
      <item>
        <p><c>OtpErlangPid __getCallerPid(com.ericsson.otp.ic.Environment)</c>, which returns the caller 
          identity for the latest call on a certain Environment.</p>
        <p></p>
      </item>
      <item>
        <p><c>java.util.Dictionary __operations()</c>, which returns the operation dictionary which
          holds all operations supported by the server skeleton.</p>
        <p></p>
      </item>
    </list>
  </section>

  <section>
    <title>A Mapping Example</title>
    <p>      <marker id="stack_idl"></marker>

      This is a small example of a simple stack. There are two
      operations on the stack, push and pop. The example shows some of the 
      generated files.</p>
    <code type="none">
// The source IDL file: stack.idl

struct s {
      long l;
      string s;
};

interface stack {
    void push(in s val);
    s pop();
};
    </code>
    <p>When this file is compiled it produces eight files. Three important files 
      are shown below.      <marker id="stack_serv"></marker>
</p>
    <p>The public interface is in <em>stack.java</em>.</p>
    <code type="none">

public interface stack {

/****
 * Operation "stack::push" interface functions 
 *
 */

    void push(s val) throws java.lang.Exception;

/****
 * Operation "stack::pop" interface functions 
 *
 */

    s pop() throws java.lang.Exception;

}
    </code>
    <p>For the IDL struct s three files are generated, a public class in <em>s.java</em>.</p>
    <code type="none">

final public class s {
   // instance variables
   public int l;
   public java.lang.String s;

   // constructors
   public s() {};
   public s(int _l, java.lang.String _s) {
     l = _l;
     s = _s;
   };

};
    </code>
    <p>A holder class in <em>sHolder.java</em> and a helper class in <em>sHelper.java</em>.
      The helper class is used for marshalling.</p>
    <code type="none">

public class sHelper {

   // constructors
   private sHelper() {};

   // methods
   public static s unmarshal(OtpInputStream in) 
      throws java.lang.Exception {
        :
        :
   };

   public static void marshal(OtpOutputStream out, s value) 
      throws java.lang.Exception {
        :
        :
   };

};
    </code>
  </section>

  <section>
    <title>Running the Compiled Code</title>
    <p>When using the generated java code you must have added 
      <c><![CDATA[$OTPROOT/lib/ic_<version number>/priv]]></c> and 
      <c><![CDATA[$OTPROOT/lib/jinterface_<version number>/priv]]></c> to your 
      <c>CLASSPATH</c> variable to get
      basic Holder types and the communication classes.</p>
  </section>
</chapter>