~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/orber/doc/src/Module_Interface.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (1.1.13 upstream)
  • mto: (3.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20090215164252-dxpjjuq108nz4noa
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
 
3
 
 
4
<erlref>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>1999</year>
 
8
      <year>2007</year>
 
9
      <holder>Ericsson AB, All Rights Reserved</holder>
 
10
    </copyright>
 
11
    <legalnotice>
 
12
  The contents of this file are subject to the Erlang Public License,
 
13
  Version 1.1, (the "License"); you may not use this file except in
 
14
  compliance with the License. You should have received a copy of the
 
15
  Erlang Public License along with this software. If not, it can be
 
16
  retrieved online at http://www.erlang.org/.
 
17
 
 
18
  Software distributed under the License is distributed on an "AS IS"
 
19
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
20
  the License for the specific language governing rights and limitations
 
21
  under the License.
 
22
 
 
23
  The Initial Developer of the Original Code is Ericsson AB.
 
24
    </legalnotice>
 
25
 
 
26
    <title>Module_Interface</title>
 
27
    <prepared></prepared>
 
28
    <docno></docno>
 
29
    <checked></checked>
 
30
    <date>1999-09-03</date>
 
31
    <rev>A</rev>
 
32
  </header>
 
33
  <module>Module_Interface</module>
 
34
  <modulesummary>Orber generated stubs/skeletons.</modulesummary>
 
35
  <description>
 
36
    <p>This module contains the stub/skeleton functions generated by IC.</p>
 
37
    <p>Starting a Orber server can be done in three ways:</p>
 
38
    <list type="bulleted">
 
39
      <item>Normal - when the server dies Orber forgets all knowledge of the server.</item>
 
40
      <item>Supervisor child - adding the configuration parameter <c>{sup_child, true}</c>
 
41
       the <c>oe_create_link/2</c> function returns <c>{ok, Pid, ObjRef}</c> which
 
42
       can be handled by the application <em>supervisor/stdlib-1.7</em> or later. </item>
 
43
      <item>Persistent object reference - adding the configuration parameters <c>{persistent, true}</c>
 
44
       and <c>{regname, {global, term()}}</c> Orber will remember the object reference until the
 
45
       server terminates with reason <em>normal</em> or <em>shutdown</em>. Hence,
 
46
       if the server is started as a <em>transient</em> supervisor child we do not
 
47
       receive a 'OBJECT_NOT_EXIST' exception when it has crashed and is being restarted.</item>
 
48
    </list>
 
49
    <p>The Orber stub can be used to start a <c>pseudo object</c>, which will create a non-server implementation.
 
50
      A pseudo object introduce some limitations:</p>
 
51
    <list type="bulleted">
 
52
      <item>The functions <c>oe_create_link/2</c> is equal to <c>oe_create/2</c>, i.e.,
 
53
       no link can or will be created.</item>
 
54
      <item>The <c>BIF:s self()</c> and <c>process_flag(trap_exit,true)</c> behaves incorrectly.</item>
 
55
      <item>The <c>IC</c> option <c>{{impl, "M::I"}, "other_impl"}</c> has no effect. The call-back
 
56
       functions must be implemented in a file called <c>M_I_impl.erl</c></item>
 
57
      <item>The <c>IC</c> option <c>from</c> has no effect. </item>
 
58
      <item>The call-back functions must be implemented as if the <c>IC</c> option 
 
59
      <c>{this, "M::I"}</c> was used.</item>
 
60
      <item>Server <c>State</c> changes have no effect. The user can provide information via
 
61
       the <c>Env</c> start parameter and the State returned from <c>init/2</c> will be the State
 
62
       passed in following invocations.</item>
 
63
      <item>If a call-back function replies with the <c>Timeout</c> parameter set it have no effect.</item>
 
64
      <item>Operations defined as <c>oneway</c> are blocking until the operation replies.</item>
 
65
      <item>The option <c>{pseudo, true}</c> overrides all other start options.</item>
 
66
      <item>Only the functions, besides own definitions, <c>init/2</c> (called via oe_create*/2) and 
 
67
      <c>terminate/2</c> (called via corba:dispose/1) must be implemented.</item>
 
68
    </list>
 
69
    <p>By adopting the rules for <c>pseudo</c> objects described above we can use <c>oe_create/2</c>
 
70
      to create <c>server</c> or <c>pseudo</c> objects, by excluding or including the 
 
71
      option <c>{pseudo, true}</c>, without changing the call-back module.
 
72
      </p>
 
73
    <p>If you start a object without <c>{regname, RegName}</c> it can only be accessed through the returned object key. 
 
74
      Started with a <c>{regname, RegName}</c> the name is registered locally or globally. 
 
75
      </p>
 
76
    <warning>
 
77
      <p>To avoid flooding Orber with old object references start erlang using the flag 
 
78
        <em>-orber objectkeys_gc_time Time</em>, which will remove all object references
 
79
        related to servers being dead for Time seconds. To avoid extra overhead, i.e., performing
 
80
        garbage collect if no persistent objects are started, the objectkeys_gc_time default value 
 
81
        is <em>infinity</em>. For more information, see the orber and corba documentation.</p>
 
82
    </warning>
 
83
  </description>
 
84
  <funcs>
 
85
    <func>
 
86
      <name>Module_Interface:typeID() -> TypeId</name>
 
87
      <fsummary>Return the Type ID related to this stub/skeleton</fsummary>
 
88
      <type>
 
89
        <v>TypeId = string(), e.g., "IDL:Module/Interface:1.0"</v>
 
90
      </type>
 
91
      <desc>
 
92
        <p>Returns the Type ID related to this stub/skeleton</p>
 
93
      </desc>
 
94
    </func>
 
95
    <func>
 
96
      <name>Module_Interface:oe_create() -> ObjRef</name>
 
97
      <fsummary>Start a Orber server.</fsummary>
 
98
      <type>
 
99
        <v>ObjRef = #object reference</v>
 
100
      </type>
 
101
      <desc>
 
102
        <p>Start a Orber server.</p>
 
103
      </desc>
 
104
    </func>
 
105
    <func>
 
106
      <name>Module_Interface:oe_create_link() -> ObjRef</name>
 
107
      <fsummary>Start a linked Orber server.</fsummary>
 
108
      <type>
 
109
        <v>ObjRef = #object reference</v>
 
110
      </type>
 
111
      <desc>
 
112
        <p>Start a linked Orber server.</p>
 
113
      </desc>
 
114
    </func>
 
115
    <func>
 
116
      <name>Module_Interface:oe_create(Env) -> ObjRef</name>
 
117
      <fsummary>Start a Orber server.</fsummary>
 
118
      <type>
 
119
        <v>Env = term()</v>
 
120
        <v>ObjRef = #object reference</v>
 
121
      </type>
 
122
      <desc>
 
123
        <p>Start a Orber server passing Env to <c>init/1</c>.</p>
 
124
      </desc>
 
125
    </func>
 
126
    <func>
 
127
      <name>Module_Interface:oe_create_link(Env) -> ObjRef</name>
 
128
      <fsummary>Start a linked Orber server.</fsummary>
 
129
      <type>
 
130
        <v>Env = term()</v>
 
131
        <v>ObjRef = #object reference</v>
 
132
      </type>
 
133
      <desc>
 
134
        <p>Start a linked Orber server passing Env to <c>init/1</c>.</p>
 
135
      </desc>
 
136
    </func>
 
137
    <func>
 
138
      <name>Module_Interface:oe_create(Env, Options) -> ObjRef</name>
 
139
      <fsummary>Start a Orber stub/skeleton</fsummary>
 
140
      <type>
 
141
        <v>Env = term()</v>
 
142
        <v>ObjRef = #object reference</v>
 
143
        <v>Options = [{sup_child, false} | {persistent, Bool} | {regname, RegName} |  {pseudo, Bool} | {local_typecheck, Bool} | {survive_exit, Bool} | {create_options, [CreateOpts]}]</v>
 
144
        <v>Bool = true | false</v>
 
145
        <v>RegName = {global, term()} | {local, atom()}</v>
 
146
        <v>CreateOpts = {debug, [Dbg]} | {timeout, Time}</v>
 
147
        <v>Dbg = trace | log | statistics | {log_to_file, FileName}</v>
 
148
      </type>
 
149
      <desc>
 
150
        <p>Start a Orber server passing Env to <c>init/1</c>.</p>
 
151
        <p>If the option <c>{pseudo, true}</c> is used, all other options are overridden.
 
152
          As default, this option is set to false.</p>
 
153
        <p>This function cannot be used for starting a server as supervisor child.
 
154
          If started as <c>persistent</c>, the options <c>[{persistent, true}, {regname, {global, term()}}]</c> must be used and
 
155
          Orber will only forget the object reference if it terminates with reason <em>normal</em> or <em>shutdown</em>.</p>
 
156
        <p>The option <c>{local_typecheck, boolean()}</c>, which overrides the
 
157
          <seealso marker="ch_install#flags">Local Typechecking</seealso>
 
158
          environment flag, turns on or off typechecking. If activated,
 
159
          parameters, replies and raised exceptions will be checked to ensure that
 
160
          the data is correct, when invoking operations on CORBA Objects within
 
161
          the same Orber domain. Due to the extra overhead, this option 
 
162
          <em>MAY ONLY</em> be used during testing and development.</p>
 
163
        <p><c>{survive_exit, boolean()}</c> overrides the
 
164
          <seealso marker="ch_install#flags">EXIT Tolerance</seealso>
 
165
          environment flag. If activated, the server will not terminate, even though
 
166
          the call-back module returns EXIT.</p>
 
167
        <p><c>Time</c> specifies how long time, in milliseconds, the server is allowed to
 
168
          spend initializing. For more information about the <c>Dbg</c> options,
 
169
          see the <c>sys</c> module.</p>
 
170
      </desc>
 
171
    </func>
 
172
    <func>
 
173
      <name>Module_Interface:oe_create_link(Env, Options) -> Return</name>
 
174
      <fsummary>Start a Orber stub/skeleton</fsummary>
 
175
      <type>
 
176
        <v>Env = term()</v>
 
177
        <v>Return = ObjRef | {ok, Pid, ObjRef}</v>
 
178
        <v>ObjRef = #object reference</v>
 
179
        <v>Options = [{sup_child, Bool} | {persistent, Bool} | {regname, RegName} | {pseudo, Bool} | {local_typecheck, Bool} | {survive_exit, Bool} |  {create_options, [CreateOpts]}]</v>
 
180
        <v>Bool = true | false</v>
 
181
        <v>RegName = {global, term()} | {local, atom()}</v>
 
182
        <v>CreateOpts = {debug, [Dbg]} | {timeout, Time}</v>
 
183
        <v>Dbg = trace | log | statistics | {log_to_file, FileName}</v>
 
184
        <v></v>
 
185
        <v></v>
 
186
        <v></v>
 
187
      </type>
 
188
      <desc>
 
189
        <p>Start a linked Orber server passing Env to <c>init/1</c>.</p>
 
190
        <p>If the option <c>{pseudo, true}</c> is used, all other options are overridden and no link will be created.
 
191
          As default, this option is set to false.</p>
 
192
        <p>This function can be used for starting a server as persistent or supervisor child. At the moment
 
193
          <c>[{persistent, true}, {regname, {global, term()}}]</c> must be used to start
 
194
          a server as persistent, i.e., if a server died and is in the process of being restarted
 
195
          a call to the server will not raise <c>'OBJECT_NOT_EXIST'</c> exception.
 
196
          Orber will only forget the object reference if it terminates with reason <em>normal</em> or <em>shutdown</em>,
 
197
          hence, the server must be started as <em>transient</em> (for more information see the
 
198
          supervisor documentation).</p>
 
199
        <p>The options <c>{local_typecheck, boolean()}</c> and <c>{survive_exit, boolean()}</c> 
 
200
          behaves in the same way as for <c>oe_create/2</c>.</p>
 
201
        <p><c>Time</c> specifies how long time, in milliseconds, the server is allowed to
 
202
          spend initializing. For more information about the <c>Dbg</c> options,
 
203
          see the <c>sys</c> module.</p>
 
204
      </desc>
 
205
    </func>
 
206
    <func>
 
207
      <name>Module_Interface:own_functions(ObjRef, Arg1, ..., ArgN) -> Reply</name>
 
208
      <name>Module_Interface:own_functions(ObjRef, Options, Arg1, ..., ArgN) -> Reply</name>
 
209
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
210
      <type>
 
211
        <v>ObjRef = #object reference</v>
 
212
        <v>Options = [Option] | Timeout</v>
 
213
        <v>Option = {timeout, Timeout} | {context, [Context]}</v>
 
214
        <v>Timeout = infinity | integer(milliseconds)</v>
 
215
        <v>Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData}</v>
 
