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
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<!-- generateKeywords macro -->
<META name="description" content="Apache Tuscany">
<META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource">
<!-- generateKeywords macro end -->
<LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css">
<LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
<TITLE>Apache Tuscany : SCA Java binding.corba</TITLE>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<BODY onload="init()">
<!-- topNav macro -->
<TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg">
<TR>
<TD valing="top" align="left">
<A href="https://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
</TD>
<TD>
<A href="http://tuscany.apache.org/"><IMG src="http://tuscany.apache.org/images/TuscanyLogo.jpg" border="0"></A>
</TD>
<TD width="100%">
</TD>
<!-- Adds the edit page link to the top banner-->
<TD valign="bottom">
<DIV style="padding: 2px 10px; margin: 0px;">
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=91234">
<IMG src="http://tuscany.apache.org/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
</DIV>
</TD>
</TR>
</TABLE>
<!-- topNav macro end -->
<!-- breadCrumbs macro -->
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR class="topBar">
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
<A href="home.html" title="Apache Tuscany">Apache Tuscany</A> > <A href="home.html" title="Home">Home</A> > <A href="sca-overview.html" title="SCA Overview">SCA Overview</A> > <A href="sca-java.html" title="SCA Java">SCA Java</A> > <A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</A> > <A href="sca-java-user-guide.html" title="SCA Java User Guide">SCA Java User Guide</A> > <A href="" title="SCA Java binding.corba">SCA Java binding.corba</A>
</TD>
<TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
<A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
</TD>
</TR>
</TABLE>
<!-- breadCrumbs macro end -->
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
<TR>
<TD align="left" valign="top">
<!-- pageContent macro -->
<DIV id="PageContent">
<DIV class="pagecontent">
<DIV class="wiki-content">
<TABLE class="sectionMacro" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR>
<TD class="confluenceTd" valign="top" width="15%">
<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="home.html" title="Home">Home</A><BR>
<A href="http://www.apache.org/licenses/LICENSE-2.0.html" class="external-link" rel="nofollow">License </A><BR>
<A href="sca-java-get-involved.html" title="SCA Java Get Involved">Get Involved</A><BR>
<A href="sca-java-found-a-bug.html" title="SCA Java Found A Bug">Found a Bug?</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java.html" title="SCA Java">SCA Java Home</A><BR>
<A href="tuscany-dashboard.html" title="Tuscany Dashboard">SCA Dashboard</A><BR>
<A href="java-sca-tools.html" title="Java SCA Tools">Tools </A><BR>
<A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 1.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-releases.html" title="SCA Java Releases">Downloads</A><BR>
<A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/" class="external-link" rel="nofollow">1.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 2.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-2x-releases.html" title="SCA Java 2.x Releases">Downloads</A><BR>
<A href="http://tuscany.apache.org/documentation-2x/" class="external-link" rel="nofollow">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/" class="external-link" rel="nofollow">2.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Documentation</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-user-guide.html" title="SCA Java User Guide">User Guide</A><BR>
<A href="sca-java-architecture-guide.html" title="SCA Java Architecture Guide">Architecture Guide</A><BR>
<A href="sca-java-development-guide.html" title="SCA Java Development Guide">Developer Guide</A><BR>
<A href="sca-java-extension-development-guide.html" title="SCA Java Extension Development Guide">Extension Developer Guide</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Resources</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A><BR>
<A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/sca" class="external-link" rel="nofollow">Source Code</A></P>
</DIV></DIV>
</TD>
<TD class="confluenceTd" valign="top" width="85%">
<H3><A name="SCAJavabinding.corba-%3Cbinding.corba%3E"></A><binding.corba></H3>
<P>The Tuscany Java SCA runtime supports CORBA using the <binding.corba> SCDL extension. New CORBA based service can be provided using a <binding.corba> element within a SCA <service>, existing CORBA object can be accessed using a <binding.corba> element within a SCA <reference>.</P>
<UL>
<LI><A href="#SCAJavabinding.corba-Location"><B>Configuring CORBA service/reference</B></A></LI>
<LI><A href="#SCAJavabinding.corba-ProvidingInterface"><B>Providing interface</B></A></LI>
<LI><A href="#SCAJavabinding.corba-ArraysUnions"><B>CORBA arrays and unions mapping</B></A></LI>
<LI><A href="#SCAJavabinding.corba-MethodMapping"><B>Methods to operations mapping</B></A></LI>
<LI><A href="#SCAJavabinding.corba-IdAttribute"><B>Usage of additional "id" attribute in CORBA service bindings</B></A></LI>
<LI><A href="#SCAJavabinding.corba-Hosts"><B>Host environment types</B></A></LI>
</UL>
<H3><A name="SCAJavabinding.corba-UsingCORBAbinding"></A>Using CORBA binding</H3>
<P><A name="SCAJavabinding.corba-Location"></A></P>
<H4><A name="SCAJavabinding.corba-ConfiguringCORBAservice%2Freference"></A>Configuring CORBA service/reference</H4>
<P>Location for both service and reference CORBA binding can be configured by:</P>
<P>1. <B>Name</B>, <B>host</B>, <B>port</B> parameters, where <B>host</B> and <B>port</B> points to name service, and <B>name</B> points to object within name service.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example service declaration:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><service name=<SPAN class="code-quote">"ScenarionOneServiceGenerated"</SPAN> promote=<SPAN class="code-quote">"ScenarionOneServiceGenerated"</SPAN>>
<<SPAN class="code-keyword">interface</SPAN>.java <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">"org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"</SPAN>/>
<tuscany:binding.corba host=<SPAN class="code-quote">"localhost"</SPAN> port=<SPAN class="code-quote">"5060"</SPAN> name=<SPAN class="code-quote">"ScenarioOne/TuscanyGenerated"</SPAN>/>
</service>
</PRE>
</DIV></DIV>
<P>2. Corbaname URI.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example reference declaration:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><reference name=<SPAN class="code-quote">"scenarioOne"</SPAN>>
<tuscany:binding.corba uri=<SPAN class="code-quote">"corbaname::localhost:5060#NamedWithURI"</SPAN>/>
</reference>
</PRE>
</DIV></DIV>
<P><A name="SCAJavabinding.corba-ProvidingInterface"></A></P>
<H4><A name="SCAJavabinding.corba-Providinginterface"></A>Providing interface</H4>
<P>For both service and reference side you can use one of two types of Java interface:</P>
<P>1. Generated by idlj compiler from *.idl file.</P>
<P>2. Created by user according to rules for Java to CORBA mapping.</P>
<P>In both cases interfaces are almost the same. Difference is that generated interfaces extends/implements CORBA types which are ignored by binding. Mapping rules are available under: <A href="http://www.omg.org/docs/formal/08-01-14.pdf" class="external-link" rel="nofollow">Java2IDL</A>, <A href="http://www.omg.org/docs/formal/08-01-11.pdf" class="external-link" rel="nofollow">IDL2Java</A>. Samples of CORBA bindings can be found in <B>sca/itest/corba</B> module.<BR>
</P>
<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Overloading, case collisions</B><BR>When using Tuscany service/reference binding to communicate with traditional CORBA objects:
<P>1. Don't overload method names in Java interface.</P>
<P>2. Don't create methods with names which differs only by case, ie. you shouldn't declare both methods: caseSensitive() and CaseSensitive().</P>
<P>You can ignore above rules if you are using Tuscany CORBA binding to communicate with other Tuscany CORBA binding. Those constraints results from differences between IDL and Java. More details can be found in <A href="#SCAJavabinding.corba-MethodMapping"><B>Method/operation mapping rules</B></A> section.</P></TD></TR></TABLE></DIV>
<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Declaring exceptions</B><BR>Exceptions declared by user should be named to match remote exception ID.
<P>Example: if in reference binding remote object throws exception with ID "IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0" then you should declare exception class named "org.apache.tuscany.sca.test.corba.generated.WrongColor".</P>
<P>The same in service bindings. SCA component exception will be thrown with ID created from Java name.</P></TD></TR></TABLE></DIV>
<P><A name="SCAJavabinding.corba-ArraysUnions"></A></P>
<H4><A name="SCAJavabinding.corba-CORBAarraysandunionsmapping"></A>CORBA arrays and unions mapping</H4>
<P>CORBA arrays and unions cannot be directly mapped so additional metadata should be used.</P>
<P><B>1. Arrays mapping</B></P>
<P>To declare CORBA array you should declare Java array and annotate it by <B>org.apache.tuscany.sca.binding.corba.meta.CorbaArray</B> annotation.</P>
<P>Annotation <B>org.apache.tuscany.sca.binding.corba.meta.CorbaArray</B> has one default attribute (array of integers) which declares lengths of following array dimensions. Objects you can annotate are:</P>
<UL>
<LI>binding interface methods arguments</LI>
<LI>binding interface methods, which will refer to return type</LI>
<LI>structure fields</LI>
</UL>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> SampleInterface {
@CorbaArray( {2, 2}) <SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> annotation makes <SPAN class="code-keyword">return</SPAN> array to be CORBA array
</SPAN> <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN>[][] passStringArray(@CorbaArray( {2, 2})<SPAN class="code-object">String</SPAN>[][] arg); <SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> annotation makes mehods argument to be CORBA array
</SPAN>
}
</PRE>
</DIV></DIV>
<P> You can also annotate fields in CORBA structures.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">final</SPAN> class SampleStruct {
@CorbaArray( {2, 2}) <SPAN class="code-comment">// following field is two dimensional CORBA array, which has 2 elements in both first and second dimension
</SPAN> <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN>[][] stringArray;
<SPAN class="code-keyword">public</SPAN> SampleStruct() {
}
<SPAN class="code-keyword">public</SPAN> SampleStruct(<SPAN class="code-object">String</SPAN>[][] stringArray) {
<SPAN class="code-keyword">this</SPAN>.stringArray = stringArray;
}
}
</PRE>
</DIV></DIV>
<P><B>2. Unions mapping</B></P>
<P>To declare CORBA union you should create final Java class which contains:</P>
<UL>
<LI>private field for every union option</LI>
<LI>private field of int, which will be discriminator</LI>
</UL>
<P>Union options as well as discriminator should be annotated with <B>org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement</B>, which has two attributes:</P>
<UL>
<LI>CorbaUnionElementType type(), which can take following values:
<UL>
<LI>CorbaUnionElementType.option for member, additional optionNumber attribute is required</LI>
<LI>CorbaUnionElementType.defaultOption for default union member</LI>
<LI>CorbaUnionElementType.discriminator for discriminator field</LI>
</UL>
</LI>
<LI>int optionNumber() - can be used only with CorbaUnionElementType.option</LI>
</UL>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example:</P>
<P>Following IDL declaration:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">union SampleUnion <SPAN class="code-keyword">switch</SPAN> (<SPAN class="code-object">long</SPAN>) {
<SPAN class="code-keyword">case</SPAN> 1: <SPAN class="code-object">long</SPAN> x;
<SPAN class="code-keyword">case</SPAN> 2: <SPAN class="code-object">float</SPAN> y;
<SPAN class="code-keyword">default</SPAN>: string z;
};
</PRE>
</DIV></DIV>
<P>is equal to Tuscany CORBA binding declaration:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
<SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">final</SPAN> class SampleUnion {
@CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
<SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> is union member, id = 1
</SPAN> <SPAN class="code-keyword">private</SPAN> <SPAN class="code-object">int</SPAN> x;
@CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
<SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> is union member, id = 2
</SPAN> <SPAN class="code-keyword">private</SPAN> <SPAN class="code-object">float</SPAN> y;
@CorbaUnionElement(type = CorbaUnionElementType.defaultOption)
<SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> is <SPAN class="code-keyword">default</SPAN> union member
</SPAN> <SPAN class="code-keyword">private</SPAN> <SPAN class="code-object">String</SPAN> z;
@CorbaUnionElement(type = CorbaUnionElementType.discriminator)
<SPAN class="code-keyword">private</SPAN> <SPAN class="code-object">int</SPAN> discriminator;
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">int</SPAN> getX() {
<SPAN class="code-keyword">return</SPAN> x;
}
<SPAN class="code-keyword">public</SPAN> void setX(<SPAN class="code-object">int</SPAN> x) {
discriminator = 1;
<SPAN class="code-keyword">this</SPAN>.x = x;
}
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">float</SPAN> getY() {
<SPAN class="code-keyword">return</SPAN> y;
}
<SPAN class="code-keyword">public</SPAN> void setY(<SPAN class="code-object">float</SPAN> y) {
discriminator = 2;
<SPAN class="code-keyword">this</SPAN>.y = y;
}
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">float</SPAN> getZ() {
<SPAN class="code-keyword">return</SPAN> z;
}
<SPAN class="code-keyword">public</SPAN> void setZ(<SPAN class="code-object">float</SPAN> z) {
discriminator = -1;
<SPAN class="code-keyword">this</SPAN>.z = z;
}
}
</PRE>
</DIV></DIV>
<P> <A name="SCAJavabinding.corba-MethodMapping"></A></P>
<H4><A name="SCAJavabinding.corba-Method%2Foperationmappingrules"></A>Method/operation mapping rules</H4>
<P>IDL rules are different than rules in Java programming language - Java method names can't be always directly mapped to CORBA operations. Following table shows used mapping rules:</P>
<DIV class="table-wrap">
<TABLE class="confluenceTable"><TBODY>
<TR>
<TH class="confluenceTh"> Mapping type <BR class="atl-forced-newline"> </TH>
<TH class="confluenceTh"> Description <BR class="atl-forced-newline"> </TH>
<TH class="confluenceTh"> Examples: Java method - translated CORBA operation </TH>
</TR>
<TR>
<TD class="confluenceTd"> 1. Getters and setters <BR class="atl-forced-newline"> </TD>
<TD class="confluenceTd"> If user declared valid pair of getter and setter then those methods wouldbe translated to operations which are responsible for getting/setting objects attribute. <BR class="atl-forced-newline"> </TD>
<TD class="confluenceTd"> 1. getName() - _get_name <BR class="atl-forced-newline">
2. setName(String newName) - _set_name <BR class="atl-forced-newline">
3. isName() - _get_name </TD>
</TR>
<TR>
<TD class="confluenceTd"> 2. Overloaded names <BR class="atl-forced-newline"> </TD>
<TD class="confluenceTd"> CORBA does not support overloading method names - Java does.. Some mapping rules were applied to allow using overloaded names in Java interfaces using CORBA binding. Final operation name is created by taking method name and appending it by CORBA parameters type names separated by '_' chars. <BR class="atl-forced-newline"> </TD>
<TD class="confluenceTd"> 1. overloadedMethod() - overloadedMethod__ <BR class="atl-forced-newline">
2. overloadedMethod(String arg1) - overloadedMethod__CORBA_WStringValue <BR class="atl-forced-newline">
3. overloadedMethod(String arg1, int arg2) - overloadedMethod_<EM>CORBA_WStringValue</EM>_long </TD>
</TR>
<TR>
<TD class="confluenceTd"> 3. Names with case collisions </TD>
<TD class="confluenceTd"> CORBA is not case sensitive - Java is. CORBA ie. doesn't distinguish methods caseDifferent() and CaseDifferent(), so some mapping rules are fixing it. Final operation name is created by taking method name and appending it by indexes of characters which are capitals. </TD>
<TD class="confluenceTd"> 1. caseDifferent() - caseDifferent_4 <BR class="atl-forced-newline">
2. CaseDifferent() - CaseDifferent_0_4 </TD>
</TR>
</TBODY></TABLE>
</DIV>
<P><A name="SCAJavabinding.corba-IdAttribute"></A></P>
<H4><A name="SCAJavabinding.corba-Usageofadditional%22id%22attributeinCORBAservicebindings"></A>Usage of additional "id" attribute in CORBA service bindings</H4>
<P>User can also provide <B>id</B> attribute for service binding. It's not required, but helpfull if we want to publish service which will be consumed by some idlj generated code. This generated code contains *Helper classes with narrow(...) methods. Narrow(...) method compares obtained CORBA reference ID to some local (which was generated). CORBA service binding provide this ID automatically basing on user provided Java interface name. Providing <B>id</B> attribute is the only way to provide custom identifier.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Example of using "id" attribute:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java"><service name=<SPAN class="code-quote">"ScenarionOneServiceGenerated"</SPAN> promote=<SPAN class="code-quote">"ScenarionOneServiceGenerated"</SPAN>>
<<SPAN class="code-keyword">interface</SPAN>.java <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">"org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"</SPAN>/>
<tuscany:binding.corba host=<SPAN class="code-quote">"localhost"</SPAN> port=<SPAN class="code-quote">"5060"</SPAN> name=<SPAN class="code-quote">"ScenarioOneTuscanyGenerated"</SPAN>
id=<SPAN class="code-quote">"IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"</SPAN>/>
</service>
</PRE>
</DIV></DIV>
<P><A name="SCAJavabinding.corba-Hosts"></A></P>
<H3><A name="SCAJavabinding.corba-Hostenvironmenttypes"></A>Host environment types</H3>
<P>CORBA binding supports two hosting environments.</P>
<H4><A name="SCAJavabinding.corba-hostcorbajse"></A>host-corba-jse</H4>
<P>It is the standalone hosting environment where various ORBs could be used. Note that you have to provide name service by yourself and configure service/reference to point onto desired ORB.<BR>
<IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Usage: add <B>tuscany-host-</B><B>jse</B><B>-<version>.jar</B> module to your class path.</P>
<H4><A name="SCAJavabinding.corba-hostcorbajsetns"></A>host-corba-jse-tns</H4>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Not available in official Apache Tuscany release</P>
<P>This hosting environment extends <B>host-corba-jse</B>. For every configured service CORBA binding which points to localhost Transient Name Service will be created and name servers for bindings using the same port will be shared.<BR>
<IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Usage: add <B>tuscany-host-jse-tns-<version>.jar</B> module to your class path.</P>
<H4><A name="SCAJavabinding.corba-hostcorbajee"></A>host-corba-jee</H4>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Not available in official Apache Tuscany release</P>
<P>It is the JEE application server environment. In this case ORB is obtained from JNDI by <B>java:comp/ORB</B> name and you don't need to provide name service. Also <B>host</B> and <B>port</B> (or their equivalent contained in corbaname URI) parameters are ignored.<BR>
<IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Usage: add <B>tuscany-host-jee-<version>.jar</B> module to your class path.</P></TD></TR></TBODY></TABLE>
</DIV>
</DIV>
</DIV>
<!-- pageContent macro end -->
</TD>
</TR>
</TABLE>
<!-- footer macro -->
<SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</SCRIPT>
<SCRIPT type="text/javascript">
_uacct = "UA-1174707-5";
urchinTracker();
</SCRIPT>
<A href="http://www.statcounter.com/" target="_blank"><IMG src="http://c26.statcounter.com/counter.php?sc_project=2619156&java=0&security=94bd7e7d&invisible=0" alt="website stats" border="0"></A>
<DIV class="footer">
Copyright � 2003-2012, The Apache Software Foundation </BR>
Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
</DIV>
<!-- footer macro end -->
</BODY>
</HTML>
|