Skip to content
Permalink
Browse files
Merge branch 'support_idl_narrow' into 'ibm-trunk'
Support idl narrow

See merge request !35
  • Loading branch information
ngmr committed Apr 30, 2015
2 parents c78bc87 + dfe6bcc commit dbd5c4c4203730088d911d0dfc2ea6d5c7877ec5
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 340 deletions.
@@ -287,14 +287,28 @@ public void testRemoteObjectAttribute() throws RemoteException {
assertEquals(42, sampleRemote2.getInt());
}

public void testCorbaAttribute(SampleCorba corbaRef) throws RemoteException {
public void testCorbaAttributeWithHelper(SampleCorba corbaRef) throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setCorbaObj(corbaRef);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleCorba corbaRef2 = SampleCorbaHelper.narrow(ser2.getCorbaObj());
corbaRef.i(42);
assertEquals(42, corbaRef2.i());
corbaRef.s("Don't panic!");
assertEquals("Don't panic!", corbaRef2.s());
}

public void testCorbaAttributeWithPRO(SampleCorba corbaRef) throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setCorbaObj(corbaRef);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleCorba corbaRef2 = (SampleCorba) PortableRemoteObject.narrow(ser2.getCorbaObj(), SampleCorba.class);
corbaRef.i(42);
assertEquals(42, corbaRef2.i());
corbaRef.s("Don't panic!");
assertEquals("Don't panic!", corbaRef2.s());
}