216
        <v>CtxId = ?ORBER_GENERIC_CTX_ID</v>
 
217
        <v>CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options}</v>
 
218
        <v>Interface = string()</v>
 
219
        <v>Options = [{Key, Value}]</v>
 
220
        <v>Key = ssl_client_verify | ssl_client_depth | ssl_client_certfile | ssl_client_cacertfile |
 
221
                 ssl_client_password | ssl_client_keyfile | ssl_client_ciphers | ssl_client_cachetimeout</v>
 
222
        <v>Value = allowed value associated with the given key</v>
 
223
        <v>ArgX = specified in the IDL-code.</v>
 
224
        <v>Reply = specified in the IDL-code.</v>
 
225
      </type>
 
226
      <desc>
 
227
        <p>The default value for the <c>Timeout</c> option is <c>infinity</c>.
 
228
          IPv4 or IPv6 addresses are accepted as local Interface.</p>
 
229
        <p>The <em>configuration</em> context is used to override the global
 
230
           SSL client side 
 
231
           <seealso marker="ch_install#config">configuration</seealso>.</p>
 
232
        <p>To gain access to <c>#'IOP_ServiceContext'{}</c> record and the 
 
233
          <c>?ORBER_GENERIC_CTX_ID</c> macro, you must add 
 
234
          <c>-include_lib("orber/include/corba.hrl").</c> to your module.</p>
 
