summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/sca-java-bindingcorba.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/trunk/site-publish/sca-java-bindingcorba.html')
-rw-r--r--site/trunk/site-publish/sca-java-bindingcorba.html441
1 files changed, 441 insertions, 0 deletions
diff --git a/site/trunk/site-publish/sca-java-bindingcorba.html b/site/trunk/site-publish/sca-java-bindingcorba.html
new file mode 100644
index 0000000000..511ff7a69b
--- /dev/null
+++ b/site/trunk/site-publish/sca-java-bindingcorba.html
@@ -0,0 +1,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%">
+ &nbsp;
+ </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%">
+ &nbsp;<A href="home.html" title="Apache Tuscany">Apache Tuscany</A>&nbsp;&gt;&nbsp;<A href="home.html" title="Home">Home</A>&nbsp;&gt;&nbsp;<A href="sca-overview.html" title="SCA Overview">SCA Overview</A>&nbsp;&gt;&nbsp;<A href="sca-java.html" title="SCA Java">SCA Java</A>&nbsp;&gt;&nbsp;<A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</A>&nbsp;&gt;&nbsp;<A href="sca-java-user-guide.html" title="SCA Java User Guide">SCA Java User Guide</A>&nbsp;&gt;&nbsp;<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>&nbsp;&nbsp;
+ </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>&lt;binding.corba&gt;</H3>
+
+<P>The Tuscany Java SCA runtime supports CORBA using the &lt;binding.corba&gt; SCDL extension. New CORBA based service can be provided using a &lt;binding.corba&gt; element within a SCA &lt;service&gt;, existing CORBA object can be accessed using a &lt;binding.corba&gt; element within a SCA &lt;reference&gt;.</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 &quot;id&quot; 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">&lt;service name=<SPAN class="code-quote">&quot;ScenarionOneServiceGenerated&quot;</SPAN> promote=<SPAN class="code-quote">&quot;ScenarionOneServiceGenerated&quot;</SPAN>&gt;
+
+ &lt;<SPAN class="code-keyword">interface</SPAN>.java <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations&quot;</SPAN>/&gt;
+
+ &lt;tuscany:binding.corba host=<SPAN class="code-quote">&quot;localhost&quot;</SPAN> port=<SPAN class="code-quote">&quot;5060&quot;</SPAN> name=<SPAN class="code-quote">&quot;ScenarioOne/TuscanyGenerated&quot;</SPAN>/&gt;
+
+&lt;/service&gt;
+</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">&lt;reference name=<SPAN class="code-quote">&quot;scenarioOne&quot;</SPAN>&gt;
+
+ &lt;tuscany:binding.corba uri=<SPAN class="code-quote">&quot;corbaname::localhost:5060#NamedWithURI&quot;</SPAN>/&gt;
+
+&lt;/reference&gt;
+</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 &#42;.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>
+&nbsp;</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&nbsp; 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 &quot;IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0&quot; then you should declare exception class named &quot;org.apache.tuscany.sca.test.corba.generated.WrongColor&quot;.</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>&nbsp;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>&nbsp;<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&nbsp; <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() - &#95;get_name <BR class="atl-forced-newline">
+2. setName(String newName) - &#95;set_name <BR class="atl-forced-newline">
+3. isName() - &#95;get_name&nbsp; </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_&#95; <BR class="atl-forced-newline">
+2. overloadedMethod(String arg1) - overloadedMethod__CORBA_WStringValue <BR class="atl-forced-newline">
+3. overloadedMethod(String arg1, int arg2) - overloadedMethod&#95;<EM>CORBA_WStringValue</EM>&#95;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 &quot;id&quot; 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 &#42;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 &quot;id&quot; attribute:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">&lt;service name=<SPAN class="code-quote">&quot;ScenarionOneServiceGenerated&quot;</SPAN> promote=<SPAN class="code-quote">&quot;ScenarionOneServiceGenerated&quot;</SPAN>&gt;
+
+ &lt;<SPAN class="code-keyword">interface</SPAN>.java <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations&quot;</SPAN>/&gt;
+
+ &lt;tuscany:binding.corba host=<SPAN class="code-quote">&quot;localhost&quot;</SPAN> port=<SPAN class="code-quote">&quot;5060&quot;</SPAN> name=<SPAN class="code-quote">&quot;ScenarioOneTuscanyGenerated&quot;</SPAN>
+ id=<SPAN class="code-quote">&quot;IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0&quot;</SPAN>/&gt;
+
+&lt;/service&gt;
+</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&#45;</B><B>jse</B><B>&#45;&lt;version&gt;.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">&nbsp; 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-&lt;version&gt;.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">&nbsp; 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-&lt;version&gt;.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&nbsp;&nbsp;</BR>
+ Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
+ </DIV>
+ <!-- footer macro end -->
+
+ </BODY>
+</HTML>