Author: delafran Date: Mon Mar 28 12:37:40 2005 New Revision: 159303 URL: http://svn.apache.org/viewcvs?view=rev&rev=159303 Log: - Removed openejb dependencies. - Changed support for Field marshalling
Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Bits.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GetField.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PutField.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/SimpleIDL.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/UrlScheme.java Removed: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ListenerInfo.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/NameServiceOperations_Skeleton.java Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrOutputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GiopMessage.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectInputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectOutputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRef.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/RemoteInterface.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/SimpleObjectInputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/SimpleObjectOutputStream.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/StringSeqHelper.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/StringSeqHolder.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/TypeCode.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ValueType.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/ClientNamingContext.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/Connection.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/UrlInfo.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/compiler/SkelCompiler.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/server/MessageHandler.java geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/server/RmiIiopServerGBean.java Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Any.java Mon Mar 28 12:37:40 2005 @@ -37,7 +37,7 @@ { if (_type.kind().value() != tk.value()) { - throw new org.omg.CORBA.BAD_TYPECODE("com.sybase.CORBA.Any.extract_" + throw new org.omg.CORBA.BAD_TYPECODE("org.apache.geronimo.interop.rmi.iiop.Any.extract_" + what + ": type = " + _type); } } @@ -130,7 +130,7 @@ if (_data == null) { throw new org.omg.CORBA.BAD_OPERATION( - "com.sybase.CORBA.Any.create_input_stream"); + "org.apache.geronimo.interop.rmi.Any.create_input_stream"); } return CdrInputStream.getInstance(); } @@ -532,10 +532,6 @@ { throw new org.omg.CORBA.NO_IMPLEMENT(); } - - // ----------------------------------------------------------------------- - // Sybase-internal constructors and methods - // ----------------------------------------------------------------------- /** * * Construct an Any from a TypeCode and a String value Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Bits.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Bits.java?view=auto&rev=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Bits.java (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/Bits.java Mon Mar 28 12:37:40 2005 @@ -0,0 +1,153 @@ +/** + * + * Copyright 2004-2005 The Apache Software Foundation + * + * 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. + */ +package org.apache.geronimo.interop.rmi.iiop; + +/** + * Utility methods for packing/unpacking primitive values in/out of byte arrays + * using big-endian byte ordering. + */ +class Bits +{ + /* + * Methods for unpacking primitive values from byte arrays starting at + * given offsets. + */ + + static boolean getBoolean(byte[] b, int off) + { + return b[off] != 0; + } + + static char getChar(byte[] b, int off) + { + return (char) (((b[off + 1] & 0xFF) << 0) + + ((b[off + 0] & 0xFF) << 8)); + } + + static short getShort(byte[] b, int off) + { + return (short) (((b[off + 1] & 0xFF) << 0) + + ((b[off + 0] & 0xFF) << 8)); + } + + static int getInt(byte[] b, int off) + { + return ((b[off + 3] & 0xFF) << 0) + + ((b[off + 2] & 0xFF) << 8) + + ((b[off + 1] & 0xFF) << 16) + + ((b[off + 0] & 0xFF) << 24); + } + + static float getFloat(byte[] b, int off) + { + int i = ((b[off + 3] & 0xFF) << 0) + + ((b[off + 2] & 0xFF) << 8) + + ((b[off + 1] & 0xFF) << 16) + + ((b[off + 0] & 0xFF) << 24); + return Float.intBitsToFloat(i); + } + + static long getLong(byte[] b, int off) + { + return ((b[off + 7] & 0xFFL) << 0) + + ((b[off + 6] & 0xFFL) << 8) + + ((b[off + 5] & 0xFFL) << 16) + + ((b[off + 4] & 0xFFL) << 24) + + ((b[off + 3] & 0xFFL) << 32) + + ((b[off + 2] & 0xFFL) << 40) + + ((b[off + 1] & 0xFFL) << 48) + + ((b[off + 0] & 0xFFL) << 56); + } + + static double getDouble(byte[] b, int off) + { + long j = ((b[off + 7] & 0xFFL) << 0) + + ((b[off + 6] & 0xFFL) << 8) + + ((b[off + 5] & 0xFFL) << 16) + + ((b[off + 4] & 0xFFL) << 24) + + ((b[off + 3] & 0xFFL) << 32) + + ((b[off + 2] & 0xFFL) << 40) + + ((b[off + 1] & 0xFFL) << 48) + + ((b[off + 0] & 0xFFL) << 56); + return Double.longBitsToDouble(j); + } + + /* + * Methods for packing primitive values into byte arrays starting at given + * offsets. + */ + + static void putBoolean(byte[] b, int off, boolean val) + { + b[off] = (byte) (val ? 1 : 0); + } + + static void putChar(byte[] b, int off, char val) + { + b[off + 1] = (byte) (val >>> 0); + b[off + 0] = (byte) (val >>> 8); + } + + static void putShort(byte[] b, int off, short val) + { + b[off + 1] = (byte) (val >>> 0); + b[off + 0] = (byte) (val >>> 8); + } + + static void putInt(byte[] b, int off, int val) + { + b[off + 3] = (byte) (val >>> 0); + b[off + 2] = (byte) (val >>> 8); + b[off + 1] = (byte) (val >>> 16); + b[off + 0] = (byte) (val >>> 24); + } + + static void putFloat(byte[] b, int off, float val) + { + int i = Float.floatToIntBits(val); + b[off + 3] = (byte) (i >>> 0); + b[off + 2] = (byte) (i >>> 8); + b[off + 1] = (byte) (i >>> 16); + b[off + 0] = (byte) (i >>> 24); + } + + static void putLong(byte[] b, int off, long val) + { + b[off + 7] = (byte) (val >>> 0); + b[off + 6] = (byte) (val >>> 8); + b[off + 5] = (byte) (val >>> 16); + b[off + 4] = (byte) (val >>> 24); + b[off + 3] = (byte) (val >>> 32); + b[off + 2] = (byte) (val >>> 40); + b[off + 1] = (byte) (val >>> 48); + b[off + 0] = (byte) (val >>> 56); + } + + static void putDouble(byte[] b, int off, double val) + { + long j = Double.doubleToLongBits(val); + b[off + 7] = (byte) (j >>> 0); + b[off + 6] = (byte) (j >>> 8); + b[off + 5] = (byte) (j >>> 16); + b[off + 4] = (byte) (j >>> 24); + b[off + 3] = (byte) (j >>> 32); + b[off + 2] = (byte) (j >>> 40); + b[off + 1] = (byte) (j >>> 48); + b[off + 0] = (byte) (j >>> 56); + } +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrInputStream.java Mon Mar 28 12:37:40 2005 @@ -23,32 +23,34 @@ import org.apache.geronimo.interop.util.*; import org.apache.geronimo.interop.IOP.*; import org.apache.geronimo.interop.GIOP.*; +import org.apache.geronimo.interop.SystemException; import org.omg.CORBA.TCKind; +import java.io.*; +import java.util.zip.*; /** ** CORBA 2.3 / GIOP 1.2 CDR InputStream. **/ public class CdrInputStream extends org.omg.CORBA_2_3.portable.InputStream { - //public static final Component component = new Component(CdrInputStream.class); public static CdrInputStream getInstance() { - CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance(); + CdrInputStream input = new CdrInputStream(); input.init(new byte[64], 0, DEFAULT_BUFFER_LENGTH, false); return input; } public static CdrInputStream getInstance(byte[] buffer) { - CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance(); + CdrInputStream input = new CdrInputStream(); input.init(buffer, 0, buffer.length, false); return input; } public static CdrInputStream getInstance(byte[] buffer, int offset, int length, boolean little) { - CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance(); + CdrInputStream input = new CdrInputStream(); input.init(buffer, offset, length, little); return input; } @@ -60,7 +62,7 @@ public static CdrInputStream getPooledInstance() { - CdrInputStream input = null; // (CdrInputStream)_pool.get(); + CdrInputStream input = null; if (input == null) { input = getInstance(); @@ -76,20 +78,22 @@ private static final int MAXIMUM_POOLED_BUFFER_LENGTH = 1024; - private static boolean RMI_TRACE = true; //SystemProperties.rmiTrace(); + private static boolean RMI_TRACE = true; private static final byte[] EMPTY_BYTE_ARRAY = {}; - //private static ThreadLocalInstancePool _pool = new ThreadLocalInstancePool(CdrInputStream.class.getName()); - private GiopMessage _giopMessage; + private boolean _moreFragments; + private ClientNamingContext _namingContext; private boolean _unaligned; private byte[] _pooledBuffer; + private boolean _gzip; + // ----------------------------------------------------------------------- // package-private data // ----------------------------------------------------------------------- @@ -117,7 +121,6 @@ public void recycle() { reset(); - //_pool.put(this); } public void reset() @@ -167,6 +170,11 @@ return message.giopVersion; } + public void setGiopVersion(int giopVersion) + { + // TODO!!! + } + public void setLength(int length) { if (_buffer.length < length) @@ -251,6 +259,11 @@ public GiopMessage receive_message(java.io.InputStream input, String url) { + return receive_message(input, url, true); + } + + public GiopMessage receive_message(java.io.InputStream input, String url, boolean readFragments) + { GiopMessage message = _giopMessage; if (message == null) { @@ -266,7 +279,28 @@ int m4 = read_octet(); if (m1 != 'G' || m2 != 'I' || m3 != 'O' || m4 != 'P') { - throw new BadMagicException(m1 + "," + m2 + "," + m3 + "," + m4); + if (m1 == 'G' && m2 == 'Z' && m3 == 'I' && m4 == 'P') + { + _gzip = true; + } + else if ((m1 == 'P' || m1 == 'p') && (m2 == 'O' || m2 == 'o') && (m3 == 'S' || m3 == 's') && + (m4 == 'T' || m4 == 't')) + { + return receive_http_post_message(input, url); + } + else if( (m1 == 'G' || m1 == 'g') && (m2 == 'E' || m2 == 'e') && (m3 == 'T' || m3 == 't') && + m4 == ' ') + { + return receive_http_get_message(input, url); + } + else + { + throw new BadMagicException(m1 + "," + m2 + "," + m3 + "," + m4); + } + } + else + { + _gzip = false; } int v1 = read_octet(); int v2 = read_octet(); @@ -278,14 +312,14 @@ message.giopVersion = giopVersion = v2; int flags = read_octet(); _little = (flags & 1) != 0; - boolean fragmented = (flags & 2) != 0; + _moreFragments = (flags & 2) != 0; int messageType = message.type = read_octet(); int messageSize = message.size = read_ulong(); - if (fragmented && messageSize % 8 != 0) + _length = 12 + messageSize; + if (_moreFragments && _length % 8 != 0) { throw new org.omg.CORBA.MARSHAL("GIOP Fragment: bad message size (not divisible by 8) = " + messageSize); } - _length = 12 + messageSize; if (messageSize > 0 && input != null) { if (_buffer.length < _length) @@ -303,13 +337,19 @@ System.arraycopy(_buffer, 0, data, 0, _length); RmiTrace.receive(url, data); } + if (_moreFragments && readFragments) + { + read_fragments(input, url); + } switch (messageType) { - case MsgType_1_1._Request: + case MsgType_1_1._Fragment: + break; + case MsgType_1_1._Request: switch (giopVersion) { - case GiopVersion.VERSION_1_0: - { + case GiopVersion.VERSION_1_0: + { RequestHeader_1_0 req10 = RequestHeader_1_0Helper.read(this); RequestHeader_1_2 req12 = new RequestHeader_1_2(); req12.service_context = req10.service_context; @@ -319,9 +359,9 @@ (req12.target = new TargetAddress()).object_key(req10.object_key); message.request = req12; } - break; - case GiopVersion.VERSION_1_1: - { + break; + case GiopVersion.VERSION_1_1: + { RequestHeader_1_1 req11 = RequestHeader_1_1Helper.read(this); RequestHeader_1_2 req12 = new RequestHeader_1_2(); req12.service_context = req11.service_context; @@ -331,53 +371,287 @@ (req12.target = new TargetAddress()).object_key(req11.object_key); message.request = req12; } - break; - case GiopVersion.VERSION_1_2: - message.request = RequestHeader_1_2Helper.read(this); - if (_length > _offset) + break; + case GiopVersion.VERSION_1_2: + message.request = RequestHeader_1_2Helper.read(this); + if (_length > _offset) + { + read_align(8, 0); // parameters are 8-byte aligned (if present) + } + break; + } + if (_gzip) { - read_align(8, 0); // parameters are 8-byte aligned (if present) + unzip(); } break; - } - break; - case MsgType_1_1._Reply: - message.reply = ReplyHeader_1_2Helper.read(this); - if (giopVersion >= GiopVersion.VERSION_1_2) - { - if (_length > _offset) + case MsgType_1_1._Reply: + message.reply = ReplyHeader_1_2Helper.read(this); + if (giopVersion >= GiopVersion.VERSION_1_2) { - read_align(8, 0); // results are 8-byte aligned (if present) + if (_length > _offset) + { + read_align(8, 0); // results are 8-byte aligned (if present) + } } - } - break; - case MsgType_1_1._LocateRequest: + if (_gzip) + { + unzip(); + } + break; + case MsgType_1_1._LocateRequest: switch (giopVersion) { - case GiopVersion.VERSION_1_0: - case GiopVersion.VERSION_1_1: - { + case GiopVersion.VERSION_1_0: + case GiopVersion.VERSION_1_1: + { LocateRequestHeader_1_0 req10 = LocateRequestHeader_1_0Helper.read(this); LocateRequestHeader_1_2 req12 = new LocateRequestHeader_1_2(); req12.request_id = req10.request_id; (req12.target = new TargetAddress()).object_key(req10.object_key); message.locateRequest = req12; } - break; - default: - message.locateRequest = LocateRequestHeader_1_2Helper.read(this); + break; + default: + message.locateRequest = LocateRequestHeader_1_2Helper.read(this); } - break; - case MsgType_1_1._LocateReply: - // We never send LocateRequest, so this is unexpected. - throw new org.omg.CORBA.MARSHAL("GIOP LocateReply: unexpected"); - // TODO: CloseConnection messages etc... - default: - throw new org.omg.CORBA.NO_IMPLEMENT("TODO: message type = " + messageType); + break; + case MsgType_1_1._LocateReply: + // We never send LocateRequest, so this is unexpected. + throw new org.omg.CORBA.MARSHAL("GIOP LocateReply: unexpected"); + // TODO: CloseConnection messages etc... + default: + throw new org.omg.CORBA.NO_IMPLEMENT("TODO: message type = " + messageType); } return message; } + private GiopMessage receive_http_post_message(java.io.InputStream input, String url) + { + int ver = http_read_hiop_version(input); + + //skip headers and read content length + boolean cLenRead = false; + int clen = 0, count; + + while( (count = http_read_line(input, 0)) != 0) + { + if( (_buffer[0] == 'c' || _buffer[0] == 'C')) + { + String str = new String(_buffer, 0, count).toLowerCase(); + if(str.startsWith("content-length:")) + { + str = str.substring(15).trim(); + try + { + clen = java.lang.Integer.parseInt(str); + } + catch(Exception e) + { + throw new SystemException(e.toString()); + } + cLenRead = true; + } + } + } + + if(!cLenRead) + { + throw new SystemException("HTTP Post: Missing content-length"); + } + + java.io.InputStream msgInput = input; + if(ver == 1) + { + byte[] buffer = new byte[clen]; + read(input, buffer, 0, clen); + String data = new String(buffer, 8, buffer.length - 8); //skip MESSAGE= + byte[] giopdata = org.apache.geronimo.interop.util.Base16Binary.fromString(data); + ByteArrayInputStream bi = new ByteArrayInputStream(giopdata); + msgInput = bi; + } + _offset = 0; + GiopMessage gm = receive_message(msgInput, url, false); + gm.httpTunneling = true; + gm.hiopVersion = ver; + return gm; + } + + /** + * Format: Get /host/port/HIOP/1.0/hex-data + */ + protected GiopMessage receive_http_get_message(java.io.InputStream input, String url) + { + //We have already read first 12 bytes ( = sizeof(GIOP header) ) + + int count = http_read_line(input, 12); + String str = new String(_buffer, 0, count); + int index = str.indexOf("/HIOP/1.0/"); + if(index == -1) + { + throw new SystemException("HTTP Tunnelling: HIOP version error"); + } + + index += 10; + if( index >= count) + { + throw new SystemException("HTTP Tunneling: GET message error"); + } + + byte[] giopdata = org.apache.geronimo.interop.util.Base16Binary.fromString(str.substring(index)); + ByteArrayInputStream bi = new ByteArrayInputStream(giopdata); + + GiopMessage gm = receive_message(bi, url, false); + gm.httpTunneling = true; + gm.hiopVersion = 1; + return gm; + } + + /** + * Note that we consider that the client always uses HIOP/2.0. Hence, the + * iiop data is binary stream instead of base64 hex string. + */ + public GiopMessage receive_http_response(java.io.InputStream input, String url) + { + //read status: HTTP/1.1 200 OK + int count = http_read_line(input, 0); + String status = new String(_buffer, 0, count).toLowerCase(); + if(!status.startsWith("http/1.1") && !status.startsWith("http/1.0")) + { + throw new SystemException("HTTP response error"); + } + + if(status.indexOf("200") == -1 || status.indexOf("ok") == -1) + { + throw new SystemException("HTTP response error"); + } + + //skip headers and read content length + boolean cLenRead = false; + int clen = 0; + + while( (count = http_read_line(input, 0)) != 0) + { + if( (_buffer[0] == 'c' || _buffer[0] == 'C')) + { + String str = new String(_buffer, 0, count).toLowerCase(); + if(str.startsWith("content-length:")) + { + str = str.substring(15).trim(); + try + { + clen = java.lang.Integer.parseInt(str); + } + catch(Exception e) + { + throw new SystemException(e.toString()); + } + cLenRead = true; + } + } + } + + if(!cLenRead) + { + throw new SystemException("HTTP Post: Missing Content-Length"); + } + + //now read the iiop stream + + GiopMessage gm = receive_message(input, url, false); + gm.httpTunneling = true; + gm.hiopVersion = 2; + return gm; + } + + /** + * Return the HIOP version (1 or 2) + */ + private int http_read_hiop_version(java.io.InputStream input) + throws java.lang.NumberFormatException + { + //We have already read first 12 bytes ( = sizeof(GIOP header) ) + int count = http_read_line(input, 12); + + String str = new String(_buffer, 0, count); + int index, ver; + + if((index = str.indexOf("HIOP")) == -1) + { + throw new SystemException("HTTP: Post Message - HIOP Version not specified"); + } + else + { + //HIOP/1.0 or HIOP/2.0 + + if((index + 8) > count) + { + throw new SystemException("HTTP: Post Message - Incorrect HIOP header"); + } + + index += 5; + + if(_buffer[index + 1] != '.' && _buffer[index + 2] != '0') + { + throw new SystemException("HTTP: Incorrect HIOP version"); + } + + if(_buffer[index] == '1') + { + ver = 1; + } + else if (_buffer[index] == '2') + { + ver = 2; + } + else + { + throw new SystemException("HTTP: Incorrect HIOP version"); + } + } + return ver; + } + + /** + * Read the line from input stream terminated by CRLF. + * CRLF is not part of the data in the buffer. Return the number of bytes in the line + */ + + private int http_read_line(java.io.InputStream input, int offset) //offset in _buffer + { + try + { + int b; + while ( (b = input.read()) != '\r' ) + { + if(b == -1) //EOF has been reached + { + throw new SystemException("HTTP: read error"); + } + if(_buffer.length <= offset) + { + byte[] newbuffer = new byte[offset*2]; + System.arraycopy(_buffer, 0, newbuffer, 0, _buffer.length); + _buffer = newbuffer; + + } + _buffer[offset++] = (byte)b; + } + + // go past the \n character + b = input.read(); + if ( b != '\n' ) + { + throw new SystemException("HTTP CRLF combination missing"); + } + } + catch (java.io.IOException ex) + { + throw new SystemException(ex.toString()); + } + return offset; + } + // ----------------------------------------------------------------------- // public methods from org.omg.CORBA.portable.InputStream // ----------------------------------------------------------------------- @@ -411,6 +685,7 @@ read_align(1, 3); int size = (int)read_wchar_size(); int value = (char)read_ushort_no_align_big_endian(); + _offset += 2; boolean littleEndian = ((value & 0xffff) == 0xFFFE); boolean bigEndian = ((value & 0xffff) == 0xFEFF); boolean bomPresent = (littleEndian || bigEndian); @@ -422,12 +697,16 @@ if (littleEndian) { read_align(1, 2); - return (char)read_ushort_no_align_little_endian(); + char ch = (char)read_ushort_no_align_little_endian(); + _offset += 2; + return ch; } else if (bigEndian) { read_align(1, 2); - return (char)read_ushort_no_align_big_endian(); + char ch = (char)read_ushort_no_align_big_endian(); + _offset += 2; + return ch; } else { @@ -703,16 +982,6 @@ { interfaceName = "org.apache.geronimo.interop" + interfaceName.substring(7); } - //if(interfaceName.equals("SessionManager.Factory")) - //{ - // ObjectRef homeRef = - // StubFactory.getInstance().getStub(org.apache.geronimo.interop.rmi.iiop.J40Home.class); - // homeRef.$setIOR(ior); - // homeRef.$setNamingContext(_namingContext); - // org.apache.geronimo.interop.rmi.iiop.J40Home home = (org.apache.geronimo.interop.rmi.iiop.J40Home)homeRef; - // org.apache.geronimo.interop.rmi.iiop.J40MetaData md = home.getJ40MetaData(); - // interfaceName = md.ejbHomeInterfaceClass; - //} Class remoteInterface = ThreadContext.loadClass(interfaceName); stub = StubFactory.getInstance().getStub(remoteInterface); } @@ -898,8 +1167,7 @@ value.read_value(os.create_input_stream(), tc); return value; } - - // Sybase-internal + public void read_Any(org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode tc) { try @@ -1037,31 +1305,31 @@ } public org.omg.CORBA.Any read_any() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_any: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_any: NOT IMPLMENTED"); } public org.omg.CORBA.Principal read_Principal() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_Principal: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_Principal: NOT IMPLMENTED"); } public int read() throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT("read: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read: NOT IMPLMENTED"); } public java.math.BigDecimal read_fixed() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_fixed: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_fixed: NOT IMPLMENTED"); } public org.omg.CORBA.Context read_Context() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_Context: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_Context: NOT IMPLMENTED"); } public org.omg.CORBA.Object read_Object(Class _class) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_Object: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_Object: NOT IMPLMENTED"); } public org.omg.CORBA.ORB orb() { - throw new org.omg.CORBA.NO_IMPLEMENT("orb: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("orb: NOT IMPLMENTED"); } @@ -1070,31 +1338,31 @@ // ----------------------------------------------------------------------- public java.io.Serializable read_value() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT IMPLMENTED"); } public java.io.Serializable read_value(Class _class) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT IMPLMENTED"); } public java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper helper) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT IMPLMENTED"); } public java.io.Serializable read_value(java.lang.String id) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT IMPLMENTED"); } public java.io.Serializable read_value(java.io.Serializable todo) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_value: NOT IMPLMENTED"); } public java.lang.Object read_abstract_interface() { - throw new org.omg.CORBA.NO_IMPLEMENT("read_abstract_interface: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_abstract_interface: NOT IMPLMENTED"); } public java.lang.Object read_abstract_interface(Class _class) { - throw new org.omg.CORBA.NO_IMPLEMENT("read_abstract_interface: NOT YET IMPLMENTED"); + throw new org.omg.CORBA.NO_IMPLEMENT("read_abstract_interface: NOT IMPLMENTED"); } @@ -1152,9 +1420,47 @@ } } + protected void read_fragments(java.io.InputStream input, String url) + { + int messageType = _giopMessage.type; + int length = _giopMessage.size + 12; + byte[] fullBuffer = ArrayUtil.getBytes(_buffer, 0, length); + do + { + _offset = 0; + receive_message(input, url, false); + if (_giopMessage.type != MsgType_1_1._Fragment) + { + throw new org.omg.CORBA.MARSHAL("GIOP Fragment: bad fragment type = " + _giopMessage.type); + } + int addSize = _giopMessage.size - 4; //skip fragment structure + int needLength = length + addSize; + if (needLength > fullBuffer.length) + { + byte[] newBuffer = new byte[needLength * 2]; + System.arraycopy(fullBuffer, 0, newBuffer, 0, length); + fullBuffer = newBuffer; + } + System.arraycopy(_buffer, 16, fullBuffer, length, addSize); + length += addSize; + } + while (_moreFragments); + _giopMessage.type = messageType; + _giopMessage.size = length - 12; + _buffer = fullBuffer; + _offset = 12; + _length = length; + } + public boolean begin() { int length = read_ulong(); // encapsulation length + int len2 = read_ulong(); // another chunk length? + if( len2 != length - 4) + { + _offset -= 4; + } + boolean saveLittle = _little; _little = read_boolean(); return saveLittle; @@ -1211,4 +1517,33 @@ } } + protected void unzip() + { + try + { + int n = _length - _offset; + ByteArrayInputStream bi = new ByteArrayInputStream(_buffer, _offset, n); + ByteArrayOutputStream bo = new ByteArrayOutputStream(n * 4); + GZIPInputStream gi = new GZIPInputStream(bi); + int b; + while ((b = gi.read()) != -1) + { + bo.write(b); + } + byte[] bytes = bo.toByteArray(); + int newLength = _offset + bytes.length; + if (newLength > _buffer.length) + { + byte[] newBuffer = new byte[newLength]; + System.arraycopy(_buffer, 0, newBuffer, 0, _offset); + _buffer = newBuffer; + } + System.arraycopy(bytes, 0, _buffer, _offset, bytes.length); + _length = newLength; + } + catch (Exception ex) + { + throw new org.omg.CORBA.MARSHAL(ExceptionUtil.getStackTrace(ex)); + } + } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrOutputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrOutputStream.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrOutputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CdrOutputStream.java Mon Mar 28 12:37:40 2005 @@ -21,32 +21,34 @@ import org.apache.geronimo.interop.util.*; import org.apache.geronimo.interop.IOP.*; import org.apache.geronimo.interop.GIOP.*; +import org.apache.geronimo.interop.SystemException; import org.omg.CORBA.TCKind; +import java.io.*; /** ** CORBA 2.3 / GIOP 1.2 CDR OutputStream. **/ public class CdrOutputStream extends org.omg.CORBA_2_3.portable.OutputStream { - //public static final Component component = new Component(CdrOutputStream.class); + private final String CRLF = "\r\n"; public static CdrOutputStream getInstance() { - CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance(); + CdrOutputStream output = new CdrOutputStream(); output.init(new byte[DEFAULT_BUFFER_LENGTH], 0); return output; } public static CdrOutputStream getInstance(byte[] buffer) { - CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance(); + CdrOutputStream output = new CdrOutputStream(); output.init(buffer, 0); return output; } public static CdrOutputStream getInstance(byte[] buffer, int offset) { - CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance(); + CdrOutputStream output = new CdrOutputStream(); output.init(buffer, offset); return output; } @@ -60,7 +62,7 @@ public static CdrOutputStream getPooledInstance() { - CdrOutputStream output = null; // (CdrOutputStream)_pool.get(); + CdrOutputStream output = null; if (output == null) { output = getInstance(); @@ -76,7 +78,7 @@ private static final int MAXIMUM_POOLED_BUFFER_LENGTH = 1024; - private static final boolean RMI_TRACE = true; //SystemProperties.rmiTrace(); + private static final boolean RMI_TRACE = true; private static IOR NULL_IOR = new IOR("", new TaggedProfile[0]); @@ -88,8 +90,6 @@ private static Version GIOP_VERSION_1_1 = new Version((byte)1, (byte)1); private static Version GIOP_VERSION_1_2 = new Version((byte)1, (byte)2); - //private static ThreadLocalInstancePool _pool = new ThreadLocalInstancePool(CdrOutputStream.class.getName()); - private int _giopVersion = GiopVersion.VERSION_1_2; private boolean _unaligned; @@ -120,7 +120,6 @@ public void recycle() { reset(); - //_pool.put(this); } public void reset() @@ -409,6 +408,87 @@ } } + public void send_http_response(java.io.OutputStream output, String url) + { + StringBuffer respHeader = new StringBuffer(256); + + respHeader.append("HTTP/1.1 200 OK\r\n"); + respHeader.append("Content-Length: "); + respHeader.append(java.lang.Integer.toString(_offset)); + respHeader.append(CRLF + CRLF); + + byte[] header = null; + try + { + String h = respHeader.toString(); + header = h.getBytes("ASCII"); + } + catch(Exception e) + { + throw new SystemException(org.apache.geronimo.interop.util.ExceptionUtil.causedBy(e)); + } + + byte[] data = new byte[header.length + _offset]; + System.arraycopy(header, 0, data, 0, header.length); + System.arraycopy(_buffer, 0, data, header.length, _offset); + + if (RMI_TRACE) + { + RmiTrace.send(url, data); + } + try + { + output.write(data, 0, data.length); + output.flush(); + } + catch (java.io.IOException ex) + { + throw new org.omg.CORBA.COMM_FAILURE(ex.toString()); + } + } + + /** + * We support only POST message + */ + public void send_http_request(java.io.OutputStream output, String url, String httpHeaders) + { + StringBuffer hdr = new StringBuffer(512); + hdr.append("POST /host/port/HIOP/2.0 HTTP/1.1\r\n"); + hdr.append("Content-Length: "); + hdr.append(java.lang.Integer.toString(_offset)); + hdr.append(CRLF); + hdr.append(httpHeaders); + hdr.append(CRLF); + + byte[] header = null; + try + { + header = hdr.toString().getBytes("ASCII"); + } + catch(Exception e) + { + throw new SystemException(org.apache.geronimo.interop.util.ExceptionUtil.causedBy(e)); + } + + byte[] data = new byte[header.length + _offset]; + System.arraycopy(header, 0, data, 0, header.length); + System.arraycopy(_buffer, 0, data, header.length, _offset); + + if (RMI_TRACE) + { + RmiTrace.send(url, data); + } + try + { + output.write(data, 0, data.length); + output.flush(); + } + catch (java.io.IOException ex) + { + throw new org.omg.CORBA.COMM_FAILURE(ex.toString()); + } + } + public void send_message(java.io.OutputStream output, String url) { if (RMI_TRACE) @@ -685,7 +765,6 @@ write_Any(value.create_input_stream(), tc); } - // Sybase-internal public void write_Any(org.omg.CORBA.portable.InputStream is, org.omg.CORBA.TypeCode tc) { try @@ -820,27 +899,27 @@ } public void write_any(org.omg.CORBA.Any value) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_any: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_any: NOT IMPLMENTED"); } public void write_Principal(org.omg.CORBA.Principal value) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_Principal: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_Principal: NOT IMPLMENTED"); } public void write(int value) throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT("write: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write: NOT IMPLMENTED"); } public void write_fixed(java.math.BigDecimal value) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_fixed: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_fixed: NOT IMPLMENTED"); } public void write_Context(org.omg.CORBA.Context context, org.omg.CORBA.ContextList list) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_Context: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_Context: NOT IMPLMENTED"); } public org.omg.CORBA.ORB orb() { - throw new org.omg.CORBA.NO_IMPLEMENT("orb: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("orb: NOT IMPLMENTED"); } @@ -849,23 +928,23 @@ // ----------------------------------------------------------------------- public void write_value(java.io.Serializable value) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED"); } public void write_value(java.io.Serializable value, Class _class) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED"); } public void write_value(java.io.Serializable value, String id) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED"); } public void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper helper) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_value: NOT IMPLMENTED"); } public void write_abstract_interface(java.lang.Object value) { - throw new org.omg.CORBA.NO_IMPLEMENT("write_abstract_interface: NOT IMPLMENTED YET"); + throw new org.omg.CORBA.NO_IMPLEMENT("write_abstract_interface: NOT IMPLMENTED"); } Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GetField.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GetField.java?view=auto&rev=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GetField.java (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GetField.java Mon Mar 28 12:37:40 2005 @@ -0,0 +1,430 @@ +/** + * + * Copyright 2004-2005 The Apache Software Foundation + * + * 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. + */ +package org.apache.geronimo.interop.rmi.iiop; + +import java.io.*; +import java.util.*; +import java.lang.reflect.*; + +/** + ** An implementation of java.io.ObjectInputStream.GetField + ** Provide access to the persistent fields read from the input stream. + **/ + +public class GetField extends java.io.ObjectInputStream.GetField +{ + /** class descriptor describing serializable fields */ + private final ObjectStreamClass desc; + /** primitive field values */ + private final byte[] primVals; + /** object field values */ + private final Object[] objVals; + /** object field value handles */ + private final int[] objHandles; + + private int primDataSize = 0; + private int numObjFields = 0; + private ObjectStreamField[] _fields = null; + + private static Method setOffsetMethod; + + static + { + try + { + Class osFieldClass = java.io.ObjectStreamField.class; + Class[] params = new Class[1]; + params[0] = int.class; + setOffsetMethod = osFieldClass.getDeclaredMethod("setOffset", params); + setOffsetMethod.setAccessible(true); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + /** + * Creates GetFieldImpl object for reading fields defined in given + * class descriptor. + */ + GetField(ObjectStreamClass desc) + { + this.desc = desc; + computeOffsets(); + primVals = new byte[primDataSize]; + objVals = new Object[numObjFields]; + objHandles = new int[objVals.length]; + } + + /** + * Get the ObjectStreamClass that describes the fields in the stream. + * + * @return the descriptor class that describes the serializable fields + */ + public ObjectStreamClass getObjectStreamClass() + { + return desc; + } + + /** + * Return true if the named field is defaulted and has no value in this + * stream. + * + * @param name the name of the field + * @return true, if and only if the named field is defaulted + * @throws IOException if there are I/O errors while reading from + * the underlying <code>InputStream</code> + * @throws IllegalArgumentException if <code>name</code> does not + * correspond to a serializable field + */ + public boolean defaulted(String name) throws IOException + { + int fieldOffset = getFieldOffset(name, null); + boolean result; + if(fieldOffset < 0) + { + result = false; + } + else + { + result = true; + } + return result; + } + + /** + * Get the value of the named boolean field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>boolean</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public boolean get(String name, boolean val) throws IOException + { + int off = getFieldOffset(name, Boolean.TYPE); + return (off >= 0) ? Bits.getBoolean(primVals, off) : val; + } + + /** + * Get the value of the named byte field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>byte</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public byte get(String name, byte val) throws IOException + { + int off = getFieldOffset(name, Byte.TYPE); + return (off >= 0) ? primVals[off] : val; + } + + /** + * Get the value of the named char field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>char</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public char get(String name, char val) throws IOException + { + int off = getFieldOffset(name, Character.TYPE); + return (off >= 0) ? Bits.getChar(primVals, off) : val; + } + + /** + * Get the value of the named short field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>short</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public short get(String name, short val) throws IOException + { + int off = getFieldOffset(name, Short.TYPE); + return (off >= 0) ? Bits.getShort(primVals, off) : val; + } + + /** + * Get the value of the named int field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>int</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public int get(String name, int val) throws IOException + { + int off = getFieldOffset(name, Integer.TYPE); + return (off >= 0) ? Bits.getInt(primVals, off) : val; + } + + /** + * Get the value of the named long field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>long</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public long get(String name, long val) throws IOException + { + int off = getFieldOffset(name, Long.TYPE); + return (off >= 0) ? Bits.getLong(primVals, off) : val; + } + + /** + * Get the value of the named float field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>float</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public float get(String name, float val) throws IOException + { + int off = getFieldOffset(name, Float.TYPE); + return (off >= 0) ? Bits.getFloat(primVals, off) : val; + } + + /** + * Get the value of the named double field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>double</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public double get(String name, double val) throws IOException + { + int off = getFieldOffset(name, Double.TYPE); + return (off >= 0) ? Bits.getDouble(primVals, off) : val; + } + + /** + * Get the value of the named Object field from the persistent field. + * + * @param name the name of the field + * @param val the default value to use if <code>name</code> does not + * have a value + * @return the value of the named <code>Object</code> field + * @throws IOException if there are I/O errors while reading from the + * underlying <code>InputStream</code> + * @throws IllegalArgumentException if type of <code>name</code> is + * not serializable or if the field type is incorrect + */ + public Object get(String name, Object val) throws IOException + { + int off = getFieldOffset(name, Object.class); + if (off >= 0) + { + return objVals[off]; + } + else + { + return val; + } + } + + + /** + * Reads primitive and object field values from stream. + */ + void readFields(ObjectInputStream oi) throws IOException + { + org.apache.geronimo.interop.rmi.iiop.ObjectInputStream in = + (org.apache.geronimo.interop.rmi.iiop.ObjectInputStream)oi; + + in._cdrInput.read_align(4, 4); + + //Read in primitive values first + for(int i = 0; i < primVals.length; i++) + { + primVals[i] = in.readByte(); + } + + //Read in the object fields + java.io.ObjectStreamField[] fields = desc.getFields(); + int numPrimFields = fields.length - objVals.length; + for (int i = 0; i < objVals.length; i++) + { + objVals[i] = in.readObject(ValueType.getInstance(fields[numPrimFields + i].getType())); + } + } + + private int getFieldOffset(String name, Class type) + { + ObjectStreamField field = getField(name, type); + if (field == null) + { + throw new IllegalArgumentException("no such field: " + name + " of type: " + type.getName()); + } + return field.getOffset(); + } + + private ObjectStreamField getField(String name, Class type) + { + if(type == null) + { + //Return match by name + for(int i = 0; i < _fields.length; i++) + { + if(_fields[i].getName().equals(name)) + { + return _fields[i]; + } + } + return (ObjectStreamField)null; + } + else if(type == java.lang.Object.class) + { + //Return match for name, and any non-primitive type + for(int i = 0; i < _fields.length; i++) + { + if(_fields[i].getName().equals(name) && !_fields[i].getType().isPrimitive()) + { + return _fields[i]; + } + } + return (ObjectStreamField)null; + } + else + { + for(int i = 0; i < _fields.length; i++) + { + if(_fields[i].getName().equals(name) && _fields[i].getType().equals(type)) + { + return _fields[i]; + } + } + return (ObjectStreamField)null; + } + } + + private void computeOffsets() + { + try + { + computeFieldOffsets(); + } + catch(Exception e) + { + throw new RuntimeException(org.apache.geronimo.interop.util.ExceptionUtil.causedBy(e)); + } + } + + private void computeFieldOffsets() throws Exception + { + primDataSize = 0; + numObjFields = 0; + int firstObjIndex = -1; + java.io.ObjectStreamField[] fields = desc.getFields(); + _fields = new ObjectStreamField[fields.length]; + Object[] args = new Object[1]; + + for (int i = 0; i < fields.length; i++) + { + java.io.ObjectStreamField f = fields[i]; + _fields[i] = new ObjectStreamField(fields[i].getName(), fields[i].getType()); + ObjectStreamField _f = _fields[i]; + + switch (f.getTypeCode()) + { + case 'Z': + case 'B': + args[0] = new Integer(primDataSize++); + setOffsetMethod.invoke(_f, args); + break; + + case 'C': + case 'S': + args[0] = new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize += 2; + break; + + case 'I': + case 'F': + args[0] = new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize += 4; + break; + + case 'J': + case 'D': + args[0] = new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize += 8; + break; + + case '[': + case 'L': + args[0] = new Integer(numObjFields++); + setOffsetMethod.invoke(_f, args); + if (firstObjIndex == -1) + { + firstObjIndex = i; + } + break; + + default: + break; + } + } + if (firstObjIndex != -1 && firstObjIndex + numObjFields != fields.length) + { + //throw new InvalidClassException(name, "illegal field order"); + } + } +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GiopMessage.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GiopMessage.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GiopMessage.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/GiopMessage.java Mon Mar 28 12:37:40 2005 @@ -27,6 +27,8 @@ public RequestHeader_1_2 request; public LocateRequestHeader_1_2 locateRequest; public ReplyHeader_1_2 reply; + public boolean httpTunneling; + public int hiopVersion; //http tunneling version - 1 or 2 public String toString() { Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectInputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectInputStream.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectInputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectInputStream.java Mon Mar 28 12:37:40 2005 @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.NotActiveException; +import java.io.ObjectStreamClass; import java.util.HashMap; import java.util.ArrayList; import java.lang.reflect.Array; @@ -33,13 +34,12 @@ **/ public class ObjectInputStream extends java.io.ObjectInputStream { - //public static final Component component = new Component(ObjectInputStream.class); public static ObjectInputStream getInstance() { ObjectInputStream ois = null; try { - ois = new ObjectInputStream(); //getInstance(CdrInputStream.getInstance()); + ois = new ObjectInputStream(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. ois = null; @@ -49,14 +49,14 @@ public static ObjectInputStream getInstance(org.apache.geronimo.interop.rmi.iiop.CdrInputStream cdrInput) { - ObjectInputStream input = getInstance(); // (ObjectInputStream)component.getInstance(); + ObjectInputStream input = getInstance(); input.init(cdrInput); return input; } public static ObjectInputStream getPooledInstance() { - ObjectInputStream input = null; // (ObjectInputStream)_pool.get(); + ObjectInputStream input = null; if (input == null) { input = getInstance(); @@ -96,8 +96,6 @@ // private data // ----------------------------------------------------------------------- - //private static ThreadLocalInstancePool _pool = new ThreadLocalInstancePool(ObjectInputStream.class.getName()); - private int _blockLength = MAXIMUM_BLOCK_LENGTH; private int _endLevel = 0; @@ -135,7 +133,6 @@ public void recycle() { $reset(); - //_pool.put(this); } // public methods from java.io.ObjectInputStream @@ -182,7 +179,7 @@ public Object readObjectOverride() { - return readObject(ValueType.OBJECT_VALUE_TYPE, false); + return readObject(ValueType.OBJECT_VALUE_TYPE, true); } public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException @@ -191,6 +188,28 @@ readDeclaredFields(state.type, state.value); } + public java.io.ObjectInputStream.GetField readFields() + throws IOException, ClassNotFoundException + { + StreamState state = top(); + + Class currentClass = state.type.getTheClass(); + if(currentClass == null) + { + throw new IOException("readFields: class from ValueType is null"); + } + + java.io.ObjectStreamClass osc = ObjectStreamClass.lookup(currentClass); + if(osc == null) + { + throw new IOException("readFields: ObjectSteamClass is null"); + } + + org.apache.geronimo.interop.rmi.iiop.GetField gf = new org.apache.geronimo.interop.rmi.iiop.GetField(osc); + gf.readFields(this); + return gf; + } + // ----------------------------------------------------------------------- // public methods used by generated and package-internal code // ----------------------------------------------------------------------- @@ -228,6 +247,21 @@ { org.omg.CORBA.TypeCode tc = null; + if (calledByCustomSerialization) + { + boolean isObjectRef = _cdrInput.read_boolean(); + if (isObjectRef) + { + org.omg.CORBA.Object ref = _cdrInput.read_Object(); + endBlock(); + if (_blockLength == MAXIMUM_BLOCK_LENGTH) + { + startBlock(); + } + return ref; + } + } + int tag = _cdrInput.read_ulong(); int saveOffset = _cdrInput._offset - 4; Object value; @@ -253,23 +287,8 @@ _cdrInput._offset = saveOffset; } - if (calledByCustomSerialization) + if(calledByCustomSerialization) { - boolean isObjectRef = _cdrInput.read_boolean(); - if (isObjectRef) - { - org.omg.CORBA.Object ref = _cdrInput.read_Object(); - endBlock(); - if (_blockLength == MAXIMUM_BLOCK_LENGTH) - { - startBlock(); - } - return ref; - } - else - { - _cdrInput._offset = saveOffset; - } } else if (declaredType.isAnyOrObjectRefOrAbstractInterface) { @@ -321,12 +340,20 @@ } } - saveOffset = _cdrInput._offset; tag = _cdrInput.read_long(); + saveOffset = _cdrInput._offset - 4; + if (tag == ValueType.NULL_VALUE_TAG) { return null; } + + if( ((tag & 0x7F000000) == 0) && tag != ValueType.INDIRECTION_TAG ) //chunk size + { + tag = _cdrInput.read_long(); + saveOffset = _cdrInput._offset - 4; + } + if (tag == ValueType.INDIRECTION_TAG) { // Indirection to value already read (or cyclic value being read). @@ -490,6 +517,11 @@ { value = readObjectState(valueType.parent, value, false); } + if (valueType.hasWriteObject || requiresCustomSerialization) + { + byte format = _cdrInput.read_octet(); + boolean defaultWriteObjectCalled = _cdrInput.read_boolean(); + } if (valueType.hasReadObject) { push(new StreamState(valueType, value, _cdrInput._offset)); @@ -521,12 +553,7 @@ else */ { - if (valueType.hasWriteObject || requiresCustomSerialization) - { - byte format = _cdrInput.read_octet(); - boolean defaultWriteObjectCalled = _cdrInput.read_boolean(); - } - valueType.readObject(value, this); + valueType.readObject(value, this); } pop(); } @@ -575,7 +602,6 @@ { Object value = null; int primitive = arrayType.primitiveArray; - int n = _cdrInput.read_ulong(); if (primitive != 0) { value = arrayType.helper.read(this); @@ -583,6 +609,7 @@ } else { + int n = _cdrInput.read_ulong(); Object[] array; try { Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectOutputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectOutputStream.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectOutputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectOutputStream.java Mon Mar 28 12:37:40 2005 @@ -20,17 +20,17 @@ import org.apache.geronimo.interop.*; import org.apache.geronimo.interop.util.*; import java.io.*; +import java.lang.reflect.*; import java.util.*; public class ObjectOutputStream extends java.io.ObjectOutputStream { - //public static final Component component = new Component(ObjectOutputStream.class); public static ObjectOutputStream getInstance() { ObjectOutputStream oos = null; try { - oos = new ObjectOutputStream(); //getInstance(CdrOutputStream.getInstance()); + oos = new ObjectOutputStream(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. oos = null; @@ -40,14 +40,14 @@ public static ObjectOutputStream getInstance(CdrOutputStream cdrOutput) { - ObjectOutputStream output = getInstance(); // (ObjectOutputStream)component.getInstance(); + ObjectOutputStream output = getInstance(); output.init(cdrOutput); return output; } public static ObjectOutputStream getPooledInstance() { - ObjectOutputStream output = null; // (ObjectOutputStream)_pool.get(); + ObjectOutputStream output = null; if (output == null) { output = getInstance(); @@ -64,6 +64,7 @@ ValueType type; Object value; int offset; + org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream.PutField putField; StreamState(ValueType type, Object value, int offset) { @@ -91,8 +92,6 @@ private static boolean OBJECT_VALUE_TYPE_INIT = false; - //private static ThreadLocalInstancePool _pool = new ThreadLocalInstancePool(ObjectOutputStream.class.getName()); - private ArrayList _stack = null; private SimpleIdentityHashMap _indirection; @@ -140,7 +139,6 @@ public void recycle() { $reset(); - //_pool.put(this); } // ----------------------------------------------------------------------- @@ -189,7 +187,7 @@ public void writeObjectOverride(Object value) { - writeObject(OBJECT_VALUE_TYPE, value); + writeObject(OBJECT_VALUE_TYPE, value, true); } public void defaultWriteObject() throws IOException @@ -270,7 +268,7 @@ { if (actualType != null) { - if (! (declaredType.isAny && actualType.isObjectRef)) + if (!declaredType.isAny || calledFromCustomSerialization) { endBlock(); } @@ -283,12 +281,12 @@ _cdrOutput.write_boolean(actualType.isObjectRef); if(actualType.isObjectRef) { - _cdrOutput.write_Object((org.omg.CORBA.Object)value); + writeObjectRef(value); endBlock(); } else { - _cdrOutput.write_long(ValueType.NULL_VALUE_TAG); + _cdrOutput.write_long(ValueType.NULL_VALUE_TAG); } return; } @@ -299,7 +297,7 @@ } if (declaredType.isObjectRef) { - _cdrOutput.write_Object((org.omg.CORBA.Object)value); + writeObjectRef(value); } else { @@ -315,28 +313,23 @@ { org.omg.CORBA.TypeCode tc = actualType.tc; _cdrOutput.write_TypeCode(tc); + if (!actualType.isAny) + { + endBlock(); + } } else if (declaredType.isAbstractInterface || calledFromCustomSerialization) { _cdrOutput.write_boolean(actualType.isObjectRef); if (actualType.isObjectRef) { - _cdrOutput.write_Object((org.omg.CORBA.Object)value); + writeObjectRef(value); return; } } if (actualType.isObjectRef) { - if (value instanceof RemoteInterface) - { - ObjectRef objectRef = ((RemoteInterface)value).getObjectRef(); - //if (value instanceof AutomaticFailover) - //{ - // objectRef.$setAutomaticFailover(); - //} - value = objectRef; - } - _cdrOutput.write_Object((org.omg.CORBA.Object)value); + writeObjectRef(value); return; } Integer ref = _indirection == null ? null : (Integer)_indirection.get(value); @@ -362,6 +355,7 @@ _cdrOutput.write_long(ValueType.SINGLE_TYPE_VALUE_TAG); _isChunked = false; } + writeMetaString(actualType.id); startBlock(); switch (actualType.readWriteCase) @@ -383,7 +377,7 @@ writeObjectState(actualType, value); } endBlock(); - writeEndTag(); + writeEndTag(declaredType, actualType, calledFromCustomSerialization); _isChunked = saveIsChunked; } @@ -415,7 +409,7 @@ { writeObjectState(type.parent, value); } - if (type.hasWriteObject && type.hasReadObject) + if (type.hasWriteObject) { push(new StreamState(type, value, _cdrOutput._offset)); if (type.skipCustomFlags) @@ -563,7 +557,93 @@ } } - /* + protected void writeEndTag(ValueType declaredType, ValueType actualType, + boolean calledFromCustomSerialization) + { + if (_isChunked) + { + if (_endTagIndex == _cdrOutput._offset - 8) + { + _cdrOutput._offset -= 8; + } + _cdrOutput.write_long(_endLevel); + _endTagIndex = _cdrOutput._offset - 4; + if (_endLevel != -1) + { + if(declaredType.isAny && !actualType.isAny && !calledFromCustomSerialization) + { + startBlock(); + _endLevel++; + } + else + { + _cdrOutput.write_long(1); + } + } + else // _endLevel == -1 + { + _cdrOutput._offset -=4; + _cdrOutput.write_long(-1); + _isChunked = false; + } + _endLevel++; + } + } + + private void writeObjectRef(java.lang.Object value) + { + if(value instanceof org.apache.geronimo.interop.rmi.iiop.ObjectRef || value == null) + { + _cdrOutput.write_Object((org.omg.CORBA.Object)value); + } + else if (value instanceof RemoteInterface) + { + ObjectRef objectRef = ((RemoteInterface)value).getObjectRef(); + value = objectRef; + _cdrOutput.write_Object((org.omg.CORBA.Object)value); + } + else + { + writeForeignObjectRef(value); + } + } + + private void writeForeignObjectRef(java.lang.Object value) + { + if (value instanceof java.rmi.Remote) + { + try + { + value = (org.omg.CORBA.Object)javax.rmi.PortableRemoteObject.toStub((java.rmi.Remote)value); + } + catch (java.rmi.NoSuchObjectException ex) + { + throw new org.omg.CORBA.MARSHAL(ExceptionUtil.causedBy(ex)); + } + } + + if (value instanceof org.omg.CORBA.Object) + { + try + { + org.omg.CORBA.Object object = (org.omg.CORBA.Object)value; + org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[0], null); + orb.create_output_stream().write_Object(object); + String ior = orb.object_to_string(object); + org.apache.geronimo.interop.rmi.iiop.ObjectRef objectRef = org.apache.geronimo.interop.rmi.iiop.ObjectRef.$getObjectFromIOR(ior); + _cdrOutput.write_Object((org.omg.CORBA.Object)objectRef); + } + catch (Exception ex) + { + throw new org.omg.CORBA.MARSHAL(ExceptionUtil.causedBy(ex)); + } + } + else + { + throw new org.omg.CORBA.MARSHAL("writeObjectRef: " + value.getClass().getName()); + } + } + public java.io.ObjectOutputStream.PutField putFields() throws IOException { StreamState state = top(); @@ -579,22 +659,23 @@ { throw new IOException("putFields: ObjectSteamClass is null"); } - state.putField = new com.sybase.CORBA.iiop.PutField(osc); - return state.putField; + + org.apache.geronimo.interop.rmi.iiop.PutField pf = new org.apache.geronimo.interop.rmi.iiop.PutField(osc); + state.putField = pf; + return pf; } public void writeFields() throws IOException { - StreamState state = top(); if(state.putField == null) { throw new IOException("writeFields: PutField object is null"); } - state.putField.writeFields(this); + org.apache.geronimo.interop.rmi.iiop.PutField pf = (org.apache.geronimo.interop.rmi.iiop.PutField)state.putField; + pf.writeFields(this); } - */ protected void push(StreamState state) { Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRef.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRef.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRef.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRef.java Mon Mar 28 12:37:40 2005 @@ -27,11 +27,10 @@ public class ObjectRef extends CorbaObject { - //public static final Component $component = new Component(ObjectRef.class); public static ObjectRef _getInstance() { - return new ObjectRef(); //(ObjectRef)$component.getInstance(); + return new ObjectRef(); } // ----------------------------------------------------------------------- @@ -61,16 +60,8 @@ private static TaggedComponent[] NO_PROFILE_COMPONENTS = {}; - /* private static TaggedProfile AUTOMATIC_FAILOVER_PROFILE; - static - { - AUTOMATIC_FAILOVER_PROFILE = new TaggedProfile(); - AUTOMATIC_FAILOVER_PROFILE.tag = AutomaticFailover.PROFILE_TAG; - AUTOMATIC_FAILOVER_PROFILE.profile_data = ArrayUtil.EMPTY_BYTE_ARRAY; - } - */ private int _iiopVersion = IIOP_VERSION_1_2; @@ -78,9 +69,11 @@ private ClientNamingContext _namingContext; + private ObjectRef _forwardingAddress; + private String _repositoryID; // CORBA repository ID e.g. "RMI:xyz:0000000000000000" - private int _protocol; + private int _protocol = Protocol.IIOP; private String _endpoint; @@ -88,8 +81,6 @@ private int _port = -1; - //private boolean _automaticFailover; - public byte[] _objectKey; public byte[] _objectState; @@ -104,6 +95,10 @@ public Connection $connect() { + if(_forwardingAddress != null) + { + return _forwardingAddress.$connect(); + } try { Connection conn = $getNamingContext().getConnectionPool().get(_protocol, $getEndpoint(), this); @@ -112,30 +107,19 @@ } catch (RuntimeException ex) { - //if (_automaticFailover) - //{ - // throw new RetryInvokeException(ex); - //} - //else - //{ - throw ex; - //} + throw ex; } } - /* - public boolean $getAutomaticFailover() + public ObjectRef $getForwardingAddress() { - return _automaticFailover; + return _forwardingAddress; } - */ - /* - public void $setAutomaticFailover() + public void $setForwardingAddress(ObjectRef ref) { - _automaticFailover = true; + _forwardingAddress = ref; } - */ public int $getIiopVersion() { @@ -319,6 +303,21 @@ return UTF8.toString($getObjectKey()); } + public String $getObjectName() + { + byte[] objectKey = $getObjectKey(); + int keyLength = objectKey.length; + + for (int colonPos = 0; colonPos < keyLength; colonPos++) + { + if (objectKey[colonPos] == ':') + { + return UTF8.toString(objectKey, 0, colonPos); + } + } + return UTF8.toString(objectKey); + } + public void $setObjectKey(byte[] objectKey) { _objectKey = objectKey; @@ -368,5 +367,40 @@ public Object $getRequestKey() { return null; + } + + public String $getIORString() + { + org.apache.geronimo.interop.IOP.IOR ior = $getIOR(); + CdrOutputStream output = CdrOutputStream.getInstanceForEncapsulation(); + output.setGiopVersion(GiopVersion.VERSION_1_0); + output.write_Object(this); + byte[] bytes = output.getEncapsulation(); + String hex = Base16Binary.toString(bytes); + String iorString = "IOR:" + hex; + return iorString; + } + + public void $setIORString(String iorString) + { + $setIOR($getObjectFromIOR(iorString).$getIOR()); + } + + public static ObjectRef $getObjectFromIOR(String iorString) + { + String hex = StringUtil.removePrefix(iorString, "IOR:"); + byte[] bytes = Base16Binary.fromString(hex); + CdrInputStream input = CdrInputStream.getInstanceForEncapsulation(); + input.setGiopVersion(GiopVersion.VERSION_1_0); + input.setEncapsulation(bytes); + ObjectRef object = (ObjectRef)input.read_Object(); + return object; + } + + public String toString() + { + return getClass().getName() + ":protocol=" + Protocol.getName($getProtocol()) + + ":host=" + $getHost() + ":port=" + $getPort() + + ":key=" + Base16Binary.toString($getObjectKey()); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java Mon Mar 28 12:37:40 2005 @@ -42,10 +42,6 @@ { RemoteInterface remote = (RemoteInterface)value; ObjectRef objectRef = remote.getObjectRef(); - //if (value instanceof AutomaticFailover) - //{ - // objectRef.$setAutomaticFailover(); - //} output._cdrOutput.write_Object(objectRef); } else Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java?view=diff&r1=159302&r2=159303 ============================================================================== --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java Mon Mar 28 12:37:40 2005 @@ -88,7 +88,7 @@ return ArrayUtil.EMPTY_CHAR_ARRAY; } char[] array = new char[n]; - input._cdrInput.read_char_array(array, 0, n); + input._cdrInput.read_wchar_array(array, 0, n); return array; } @@ -97,7 +97,7 @@ char[] array = (char[])value; int n = array.length; output._cdrOutput.write_long(n); - output._cdrOutput.write_char_array(array, 0, n); + output._cdrOutput.write_wchar_array(array, 0, n); } } ;