235
      </desc>
 
236
    </func>
 
237
  </funcs>
 
238
 
 
239
  <section>
 
240
    <title>CALLBACK FUNCTIONS</title>
 
241
    <p>The following functions should be exported from a <c>CORBA</c>
 
242
      callback module. Note, a complete template of the call-back module can
 
243
      be generated automatically by compiling the IDL-file with the IC option 
 
244
      <c>{be,erl_template}</c>. One should also add
 
245
      the same compile options, for example <c>this</c> or <c>from</c>,
 
246
      used when generating the stub/skeleton modules.</p>
 
247
  </section>
 
248
  <funcs>
 
249
    <func>
 
250
      <name>Module_Interface_impl:init(Env) -> CallReply</name>
 
251
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
252
      <type>
 
253
        <v>Env = term()</v>
 
254
        <v>CallReply = {ok, State} | {ok, State, Timeout} | ignore | {stop, StopReason}</v>
 
255
        <v>State = term()</v>
 
256
        <v>Timeout = int() >= 0 | infinity</v>
 
257
        <v>StopReason = term()</v>
 
258
      </type>
 
259
      <desc>
 
260
        <p>Whenever a new server is started, <em>init/1</em> is the first function called in the specified call-back module.</p>
 
261
      </desc>
 
262
    </func>
 
