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=159004&r2=159005
==============================================================================
--- 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 Fri Mar 25 03:54:30 2005
@@ -17,48 +17,52 @@
*/
package org.apache.geronimo.interop.rmi.iiop;
-import org.omg.CORBA.TCKind;
-
-import org.apache.geronimo.interop.GIOP.*;
+import org.apache.geronimo.interop.rmi.*;
+import org.apache.geronimo.interop.rmi.iiop.client.*;
+import org.apache.geronimo.interop.rmi.iiop.compiler.StubFactory;
+import org.apache.geronimo.interop.util.*;
import org.apache.geronimo.interop.IOP.*;
-import org.apache.geronimo.interop.rmi.RmiTrace;
-import org.apache.geronimo.interop.rmi.iiop.client.ClientNamingContext;
-import org.apache.geronimo.interop.util.ArrayUtil;
-import org.apache.geronimo.interop.util.BigEndian;
-import org.apache.geronimo.interop.util.LittleEndian;
-import org.apache.geronimo.interop.util.UTF8;
-import org.apache.geronimo.interop.util.UnsignedShort;
-
+import org.apache.geronimo.interop.GIOP.*;
+import org.omg.CORBA.TCKind;
/**
- * * CORBA 2.3 / GIOP 1.2 CDR InputStream.
- */
-public class CdrInputStream extends org.omg.CORBA_2_3.portable.InputStream {
- public static CdrInputStream getInstance() {
- CdrInputStream input = new CdrInputStream();
+ ** 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();
input.init(new byte[64], 0, DEFAULT_BUFFER_LENGTH, false);
return input;
}
- public static CdrInputStream getInstance(byte[] buffer) {
- CdrInputStream input = new CdrInputStream();
+ public static CdrInputStream getInstance(byte[] buffer)
+ {
+ CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance();
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();
+ public static CdrInputStream getInstance(byte[] buffer, int offset, int length, boolean little)
+ {
+ CdrInputStream input = new CdrInputStream(); //(CdrInputStream)component.getInstance();
input.init(buffer, offset, length, little);
return input;
}
- public static CdrInputStream getInstanceForEncapsulation() {
+ public static CdrInputStream getInstanceForEncapsulation()
+ {
return getInstance();
}
- public static CdrInputStream getPooledInstance() {
- CdrInputStream input = null; //(CdrInputStream)_pool.get();
- if (input == null) {
+ public static CdrInputStream getPooledInstance()
+ {
+ CdrInputStream input = null; // (CdrInputStream)_pool.get();
+ if (input == null)
+ {
input = getInstance();
}
return input;
@@ -102,24 +106,29 @@
// public methods
// -----------------------------------------------------------------------
- public void init(byte[] buffer, int offset, int length, boolean little) {
+ public void init(byte[] buffer, int offset, int length, boolean little)
+ {
_buffer = buffer;
_offset = offset;
_length = length;
_little = little;
}
- public void recycle() {
+ public void recycle()
+ {
reset();
//_pool.put(this);
}
- public void reset() {
+ public void reset()
+ {
_offset = 0;
- if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH) {
+ if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH)
+ {
_buffer = _pooledBuffer;
_pooledBuffer = null;
- if (_buffer == null) {
+ if (_buffer == null)
+ {
_buffer = new byte[DEFAULT_BUFFER_LENGTH];
}
}
@@ -128,32 +137,40 @@
_namingContext = null;
}
- public void setUnaligned() {
+ public void setUnaligned()
+ {
_unaligned = true;
}
- public byte[] getBytes() {
+ public byte[] getBytes()
+ {
return ArrayUtil.getBytes(_buffer, 0, _length);
}
- public byte[] getBuffer() {
+ public byte[] getBuffer()
+ {
return _buffer;
}
- public int getOffset() {
+ public int getOffset()
+ {
return _offset;
}
- public int getGiopVersion() {
+ public int getGiopVersion()
+ {
GiopMessage message = _giopMessage;
- if (message == null) {
+ if (message == null)
+ {
throw new IllegalStateException();
}
return message.giopVersion;
}
- public void setLength(int length) {
- if (_buffer.length < length) {
+ public void setLength(int length)
+ {
+ if (_buffer.length < length)
+ {
byte[] newBuffer = new byte[length];
System.arraycopy(_buffer, 0, newBuffer, 0, 12);
pool(_buffer);
@@ -162,49 +179,64 @@
_length = length;
}
- public void setNamingContext(ClientNamingContext namingContext) {
+ public ClientNamingContext getNamingContext()
+ {
+ return _namingContext;
+ }
+
+ public void setNamingContext(ClientNamingContext namingContext)
+ {
_namingContext = namingContext;
}
- public void setEncapsulation(byte[] data) {
+ public void setEncapsulation(byte[] data)
+ {
_buffer = data;
_offset = 0;
_length = data.length;
_little = read_boolean();
}
- public boolean hasMoreData() {
+ public boolean hasMoreData()
+ {
return _offset < _length;
}
/**
- * * Align the buffer offset so the next item is read from at an offset
- * * aligned according to <code>alignment</code>, which must be a
- * * power of 2 (and at least = 1).
- * * <p>Then we check if there is enough space left in the buffer for
- * * an item of <code>size</code> bytes; if not, we throw an
- * * exception.
- */
- public final void read_align(int alignment, int size) {
- if (_unaligned) {
+ ** Align the buffer offset so the next item is read from at an offset
+ ** aligned according to <code>alignment</code>, which must be a
+ ** power of 2 (and at least = 1).
+ ** <p>Then we check if there is enough space left in the buffer for
+ ** an item of <code>size</code> bytes; if not, we throw an
+ ** exception.
+ **/
+ public final void read_align(int alignment, int size)
+ {
+ if (_unaligned)
+ {
alignment = 1;
}
int mask = alignment - 1;
_offset += (alignment - (_offset & mask)) & mask;
- if (_offset + size <= _length) {
+ if (_offset + size <= _length)
+ {
return;
- } else {
+ }
+ else
+ {
throw new org.omg.CORBA.MARSHAL("offset (" + _offset + ") + size ("
- + size + ") > buffer length (" + _length + ")");
+ + size + ") > buffer length (" + _length + ")");
}
}
/**
- * * Convenience method needed in many places.
- */
- public byte[] read_octet_sequence() {
+ ** Convenience method needed in many places.
+ **/
+ public byte[] read_octet_sequence()
+ {
int n = read_long();
- if (n == 0) {
+ if (n == 0)
+ {
return EMPTY_BYTE_ARRAY;
}
byte[] bytes = new byte[n];
@@ -212,23 +244,28 @@
return bytes;
}
- public GiopMessage read_message() {
+ public GiopMessage read_message()
+ {
return receive_message(null, null);
}
- public GiopMessage receive_message(java.io.InputStream input, String host) {
+ public GiopMessage receive_message(java.io.InputStream input, String url)
+ {
GiopMessage message = _giopMessage;
- if (message == null) {
+ if (message == null)
+ {
message = _giopMessage = new GiopMessage();
}
- if (input != null) {
+ if (input != null)
+ {
read(input, _buffer, 0, 12);
}
int m1 = read_octet();
int m2 = read_octet();
int m3 = read_octet();
int m4 = read_octet();
- if (m1 != 'G' || m2 != 'I' || m3 != 'O' || m4 != 'P') {
+ if (m1 != 'G' || m2 != 'I' || m3 != 'O' || m4 != 'P')
+ {
throw new BadMagicException(m1 + "," + m2 + "," + m3 + "," + m4);
}
int v1 = read_octet();
@@ -244,12 +281,15 @@
boolean fragmented = (flags & 2) != 0;
int messageType = message.type = read_octet();
int messageSize = message.size = read_ulong();
- if (fragmented && messageSize % 8 != 0) {
+ if (fragmented && messageSize % 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) {
+ if (messageSize > 0 && input != null)
+ {
+ if (_buffer.length < _length)
+ {
byte[] newBuffer = new byte[_length];
System.arraycopy(_buffer, 0, newBuffer, 0, 12);
pool(_buffer);
@@ -257,76 +297,83 @@
}
read(input, _buffer, 12, _length);
}
- if (RMI_TRACE && host != null) {
+ if (RMI_TRACE && url != null)
+ {
byte[] data = new byte[_length];
System.arraycopy(_buffer, 0, data, 0, _length);
- RmiTrace.receive(host, data);
+ RmiTrace.receive(url, data);
}
- switch (messageType) {
- case MsgType_1_1._Request:
- switch (giopVersion) {
- 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;
- req12.request_id = req10.request_id;
- req12.response_flags = (byte) (req10.response_expected ? 3 : 0);
- req12.operation = req10.operation;
- (req12.target = new TargetAddress()).object_key(req10.object_key);
- message.request = req12;
- }
- 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;
- req12.request_id = req11.request_id;
- req12.response_flags = (byte) (req11.response_expected ? 3 : 0);
- req12.operation = req11.operation;
- (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) {
- read_align(8, 0); // parameters are 8-byte aligned (if present)
- }
- break;
+ switch (messageType)
+ {
+ case MsgType_1_1._Request:
+ switch (giopVersion)
+ {
+ 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;
+ req12.request_id = req10.request_id;
+ req12.response_flags = (byte)(req10.response_expected ? 3 : 0);
+ req12.operation = req10.operation;
+ (req12.target = new TargetAddress()).object_key(req10.object_key);
+ message.request = req12;
}
break;
- case MsgType_1_1._Reply:
- message.reply = ReplyHeader_1_2Helper.read(this);
- if (giopVersion >= GiopVersion.VERSION_1_2) {
- if (_length > _offset) {
- read_align(8, 0); // results are 8-byte aligned (if present)
- }
+ 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;
+ req12.request_id = req11.request_id;
+ req12.response_flags = (byte)(req11.response_expected ? 3 : 0);
+ req12.operation = req11.operation;
+ (req12.target = new TargetAddress()).object_key(req11.object_key);
+ message.request = req12;
}
break;
- case MsgType_1_1._LocateRequest:
- switch (giopVersion) {
- 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);
+ 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;
- 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._Reply:
+ message.reply = ReplyHeader_1_2Helper.read(this);
+ if (giopVersion >= GiopVersion.VERSION_1_2)
+ {
+ if (_length > _offset)
+ {
+ read_align(8, 0); // results are 8-byte aligned (if present)
+ }
+ }
+ break;
+ case MsgType_1_1._LocateRequest:
+ switch (giopVersion)
+ {
+ 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;
+ 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;
}
@@ -335,105 +382,138 @@
// public methods from org.omg.CORBA.portable.InputStream
// -----------------------------------------------------------------------
- public boolean read_boolean() {
+ public boolean read_boolean()
+ {
read_align(1, 1);
int b = _buffer[_offset++];
- if (b == 0) {
+ if (b == 0)
+ {
return false;
- } else if (b == 1) {
+ }
+ else if (b == 1)
+ {
return true;
- } else {
+ }
+ else
+ {
throw new org.omg.CORBA.MARSHAL("read_boolean: value = " + b);
}
}
- public char read_char() {
+ public char read_char()
+ {
read_align(1, 1);
- return (char) _buffer[_offset++];
+ return (char)_buffer[_offset++];
}
- public char read_wchar() {
+ public char read_wchar()
+ {
read_align(1, 3);
- int size = (int) read_wchar_size();
- int value = (char) read_ushort_no_align_big_endian();
+ int size = (int)read_wchar_size();
+ int value = (char)read_ushort_no_align_big_endian();
boolean littleEndian = ((value & 0xffff) == 0xFFFE);
boolean bigEndian = ((value & 0xffff) == 0xFEFF);
boolean bomPresent = (littleEndian || bigEndian);
- if ((bomPresent && size != 4) || (!bomPresent && size != 2)) {
+ if ((bomPresent && size != 4) || (! bomPresent && size != 2))
+ {
throw new org.omg.CORBA.MARSHAL("wchar size = " + size
- + (bomPresent ? " (BOM present)" : " (BOM absent)"));
+ + (bomPresent ? " (BOM present)" : " (BOM absent)"));
}
- if (littleEndian) {
+ if (littleEndian)
+ {
read_align(1, 2);
- return (char) read_ushort_no_align_little_endian();
- } else if (bigEndian) {
+ return (char)read_ushort_no_align_little_endian();
+ }
+ else if (bigEndian)
+ {
read_align(1, 2);
- return (char) read_ushort_no_align_big_endian();
- } else {
+ return (char)read_ushort_no_align_big_endian();
+ }
+ else
+ {
// no BOM, big endian
- return (char) value;
+ return (char)value;
}
}
- public byte read_octet() {
+ public byte read_octet()
+ {
read_align(1, 1);
return _buffer[_offset++];
}
- public short read_short() {
+ public short read_short()
+ {
read_align(2, 2);
int oldOffset = _offset;
_offset += 2;
- if (_little) {
+ if (_little)
+ {
return LittleEndian.getShort(_buffer, oldOffset);
- } else {
+ }
+ else
+ {
return BigEndian.getShort(_buffer, oldOffset);
}
}
- public short read_ushort() {
+ public short read_ushort()
+ {
return read_short();
}
- public int read_long() {
+ public int read_long()
+ {
read_align(4, 4);
int oldOffset = _offset;
_offset += 4;
- if (_little) {
+ if (_little)
+ {
return LittleEndian.getInt(_buffer, oldOffset);
- } else {
+ }
+ else
+ {
return BigEndian.getInt(_buffer, oldOffset);
}
}
- public int read_ulong() {
+ public int read_ulong()
+ {
return read_long();
}
- public long read_longlong() {
+ public long read_longlong()
+ {
read_align(8, 8);
int oldOffset = _offset;
_offset += 8;
- if (_little) {
+ if (_little)
+ {
return LittleEndian.getLong(_buffer, oldOffset);
- } else {
+ }
+ else
+ {
return BigEndian.getLong(_buffer, oldOffset);
}
}
- public long read_ulonglong() {
+ public long read_ulonglong()
+ {
return read_longlong();
}
- public float read_float() {
+ public float read_float()
+ {
return Float.intBitsToFloat(read_ulong());
}
- public double read_double() {
+ public double read_double()
+ {
return Double.longBitsToDouble(read_ulonglong());
}
- public java.lang.String read_string() {
+ public java.lang.String read_string()
+ {
int size = read_ulong();
if (size < 1) // Zero or negative due to unsigned value > 2Gb
{
@@ -441,177 +521,229 @@
}
read_align(1, size);
size--;
- if (_buffer[_offset + size] != 0) {
+ if (_buffer[_offset + size] != 0)
+ {
throw new org.omg.CORBA.MARSHAL("read_string: missing NUL");
}
// Assume transmission code set is UTF-8
- String value = UTF8.toString(_buffer, _offset, size);
+ String value = size == 0 ? "" : UTF8.toString(_buffer, _offset, size);
_offset += size + 1; // 1 for NUL
return value;
}
- public java.lang.String read_wstring() {
+ public java.lang.String read_wstring()
+ {
int size = read_long();
- if (size == 0) {
+ if (size == 0)
+ {
return "";
}
read_align(2, size);
int numChars = size / 2;
boolean littleEndian = false;
read_align(1, 2);
- int firstChar = (char) read_ushort_no_align_big_endian();
- _offset += 2;
+ int firstChar = (char)read_ushort_no_align_big_endian();
+ _offset+=2;
char[] result;
int index = 0;
- if (firstChar == 0xFEFF) {
+ if (firstChar == 0xFEFF)
+ {
// big endian
result = new char[--numChars];
- } else if (firstChar == 0xFFFE) {
+ }
+ else if (firstChar == 0xFFFE)
+ {
// little endian
result = new char[--numChars];
littleEndian = true;
- } else {
+ }
+ else
+ {
// no BOM, big endian
result = new char[numChars--];
- result[index++] = (char) firstChar;
+ result[index++] = (char)firstChar;
}
read_align(1, 2 * numChars);
- if (littleEndian) {
- for (int i = 0; i < numChars; i++) {
- result[index++] = (char) read_ushort_no_align_little_endian();
- _offset += 2;
- }
- } else {
- for (int i = 0; i < numChars; i++) {
- result[index++] = (char) read_ushort_no_align_big_endian();
- _offset += 2;
+ if (littleEndian)
+ {
+ for (int i = 0; i < numChars; i++)
+ {
+ result[index++] = (char)read_ushort_no_align_little_endian();
+ _offset+=2;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < numChars; i++)
+ {
+ result[index++] = (char)read_ushort_no_align_big_endian();
+ _offset+=2;
}
}
return new String(result);
}
- public void read_boolean_array(boolean[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_boolean_array(boolean[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_boolean();
}
}
- public void read_char_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_char_array(char[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[i] = read_char();
}
}
- public void read_wchar_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_wchar_array(char[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_wchar();
}
}
- public void read_octet_array(byte[] value, int offset, int length) {
+ public void read_octet_array(byte[] value, int offset, int length)
+ {
read_align(1, length);
System.arraycopy(_buffer, _offset, value, offset, length);
_offset += length;
}
- public void read_short_array(short[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_short_array(short[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_short();
}
}
- public void read_ushort_array(short[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_ushort_array(short[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_ushort();
}
}
- public void read_long_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_long_array(int[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_long();
}
}
- public void read_ulong_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_ulong_array(int[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_ulong();
}
}
- public void read_longlong_array(long[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_longlong_array(long[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_longlong();
}
}
- public void read_ulonglong_array(long[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_ulonglong_array(long[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_ulonglong();
}
}
- public void read_float_array(float[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_float_array(float[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_float();
}
}
- public void read_double_array(double[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void read_double_array(double[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
value[offset + i] = read_double();
}
}
- public org.omg.CORBA.Object read_Object() {
+ public org.omg.CORBA.Object read_Object()
+ {
IOR ior = IORHelper.read(this);
- if (ior.profiles.length == 0) {
+ if (ior.profiles.length == 0)
+ {
return null;
}
ObjectRef stub = null;
- if (ior.type_id.length() != 0) {
- // Return instance of appropriate stub class
- if (ior.type_id.startsWith("RMI:") && ior.type_id.endsWith(":0000000000000000")) {
- String interfaceName = ior.type_id.substring(4, ior.type_id.length() - 17);
-
- System.out.println("TODO: CdrInputStream.read_Object(): NYI: interfaceName = " + interfaceName + ", ior = " + ior.type_id);
- stub = null;
-
- //Class remoteInterface = ThreadContext.loadClass(interfaceName);
- //stub = StubFactory.getInstance().getStub(remoteInterface);
+ if (ior.type_id.length() != 0)
+ {
+ String interfaceName = "";
+ if (ior.type_id.startsWith("RMI:") && ior.type_id.endsWith(":0000000000000000"))
+ {
+ interfaceName = ior.type_id.substring(4, ior.type_id.length() - 17);
+ }
+ else if (ior.type_id.startsWith("IDL:") && ior.type_id.endsWith(":1.0"))
+ {
+ interfaceName = ior.type_id.substring(4, ior.type_id.length() - 4).replace('/', '.');
}
- if (ior.type_id.startsWith("IDL:") && ior.type_id.endsWith(":1.0")) {
- String interfaceName = ior.type_id.substring(4, ior.type_id.length() - 4).replace('/', '.');
-
- System.out.println("TODO: CdrInputStream.read_Object(): NYI: interfaceName = " + interfaceName + ", ior = " + ior.type_id);
- stub = null;
- //Class remoteInterface = ThreadContext.loadClass(interfaceName);
- //stub = StubFactory.getInstance().getStub(remoteInterface);
+ // Return instance of appropriate stub class
+ if(interfaceName.startsWith("omg.org", 0))
+ {
+ 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);
}
- if (stub == null) {
- stub = new ObjectRef();
+ if (stub == null)
+ {
+ stub = ObjectRef._getInstance();
}
stub.$setIOR(ior);
stub.$setNamingContext(_namingContext);
return stub;
}
- public org.omg.CORBA.TypeCode read_TypeCode() {
+ public org.omg.CORBA.TypeCode read_TypeCode()
+ {
return read_TypeCode(new java.util.HashMap());
}
- private org.omg.CORBA.TypeCode read_TypeCode(java.util.HashMap table) {
+ private org.omg.CORBA.TypeCode read_TypeCode(java.util.HashMap table)
+ {
int beforeKindOffset = _offset;
int tk = read_ulong();
int afterKindOffset = _offset;
org.apache.geronimo.interop.rmi.iiop.TypeCode tc;
- if (tk == 0xffffffff) {
+ if (tk == 0xffffffff)
+ {
// an indirection to another TypeCode we have seen.
int offset = read_long();
Integer key = new Integer(afterKindOffset + offset);
- org.omg.CORBA.TypeCode ref = (org.omg.CORBA.TypeCode) table.get(key);
- if (ref == null) {
+ org.omg.CORBA.TypeCode ref = (org.omg.CORBA.TypeCode)table.get(key);
+ if (ref == null)
+ {
throw new org.omg.CORBA.MARSHAL("read_TypeCode: bad indirection: offset = " + offset);
}
tc = new org.apache.geronimo.interop.rmi.iiop.TypeCode(TCKind.tk_null);
@@ -620,7 +752,8 @@
}
tc = new org.apache.geronimo.interop.rmi.iiop.TypeCode(TCKind.from_int(tk));
table.put(new Integer(beforeKindOffset), tc);
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_null:
case TCKind._tk_void:
case TCKind._tk_TypeCode:
@@ -686,7 +819,8 @@
tc.name(read_string());
int count = read_ulong();
tc.member_count(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
tc.member_name(i, read_string());
}
end(saveLittle);
@@ -700,7 +834,8 @@
tc.name(read_string());
int count = read_ulong();
tc.member_count(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
tc.member_name(i, read_string());
tc.member_type(i, read_TypeCode(table));
}
@@ -717,7 +852,8 @@
int di = read_ulong();
int count = read_ulong();
tc.member_count(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
org.omg.CORBA.Any label = new org.apache.geronimo.interop.rmi.iiop.Any();
read_Any(label.create_output_stream(), dt);
label.read_value(null, dt);
@@ -738,7 +874,8 @@
tc.concrete_base_type(read_TypeCode(table));
int count = read_ulong();
tc.member_count(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
tc.member_name(i, read_string());
tc.member_type(i, read_TypeCode(table));
tc.member_visibility(i, read_short());
@@ -752,7 +889,8 @@
return tc;
}
- public org.omg.CORBA.Any read_Any() {
+ public org.omg.CORBA.Any read_Any()
+ {
org.omg.CORBA.TypeCode tc = read_TypeCode();
org.omg.CORBA.Any value = new org.apache.geronimo.interop.rmi.iiop.Any();
org.omg.CORBA.portable.OutputStream os = value.create_output_stream();
@@ -762,10 +900,13 @@
}
// Sybase-internal
- public void read_Any(org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode tc) {
- try {
+ public void read_Any(org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode tc)
+ {
+ try
+ {
int tk = tc.kind().value();
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_null:
case TCKind._tk_void:
break;
@@ -828,7 +969,8 @@
{
int n = tc.length();
org.omg.CORBA.TypeCode c = tc.content_type();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
read_Any(os, c);
}
}
@@ -838,7 +980,8 @@
int n = read_ulong();
os.write_ulong(n);
org.omg.CORBA.TypeCode c = tc.content_type();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
read_Any(os, c);
}
}
@@ -847,7 +990,8 @@
case TCKind._tk_except:
{
int n = tc.member_count();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
read_Any(os, tc.member_type(i));
}
}
@@ -861,14 +1005,17 @@
write_disc(disc, os, dt);
int di = tc.default_index();
int i, n = tc.member_count();
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++)
+ {
org.omg.CORBA.Any label = tc.member_label(i);
- if (label.equal(disc)) {
+ if (label.equal(disc))
+ {
read_Any(os, tc.member_type(i));
break;
}
}
- if (i == n && di >= 0) {
+ if (i == n && di >= 0)
+ {
read_Any(os, tc.member_type(di));
}
}
@@ -878,9 +1025,13 @@
default:
throw new org.omg.CORBA.MARSHAL("read_Any: type = " + tc);
}
- } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+ {
throw new org.omg.CORBA.MARSHAL("read_Any: " + ex.toString());
- } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.Bounds ex)
+ {
throw new org.omg.CORBA.MARSHAL("read_Any: " + ex.toString());
}
}
@@ -951,65 +1102,85 @@
// protected methods
// -----------------------------------------------------------------------
- protected void pool(byte[] oldBuffer) {
- if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH) {
+ protected void pool(byte[] oldBuffer)
+ {
+ if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH)
+ {
_pooledBuffer = oldBuffer;
}
}
- protected int read_ushort_no_align_big_endian() {
+ protected int read_ushort_no_align_big_endian()
+ {
return UnsignedShort.intValue(BigEndian.getShort(_buffer, _offset));
}
- protected int read_ushort_no_align_little_endian() {
+ protected int read_ushort_no_align_little_endian()
+ {
return UnsignedShort.intValue(LittleEndian.getShort(_buffer, _offset));
}
- protected int read_wchar_size() {
+ protected int read_wchar_size()
+ {
read_align(1, 1);
- int size = _buffer[_offset++];
- if (size < 2) {
+ int size = _buffer[_offset++];
+ if (size < 2)
+ {
throw new org.omg.CORBA.MARSHAL("wchar size = " + size);
}
return size;
}
- protected void read(java.io.InputStream input, byte[] buffer, int offset, int length) {
- try {
- while (offset < length) {
+ protected void read(java.io.InputStream input, byte[] buffer, int offset, int length)
+ {
+ try
+ {
+ while (offset < length)
+ {
int needLength = length - offset;
int readLength = input.read(buffer, offset, needLength);
- if (readLength == -1) {
+ if (readLength == -1)
+ {
throw new org.omg.CORBA.MARSHAL("read: EOF");
}
offset += readLength;
}
- } catch (java.io.IOException ex) {
+ }
+ catch (java.io.IOException ex)
+ {
throw new org.omg.CORBA.COMM_FAILURE(ex.toString());
}
}
- public boolean begin() {
+ public boolean begin()
+ {
int length = read_ulong(); // encapsulation length
boolean saveLittle = _little;
_little = read_boolean();
return saveLittle;
}
- public void end(boolean saveLittle) {
+ public void end(boolean saveLittle)
+ {
_little = saveLittle;
}
- private void write_disc(org.omg.CORBA.Any disc, org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode dt) {
+ private void write_disc(org.omg.CORBA.Any disc, org.omg.CORBA.portable.OutputStream os, org.omg.CORBA.TypeCode dt)
+ {
int tk = dt.kind().value();
- if (tk == TCKind._tk_alias) {
- try {
+ if (tk == TCKind._tk_alias)
+ {
+ try
+ {
write_disc(disc, os, dt.content_type());
- } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+ {
throw new org.omg.CORBA.MARSHAL("write_disc: " + ex.toString());
}
}
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_boolean:
os.write_boolean(disc.extract_boolean());
break;
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=159004&r2=159005
==============================================================================
--- 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 Fri Mar 25 03:54:30 2005
@@ -17,49 +17,52 @@
*/
package org.apache.geronimo.interop.rmi.iiop;
-import org.omg.CORBA.TCKind;
-
-import org.apache.geronimo.interop.GIOP.*;
+import org.apache.geronimo.interop.rmi.*;
+import org.apache.geronimo.interop.util.*;
import org.apache.geronimo.interop.IOP.*;
-import org.apache.geronimo.interop.rmi.RmiTrace;
-import org.apache.geronimo.interop.util.ArrayUtil;
-import org.apache.geronimo.interop.util.BigEndian;
-import org.apache.geronimo.interop.util.ExceptionUtil;
-import org.apache.geronimo.interop.util.JavaClass;
-import org.apache.geronimo.interop.util.UTF8;
-
+import org.apache.geronimo.interop.GIOP.*;
+import org.omg.CORBA.TCKind;
/**
- * * CORBA 2.3 / GIOP 1.2 CDR OutputStream.
- */
-public class CdrOutputStream extends org.omg.CORBA_2_3.portable.OutputStream {
- public static CdrOutputStream getInstance() {
- CdrOutputStream output = new CdrOutputStream();
+ ** 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);
+
+ public static CdrOutputStream getInstance()
+ {
+ CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance();
output.init(new byte[DEFAULT_BUFFER_LENGTH], 0);
return output;
}
- public static CdrOutputStream getInstance(byte[] buffer) {
- CdrOutputStream output = new CdrOutputStream();
+ public static CdrOutputStream getInstance(byte[] buffer)
+ {
+ CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance();
output.init(buffer, 0);
return output;
}
- public static CdrOutputStream getInstance(byte[] buffer, int offset) {
- CdrOutputStream output = new CdrOutputStream();
+ public static CdrOutputStream getInstance(byte[] buffer, int offset)
+ {
+ CdrOutputStream output = new CdrOutputStream(); //(CdrOutputStream)component.getInstance();
output.init(buffer, offset);
return output;
}
- public static CdrOutputStream getInstanceForEncapsulation() {
+ public static CdrOutputStream getInstanceForEncapsulation()
+ {
CdrOutputStream output = getInstance();
output.write_boolean(false); // byte order: big endian
return output;
}
- public static CdrOutputStream getPooledInstance() {
- CdrOutputStream output = null; //(CdrOutputStream)_pool.get();
- if (output == null) {
+ public static CdrOutputStream getPooledInstance()
+ {
+ CdrOutputStream output = null; // (CdrOutputStream)_pool.get();
+ if (output == null)
+ {
output = getInstance();
}
return output;
@@ -77,13 +80,13 @@
private static IOR NULL_IOR = new IOR("", new TaggedProfile[0]);
- private static char[] GIOP_MAGIC = {'G', 'I', 'O', 'P'};
+ private static char[] GIOP_MAGIC = { 'G', 'I', 'O', 'P' };
private static ServiceContext[] EMPTY_SERVICE_CONTEXT_LIST = {};
- private static Version GIOP_VERSION_1_0 = new Version((byte) 1, (byte) 0);
- 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 Version GIOP_VERSION_1_0 = new Version((byte)1, (byte)0);
+ 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());
@@ -107,84 +110,101 @@
// public methods
// -----------------------------------------------------------------------
- public void init(byte[] buffer, int offset) {
+ public void init(byte[] buffer, int offset)
+ {
_buffer = buffer;
_offset = offset;
_length = _buffer.length;
}
- public void recycle() {
+ public void recycle()
+ {
reset();
//_pool.put(this);
}
- public void reset() {
+ public void reset()
+ {
_offset = 0;
- if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH) {
+ if (_buffer.length > MAXIMUM_POOLED_BUFFER_LENGTH)
+ {
_buffer = _pooledBuffer;
_pooledBuffer = null;
- if (_buffer == null) {
+ if (_buffer == null)
+ {
_buffer = new byte[DEFAULT_BUFFER_LENGTH];
}
}
_length = _buffer.length;
}
- public void setUnaligned() {
+ public void setUnaligned()
+ {
_unaligned = true;
}
- public byte[] getBytes() {
+ public byte[] getBytes()
+ {
int n = _offset;
byte[] bytes = new byte[n];
System.arraycopy(_buffer, 0, bytes, 0, n);
return bytes;
}
- public byte[] getBuffer() {
+ public byte[] getBuffer()
+ {
return _buffer;
}
- public int getOffset() {
+ public int getOffset()
+ {
return _offset;
}
- public int getLength() {
+ public int getLength()
+ {
return _length;
}
- public byte[] getEncapsulation() {
+ public byte[] getEncapsulation()
+ {
byte[] data = new byte[_offset];
System.arraycopy(_buffer, 0, data, 0, _offset);
return data;
}
- public void setGiopVersion(int version) {
+ public void setGiopVersion(int version)
+ {
_giopVersion = version;
}
/**
- * * Align the buffer offset so the next item is written at an offset
- * * aligned according to <code>alignment</code>, which must be a
- * * power of 2 (and at least = 1).
- * * <p>The padding bytes are set to zero, to prevent the
- * * security problems inherent in uninitialised padding bytes.
- * * <p>Then we check if there is enough space left in the buffer for
- * * an item of <code>size</code> bytes; if not, we expand the buffer
- * * to make space.
- */
- public final void write_align(int alignment, int size) {
- if (_unaligned) {
+ ** Align the buffer offset so the next item is written at an offset
+ ** aligned according to <code>alignment</code>, which must be a
+ ** power of 2 (and at least = 1).
+ ** <p>The padding bytes are set to zero, to prevent the
+ ** security problems inherent in uninitialised padding bytes.
+ ** <p>Then we check if there is enough space left in the buffer for
+ ** an item of <code>size</code> bytes; if not, we expand the buffer
+ ** to make space.
+ **/
+ public final void write_align(int alignment, int size)
+ {
+ if (_unaligned)
+ {
alignment = 1;
}
int needLength = _offset + alignment + size;
- if (needLength > _length) {
+ if (needLength > _length)
+ {
// We need to increase the buffer size. We allow for a bit
// of future expansion (if possible).
int factor8 = 32;
- for (int pass = 1; pass <= 7; pass++, factor8 /= 2) {
+ for (int pass = 1; pass <= 7; pass++, factor8 /= 2)
+ {
// We try factors 5, 3, 2, 1.5, 1.25, 1.125, 1.
- try {
+ try
+ {
byte[] newBuffer = new byte[needLength + factor8 * needLength / 8];
// Copy old buffer contents into new buffer.
System.arraycopy(_buffer, 0, newBuffer, 0, _offset);
@@ -192,24 +212,30 @@
_buffer = newBuffer;
_length = newBuffer.length;
break;
- } catch (OutOfMemoryError ignore) {
- if (pass == 7) {
+ }
+ catch (OutOfMemoryError ignore)
+ {
+ if (pass == 7)
+ {
throw new org.omg.CORBA.NO_MEMORY(needLength + " bytes");
}
}
}
}
int mask = alignment - 1;
- for (int i = (alignment - (_offset & mask)) & mask; i > 0; i--) {
+ for (int i = (alignment - (_offset & mask)) & mask; i > 0; i--)
+ {
_buffer[_offset++] = 0;
}
}
/**
- * * Convenience method needed in many places.
- */
- public void write_octet_sequence(byte[] bytes) {
- if (bytes == null) {
+ ** Convenience method needed in many places.
+ **/
+ public void write_octet_sequence(byte[] bytes)
+ {
+ if (bytes == null)
+ {
bytes = ArrayUtil.EMPTY_BYTE_ARRAY;
}
int n = bytes.length;
@@ -217,30 +243,33 @@
write_octet_array(bytes, 0, n);
}
- public void write_message(int messageType) {
+ public void write_message(int messageType)
+ {
MessageHeader_1_1 header = new MessageHeader_1_1();
header.magic = GIOP_MAGIC;
- switch (_giopVersion) {
- case GiopVersion.VERSION_1_0:
- header.GIOP_version = GIOP_VERSION_1_2;
- break;
- case GiopVersion.VERSION_1_1:
- header.GIOP_version = GIOP_VERSION_1_1;
- break;
- case GiopVersion.VERSION_1_2:
- header.GIOP_version = GIOP_VERSION_1_2;
- break;
- default:
- throw new IllegalStateException();
+ switch (_giopVersion)
+ {
+ case GiopVersion.VERSION_1_0:
+ header.GIOP_version = GIOP_VERSION_1_2;
+ break;
+ case GiopVersion.VERSION_1_1:
+ header.GIOP_version = GIOP_VERSION_1_1;
+ break;
+ case GiopVersion.VERSION_1_2:
+ header.GIOP_version = GIOP_VERSION_1_2;
+ break;
+ default:
+ throw new IllegalStateException();
}
header.flags = 0;
- header.message_type = (byte) messageType;
+ header.message_type = (byte)messageType;
header.message_size = 0;
// header.message_size is rewritten later
MessageHeader_1_1Helper.write(this, header);
}
- public void write_message_size() {
+ public void write_message_size()
+ {
int messageSize = _offset - 12;
int saveOffset = _offset;
_offset = 8;
@@ -248,43 +277,50 @@
_offset = saveOffset;
}
- public void write_request(RequestHeader_1_2 request, CdrOutputStream parameters) {
- if (request.service_context == null) {
+ public void write_request(RequestHeader_1_2 request, CdrOutputStream parameters)
+ {
+ if (request.service_context == null)
+ {
// Avoid allocation of empty array by Helper.
request.service_context = EMPTY_SERVICE_CONTEXT_LIST;
}
write_message(MsgType_1_1._Request);
- switch (_giopVersion) {
- case GiopVersion.VERSION_1_0:
- RequestHeader_1_0 req10 = new RequestHeader_1_0();
- req10.service_context = request.service_context;
- req10.request_id = request.request_id;
- req10.response_expected = (request.response_flags & 1) != 0;
- req10.operation = request.operation;
- req10.object_key = request.target.object_key();
- RequestHeader_1_0Helper.write(this, req10);
- break;
- case GiopVersion.VERSION_1_1:
- RequestHeader_1_1 req11 = new RequestHeader_1_1();
- req11.service_context = request.service_context;
- req11.request_id = request.request_id;
- req11.response_expected = (request.response_flags & 1) != 0;
- req11.operation = request.operation;
- req11.object_key = request.target.object_key();
- RequestHeader_1_1Helper.write(this, req11);
- break;
- case GiopVersion.VERSION_1_2:
- RequestHeader_1_2Helper.write(this, request);
- break;
- default:
- throw new IllegalStateException();
+ switch (_giopVersion)
+ {
+ case GiopVersion.VERSION_1_0:
+ RequestHeader_1_0 req10 = new RequestHeader_1_0();
+ req10.service_context = request.service_context;
+ req10.request_id = request.request_id;
+ req10.response_expected = (request.response_flags & 1) != 0;
+ req10.operation = request.operation;
+ req10.object_key = request.target.object_key();
+ RequestHeader_1_0Helper.write(this, req10);
+ break;
+ case GiopVersion.VERSION_1_1:
+ RequestHeader_1_1 req11 = new RequestHeader_1_1();
+ req11.service_context = request.service_context;
+ req11.request_id = request.request_id;
+ req11.response_expected = (request.response_flags & 1) != 0;
+ req11.operation = request.operation;
+ req11.object_key = request.target.object_key();
+ RequestHeader_1_1Helper.write(this, req11);
+ break;
+ case GiopVersion.VERSION_1_2:
+ RequestHeader_1_2Helper.write(this, request);
+ break;
+ default:
+ throw new IllegalStateException();
}
byte[] parametersBuffer = parameters.getBuffer();
int parametersLength = parameters.getOffset();
- if (parametersLength > 0) {
- if (_giopVersion >= GiopVersion.VERSION_1_2) {
+ if (parametersLength > 0)
+ {
+ if (_giopVersion >= GiopVersion.VERSION_1_2)
+ {
write_align(8, 0); // parameters are 8-byte aligned
- } else {
+ }
+ else
+ {
// TODO: should have padded service context earlier
}
write_octet_array(parametersBuffer, 0, parametersLength);
@@ -292,33 +328,40 @@
write_message_size();
}
- public void write_reply(ReplyHeader_1_2 reply, CdrOutputStream results) {
- if (reply.service_context == null) {
+ public void write_reply(ReplyHeader_1_2 reply, CdrOutputStream results)
+ {
+ if (reply.service_context == null)
+ {
// Avoid allocation of empty array by Helper.
reply.service_context = EMPTY_SERVICE_CONTEXT_LIST;
}
write_message(MsgType_1_1._Reply);
- switch (_giopVersion) {
- case GiopVersion.VERSION_1_0:
- case GiopVersion.VERSION_1_1:
- ReplyHeader_1_0 rep10 = new ReplyHeader_1_0();
- rep10.service_context = reply.service_context;
- rep10.request_id = reply.request_id;
- rep10.reply_status = reply.reply_status;
- ReplyHeader_1_0Helper.write(this, rep10);
- break;
- case GiopVersion.VERSION_1_2:
- ReplyHeader_1_2Helper.write(this, reply);
- break;
- default:
- throw new IllegalStateException();
+ switch (_giopVersion)
+ {
+ case GiopVersion.VERSION_1_0:
+ case GiopVersion.VERSION_1_1:
+ ReplyHeader_1_0 rep10 = new ReplyHeader_1_0();
+ rep10.service_context = reply.service_context;
+ rep10.request_id = reply.request_id;
+ rep10.reply_status = reply.reply_status;
+ ReplyHeader_1_0Helper.write(this, rep10);
+ break;
+ case GiopVersion.VERSION_1_2:
+ ReplyHeader_1_2Helper.write(this, reply);
+ break;
+ default:
+ throw new IllegalStateException();
}
byte[] resultsBuffer = results.getBuffer();
int resultsLength = results.getOffset();
- if (resultsLength > 0) {
- if (_giopVersion >= GiopVersion.VERSION_1_2) {
+ if (resultsLength > 0)
+ {
+ if (_giopVersion >= GiopVersion.VERSION_1_2)
+ {
write_align(8, 0); // results are 8-byte aligned
- } else {
+ }
+ else
+ {
// TODO: should have padded service context earlier
}
write_octet_array(resultsBuffer, 0, resultsLength);
@@ -326,40 +369,61 @@
write_message_size();
}
- public void write_reply(LocateReplyHeader_1_2 reply) {
+ public void write_reply(LocateReplyHeader_1_2 reply)
+ {
write_message(MsgType_1_1._LocateReply);
LocateReplyHeader_1_2Helper.write(this, reply);
write_message_size();
}
- public void write_SystemException(Exception ex, boolean withStackTrace) {
+ public void write_SystemException(Exception ex, boolean withStackTrace)
+ {
String type = "UNKNOWN";
- if (ex instanceof org.omg.CORBA.SystemException) {
+ if (ex instanceof org.omg.CORBA.SystemException)
+ {
type = JavaClass.getNameSuffix(ex.getClass().getName());
- } else if (ex instanceof SecurityException) {
- type = "NO_PERMISSION";
- } else if (ex instanceof UnsupportedOperationException) {
+ }
+ else if (ex instanceof UnsupportedOperationException)
+ {
type = "BAD_OPERATION";
}
+ else if (ex instanceof SecurityException)
+ {
+ type = "NO_PERMISSION";
+ }
+ else if (ex instanceof java.rmi.NoSuchObjectException)
+ {
+ type = "OBJECT_NOT_EXIST";
+ }
+ //else if (ex instanceof org.apache.geronimo.interop.transaction.TransactionRolledbackSystemException)
+ //{
+ // type = "TRANSACTION_ROLLEDBACK";
+ //}
String id = "IDL:omg.org/CORBA/" + type + ":1.0";
write_string(id);
write_long(0); // minor (TODO: other values?)
write_long(0); // completed (TODO: other values?)
- if (withStackTrace) {
+ if (withStackTrace)
+ {
write_string(ExceptionUtil.getStackTrace(ex));
}
}
- public void send_message(java.io.OutputStream output, String host) {
- if (RMI_TRACE) {
+ public void send_message(java.io.OutputStream output, String url)
+ {
+ if (RMI_TRACE)
+ {
byte[] data = new byte[_offset];
System.arraycopy(_buffer, 0, data, 0, _offset);
- RmiTrace.send(host, data);
+ RmiTrace.send(url, data);
}
- try {
+ try
+ {
output.write(_buffer, 0, _offset);
output.flush();
- } catch (java.io.IOException ex) {
+ }
+ catch (java.io.IOException ex)
+ {
throw new org.omg.CORBA.COMM_FAILURE(ex.toString());
}
}
@@ -368,209 +432,267 @@
// public methods from org.omg.CORBA.portable.OutputStream
// -----------------------------------------------------------------------
- public void write_boolean(boolean value) {
+ public void write_boolean(boolean value)
+ {
write_align(1, 1);
- if (value) {
+ if (value)
+ {
_buffer[_offset++] = 1;
- } else {
+ }
+ else
+ {
_buffer[_offset++] = 0;
}
}
- public void write_char(char value) {
+ public void write_char(char value)
+ {
write_align(1, 1);
- if ((int) value > 255) {
+ if ((int)value > 255)
+ {
throw new org.omg.CORBA.MARSHAL("write_char: value = " + value);
}
- _buffer[_offset++] = (byte) value;
+ _buffer[_offset++] = (byte)value;
}
- public void write_wchar(char value) {
- write_octet((byte) 2); // size of wchar is 2 bytes
+ public void write_wchar(char value)
+ {
+ write_octet((byte)2); // size of wchar is 2 bytes
write_align(1, 2);
- write_ushort_no_align_big_endian((int) value);
+ write_ushort_no_align_big_endian((int)value);
}
- public void write_octet(byte value) {
+ public void write_octet(byte value)
+ {
write_align(1, 1);
_buffer[_offset++] = value;
}
- public void write_short(short value) {
+ public void write_short(short value)
+ {
write_align(2, 2);
int oldOffset = _offset;
_offset += 2;
BigEndian.setShort(_buffer, oldOffset, value);
}
- public void write_ushort(short value) {
+ public void write_ushort(short value)
+ {
write_short(value);
}
- public void write_long(int value) {
+ public void write_long(int value)
+ {
write_align(4, 4);
int oldOffset = _offset;
_offset += 4;
BigEndian.setInt(_buffer, oldOffset, value);
}
- public void write_ulong(int value) {
+ public void write_ulong(int value)
+ {
write_long(value);
}
- public void write_longlong(long value) {
+ public void write_longlong(long value)
+ {
write_align(8, 8);
int oldOffset = _offset;
_offset += 8;
BigEndian.setLong(_buffer, oldOffset, value);
}
- public void write_ulonglong(long value) {
+ public void write_ulonglong(long value)
+ {
write_longlong(value);
}
- public void write_float(float value) {
+ public void write_float(float value)
+ {
write_long(Float.floatToIntBits(value));
}
- public void write_double(double value) {
+ public void write_double(double value)
+ {
write_longlong(Double.doubleToLongBits(value));
}
- public void write_string(String value) {
- if (value == null) {
+ public void write_string(String value)
+ {
+ if (value == null)
+ {
value = "";
}
write_align(4, 4);
int size = UTF8.fromString(value, _buffer, _offset + 4, _length - 1);
- if (size == -1) {
+ if (size == -1)
+ {
// No room to convert in-place, ok to allocate new byte array.
byte[] bytes = UTF8.fromString(value);
size = bytes.length;
write_ulong(size + 1);
write_octet_array(bytes, 0, size);
- } else {
+ }
+ else
+ {
// Already converted already into _buffer.
write_ulong(size + 1);
_offset += size;
}
- write_octet((byte) 0);
+ write_octet((byte)0);
}
- public void write_wstring(String value) {
- if (value == null) {
+ public void write_wstring(String value)
+ {
+ if (value == null)
+ {
value = "";
}
int size = value.length();
int numBytes = 2 * size;
write_ulong(numBytes); // No terminating NUL
write_align(1, numBytes);
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++)
+ {
char c = value.charAt(i);
- BigEndian.setShort(_buffer, _offset, (short) c);
+ BigEndian.setShort(_buffer, _offset, (short)c);
_offset += 2;
}
}
- public void write_boolean_array(boolean[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_boolean_array(boolean[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_boolean(value[offset + i]);
}
}
- public void write_char_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_char_array(char[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_char(value[offset + i]);
}
}
- public void write_wchar_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_wchar_array(char[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_wchar(value[offset + i]);
}
}
- public void write_octet_array(byte[] value, int offset, int length) {
+ public void write_octet_array(byte[] value, int offset, int length)
+ {
write_align(1, length);
System.arraycopy(value, offset, _buffer, _offset, length);
_offset += length;
}
- public void write_short_array(short[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_short_array(short[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_short(value[offset + i]);
}
}
- public void write_ushort_array(short[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_ushort_array(short[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_ushort(value[offset + i]);
}
}
- public void write_long_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_long_array(int[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_long(value[offset + i]);
}
}
- public void write_ulong_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_ulong_array(int[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_ulong(value[offset + i]);
}
}
- public void write_longlong_array(long[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_longlong_array(long[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_longlong(value[offset + i]);
}
}
- public void write_ulonglong_array(long[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_ulonglong_array(long[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_ulonglong(value[offset + i]);
}
}
- public void write_float_array(float[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_float_array(float[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_float(value[offset + i]);
}
}
- public void write_double_array(double[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
+ public void write_double_array(double[] value, int offset, int length)
+ {
+ for (int i = 0; i < length; i++)
+ {
write_double(value[offset + i]);
}
}
- public void write_Object(org.omg.CORBA.Object value) {
- if (value == null) {
+ public void write_Object(org.omg.CORBA.Object value)
+ {
+ if (value == null)
+ {
write_IOR(null);
- } else if (value instanceof ObjectRef) {
- ObjectRef ref = (ObjectRef) value;
+ }
+ else if (value instanceof ObjectRef)
+ {
+ ObjectRef ref = (ObjectRef)value;
IOR ior = ref.$getIOR();
write_IOR(ior);
- } else {
+ }
+ else
+ {
throw new org.omg.CORBA.MARSHAL(value.getClass().getName());
}
}
- public void write_TypeCode(org.omg.CORBA.TypeCode tc) {
+ public void write_TypeCode(org.omg.CORBA.TypeCode tc)
+ {
write_TypeCode(tc, new java.util.HashMap());
}
- public void write_Any(org.omg.CORBA.Any value) {
+ public void write_Any(org.omg.CORBA.Any value)
+ {
org.omg.CORBA.TypeCode tc = value.type();
write_TypeCode(tc);
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 {
+ public void write_Any(org.omg.CORBA.portable.InputStream is, org.omg.CORBA.TypeCode tc)
+ {
+ try
+ {
int tk = tc.kind().value();
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_null:
case TCKind._tk_void:
break;
@@ -633,7 +755,8 @@
{
int n = tc.length();
org.omg.CORBA.TypeCode c = tc.content_type();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
write_Any(is, c);
}
}
@@ -643,7 +766,8 @@
int n = is.read_ulong();
write_ulong(n);
org.omg.CORBA.TypeCode c = tc.content_type();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
write_Any(is, c);
}
}
@@ -652,7 +776,8 @@
case TCKind._tk_except:
{
int n = tc.member_count();
- for (int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++)
+ {
write_Any(is, tc.member_type(i));
}
}
@@ -664,13 +789,16 @@
write_Any(disc.create_input_stream(), dt);
int di = tc.default_index();
int i, n = tc.member_count();
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++)
+ {
org.omg.CORBA.Any label = tc.member_label(i);
- if (label.equal(disc)) {
+ if (label.equal(disc))
+ {
write_Any(is, tc.member_type(i));
}
}
- if (i == n && di >= 0) {
+ if (i == n && di >= 0)
+ {
write_Any(is, tc.member_type(di));
}
}
@@ -680,9 +808,13 @@
default:
throw new org.omg.CORBA.MARSHAL("write_Any: type = " + tc);
}
- } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+ {
throw new org.omg.CORBA.MARSHAL("write_Any: " + ex.toString());
- } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.Bounds ex)
+ {
throw new org.omg.CORBA.MARSHAL("write_Any: " + ex.toString());
}
}
@@ -739,10 +871,11 @@
// doing this specifically to handle Any. This implementation
// could be worng but will work for us
- public org.omg.CORBA.portable.InputStream create_input_stream() {
+ public org.omg.CORBA.portable.InputStream create_input_stream()
+ {
CdrInputStream is = CdrInputStream.getInstance();
is._buffer = new byte[_buffer.length];
- System.arraycopy(_buffer, 0, is._buffer, 0, _buffer.length);
+ System.arraycopy(_buffer,0,is._buffer,0,_buffer.length);
is._length = _buffer.length;
is._offset = 0;
return is;
@@ -752,51 +885,63 @@
// protected methods
// -----------------------------------------------------------------------
- protected void pool(byte[] oldBuffer) {
- if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH) {
+ protected void pool(byte[] oldBuffer)
+ {
+ if (oldBuffer.length <= MAXIMUM_POOLED_BUFFER_LENGTH)
+ {
_pooledBuffer = oldBuffer;
}
}
- protected final void write_ushort_no_align_big_endian(int value) {
+ protected final void write_ushort_no_align_big_endian(int value)
+ {
int oldOffset = _offset;
_offset += 2;
- BigEndian.setShort(_buffer, oldOffset, (short) value);
+ BigEndian.setShort(_buffer, oldOffset, (short)value);
}
- protected void write_IOR(IOR ior) {
- if (ior == null) {
+ protected void write_IOR(IOR ior)
+ {
+ if (ior == null)
+ {
ior = NULL_IOR;
}
IORHelper.write(this, ior);
}
- public int begin() {
+ public int begin()
+ {
write_ulong(0);
int saveOffset = _offset;
write_boolean(false);
return saveOffset;
}
- public void end(int saveOffset) {
+ public void end(int saveOffset)
+ {
int endOffset = _offset;
_offset = saveOffset - 4;
write_ulong(endOffset - saveOffset);
_offset = endOffset;
}
- private void write_TypeCode(org.omg.CORBA.TypeCode tc, java.util.HashMap table) {
- try {
+ private void write_TypeCode(org.omg.CORBA.TypeCode tc, java.util.HashMap table)
+ {
+ try
+ {
int tk = tc.kind().value();
// Check if we need to write an indirection
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_struct:
case TCKind._tk_union:
case TCKind._tk_value:
String id = tc.id();
- if (!id.equals("")) {
- Integer key = (Integer) table.get(id);
- if (key != null) {
+ if (! id.equals(""))
+ {
+ Integer key = (Integer)table.get(id);
+ if (key != null)
+ {
write_ulong(0xffffffff);
write_long(key.intValue() - _offset);
return;
@@ -805,7 +950,8 @@
}
}
write_ulong(tk);
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_null:
case TCKind._tk_void:
case TCKind._tk_TypeCode:
@@ -869,7 +1015,8 @@
write_string(tc.name());
int count = tc.member_count();
write_ulong(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
write_string(tc.member_name(i));
}
end(saveOffset);
@@ -883,7 +1030,8 @@
write_string(tc.name());
int count = tc.member_count();
write_ulong(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
write_string(tc.member_name(i));
write_TypeCode(tc.member_type(i), table);
}
@@ -901,7 +1049,8 @@
write_ulong(di);
int count = tc.member_count();
write_ulong(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
write_Any(tc.member_label(i).create_input_stream(), dt);
write_string(tc.member_name(i));
write_TypeCode(tc.member_type(i), table);
@@ -918,7 +1067,8 @@
write_TypeCode(tc.concrete_base_type(), table);
int count = tc.member_count();
write_ulong(count);
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
write_string(tc.member_name(i));
write_TypeCode(tc.member_type(i), table);
write_short(tc.member_visibility(i));
@@ -929,24 +1079,34 @@
default:
throw new org.omg.CORBA.MARSHAL("write_TypeCode: kind = " + tk);
}
- } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+ {
throw new org.omg.CORBA.MARSHAL(ex.toString());
- } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.Bounds ex)
+ {
throw new org.omg.CORBA.MARSHAL(ex.toString());
}
}
- private org.omg.CORBA.Any read_disc(org.omg.CORBA.portable.InputStream is, org.omg.CORBA.TypeCode dt) {
+ private org.omg.CORBA.Any read_disc(org.omg.CORBA.portable.InputStream is, org.omg.CORBA.TypeCode dt)
+ {
int tk = dt.kind().value();
- if (tk == TCKind._tk_alias) {
- try {
+ if (tk == TCKind._tk_alias)
+ {
+ try
+ {
return read_disc(is, dt.content_type());
- } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex)
+ {
throw new org.omg.CORBA.MARSHAL("read_disc: " + ex.toString());
}
}
org.omg.CORBA.Any disc = new org.apache.geronimo.interop.rmi.iiop.Any();
- switch (tk) {
+ switch (tk)
+ {
case TCKind._tk_boolean:
disc.insert_boolean(is.read_boolean());
break;
Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CorbaObject.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CorbaObject.java?view=auto&rev=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CorbaObject.java (added)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/CorbaObject.java Fri Mar 25 03:54:30 2005
@@ -0,0 +1,78 @@
+/**
+ *
+ * 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 org.omg.CORBA.*;
+
+public class CorbaObject implements org.omg.CORBA.Object {
+ // -----------------------------------------------------------------------
+ // unimplemented public methods (only required for full CORBA ORB)
+ // -----------------------------------------------------------------------
+
+ public boolean _is_a(String id) {
+ return false;
+ }
+
+ public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context p1, String p2, org.omg.CORBA.NVList p3, org.omg.CORBA.NamedValue p4) {
+ throw new org.omg.CORBA.BAD_OPERATION("_create_request");
+ }
+
+ public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context p1, String p2, org.omg.CORBA.NVList p3, org.omg.CORBA.NamedValue p4, org.omg.CORBA.ExceptionList p5, org.omg.CORBA.ContextList p6) {
+ throw new org.omg.CORBA.BAD_OPERATION("_create_request");
+ }
+
+ public org.omg.CORBA.Object _duplicate() {
+ throw new org.omg.CORBA.BAD_OPERATION("_duplicate");
+ }
+
+ public org.omg.CORBA.DomainManager[] _get_domain_managers() {
+ throw new org.omg.CORBA.BAD_OPERATION("_get_domain_manager");
+ }
+
+ public org.omg.CORBA.Object _get_interface_def() {
+ throw new org.omg.CORBA.BAD_OPERATION("_get_interface_def");
+ }
+
+ public org.omg.CORBA.Policy _get_policy(int p1) {
+ throw new org.omg.CORBA.BAD_OPERATION("_get_policy");
+ }
+
+ public int _hash(int p1) {
+ throw new org.omg.CORBA.BAD_OPERATION("_hash");
+ }
+
+ public boolean _is_equivalent(org.omg.CORBA.Object p1) {
+ throw new org.omg.CORBA.BAD_OPERATION("_is_equivalent");
+ }
+
+ public boolean _non_existent() {
+ throw new org.omg.CORBA.BAD_OPERATION("_non_existent");
+ }
+
+ public void _release() {
+ throw new org.omg.CORBA.BAD_OPERATION("_release");
+ }
+
+ public org.omg.CORBA.Request _request(String p1) {
+ throw new org.omg.CORBA.BAD_OPERATION("_request");
+ }
+
+ public org.omg.CORBA.Object _set_policy_override(org.omg.CORBA.Policy[] p1, org.omg.CORBA.SetOverrideType p2) {
+ throw new org.omg.CORBA.BAD_OPERATION("_set_policy_override");
+ }
+}
Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/FieldByNameComparator.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/FieldByNameComparator.java?view=diff&r1=159004&r2=159005
==============================================================================
--- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/FieldByNameComparator.java (original)
+++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop/FieldByNameComparator.java Fri Mar 25 03:54:30 2005
@@ -17,23 +17,25 @@
*/
package org.apache.geronimo.interop.rmi.iiop;
-import java.lang.reflect.Field;
-import java.util.Comparator;
-
+import java.lang.reflect.*;
+import java.util.*;
/**
- * * Sort fields by name only.
- */
-public class FieldByNameComparator implements Comparator {
+ ** Sort fields by name only.
+ **/
+public class FieldByNameComparator implements Comparator
+{
public static final FieldByNameComparator SINGLETON = new FieldByNameComparator();
- public int compare(Object x, Object y) {
- Field a = (Field) x;
- Field b = (Field) y;
+ public int compare(Object x, Object y)
+ {
+ Field a = (Field)x;
+ Field b = (Field)y;
return a.getName().compareTo(b.getName());
}
- public boolean equals(Object x) {
+ public boolean equals(Object x)
+ {
// shouldn't be used
return false;
}
|