summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-22 09:11:51 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-22 09:11:51 +0000
commit0d7533759f027a0fafc5844210ddf4e35122c758 (patch)
treecd7e7bedbd53b9e04541ea6ba48a5b44a5460e6d /sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee
parent40e207beb6ed5c979bdedc71ebc735ba9295ecfe (diff)
Create branch for next release
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@966547 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee')
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/LICENSE205
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/META-INF/MANIFEST.MF23
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/NOTICE6
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/pom.xml44
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java164
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHost17
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java208
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java174
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java37
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java29
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java99
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java50
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java30
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java73
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java72
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java35
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/resources/general.idl45
17 files changed, 1311 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/LICENSE b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..71fbb7e6a9
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Private-Package: org.apache.tuscany.sca.host.corba.jee;version="2.0.0"
+Tool: Bnd-0.0.255
+Bundle-Name: Apache Tuscany SCA JEE environment CORBA Host
+Created-By: 1.6.0_07 (Sun Microsystems Inc.)
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bnd-LastModified: 1225397427890
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA JEE environment CORBA Host
+Import-Package: javax.naming,
+ javax.naming.spi;resolution:=optional,
+ javax.rmi,
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.host.corba;version="2.0.0",
+ org.omg.CORBA,
+ org.omg.CORBA.portable;resolution:=optional,
+ org.omg.CosNaming,
+ org.omg.CosNaming.NamingContextPackage
+Bundle-SymbolicName: org.apache.tuscany.sca.host.corba.jee
+Bundle-DocURL: http://www.apache.org/
+
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/NOTICE b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/NOTICE
new file mode 100644
index 0000000000..9ddba06a32
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/pom.xml b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/pom.xml
new file mode 100644
index 0000000000..d92b13ad52
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>2.0-Beta1-SNAPSHOT</version>
+ </parent>
+ <artifactId>tuscany-host-corba-jee</artifactId>
+ <name>Apache Tuscany SCA JEE environment CORBA Host</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba</artifactId>
+ <version>2.0-Beta1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jse</artifactId>
+ <version>2.0-Beta1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java
new file mode 100644
index 0000000000..4d86a08eaa
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java
@@ -0,0 +1,164 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.tuscany.sca.core.LifeCycleListener;
+import org.apache.tuscany.sca.host.corba.CorbaHost;
+import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
+import org.apache.tuscany.sca.host.corba.CorbanameURL;
+import org.oasisopen.sca.ServiceRuntimeException;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextHelper;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+
+/**
+ * @version $Rev$ $Date$
+ * Implementation of JEE CORBA host
+ */
+public class JEECorbaHost implements CorbaHost, LifeCycleListener {
+
+ public static final String ORB_NAME = "java:comp/ORB";
+
+ private List<String> registeredServants = Collections.synchronizedList(new ArrayList<String>());
+ private ORB orb;
+
+ private void registerURI(String uri) {
+ registeredServants.add(uri);
+ }
+
+ private void removeURI(String uri) {
+ registeredServants.remove(uri);
+ }
+
+ private NamingContextExt getNamingContext(String nameService) throws Exception {
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references(nameService);
+ return NamingContextExtHelper.narrow(objRef);
+ }
+
+ private void handleException(Exception e) throws CorbaHostException {
+ // The cause of the Exception is JDK specific
+ if (e instanceof NotFound) {
+ throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT, e);
+ } else if (e instanceof InvalidName) {
+ throw new CorbaHostException(e);
+ } else {
+ throw new CorbaHostException(e);
+ }
+ }
+
+ public void registerServant(String uri, Object servantObject) throws CorbaHostException {
+ CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
+ try {
+ NamingContext namingCtx = getNamingContext(details.getNameService());
+ for (int i = 0; i < details.getNamePath().size() - 1; i++) {
+ NameComponent nc = new NameComponent(details.getNamePath().get(i), "");
+ NameComponent[] path = new NameComponent[] {nc};
+ try {
+ namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path));
+ } catch (Exception e) {
+ namingCtx = namingCtx.bind_new_context(path);
+ }
+ }
+ NameComponent finalName =
+ new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), "");
+ try {
+ namingCtx.resolve(new NameComponent[] {finalName});
+ // no exception means that some object is already registered
+ // under this name, we need to crash here
+ throw new CorbaHostException(CorbaHostException.BINDING_IN_USE);
+ } catch (NotFound e) {
+ namingCtx.bind(new NameComponent[] {finalName}, servantObject);
+ registerURI(uri);
+ }
+ } catch (CorbaHostException e) {
+ throw e;
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ public void unregisterServant(String uri) throws CorbaHostException {
+ CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
+ try {
+ NamingContextExt namingCtx = getNamingContext(details.getNameService());
+ namingCtx.unbind(namingCtx.to_name(details.getName()));
+ removeURI(uri);
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ public Object lookup(String uri) throws CorbaHostException {
+ Object result = null;
+ try {
+ CorbanameURL url = new CorbanameURL(uri);
+ NamingContextExt context = getNamingContext(url.getNameService());
+ result = context.resolve_str(url.getName());
+ } catch (Exception e) {
+ // e.printStackTrace();
+ handleException(e);
+ }
+ if (result == null) {
+ throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT);
+ }
+ return result;
+ }
+
+ // obtain ORB from environment
+ public void start() {
+ Context ctx;
+ try {
+ ctx = new InitialContext();
+ orb = (ORB)PortableRemoteObject.narrow(ctx.lookup(ORB_NAME), org.omg.CORBA.ORB.class);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // unregister registered servants
+ public void stop() {
+ // use copy because unregisterServant(...) method removes from
+ // registeredServants collection
+ List<String> rsCopy = new ArrayList<String>(registeredServants);
+ for (String servantURI : rsCopy) {
+ try {
+ unregisterServant(servantURI);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHost b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHost
new file mode 100644
index 0000000000..45da924da6
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHost
@@ -0,0 +1,17 @@
+# 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.
+org.apache.tuscany.sca.host.corba.jee.JEECorbaHost;ranking=100
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java
new file mode 100644
index 0000000000..fd952a02c7
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import javax.naming.Context;
+
+import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost;
+import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface;
+import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper;
+import org.apache.tuscany.sca.host.corba.jee.testing.servants.TestInterfaceServant;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * General tests for JEECorbaHost. Uses host-corba-jdk as mock for JEE
+ * environment ORB.
+ */
+public class JEECorbaHostTestCase {
+
+ public static final String LOCALHOST = "localhost";
+ public static final int DEFAULT_PORT = 11100;
+ private static JEECorbaHost host;
+ private static TransientNameServer server;
+ private static String factoryClassName;
+
+ private String createCorbanameURI(String name) {
+ return "corbaname:#" + name;
+ }
+
+ @BeforeClass
+ public static void start() {
+ try {
+ server = new TransientNameServer(LOCALHOST, DEFAULT_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ fail("The naming server cannot be started");
+ }
+ factoryClassName = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestInitialContextFactory.class.getName());
+ host = new JEECorbaHost();
+ host.start();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void stop() {
+ server.stop();
+ if (factoryClassName != null) {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, factoryClassName);
+ } else {
+ System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);
+ }
+ }
+
+ /**
+ * Tests registering and lookup CORBA services
+ */
+ @Test
+ public void test_registerServant() {
+ try {
+ String uri = createCorbanameURI("Nested/Test");
+ TestInterface servant = new TestInterfaceServant();
+ host.registerServant(uri, servant);
+ TestInterface ref = TestInterfaceHelper.narrow(host.lookup(uri));
+ assertEquals(2, ref.getInt(2));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests unregistering servants
+ */
+ @Test
+ public void test_unregisterServant() {
+ try {
+ String uri = createCorbanameURI("Unregistering/Test");
+ TestInterface servant = new TestInterfaceServant();
+
+ // creating and releasing using corbaname URI
+ host.registerServant(uri, servant);
+ host.unregisterServant(uri);
+ host.registerServant(uri, servant);
+ host.unregisterServant(uri);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests situation when name is already registered
+ */
+ @Test
+ public void test_nameAlreadyRegistered() {
+ // test using URI
+ try {
+ TestInterface servant = new TestInterfaceServant();
+ String uri = createCorbanameURI("AlreadyRegisteredTest2");
+ host.registerServant(uri, servant);
+ host.registerServant(uri, servant);
+ fail();
+ } catch (CorbaHostException e) {
+ assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests getting non existing reference
+ */
+ @Test
+ public void test_getNonExistingObject() {
+ // try to fetch object with corbaname URI
+ try {
+ host.lookup(createCorbanameURI("NonExistingOne"));
+ fail();
+ } catch (CorbaHostException e) {
+ // The message is JDK-specific
+ // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
+ } catch (Exception e) {
+ // e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests unregistering non existing reference
+ */
+ @Test
+ public void test_unregisterNonExistentObject() {
+ // test using URI
+ try {
+ String uri = createCorbanameURI("NonExistingReference1");
+ host.unregisterServant(uri);
+ fail();
+ } catch (CorbaHostException e) {
+ assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests unregistering servants on host stop
+ */
+ @Test
+ public void test_unregisterOnStop() {
+ try {
+ String uri1 = createCorbanameURI("TempService1");
+ String uri2 = createCorbanameURI("TempService2");
+ JEECorbaHost innerHost = new JEECorbaHost();
+ innerHost.start();
+ TestInterfaceServant servant = new TestInterfaceServant();
+ innerHost.registerServant(uri1, servant);
+ innerHost.registerServant(uri2, servant);
+ innerHost.stop();
+ try {
+ innerHost.lookup(uri1);
+ fail();
+ } catch (CorbaHostException e) {
+ assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage());
+ }
+ try {
+ innerHost.lookup(uri2);
+ fail();
+ } catch (CorbaHostException e) {
+ assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java
new file mode 100644
index 0000000000..a0b9b7c514
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing;
+
+import java.util.Hashtable;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost;
+import org.omg.CORBA.ORB;
+
+/**
+ * Mock implementation of javax.naming.Context interface.
+ */
+public class TestContext implements Context {
+
+ private ORB orb;
+
+ public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+ return null;
+ }
+
+ public void bind(Name name, Object obj) throws NamingException {
+
+ }
+
+ public void bind(String name, Object obj) throws NamingException {
+
+ }
+
+ public void close() throws NamingException {
+
+ }
+
+ public Name composeName(Name name, Name prefix) throws NamingException {
+ return null;
+ }
+
+ public String composeName(String name, String prefix) throws NamingException {
+ return null;
+ }
+
+ public Context createSubcontext(Name name) throws NamingException {
+ return null;
+ }
+
+ public Context createSubcontext(String name) throws NamingException {
+ return null;
+ }
+
+ public void destroySubcontext(Name name) throws NamingException {
+
+ }
+
+ public void destroySubcontext(String name) throws NamingException {
+
+ }
+
+ public Hashtable<?, ?> getEnvironment() throws NamingException {
+ return null;
+ }
+
+ public String getNameInNamespace() throws NamingException {
+ return null;
+ }
+
+ public NameParser getNameParser(Name name) throws NamingException {
+ return null;
+ }
+
+ public NameParser getNameParser(String name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
+ return null;
+ }
+
+ public Object lookup(Name name) throws NamingException {
+ return null;
+ }
+
+ public Object lookup(String name) throws NamingException {
+ try {
+ if (name.equals(JEECorbaHost.ORB_NAME)) {
+ if (orb == null) {
+ // get ORB which was spawned under host and port declared in
+ // test class
+ String[] args =
+ {"-ORBInitialHost", JEECorbaHostTestCase.LOCALHOST, "-ORBInitialPort",
+ "" + JEECorbaHostTestCase.DEFAULT_PORT};
+ orb = ORB.init(args, null);
+ }
+ } else {
+ throw new NamingException("Unknown name: " + name);
+ }
+ } catch (Exception e) {
+ throw new NamingException(e.getMessage());
+ }
+ return orb;
+ }
+
+ public Object lookupLink(Name name) throws NamingException {
+ return null;
+ }
+
+ public Object lookupLink(String name) throws NamingException {
+ return null;
+ }
+
+ public void rebind(Name name, Object obj) throws NamingException {
+
+ }
+
+ public void rebind(String name, Object obj) throws NamingException {
+
+ }
+
+ public Object removeFromEnvironment(String propName) throws NamingException {
+ return null;
+ }
+
+ public void rename(Name oldName, Name newName) throws NamingException {
+
+ }
+
+ public void rename(String oldName, String newName) throws NamingException {
+
+ }
+
+ public void unbind(Name name) throws NamingException {
+
+ }
+
+ public void unbind(String name) throws NamingException {
+
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java
new file mode 100644
index 0000000000..f480235fa8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+/**
+ * Factory for mock implementation of javax.naming.Context interface.
+ */
+public class TestInitialContextFactory implements InitialContextFactory {
+
+ public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
+ return new TestContext();
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java
new file mode 100644
index 0000000000..c868329f10
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+public interface TestInterface extends TestInterfaceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
+} // interface TestInterface
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java
new file mode 100644
index 0000000000..e00b2429da
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+abstract public class TestInterfaceHelper {
+ private static String _id = "IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0";
+
+ public static void insert(org.omg.CORBA.Any a,
+ org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface that) {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
+ a.type(type());
+ write(out, that);
+ a.read_value(out.create_input_stream(), type());
+ }
+
+ public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface extract(org.omg.CORBA.Any a) {
+ return read(a.create_input_stream());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+
+ synchronized public static org.omg.CORBA.TypeCode type() {
+ if (__typeCode == null) {
+ __typeCode =
+ org.omg.CORBA.ORB
+ .init()
+ .create_interface_tc(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.id(),
+ "TestInterface");
+ }
+ return __typeCode;
+ }
+
+ public static String id() {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface read(org.omg.CORBA.portable.InputStream istream) {
+ return narrow(istream.read_Object(_TestInterfaceStub.class));
+ }
+
+ public static void write(org.omg.CORBA.portable.OutputStream ostream,
+ org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value) {
+ ostream.write_Object((org.omg.CORBA.Object)value);
+ }
+
+ public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface narrow(org.omg.CORBA.Object obj) {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)
+ return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj;
+ else if (!obj._is_a(id()))
+ throw new org.omg.CORBA.BAD_PARAM();
+ else {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
+ org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub =
+ new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+ public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface unchecked_narrow(org.omg.CORBA.Object obj) {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)
+ return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj;
+ else {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
+ org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub =
+ new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java
new file mode 100644
index 0000000000..292e1d09ab
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+public final class TestInterfaceHolder implements org.omg.CORBA.portable.Streamable {
+ public org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value = null;
+
+ public TestInterfaceHolder() {
+ }
+
+ public TestInterfaceHolder(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface initialValue) {
+ value = initialValue;
+ }
+
+ public void _read(org.omg.CORBA.portable.InputStream i) {
+ value = org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.read(i);
+ }
+
+ public void _write(org.omg.CORBA.portable.OutputStream o) {
+ org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.write(o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type() {
+ return org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.type();
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java
new file mode 100644
index 0000000000..8d66535eb2
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+public interface TestInterfaceOperations {
+ int getInt(int arg);
+} // interface TestInterfaceOperations
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java
new file mode 100644
index 0000000000..4f75c045ca
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+public abstract class _TestInterfaceImplBase extends org.omg.CORBA.portable.ObjectImpl implements
+ org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface, org.omg.CORBA.portable.InvokeHandler {
+
+ // Constructors
+ public _TestInterfaceImplBase() {
+ }
+
+ private static java.util.Hashtable _methods = new java.util.Hashtable();
+ static {
+ _methods.put("getInt", new java.lang.Integer(0));
+ }
+
+ public org.omg.CORBA.portable.OutputStream _invoke(String $method,
+ org.omg.CORBA.portable.InputStream in,
+ org.omg.CORBA.portable.ResponseHandler $rh) {
+ org.omg.CORBA.portable.OutputStream out = null;
+ java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
+ if (__method == null)
+ throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+
+ switch (__method.intValue()) {
+ case 0: // org/apache/tuscany/sca/host/corba/testing/general/TestInterface/getInt
+ {
+ int arg = in.read_long();
+ int $result = (int)0;
+ $result = this.getInt(arg);
+ out = $rh.createReply();
+ out.write_long($result);
+ break;
+ }
+
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ return out;
+ } // _invoke
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
+
+ public String[] _ids() {
+ return (String[])__ids.clone();
+ }
+
+} // class _TestInterfaceImplBase
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java
new file mode 100644
index 0000000000..cc6d137109
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.general;
+
+/**
+* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from general_tests.idl
+*/
+
+public class _TestInterfaceStub extends org.omg.CORBA.portable.ObjectImpl implements
+ org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface {
+
+ public int getInt(int arg) {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request("getInt", true);
+ $out.write_long(arg);
+ $in = _invoke($out);
+ int $result = $in.read_long();
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream();
+ String _id = $ex.getId();
+ throw new org.omg.CORBA.MARSHAL(_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return getInt(arg);
+ } finally {
+ _releaseReply($in);
+ }
+ } // getInt
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
+
+ public String[] _ids() {
+ return (String[])__ids.clone();
+ }
+
+ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
+ String str = s.readUTF();
+ String[] args = null;
+ java.util.Properties props = null;
+ org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
+ _set_delegate(delegate);
+ }
+
+ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
+ String[] args = null;
+ java.util.Properties props = null;
+ String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
+ s.writeUTF(str);
+ }
+} // class _TestInterfaceStub
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java
new file mode 100644
index 0000000000..6195f3af9c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.host.corba.jee.testing.servants;
+
+import org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceImplBase;
+
+/**
+ * Testing servant
+ */
+public class TestInterfaceServant extends _TestInterfaceImplBase {
+
+ private static final long serialVersionUID = 1L;
+
+ public int getInt(int arg) {
+ return arg;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/resources/general.idl b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/resources/general.idl
new file mode 100644
index 0000000000..9194a37334
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta1/modules/host-corba-jee/src/test/resources/general.idl
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/*
+ * compile by
+ * idlj -fall -oldImplBase general.idl
+ */
+
+module org {
+ module apache {
+ module tuscany {
+ module sca {
+ module host {
+ module corba {
+ module jee {
+ module testing {
+ module general {
+ interface TestInterface {
+ long getInt(in long arg);
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+};