263
    <func>
 
264
      <name>Module_Interface_impl:terminate(Reason, State) -> ok</name>
 
265
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
266
      <type>
 
267
        <v>Reason = term()</v>
 
268
        <v>State = term()</v>
 
269
      </type>
 
270
      <desc>
 
271
        <p>This call-back function is called whenever the server is about to terminate.</p>
 
272
      </desc>
 
273
    </func>
 
274
    <func>
 
275
      <name>Module_Interface_impl:code_change(OldVsn, State, Extra) -> CallReply</name>
 
276
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
277
      <type>
 
278
        <v>OldVsn = undefined | term()</v>
 
279
        <v>State = term()</v>
 
280
        <v>Extra = term()</v>
 
281
        <v>CallReply = {ok, NewState}</v>
 
282
        <v>NewState = term()</v>
 
283
      </type>
 
284
      <desc>
 
285
        <p>Update the internal <c>State</c>.</p>
 
286
      </desc>
 
287
    </func>
 
288
    <func>
 
289
      <name>Module_Interface_impl:handle_info(Info, State) -> CallReply</name>
 
290
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
291
      <type>
 
292
        <v>Info = term()</v>
 
293
        <v>State = term()</v>
 
294
        <v>CallReply = {noreply, State} | {noreply, State, Timeout} | {stop, StopReason, State}</v>
 