public void testComplexCorbaAttribute(SampleCorba corbaRef) throws RemoteException {
@@ -354,7 +368,8 @@ public static void main(String[] args) throws Exception {
test.testComplexRemoteArgument();
test.testSerializableAttribute();
test.testSerializableSelfReference();
test.testCorbaAttribute(SampleCorbaHelper.narrow(sampleCorbaRef));
test.testCorbaAttributeWithHelper(SampleCorbaHelper.narrow(sampleCorbaRef));
test.testCorbaAttributeWithPRO((SampleCorba) PortableRemoteObject.narrow(sampleCorbaRef, SampleCorba.class));
test.testComplexCorbaAttribute(SampleCorbaHelper.narrow(sampleCorbaRef));
test.testHashMap();
test.testEnum();
@@ -15,15 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test.rmi;


/**
* test/rmi/SampleCorba.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from src/test/java/test/rmi/SampleCorbaObject.idl
* 9. maj 2006 14:03:27 CEST
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/

public interface SampleCorba extends SampleCorbaOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
@@ -15,15 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test.rmi;


/**
* test/rmi/SampleCorbaHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from src/test/java/test/rmi/SampleCorbaObject.idl
* 9. maj 2006 14:03:27 CEST
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/

abstract public class SampleCorbaHelper
@@ -40,17 +39,21 @@ public static void insert (org.omg.CORBA.Any a, test.rmi.SampleCorba that)

public static test.rmi.SampleCorba extract (org.omg.CORBA.Any a)
{
if (!a.type().equal(type()))
throw new org.omg.CORBA.BAD_OPERATION("extract() failed.Expected a test.rmi.SampleCorba .");
return read (a.create_input_stream ());
}

private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
private static volatile org.omg.CORBA.TypeCode __typeCode = null;
public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
org.omg.CORBA.TypeCode __localTc = __typeCode;
if (__localTc == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (test.rmi.SampleCorbaHelper.id (), "SampleCorba");
__localTc = org.omg.CORBA.ORB.init ().create_interface_tc (test.rmi.SampleCorbaHelper.id (), "SampleCorba");
__typeCode = __localTc;
}
return __typeCode;
return __localTc;
}

public static String id ()
@@ -79,9 +82,7 @@ else if (!obj._is_a (id ()))
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
test.rmi._SampleCorbaStub stub = new test.rmi._SampleCorbaStub ();
stub._set_delegate(delegate);
return stub;
return new test.rmi._SampleCorbaStub (delegate);
}
}

@@ -94,9 +95,7 @@ else if (obj instanceof test.rmi.SampleCorba)
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
test.rmi._SampleCorbaStub stub = new test.rmi._SampleCorbaStub ();
stub._set_delegate(delegate);
return stub;
return new test.rmi._SampleCorbaStub (delegate);
}
}

@@ -15,14 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test.rmi;

/**
* test/rmi/SampleCorbaHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from src/test/java/test/rmi/SampleCorbaObject.idl
* 9. maj 2006 14:03:27 CEST
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/

public final class SampleCorbaHolder implements org.omg.CORBA.portable.Streamable
@@ -1,25 +1,26 @@
/**
*
/**
*
* 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.
*/
module test {
module rmi {
interface SampleCorba {
attribute long i;
};
};
};
*
* 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.
*/
module test {
module rmi {
interface SampleCorba {
attribute long i;
attribute string s;
};
};
};
@@ -15,19 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test.rmi;


/**
* test/rmi/SampleCorbaOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from src/test/java/test/rmi/SampleCorbaObject.idl
* 9. maj 2006 14:03:27 CEST
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/

public interface SampleCorbaOperations
{
int i ();
void i (int newI);
String s ();
void s (String newS);
} // interface SampleCorbaOperations
@@ -15,28 +15,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test.rmi;


/**
* test/rmi/SampleCorbaPOA.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from src/test/java/test/rmi/SampleCorbaObject.idl
* 9. maj 2006 14:03:27 CEST
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/

public abstract class SampleCorbaPOA extends org.omg.PortableServer.Servant
implements test.rmi.SampleCorbaOperations, org.omg.CORBA.portable.InvokeHandler
implements test.rmi.SampleCorbaOperations, org.omg.CORBA.portable.InvokeHandler
{

// Constructors
public test.rmi.SampleCorba _this() {
return test.rmi.SampleCorbaHelper.narrow(
super._this_object());
}

public test.rmi.SampleCorba _this(org.omg.CORBA.ORB orb) {
return test.rmi.SampleCorbaHelper.narrow(
super._this_object(orb));
}

public String[] _all_interfaces(
org.omg.PortableServer.POA poa,
byte[] objectId) {
return (String[])__ids.clone();
}

// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:test/rmi/SampleCorba:1.0"};

private static java.util.Hashtable _methods = new java.util.Hashtable ();
static
{
_methods.put ("_get_i", new java.lang.Integer (0));
_methods.put ("_set_i", new java.lang.Integer (1));
_methods.put ("_get_s", new java.lang.Integer (2));
_methods.put ("_set_s", new java.lang.Integer (3));
}

public org.omg.CORBA.portable.OutputStream _invoke (String $method,
@@ -52,10 +71,10 @@ public org.omg.CORBA.portable.OutputStream _invoke (String $method,
{
case 0: // test/rmi/SampleCorba/_get_i
{
int $result = (int)0;
$result = this.i ();
int __result = (int)0;
__result = this.i ();
out = $rh.createReply();
out.write_long ($result);
out.write_long (__result);
break;
}

@@ -67,33 +86,29 @@ public org.omg.CORBA.portable.OutputStream _invoke (String $method,
break;
}

case 2: // test/rmi/SampleCorba/_get_s
{
String __result = null;
__result = this.s ();
out = $rh.createReply();
out.write_string (__result);
break;
}

case 3: // test/rmi/SampleCorba/_set_s
{
String newS = in.read_string ();
this.s (newS);
out = $rh.createReply();
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:test/rmi/SampleCorba:1.0"};

public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
{
return (String[])__ids.clone ();
}

public SampleCorba _this()
{
return SampleCorbaHelper.narrow(
super._this_object());
}

public SampleCorba _this(org.omg.CORBA.ORB orb)
{
return SampleCorbaHelper.narrow(
super._this_object(orb));
}


} // class SampleCorbaPOA
} // class _SampleCorbaPOA
@@ -1,11 +1,11 @@
/**
*
* 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
* 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
*
@@ -18,12 +18,22 @@
package test.rmi;

public class SampleCorba_impl extends SampleCorbaPOA {
private int i;
public int i() {
return i;
}
private int i;
private String s;

public void i(int newI) {
this.i = newI;
}
public int i() {
return i;
}

public void i(int newI) {
this.i = newI;
}

public String s() {
return s;
}

public void s(String newS) {
s = newS;
}
}

0 comments on commit dbd5c4c

Please sign in to comment.