295
        <v>Timeout = int() >= 0 | infinity</v>
 
296
        <v>StopReason = normal | shutdown | term()</v>
 
297
      </type>
 
298
      <desc>
 
299
        <p>If the configuration parameter <em>{{handle_info, "Module::Interface"}, true}</em>
 
300
          is passed to IC and <em>process_flag(trap_exit,true)</em> is set in the <em>init()</em> 
 
301
          call-back this function must be exported. </p>
 
302
        <note>
 
303
          <p>To be able to handle the <c>Timeout</c> option in <c>CallReply</c> in the call-back
 
304
            module the configuration parameter <em>{{handle_info, "Module::Interface"}, true}</em> must
 
305
            be passed to IC. </p>
 
306
        </note>
 
307
      </desc>
 
308
    </func>
 
309
    <func>
 
310
      <name>Module_Interface_impl:own_functions(State, Arg1, ..., ArgN) -> CallReply</name>
 
311
      <name>Module_Interface_impl:own_functions(This, State, Arg1, ..., ArgN) -> CallReply</name>
 
312
      <name>Module_Interface_impl:own_functions(This, From, State, Arg1, ..., ArgN) -> ExtCallReply</name>
 
313
      <name>Module_Interface_impl:own_functions(From, State, Arg1, ..., ArgN) -> ExtCallReply</name>
 
314
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
315
      <type>
 
316
        <v>This = the servers #object reference</v>
 
317
        <v>State = term()</v>
 
318
        <v>ArgX = specified in the IDL-code.</v>
 
319
        <v>CallReply = {reply, Reply, State} | {reply, Reply, State, Timeout} |  {stop, StopReason, Reply, State} | {stop, StopReason, State} |  corba:raise(Exception)</v>
 
320
        <v>ExtCallReply = CallReply | corba:reply(From, Reply), {noreply, State} | corba:reply(From, Reply), {noreply, State, Timeout}</v>
 
321
        <v>Reply = specified in the IDL-code.</v>
 
322
        <v>Timeout = int() >= 0 | infinity</v>
 
323
        <v>StopReason = normal | shutdown | term()</v>
 
324
      </type>
 
325
      <desc>
 
326
        <p>All two-way functions must return one of the listed replies or raise any of
 
327
          the exceptions listed in the IDL code (i.e. raises(...)). 
 
328
          If the IC compile options <em>this</em> and/or <em>from</em> are used,
 
329
          the implementation must accept the <em>This</em> and/or <em>From</em> 
 
330
          parameters.</p>
 
331
      </desc>
 
332
    </func>
 
333
    <func>
 
334
      <name>Module_Interface_impl:own_functions(State, Arg1, ..., ArgN) -> CastReply</name>
 
335
      <name>Module_Interface_impl:own_functions(This, State, Arg1, ..., ArgN) -> CastReply</name>
 
336
      <fsummary>User defined function which is not a part of Orber</fsummary>
 
337
      <type>
 
338
        <v>This = the servers #object reference</v>
 
339
        <v>State = term()</v>
 
340
        <v>CastReply = {noreply, State} | {noreply, State, Timeout} | {stop, StopReason, State}</v>
 
341
        <v>ArgX = specified in the IDL-code.</v>
 
342
        <v>Reply = specified in the IDL-code.</v>
 
343
        <v>Timeout = int() >= 0 | infinity</v>
 
344
        <v>StopReason = normal | shutdown | term()</v>
 
345
      </type>
 
346
      <desc>
 
347
        <p>All one-way functions must return one of the listed replies. 
 
348
          If the IC compile option <em>this</em> is used,
 
349
          the implementation must accept the <em>This</em> parameter.</p>
 
350
      </desc>
 
351
    </func>
 
352
  </funcs>
 
353
  
 
354
</erlref>
 
355