Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 10647 invoked from network); 28 Mar 2005 20:37:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Mar 2005 20:37:49 -0000 Received: (qmail 63582 invoked by uid 500); 28 Mar 2005 20:37:48 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 63547 invoked by uid 500); 28 Mar 2005 20:37:48 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 63532 invoked by uid 99); 28 Mar 2005 20:37:48 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 28 Mar 2005 12:37:46 -0800 Received: (qmail 10639 invoked by uid 65534); 28 Mar 2005 20:37:45 -0000 Message-ID: <20050328203745.10637.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Mon, 28 Mar 2005 20:37:44 -0000 Subject: svn commit: r159303 [2/2] - in geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi/iiop: ./ client/ compiler/ server/ To: scm@geronimo.apache.org From: delafran@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/= rmi/iiop/PutField.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/PutField.java?view=3Dauto&rev=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/PutField.java (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/PutField.java Mon Mar 28 12:37:40 2005 @@ -0,0 +1,360 @@ +/** + * + * 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 implie= d=2E + * + * 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.ObjectOutputStream.PutField + ** Provide programatic access to the persistent fields to be written + ** to ObjectOutput. + **/ + +public class PutField extends java.io.ObjectOutputStream.PutField +{ + /** class descriptor describing serializable fields */ + private final ObjectStreamClass desc; + /** primitive field values */ + private final byte[] primVals; + /** object field values */ + private final Object[] objVals; + + private int primDataSize =3D 0; + private int numObjFields =3D 0; + private ObjectStreamField[] _fields =3D null; + + private static Method setOffsetMethod; + + static + { + try + { + Class osFieldClass =3D java.io.ObjectStreamField.class; + Class[] params =3D new Class[1]; + params[0] =3D int.class; + setOffsetMethod =3D osFieldClass.getDeclaredMethod("setOffset"= , params); + setOffsetMethod.setAccessible(true); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + /** + * Creates PutField object for writing fields defined in given + * class descriptor. + */ + PutField(ObjectStreamClass desc) + { + this.desc =3D desc; + computeOffsets(); + primVals =3D new byte[primDataSize]; + objVals =3D new Object[numObjFields]; + } + + /** + * Put the value of the named boolean field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, boolean val) + { + Bits.putBoolean(primVals, getFieldOffset(name, Boolean.TYPE), val); + } + + /** + * Put the value of the named byte field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, byte val) + { + primVals[getFieldOffset(name, Byte.TYPE)] =3D val; + } + + /** + * Put the value of the named char field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, char val) + { + Bits.putChar(primVals, getFieldOffset(name, Character.TYPE), val); + } + + /** + * Put the value of the named short field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, short val) + { + Bits.putShort(primVals, getFieldOffset(name, Short.TYPE), val); + } + + /** + * Put the value of the named int field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, int val) + { + Bits.putInt(primVals, getFieldOffset(name, Integer.TYPE), val); + } + + /** + * Put the value of the named long field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, long val) + { + Bits.putLong(primVals, getFieldOffset(name, Long.TYPE), val); + } + + /** + * Put the value of the named float field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, float val) + { + Bits.putFloat(primVals, getFieldOffset(name, Float.TYPE), val); + } + + /** + * Put the value of the named double field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, double val) + { + Bits.putDouble(primVals, getFieldOffset(name, Double.TYPE), val); + } + + /** + * Put the value of the named Object field into the persistent field. + * + * @param name the name of the serializable field + * @param val the value to assign to the field + */ + public void put(String name, Object val) + { + objVals[getFieldOffset(name, Object.class)] =3D val; + } + + /** + * Write the data and fields to the specified ObjectOutput stream. + *=20 + * @param out the stream to write the data and fields to + * @throws IOException if I/O errors occur while writing to the + * underlying stream + * @deprecated This method does not write the values contained by this + * PutField object in a proper format, and may + * result in corruption of the serialization stream. The + * correct way to write PutField data is by + * calling the {@link java.io.ObjectOutputStream#writeFields()} + * method. + */ + public void write(ObjectOutput out) throws IOException + { + /* + * Applications should *not* use this method to write PutField + * data, as it will lead to stream corruption if the PutField + * object writes any primitive data (since block data mode is not + * unset/set properly, as is done in OOS.writeFields()). This + * broken implementation is being retained solely for behavioral + * compatibility, in order to support applications which use + * OOS.PutField.write() for writing only non-primitive data. + *=20 + * Serialization of unshared objects is not implemented here since + * it is not necessary for backwards compatibility; also, unshared + * semantics may not be supported by the given ObjectOutput + * instance. Applications which write unshared objects using the + * PutField API must use OOS.writeFields(). + */ + throw new IOException("PutField.write(ObjectOutput) - not supporte= d for RMI/IIOP"); + } + + /** + * Writes buffered primitive data and object fields to stream. + */ + void writeFields(ObjectOutputStream o) throws IOException + { + org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream out =3D (o= rg.apache.geronimo.interop.rmi.iiop.ObjectOutputStream)o; + + out._cdrOutput.write_align(4, 4); // write any necessary padding + + //Write out the primitive values first + for(int i =3D 0; i < primVals.length; i++) + { + out.writeByte(primVals[i]); + } + + //Write out the object fields + java.io.ObjectStreamField[] fields =3D desc.getFields(); + int numPrimFields =3D fields.length - objVals.length; + for (int i =3D 0; i < objVals.length; i++) + { + out.writeObject(ValueType.getInstance(objVals[i].getClass()), = objVals[i]); + } + } + + /** + * Returns offset of field with given name and type. A specified type + * of null matches all types, Object.class matches all non-primitive + * types, and any other non-null type matches assignable types only. + * Throws IllegalArgumentException if no matching field found. + */ + private int getFieldOffset(String name, Class type) + { + ObjectStreamField field =3D getField(name, type); + if (field =3D=3D null) + { + throw new IllegalArgumentException("no such field"); + } + return field.getOffset(); + } + + private ObjectStreamField getField(String name, Class type) + { + if(type =3D=3D null) + { + //Return match by name + for(int i =3D 0; i < _fields.length; i++) + { + if(_fields[i].getName().equals(name)) + { + return _fields[i]; + } + } + return (ObjectStreamField)null; + } + else if(type =3D=3D java.lang.Object.class) + { + //Return match for name, and any non-primitive type + for(int i =3D 0; i < _fields.length; i++) + { + if(_fields[i].getName().equals(name) && !_fields[i].getTyp= e().isPrimitive()) + { + return _fields[i]; + } + } + return (ObjectStreamField)null; + } + else + { + for(int i =3D 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.Ex= ceptionUtil.causedBy(e)); + } + } + + private void computeFieldOffsets() throws Exception + { + primDataSize =3D 0; + numObjFields =3D 0; + int firstObjIndex =3D -1; + java.io.ObjectStreamField[] fields =3D desc.getFields(); + _fields =3D new ObjectStreamField[fields.length]; + Object[] args =3D new Object[1]; + + for (int i =3D 0; i < fields.length; i++) + { + java.io.ObjectStreamField f =3D fields[i]; + _fields[i] =3D new ObjectStreamField(fields[i].getName(), fiel= ds[i].getType()); + ObjectStreamField _f =3D _fields[i]; + =20 + switch (f.getTypeCode()) + { + case 'Z': + case 'B': + args[0] =3D new Integer(primDataSize++); + setOffsetMethod.invoke(_f, args); + break; + + case 'C': + case 'S': + args[0] =3D new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize +=3D 2; + break; + + case 'I': + case 'F': + args[0] =3D new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize +=3D 4; + break; + + case 'J': + case 'D': + args[0] =3D new Integer(primDataSize); + setOffsetMethod.invoke(_f, args); + primDataSize +=3D 8; + break; + + case '[': + case 'L': + args[0] =3D new Integer(numObjFields++); + setOffsetMethod.invoke(_f, args); + if (firstObjIndex =3D=3D -1) + { + firstObjIndex =3D i; + } + break; + + default: + break; + } + } + if (firstObjIndex !=3D -1 && firstObjIndex + numObjFields !=3D fie= lds.length) + { =20 + //throw new InvalidClassException(name, "illegal field order"); + } + } + +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/RemoteInterface.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/RemoteInterface.java?view=3Ddiff&r1=3D= 159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/RemoteInterface.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/RemoteInterface.java Mon Mar 28 12:37:40 2005 @@ -19,9 +19,9 @@ =20 import org.apache.geronimo.interop.adapter.Adapter; =20 -public interface RemoteInterface { +public interface RemoteInterface=20 +{ public ObjectRef getObjectRef(); -// public RemoteInterface $getSkeleton(); + public void invoke(String method, byte[] objectKey, Adapter adapter,= ObjectInputStream input, ObjectOutputStream output); -// public void $invoke(String method, byte[] objectKey, ObjectInputStre= am input, ObjectOutputStream output); } Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/= rmi/iiop/SimpleIDL.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/SimpleIDL.java?view=3Dauto&rev=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleIDL.java (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleIDL.java Mon Mar 28 12:37:40 2005 @@ -0,0 +1,23 @@ +/** + * + * 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 implie= d=2E + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.interop.rmi.iiop; + +public interface SimpleIDL +{ + // Intentionally empty. +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/SimpleObjectInputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/SimpleObjectInputStream.java?view=3Ddi= ff&r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleObjectInputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleObjectInputStream.java Mon Mar 28 12:37:40 2005 @@ -24,8 +24,6 @@ =20 public class SimpleObjectInputStream extends ObjectInputStream { - //public static final Component component =3D new Component(SimpleObje= ctInputStream.class); - public static ObjectInputStream getInstance() { ObjectInputStream ois =3D null; @@ -34,7 +32,7 @@ } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use = File | Settings | File Templates. } - return ois; // getInstance(CdrInputStream.getInstance()); + return ois; } =20 public static ObjectInputStream getInstance(byte[] bytes) @@ -44,14 +42,14 @@ =20 public static ObjectInputStream getInstance(org.apache.geronimo.intero= p=2Ermi.iiop.CdrInputStream cdrInput) { - ObjectInputStream input =3D getInstance(); // (SimpleObjectInputSt= ream)component.getInstance(); + ObjectInputStream input =3D getInstance(); input.init(cdrInput); return input; } =20 public static ObjectInputStream getPooledInstance() { - ObjectInputStream input =3D null; // (SimpleObjectInputStream)_poo= l=2Eget(); + ObjectInputStream input =3D null; if (input =3D=3D null) { input =3D getInstance(); @@ -63,8 +61,6 @@ // private data // -------------------------------------------------------------------= ---- =20 - //private static ThreadLocalInstancePool _pool =3D new ThreadLocalInst= ancePool(SimpleObjectInputStream.class.getName()); - // -------------------------------------------------------------------= ---- // public methods // -------------------------------------------------------------------= ---- @@ -82,7 +78,6 @@ public void recycle() { $reset(); - //_pool.put(this); } =20 public Exception readException(ValueType type) Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/SimpleObjectOutputStream.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/SimpleObjectOutputStream.java?view=3Dd= iff&r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleObjectOutputStream.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SimpleObjectOutputStream.java Mon Mar 28 12:37:40 2005 @@ -24,8 +24,6 @@ =20 public class SimpleObjectOutputStream extends ObjectOutputStream { - //public static final Component component =3D new Component(SimpleObje= ctOutputStream.class); - public static ObjectOutputStream getInstance() { ObjectOutputStream oos =3D null; @@ -34,19 +32,19 @@ } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use = File | Settings | File Templates. } - return oos; // getInstance(CdrOutputStream.getInstance()); + return oos; } =20 public static ObjectOutputStream getInstance(CdrOutputStream cdrOutput= ) { - ObjectOutputStream output =3D getInstance(); // (SimpleObjectOutpu= tStream)component.getInstance(); + ObjectOutputStream output =3D getInstance(); output.init(cdrOutput); return output; } =20 public static ObjectOutputStream getPooledInstance() { - ObjectOutputStream output =3D null; // (SimpleObjectOutputStream)_= pool.get(); + ObjectOutputStream output =3D null; if (output =3D=3D null) { output =3D getInstance(); @@ -58,8 +56,6 @@ // private data // -------------------------------------------------------------------= ---- =20 - //private static ThreadLocalInstancePool _pool =3D new ThreadLocalInst= ancePool(SimpleObjectOutputStream.class.getName()); - // -------------------------------------------------------------------= ---- // public methods // -------------------------------------------------------------------= ---- @@ -77,7 +73,6 @@ public void recycle() { $reset(); - //_pool.put(this); } =20 public void writeException(ValueType type, Exception value) Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/StringSeqHelper.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/StringSeqHelper.java?view=3Ddiff&r1=3D= 159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHelper.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHelper.java Mon Mar 28 12:37:40 2005 @@ -17,14 +17,6 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -/** - ** Generated by Sybase EAServer 5.0 - Thu Nov 04 15:51:10 NZDT 2004 - ** - ** from com::sybase::djc::rmi::iiop::StringSeq (file C:/easme/build/idl= /com-sybase-djc-rmi-iiop.idl, line 13). - ** - ** Please do not modify this file. - **/ - public abstract class StringSeqHelper { public static java.lang.String[] clone @@ -104,6 +96,6 @@ =20 public static java.lang.String id() { - return "IDL:com/sybase/djc/rmi/iiop/StringSeq:1.0"; + return "IDL:org/apache/geronimo/interop/rmi/iiop/StringSeq:1.0"; } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/StringSeqHolder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/StringSeqHolder.java?view=3Ddiff&r1=3D= 159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHolder.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHolder.java Mon Mar 28 12:37:40 2005 @@ -17,14 +17,6 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -/** - ** Generated by Sybase EAServer 5.0 - Thu Nov 04 15:51:10 NZDT 2004 - ** - ** from com::sybase::djc::rmi::iiop::StringSeq (file C:/easme/build/idl= /com-sybase-djc-rmi-iiop.idl, line 13). - ** - ** Please do not modify this file. - **/ - public final class StringSeqHolder implements org.omg.CORBA.portable.Strea= mable { public java.lang.String[] value; Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/TypeCode.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/TypeCode.java?view=3Ddiff&r1=3D159302&= r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/TypeCode.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/TypeCode.java Mon Mar 28 12:37:40 2005 @@ -281,7 +281,6 @@ return default_id(); } =20 - // Sybase-internal /** * @param id */ @@ -338,7 +337,6 @@ return _name; } =20 - // Sybase-internal /** * @param name */ @@ -365,7 +363,6 @@ return _member_name.length; } =20 - // Sybase-internal /** * @param count */ @@ -407,7 +404,6 @@ return _member_name[index]; } =20 - // Sybase-internal /** * @param index * @param name @@ -441,7 +437,6 @@ return _member_type[index]; } =20 - // Sybase-internal /** * @param index * @param type @@ -475,7 +470,6 @@ return _member_label[index]; } =20 - // Sybase-internal /** * @param index * @param label @@ -504,7 +498,6 @@ return _ref; } =20 - // Sybase-internal /** * @param disc */ @@ -531,7 +524,6 @@ return _default; } =20 - // Sybase-internal /** * @param index */ @@ -567,7 +559,6 @@ return _length; } =20 - // Sybase-internal /** * @param length */ @@ -601,7 +592,6 @@ return _ref; } =20 - // Sybase-internal /** * @param type */ @@ -629,7 +619,6 @@ return _digits; } =20 - // Sybase-internal /** * @param digits */ @@ -657,7 +646,6 @@ return _scale; } =20 - // Sybase-internal /** * @param scale */ @@ -691,7 +679,6 @@ return _member_visibility[index]; } =20 - // Sybase-internal /** * @param index * @param visibility @@ -720,7 +707,6 @@ return _type_modifier; } =20 - // Sybase-internal /** * @param modifier */ @@ -748,7 +734,6 @@ return _ref; } =20 - // Sybase-internal /** * @param base */ @@ -757,7 +742,6 @@ _ref =3D base; } =20 - // Sybase-internal /** * @param ref */ @@ -767,7 +751,6 @@ _indirection =3D true; } =20 - // Sybase-internal /** * @param id */ @@ -778,7 +761,6 @@ _indirection =3D true; } =20 - // Sybase-internal /** * */ Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/ValueType.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/ValueType.java?view=3Ddiff&r1=3D159302= &r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/ValueType.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/ValueType.java Mon Mar 28 12:37:40 2005 @@ -26,10 +26,13 @@ import java.util.*; import org.omg.CORBA.TCKind; =20 +/** + ** A wrapper over java.lang.Class to help improve performance of using + ** the Java reflection API for valuetype marshalling. We keep as much + ** derived information as possible for optimal performance. + **/ public class ValueType { - //public static final Component component =3D new Component(ValueType.= class); - public static ValueType getInstance(Class forClass) { ValueType vt =3D (ValueType)_valueTypeMap.get(forClass); @@ -40,7 +43,6 @@ vt =3D (ValueType)_valueTypeMap.get(forClass); if (vt =3D=3D null) { - //vt =3D (ValueType)component.getInstance(); vt =3D new ValueType(); _valueTypeMap.put(forClass, vt); vt.init(forClass); @@ -524,14 +526,14 @@ { final String sixteenZeros =3D "0000000000000000"; final int requiredLength =3D 16; - if (isAny) + /* if (isAny) { id =3D "#ANY-TODO#"; return; - } + }*/ if (isArray && primitiveArray !=3D 0) { - id =3D "#ARRAY-TODO#"; + id =3D "RMI:" + _class.getName() + ":" + sixteenZeros; return; } if (_class =3D=3D String.class) @@ -551,8 +553,7 @@ } if (_class =3D=3D java.math.BigInteger.class) { - id =3D "RMI:java.math.BigInteger:8CAD1A3C6C0A9DF0:8CFC9F1FA93B= FB1D"; - skipCustomFlags =3D true; // TODO: move this and check usage + id =3D "RMI:java.math.BigInteger:E2F79B6E7A470003:8CFC9F1FA93B= FB1D"; return; } if (_objectStreamClass =3D=3D null) @@ -759,6 +760,11 @@ { throw new org.omg.CORBA.INV_IDENT(id); } + } + + public Class getTheClass() + { + return _class; } =20 static Class loadClass(String className) Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/ClientNamingContext.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/ClientNamingContext.java?view= =3Ddiff&r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/ClientNamingContext.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/ClientNamingContext.java Mon Mar 28 12:37:40 2005 @@ -17,9 +17,7 @@ */ package org.apache.geronimo.interop.rmi.iiop.client; =20 -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Random; +import java.util.*; import javax.naming.Context; import javax.naming.Name; import javax.naming.NameNotFoundException; @@ -36,14 +34,19 @@ import org.apache.geronimo.interop.rmi.iiop.compiler.StubFactory; import org.apache.geronimo.interop.util.ExceptionUtil; =20 -public class ClientNamingContext implements Context, java.io.Serializable = { +public class ClientNamingContext implements Context, java.io.Serializable=20 +{ =20 - public static ClientNamingContext getInstance(Hashtable env) { + public static ClientNamingContext getInstance(Hashtable env) + { ClientNamingContext nc =3D (ClientNamingContext) contextMap.get(en= v); - if (nc =3D=3D null) { - synchronized (contextMap) { + if (nc =3D=3D null) + { + synchronized (contextMap) + { nc =3D (ClientNamingContext) contextMap.get(env); - if (nc =3D=3D null) { + if (nc =3D=3D null)=20 + { nc =3D new ClientNamingContext(); nc.init(env); contextMap.put(env, nc); @@ -53,54 +56,72 @@ return nc; } =20 - public static final StringProperty usernameProperty =3D - new StringProperty(SystemProperties.class, "java.naming.securi= ty.principal"); - - public static final StringProperty passwordProperty =3D - new StringProperty(SystemProperties.class, "java.naming.securi= ty.credentials"); =20 public static final IntProperty idleConnectionTimeoutProperty =3D - new IntProperty(SystemProperties.class, "org.apache.geronimo.i= nterop.rmi.idleConnectionTimeout") - .defaultValue(60); // seconds + new IntProperty(SystemProperties.class, "idleConnectionTimeout") + .defaultValue(60); // 60 seconds + + public static final IntProperty lookupCacheTimeoutProperty =3D + new IntProperty(SystemProperties.class, "lookupCacheTimeout") + .defaultValue(600); // 10 minutes + + public static final StringProperty usernameSystemProperty =3D + new StringProperty(SystemProperties.class, "java.naming.security.p= rincipal"); =20 - private static int idleConnectionTimeout =3D - idleConnectionTimeoutProperty.getInt(); + public static final StringProperty passwordSystemProperty =3D + new StringProperty(SystemProperties.class, "java.naming.security.c= redentials"); =20 - private static int namingContextCacheTimeout =3D - SystemProperties.rmiNamingContextCacheTimeoutProperty.getInt()= ; + private static long idleConnectionTimeout; + + private static long lookupCacheTimeout; + + private static int socketTimeout; =20 private static HashMap contextMap =3D new HashMap(); + private static HashMap hostListCache =3D new HashMap(); - private static HashMap multiHostMap =3D new HashMap(); - private static Random random =3D new Random(); + +// private ArrayList requestKeys; + private HashMap cache =3D new HashMap(); + private Hashtable env; + private ConnectionPool connectionPool; + private PropertyMap connectionProperties; + static private HashMap nameMap =3D new HashMap(); - private String prefix; + private String username; + private String password; =20 + private String namePrefix; + private org.apache.geronimo.interop.CosNaming.NamingContext serverNami= ngContext; =20 public ConnectionPool getConnectionPool() { return connectionPool; } =20 - public PropertyMap getConnectionProperties() { + public PropertyMap getConnectionProperties() + { return connectionProperties; } =20 - public int getIdleConnectionTimeout() { + public long getIdleConnectionTimeout() + { return idleConnectionTimeout; } =20 - public String getUsername() { + public String getUsername() + { return username; } =20 - public String getPassword() { + public String getPassword() + { return password; } =20 @@ -268,11 +289,11 @@ throw new OperationNotSupportedException(); } =20 - protected void init(Hashtable env) { - env =3D env; + protected void init(Hashtable env)=20 + { + this.env =3D env; Object urlObject =3D env.get(Context.PROVIDER_URL); if (urlObject =3D=3D null) { - System.out.println("ClientNamingContext.init(): TODO: urlObjec= t was null, create one based on the current hostname."); urlObject =3D SystemProperties.getInstance().getProperty("java= .naming.provider.url", "iiop:/= /" + "delafran-t30" + ":2000"); } @@ -280,59 +301,88 @@ UrlInfo urlInfo =3D UrlInfo.getInstance(url); serverNamingContext =3D (org.apache.geronimo.interop.CosNaming.Nam= ingContext) StubFactory.getInstance().getStub(org.apache.geronimo.inte= rop.CosNaming.NamingContext.class); + + namePrefix =3D urlInfo.getNamePrefix(); + ObjectRef ncRef =3D (ObjectRef) serverNamingContext; ncRef.$setNamingContext(this); ncRef.$setProtocol(urlInfo.getProtocol()); ncRef.$setHost("ns~" + urlInfo.getHost()); ncRef.$setPort(urlInfo.getPort()); ncRef.$setObjectKey(urlInfo.getObjectKey()); - connectionProperties =3D urlInfo.getProperties(); connectionPool =3D ConnectionPool.getInstance(this); Object u =3D env.get(Context.SECURITY_PRINCIPAL); Object p =3D env.get(Context.SECURITY_CREDENTIALS); - if (u =3D=3D null) { - u =3D usernameProperty.getString(); + if (u =3D=3D null) + { + u =3D usernameSystemProperty.getString(); } - if (p =3D=3D null) { - p =3D passwordProperty.getString(); + if (p =3D=3D null) + { + p =3D passwordSystemProperty.getString(); } username =3D u !=3D null ? u.toString() : null; password =3D p !=3D null ? p.toString() : null; =20 - /* - if (_serverNamingContext._is_a("IDL:org.apache.geronimo.interop/rm= i/iiop/NameService:1.0")) + PropertyMap props =3D urlInfo.getProperties(); + props.putAll(env); + PropertyMap copyProps =3D new PropertyMap(); + copyProps.putAll(props); + for (Iterator i =3D copyProps.entrySet().iterator(); i.hasNext();) { - _serverNamingContext =3D (org.apache.geronimo.interop.rmi.iiop= .NameService) - StubFactory.getInstance().getStub(org.apache.geronimo.inte= rop.rmi.iiop.NameService.class); - ncRef =3D (ObjectRef)_serverNamingContext; - ncRef.$setNamingContext(this); - ncRef.$setProtocol(urlInfo.getProtocol()); - ncRef.$setHost("ns~" + urlInfo.getHost()); - ncRef.$setPort(urlInfo.getPort()); - ncRef.$setObjectKey(urlInfo.getObjectKey()); + Map.Entry entry =3D (Map.Entry)i.next(); + String property =3D (String)entry.getKey(); + Object value =3D entry.getValue(); + + String startsWith =3D "org.apache.geronimo.interop.rmi."; + if (property.startsWith(startsWith)) + { + int replace =3D startsWith.length(); + props.remove(property); + props.put(property.substring(replace), value); + } } - */ + for (Iterator i =3D SystemProperties.getInstance().entrySet().iter= ator(); i.hasNext();) + { + Map.Entry entry =3D (Map.Entry)i.next(); + String property =3D (String)entry.getKey(); + Object value =3D entry.getValue(); + if (property.startsWith("djc.")) + { + props.put(property.substring(4), value); + } + } + connectionProperties =3D props; + idleConnectionTimeout =3D 1000 * idleConnectionTimeoutProperty.get= Int(url, props); + lookupCacheTimeout =3D 1000 * lookupCacheTimeoutProperty.getInt(ur= l, props); } =20 - protected NameBinding resolve(String name) throws NamingException { + protected NameBinding resolve(String name) throws NamingException + { Object value =3D org.apache.geronimo.interop.naming.NameService.ge= tInitialContext().lookupReturnNullIfNotFound(name); - if (value !=3D null) { + if (value !=3D null) + { NameBinding nb =3D new NameBinding(); nb.object =3D value; - nb.cacheTimeout =3D System.currentTimeMillis() + namingContext= CacheTimeout; + nb.cacheTimeout =3D System.currentTimeMillis() + lookupCacheTi= meout; return nb; } - try { + try + { org.apache.geronimo.interop.CosNaming.NameComponent[] resolveN= ame =3D - {new org.apache.geronimo.interop.CosNaming.NameCompone= nt(name, "")}; + { new org.apache.geronimo.interop.CosNaming.NameComponent(= namePrefix + name, "") }; org.omg.CORBA.Object object =3D serverNamingContext.resolve(re= solveName); NameBinding nb =3D new NameBinding(); nb.object =3D object; - nb.cacheTimeout =3D System.currentTimeMillis() + namingContext= CacheTimeout; + nb.cacheTimeout =3D System.currentTimeMillis() + lookupCacheTi= meout; return nb; - } catch (org.apache.geronimo.interop.CosNaming.NamingContextPackag= e=2ENotFound notFound) { + } + catch (org.apache.geronimo.interop.CosNaming.NamingContextPackage.= NotFound notFound) + { throw new NameNotFoundException(name); - } catch (Exception ex) { + } + catch (Exception ex) + { throw new javax.naming.NamingException(ExceptionUtil.getStackT= race(ex)); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/Connection.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/Connection.java?view=3Ddiff&r1= =3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/Connection.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/Connection.java Mon Mar 28 12:37:40 2005 @@ -18,6 +18,8 @@ package org.apache.geronimo.interop.rmi.iiop.client; =20 import java.net.Socket; +import java.io.IOException; +import java.lang.reflect.Constructor; =20 import org.apache.geronimo.interop.GIOP.*; import org.apache.geronimo.interop.IOP.*; @@ -26,25 +28,31 @@ import org.apache.geronimo.interop.properties.IntProperty; import org.apache.geronimo.interop.properties.PropertyMap; import org.apache.geronimo.interop.properties.SystemProperties; -import org.apache.geronimo.interop.rmi.iiop.BadMagicException; -import org.apache.geronimo.interop.rmi.iiop.CdrInputStream; -import org.apache.geronimo.interop.rmi.iiop.CdrOutputStream; -import org.apache.geronimo.interop.rmi.iiop.GiopMessage; -import org.apache.geronimo.interop.rmi.iiop.ObjectRef; -import org.apache.geronimo.interop.rmi.iiop.SecurityInfo; -import org.apache.geronimo.interop.rmi.iiop.UnsupportedProtocolVersionExce= ption; +import org.apache.geronimo.interop.rmi.iiop.*; import org.apache.geronimo.interop.util.ExceptionUtil; import org.apache.geronimo.interop.util.InstancePool; import org.apache.geronimo.interop.util.StringUtil; import org.apache.geronimo.interop.util.ThreadContext; import org.apache.geronimo.interop.util.UTF8; =20 -public class Connection { +public class Connection=20 +{ =20 - public Connection() { + private static final byte reservedBA[] =3D new byte[] { 0, 0, 0}; + private int requestid_ =3D 0; + =20 + // http tunnelling related + private boolean httpTunnelled; + private String httpHeaders; + private String webProxyHost; + private int webProxyPort; + + public Connection() + { } =20 - public static Connection getInstance(String endpoint, ObjectRef object= Ref, PropertyMap connProps) { + public static Connection getInstance(String endpoint, ObjectRef object= Ref, PropertyMap connProps)=20 + { Connection conn =3D new Connection(); conn.init(endpoint, objectRef, connProps); return conn; @@ -55,40 +63,69 @@ =20 public static final IntProperty socketTimeoutProperty =3D new IntProperty(Connection.class, "socketTimeout") - .defaultValue(SystemProperties.rmiSocketTimeoutProperty.getInt= ()); + .defaultValue(600); // 10 minutes + + private static final boolean SIMPLE_IDL =3D simpleIDLProperty.getBoole= an(); + + private static final ServiceContext[] EMPTY_SERVICE_CONTEXT =3D {}; + + private static final byte[] CODE_SET_ENCAPSULATION =3D + { + (byte)0, // big endian + (byte)0, (byte)0, (byte)0, // padding + (byte)0x05, (byte)0x01, (byte)0x00, (byte)0x01, // 0x05010001 =3D = CodeSet ID for UTF-8 + (byte)0x00, (byte)0x01, (byte)0x01, (byte)0x09, // 0x00010109 =3D = CodeSet ID for UTF-16 + }; + + private static final ServiceContext CODE_SET_SERVICE_CONTEXT =3D new S= erviceContext(1, CODE_SET_ENCAPSULATION); =20 - private static final boolean SIMPLE_IDL =3D false; // simpleIDLPropert= y=2EgetBoolean(); - private ServiceContext[] EMPTY_SERVICE_CONTEXT =3D {}; private String url; + private boolean ok; + private InstancePool pool; - private String serverHost; + private Socket socket; + + protected org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input= ; + + protected org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream outp= ut; + private CdrOutputStream parameters; + private CdrOutputStream requestOut; + private CdrInputStream results; + private String exceptionType; + private Exception exception; + private RequestHeader_1_2 requestHeader; + private int callForget; =20 - private org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input; - private org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream output= ; =20 protected java.io.InputStream socketIn; + protected java.io.OutputStream socketOut; =20 - public String getInstanceName() { + public String getInstanceName()=20 + { return url; } =20 - public void close() { + public void close()=20 + { parameters =3D null; input =3D null; output =3D null; - if (ok) { + if (ok)=20 + { pool.put(this); - } else { + } + else + { shutdown(); } } @@ -101,62 +138,85 @@ public void forget(Object requestKey) { } =20 - public void invoke(ObjectRef object, String method, Object requestKey,= int retryCount) { - RequestHeader_1_2 request =3D requestHeader; + public void invoke(ObjectRef object, String method, Object requestKey,= int retryCount) + { + if(object.$getForwardingAddress() !=3D null) + { + object =3D object.$getForwardingAddress(); + } =20 - System.out.println( "object =3D " + object ); - System.out.println( "method =3D " + method ); - System.out.println( "requestKey =3D " + requestKey ); + RequestHeader_1_2 request =3D requestHeader; =20 - request.request_id =3D 0; + request.request_id =3D requestid_++; request.response_flags =3D 3; request.target =3D new TargetAddress(); request.target.object_key(object.$getObjectKey()); request.operation =3D method; request.service_context =3D getServiceContext(object, requestKey, = retryCount); + request.reserved =3D reservedBA; // Sun's generated org.omg.GIOP.= RequestHeader_1_2Helper wants this.... =20 - request.reserved =3D new byte[3]; // Sun's generated org.omg.GIOP= .RequestHeader_1_2Helper wants this.... - - if (requestOut =3D=3D null) { - System.out.println( "requestOut =3D=3D null" ); + if (requestOut =3D=3D null) + { requestOut =3D CdrOutputStream.getInstance(); } - System.out.println( "write_request" ); requestOut.write_request(request, parameters); =20 - try { - requestOut.send_message(socketOut, url);//_serverHost); + + try=20 + { + if(httpTunnelled) + { + requestOut.send_http_request(socketOut, url, httpHeaders); + } + else + { + requestOut.send_message(socketOut, url); + } } catch (RuntimeException ex) { - //if (object.$getAutomaticFailover()) - //{ - // throw new RetryInvokeException(ex); - //} throw ex; } =20 requestOut.reset(); =20 - if (results =3D=3D null) { + if (results =3D=3D null) + { results =3D CdrInputStream.getInstance(); - } else { + } + else + { results.reset(); } =20 results.setNamingContext(object.$getNamingContext()); GiopMessage message; - try { - message =3D results.receive_message(socketIn, url);//_serverHo= st); - } catch (BadMagicException ex) { + try + { + if(httpTunnelled) + { + message =3D results.receive_http_response(socketIn, url); + } + else + { + message =3D results.receive_message(socketIn, url);//_serv= erHost); + } + } + catch (BadMagicException ex) + { throw new SystemException(ex); - } catch (UnsupportedProtocolVersionException ex) { + } + catch (UnsupportedProtocolVersionException ex) + { throw new SystemException(ex); - } catch (RuntimeException ex) { + } + catch (RuntimeException ex) + { throw new RetryInvokeException(ex); } =20 - switch (message.type) { - case MsgType_1_1._Reply: - processReply(message.reply); + switch (message.type) + { + case MsgType_1_1._Reply: + processReply(message.reply, object); break; =20 default: @@ -224,23 +284,75 @@ } } =20 + public void clearException() + { + exceptionType =3D null; + exception =3D null; + } + // TODO: check why we have 'objectRef' parameter??? - protected void init(String endpoint, ObjectRef objectRef, PropertyMap = connProps) { + protected void init(String endpoint, ObjectRef objectRef, PropertyMap = connProps) + { + setHttpTunnelledPropsIfTrue(connProps); + + if(httpTunnelled) + { + httpInit(endpoint, connProps); + return; + } + url =3D "iiop://" + endpoint; UrlInfo urlInfo =3D UrlInfo.getInstance(url); String host =3D urlInfo.getHost(); int port =3D urlInfo.getPort(); int socketTimeout =3D socketTimeoutProperty.getInt(endpoint, connP= rops); - try { + try + { + socket =3D new Socket(host, port); + socketIn =3D socket.getInputStream(); + socketOut =3D socket.getOutputStream(); + socket.setSoTimeout(1000 * socketTimeout); + } + catch (Exception ex)=20 + { + throw new SystemException(ex); + } + requestHeader =3D new RequestHeader_1_2(); + requestHeader.reserved =3D reservedBA; + } + + private void httpInit(String endpoint, PropertyMap connProps) + { + String host =3D null; + int port; + url =3D "iiop://" + endpoint; + int socketTimeout =3D socketTimeoutProperty.getInt(endpoint, connP= rops); + + if(webProxyHost !=3D null) + { + host =3D webProxyHost; + port =3D webProxyPort; + } + else + { + UrlInfo urlInfo =3D UrlInfo.getInstance(url); + host =3D urlInfo.getHost(); + port =3D urlInfo.getPort(); + } + + try + { socket =3D new Socket(host, port); socketIn =3D socket.getInputStream(); socketOut =3D socket.getOutputStream(); socket.setSoTimeout(1000 * socketTimeout); - serverHost =3D host; - } catch (Exception ex) { - throw new SystemException(errorConnectFailed(host, port, ex)); + } + catch (IOException ex) + { + throw new SystemException(ex); } requestHeader =3D new RequestHeader_1_2(); + requestHeader.reserved =3D reservedBA; } =20 public ServiceContext[] getServiceContext(ObjectRef object, Object req= uestKey, int retryCount) { @@ -276,53 +388,53 @@ if (requestKey !=3D null) { count++; } - if (count =3D=3D 0) { - return EMPTY_SERVICE_CONTEXT; // avoid allocating empty array. - } ServiceContext[] context =3D new ServiceContext[count]; int index =3D 0; + context[index++] =3D CODE_SET_SERVICE_CONTEXT; if (username !=3D null) { context[index++] =3D new ServiceContext(SecurityInfo.TAG_USERN= AME, SecurityInfo.encode(username)); } if (password !=3D null) { context[index++] =3D new ServiceContext(SecurityInfo.TAG_PASSW= ORD, SecurityInfo.encode(password)); } - if (requestKey !=3D null) { - if (retryCount =3D=3D 0) { - // 'BF' indicates Before Failure - context[index++] =3D new ServiceContext(0xBFBFBFBF, UTF8.f= romString((String) requestKey)); - } else { - // 'AF' indicates After Failure - context[index++] =3D new ServiceContext(0xAFAFAFAF, UTF8.f= romString((String) requestKey)); - } - } return context; } =20 - protected void processReply(ReplyHeader_1_2 reply) { + protected void processReply(ReplyHeader_1_2 reply, ObjectRef object) + { processReplyServiceContext(reply); int status =3D reply.reply_status.value(); - switch (status) { - case ReplyStatusType_1_2._NO_EXCEPTION: - processNormalReply(reply); - break; - case ReplyStatusType_1_2._USER_EXCEPTION: - processUserException(reply); - break; - case ReplyStatusType_1_2._SYSTEM_EXCEPTION: - processSystemException(reply); - break; - case ReplyStatusType_1_2._LOCATION_FORWARD: - throw new SystemException("TODO"); - case ReplyStatusType_1_2._LOCATION_FORWARD_PERM: - throw new SystemException("TODO"); - case ReplyStatusType_1_2._NEEDS_ADDRESSING_MODE: - throw new SystemException("TODO"); - default: - throw new SystemException("reply status =3D " + status); + switch (status) + { + case ReplyStatusType_1_2._NO_EXCEPTION: + processNormalReply(reply); + break; + case ReplyStatusType_1_2._USER_EXCEPTION: + processUserException(reply); + break; + case ReplyStatusType_1_2._SYSTEM_EXCEPTION: + processSystemException(reply); + break; + case ReplyStatusType_1_2._LOCATION_FORWARD: + processLocationForward(reply, object); + break; + case ReplyStatusType_1_2._LOCATION_FORWARD_PERM: + processLocationForward(reply, object); + break; + case ReplyStatusType_1_2._NEEDS_ADDRESSING_MODE: + throw new SystemException("TODO"); + default: + throw new SystemException("reply status =3D " + status); } } =20 + protected void processLocationForward(ReplyHeader_1_2 reply, ObjectRef= object) + { + ObjectRef ref =3D (ObjectRef)results.read_Object(); + object.$setForwardingAddress(ref); + throw new RetryInvokeException(new RuntimeException("LOCATION_FORW= ARD")); + } + protected void processReplyServiceContext(ReplyHeader_1_2 reply) { ServiceContext[] list =3D reply.service_context; int n =3D list.length; @@ -341,35 +453,126 @@ // Intentionally empty. } =20 - protected void processUserException(ReplyHeader_1_2 reply) { + protected void processUserException(ReplyHeader_1_2 reply) + { exception =3D null; - exceptionType =3D results.read_string(); + String type =3D results.read_string(); + type =3D StringUtil.removePrefix(type, "IDL:"); + type =3D StringUtil.removeSuffix(type, ":1.0"); + if (! (input instanceof SimpleObjectInputStream)) + { + if (type.endsWith("Ex")) + { + type =3D StringUtil.removeSuffix(type, "Ex") + "Exception"= ; + } + } + type =3D type.replace('/', '.'); + exceptionType =3D type; ok =3D true; } =20 - protected void processSystemException(ReplyHeader_1_2 reply) { + protected void processSystemException(ReplyHeader_1_2 reply) + { exceptionType =3D "???"; SystemExceptionReplyBody replyBody =3D SystemExceptionReplyBodyHel= per.read(results); String id =3D replyBody.exception_id; + id =3D StringUtil.removePrefix(id, "IDL:CORBA/"); // ancient serve= rs might send this! id =3D StringUtil.removePrefix(id, "IDL:omg.org/CORBA/"); id =3D StringUtil.removeSuffix(id, ":1.0"); - String stackTrace =3D null; - if (results.hasMoreData()) { - stackTrace =3D results.read_string() + ExceptionUtil.getDivide= r(); + String causedBy =3D null; + if (results.hasMoreData()) + { + // This is non-standard for IIOP, but if the data isn't presen= t, + // we wont try to read it! + causedBy =3D ExceptionUtil.causedBy(results.read_string()); } ok =3D true; String exceptionClassName =3D "org.omg.CORBA." + id; - try { + try + { Class exceptionClass =3D ThreadContext.loadClass(exceptionClas= sName); - org.omg.CORBA.SystemException corbaException =3D (org.omg.CORB= A=2ESystemException) exceptionClass.newInstance(); + Constructor constructor =3D exceptionClass.getConstructor + ( + new Class[] { String.class } + ); + org.omg.CORBA.SystemException corbaException; + corbaException =3D (org.omg.CORBA.SystemException)constructor.= newInstance + ( + new Object[] { causedBy =3D=3D null ? "" : causedBy } + ); corbaException.minor =3D replyBody.minor_code_value; corbaException.completed =3D org.omg.CORBA.CompletionStatus.fr= om_int(replyBody.completion_status); - exception =3D new org.apache.geronimo.interop.SystemException(= stackTrace, corbaException); - } catch (Exception ex) { - exception =3D new org.apache.geronimo.interop.SystemException(= stackTrace, - n= ew org.omg.CORBA.UNKNOWN(replyBody.exception_id, - = replyBody.minor_code_value, - = org.omg.CORBA.CompletionStatus.from_int(replyBody.= completion_status))); + exception =3D corbaException; + } + catch (Exception ex) + { + // Shouldn't happen, but just in case + ex.printStackTrace(); + if (causedBy =3D=3D null) + { + causedBy =3D replyBody.exception_id; + } + else + { + causedBy =3D replyBody.exception_id + "\nCaused by: " + ca= usedBy; + } + exception =3D new org.omg.CORBA.UNKNOWN(causedBy, + replyBody.minor_code_value, + org.omg.CORBA.CompletionStatus.from_int(replyBody.completi= on_status)); + } + } + + private void setHttpTunnelledPropsIfTrue(PropertyMap connprops) + { + if(connprops.get("http") !=3D null) + { + httpTunnelled =3D true; + } + else + { + httpTunnelled =3D false; + } + + if(httpTunnelled) + { + // get http extra headers if present + httpHeaders =3D connprops.getProperty("HttpExtraHeader"); + =20 + if(httpHeaders !=3D null && httpHeaders.toLowerCase().indexOf(= "user-agent") =3D=3D -1) + { + httpHeaders +=3D "User-Agent: Geronimo/1.0\r\n"; + } + + if(httpHeaders =3D=3D null) + { + httpHeaders =3D "User-Agent: Geronimo/1.0\r\n"; + } + + //get webproxy host/port if present: + webProxyHost =3D connprops.getProperty("WebProxyHost"); + String port =3D connprops.getProperty("WebProxyPort"); + =20 + if(port !=3D null) + { + try + { + webProxyPort =3D java.lang.Integer.parseInt(port); + } + catch(java.lang.NumberFormatException e) + { + throw new SystemException(org.apache.geronimo.interop.= util.ExceptionUtil.causedBy(e)); + } + } + + if(port =3D=3D null && webProxyHost !=3D null) + { + webProxyPort =3D 80; //default + } + } + else + { + webProxyHost =3D null; + httpHeaders =3D null; } } =20 @@ -395,11 +598,5 @@ } socket =3D null; } - } - - protected String errorConnectFailed(String host, int port, Exception e= x) { - String msg; - msg =3D "Error: errorConnectFailed: host=3D" + host + ", port=3D" = + port + ", ex =3D " + ex; - return msg; } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/UrlInfo.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/UrlInfo.java?view=3Ddiff&r1=3D1= 59302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/UrlInfo.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/UrlInfo.java Mon Mar 28 12:37:40 2005 @@ -30,6 +30,14 @@ import org.apache.geronimo.interop.util.StringUtil; =20 public class UrlInfo { + + private String namePrefix =3D ""; + private int ver; + =20 + final static int IIOP_1_0 =3D 0; + final static int IIOP_1_1 =3D 1; + final static int IIOP_1_2 =3D 2; + public static UrlInfo getInstance(String url) { UrlInfo object =3D new UrlInfo(); object.init(url); @@ -46,12 +54,41 @@ } =20 private int protocol; + private String host; + private int port; + private String objectKey; + private PropertyMap properties; =20 - protected void init(String urlString) { + private boolean handleUrl(String url) + { + if(!UrlScheme.canProcess(url)) + return false; + + UrlScheme us =3D new UrlScheme(url); + us.process(); + =20 + host =3D us.getHost(0); + port =3D us.getPort(0); + ver =3D us.getVersion(0); + objectKey =3D us.getObjectKey(); + namePrefix =3D us.getNamePrefix(); + properties =3D new PropertyMap(); + protocol =3D Protocol.IIOP; + =20 + return true; + } + + protected void init(String urlString) + { + if(handleUrl(urlString)) + { + return; + } + int cssPos =3D urlString.indexOf("://"); if (cssPos =3D=3D -1) { throw new IllegalArgumentException(urlString); @@ -120,6 +157,16 @@ =20 public PropertyMap getProperties() { return properties; + } + + public String getNamePrefix() + { + return namePrefix; + } + + public int getVersion() + { + return ver; } =20 public String toString() { Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/= rmi/iiop/client/UrlScheme.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/UrlScheme.java?view=3Dauto&rev= =3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/UrlScheme.java (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/UrlScheme.java Mon Mar 28 12:37:40 2005 @@ -0,0 +1,280 @@ +/** + * + * 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 implie= d=2E + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.interop.rmi.iiop.client; + +/** + * corbaname and corbaloc urls + */ + +public class UrlScheme +{ + class Addr + { + Addr(String h, int port, int ver) + { + _host =3D h; + _port =3D port; + _version =3D ver; + } + + String _host; + int _port; + int _version; + } + + static final int IIOP_1_0 =3D 0; + static final int IIOP_1_1 =3D 1; + static final int IIOP_1_2 =3D 2; + + private boolean _corbaloc, _corbaname; + private java.util.ArrayList _addrList; + private String _url; + private String _namePrefix; + private String _objKey; + + public UrlScheme(String url) + { + _url =3D url; + _addrList =3D new java.util.ArrayList(); + } + + public String getHost(int i) + { + Addr addr =3D getEntry(i); + return addr._host; + } + + public int getPort(int i) + { + Addr addr =3D getEntry(i); + return addr._port; + } + + public int getVersion(int i) + { + Addr addr =3D getEntry(i); + return addr._version; + } + + public String getObjectKey() + { + return _objKey; + } + + public String getNamePrefix() + { + return _namePrefix; + } + + public int getAddressCount() + { + return _addrList.size(); + } + + private Addr getEntry(int i) + { + try + { + return (Addr)_addrList.get(i); + } + catch(IndexOutOfBoundsException e) + { + throw new IllegalArgumentException(_url); + } + } + + public static boolean canProcess(String url) + { + return url.startsWith("corbaloc:") || url.startsWith("corbaname:"); + } + + public boolean process() + { + boolean handled =3D false; + + String cloc =3D "corbaloc:"; + String cname =3D "corbaname:"; + =20 + _corbaloc =3D _url.startsWith(cloc); + _corbaname =3D_url.startsWith(cname); + + if(_corbaloc || _corbaname) + { + try + { + int keySep =3D _url.indexOf("/"); + int nameSep =3D _url.indexOf("#"); + + if(keySep > nameSep) //we may have "/" in a name + { + keySep =3D -1; + } + =20 + int addrStart =3D _corbaloc ? "corbaloc:".length() : "corb= aname:".length(); + String addrlist; + =20 + if(keySep !=3D -1) + { + addrlist =3D _url.substring(addrStart, keySep); + } + else if(nameSep !=3D -1) + { + addrlist =3D _url.substring(addrStart, nameSep); + } + else + { + addrlist =3D _url.substring(addrStart); + } + + readAddrList(addrlist); + readKeyAndName(keySep, nameSep); + } + catch(Exception e) + { + throw new IllegalArgumentException(_url); + } + } + + return handled; + } + + //addr,addr... + private void readAddrList(String addrlist) + { + java.util.StringTokenizer tk =3D new java.util.StringTokenizer(add= rlist, ","); + if(tk.countTokens() < 1) + { + throw new IllegalArgumentException(_url); + } + =20 + while(tk.hasMoreElements()) + { + String addr =3D tk.nextToken(); + readAddr(addr); + } + } + + //supported protocol: iiop + //addr <- <":" | "iiop:">[ [":" ]] + //version <- ."@" | empty_string + + private void readAddr(String addr) + { + String host; + int port, ver =3D IIOP_1_2; + + int addrlen =3D addr.length(); + + if(!addr.startsWith("iiop:") && !addr.startsWith(":")) + { + throw new IllegalArgumentException(_url); + } + + int curindex =3D addr.indexOf(":") + 1; + + //VERSION + if( (curindex + 3) < addrlen && addr.charAt(curindex + 3) =3D=3D '= @' ) + { + if(addr.startsWith("1.0@", curindex)) + { + ver =3D IIOP_1_0; + } + else if(addr.startsWith("1.1@", curindex)) + { + ver =3D IIOP_1_1; + } + else if(addr.startsWith("1.2@", curindex)) + { + ver =3D IIOP_1_2; + } + else + { + throw new IllegalArgumentException(_url); + } + curindex +=3D 4; + } + + //defaults + host =3D "localhost"; + port =3D 2089;=20 + + //HOST + if(curindex < addrlen) + { + //is it ipv6 address? (Enclosed between '[' and ']') + if(addr.charAt(curindex) =3D=3D '[') + { + int lastindex =3D addr.indexOf(']', curindex); + if(-1 =3D=3D lastindex) + { + throw new IllegalArgumentException(_url); + } + host =3D addr.substring(curindex, lastindex + 1); + curindex =3D lastindex + 1; + } + else if(addr.charAt(curindex) !=3D ':') + { + int i =3D addr.indexOf(":", curindex); + if(-1 =3D=3D i) + { + i =3D addrlen; + } + host =3D addr.substring(curindex, i); + curindex =3D i + 1; + } + } + + //PORT + if(curindex < addrlen) + { + try + { + String sport =3D addr.substring(curindex); + port =3D new Integer(sport).intValue(); + } + catch(NumberFormatException e) + { + throw new IllegalArgumentException(_url); + } + } + + _addrList.add(new Addr(host, port, ver)); + } + + //TODO: key may be escaped + private void readKeyAndName(int keySep, int nameSep) + { + _objKey =3D "NameService"; + _namePrefix =3D ""; + + if(keySep !=3D -1) + { + int i =3D nameSep; + if(-1 =3D=3D i) + { + i =3D _url.length(); + } + _objKey =3D _url.substring(keySep + 1, i); + } + + if(nameSep !=3D -1) + { + _namePrefix =3D _url.substring(nameSep + 1); + } + } +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/compiler/SkelCompiler.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/compiler/SkelCompiler.java?view=3Ddiff= &r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/compiler/SkelCompiler.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/compiler/SkelCompiler.java Mon Mar 28 12:37:40 2005 @@ -236,12 +236,12 @@ // catch (java.lang.Exception $ex_1) // { // Listed here are the individual catches that the = method can throw - // if ($ex_1 instanceof com.sybase.djc.org.omg.CosN= aming.NamingContextPackage.NotFound) + // if ($ex_1 instanceof org.apache.geronimo.interop= .CosNaming.NamingContextPackage.NotFound) // { // $output.writeException(type$4, $ex_1); // return; // } - // if ($ex_1 instanceof com.sybase.djc.org.omg.CosN= aming.NamingContextPackage.CannotProceed) + // if ($ex_1 instanceof org.apache.geronimo.interop= .CosNaming.NamingContextPackage.CannotProceed) // { // $output.writeException(type$5, $ex_1); // return; Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/server/MessageHandler.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/server/MessageHandler.java?view=3Ddiff= &r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/server/MessageHandler.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/server/MessageHandler.java Mon Mar 28 12:37:40 2005 @@ -26,13 +26,13 @@ import org.apache.geronimo.interop.GIOP.*; import org.apache.geronimo.interop.IOP.*; import org.apache.geronimo.interop.SystemException; -import org.apache.geronimo.interop.adapter.HomeAdapter; +//import org.apache.geronimo.interop.adapter.HomeAdapter; import org.apache.geronimo.interop.adapter.AdapterManager; import org.apache.geronimo.interop.adapter.Adapter; import org.apache.geronimo.interop.naming.NameService; import org.apache.geronimo.interop.rmi.iiop.*; import org.apache.geronimo.interop.util.UTF8; -import org.openejb.server.ServiceException; +//import org.openejb.server.ServiceException; =20 public class MessageHandler { =20 @@ -49,7 +49,7 @@ this.writeSystemExceptionStackTrace =3D writeSystemExceptionStackT= race; } =20 - public void service(Socket socket) throws ServiceException, IOExceptio= n { + public void service(Socket socket) throws Exception { =20 InputStream in; OutputStream out; @@ -124,7 +124,14 @@ =20 if (sendResponse) { try { - output.send_message( out, clientInfo ); + if(inputMessage.httpTunneling) + { + output.send_http_response( out, clientInfo ); + } + else + { + output.send_message( out, clientInfo ); + } } catch (Exception ex) { warnSendFailed(clientInfo, ex); closeStreams( in, out ); Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/server/RmiIiopServerGBean.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/server/RmiIiopServerGBean.java?view=3D= diff&r1=3D159302&r2=3D159303 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/server/RmiIiopServerGBean.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/server/RmiIiopServerGBean.java Mon Mar 28 12:37:40 2005 @@ -22,15 +22,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; =20 -import org.openejb.server.SocketService; -import org.openejb.server.ServerService; -import org.openejb.server.ServiceException; +//import org.openejb.server.SocketService; +//import org.openejb.server.ServerService; +//import org.openejb.server.ServiceException; =20 import java.util.*; import java.net.Socket; import java.io.IOException; =20 -public class RmiIiopServerGBean implements ServerService { +//public class RmiIiopServerGBean implements ServerService { +public class RmiIiopServerGBean { =20 private final Log log =3D LogFactory.getLog(RmiIiopServerGBean.class); =20 @@ -62,7 +63,7 @@ this.msgHandler =3D null; } =20 - public void service(Socket socket) throws ServiceException, IOExceptio= n { + public void service(Socket socket) throws Exception { log.debug( "RmiIiopServerGBean.service(): socket =3D " + socket ); msgHandler.service(socket); } @@ -72,11 +73,11 @@ //To change body of implemented methods use File | Settings | File= Templates. } =20 - public void start() throws ServiceException { + public void start() throws Exception { log.debug( "RmiIiopServerGBean.start(): " ); } =20 - public void stop() throws ServiceException { + public void stop() throws Exception { log.debug( "RmiIiopServerGBean.stop(): " ); } =20 @@ -137,7 +138,7 @@ static { GBeanInfoBuilder infoFactory =3D new GBeanInfoBuilder(RmiIiopServe= rGBean.class); =20 - infoFactory.addInterface(SocketService.class); + //infoFactory.addInterface(SocketService.class); =20 infoFactory.addAttribute("args", ArrayList.class, true); infoFactory.addAttribute("props", Properties.class, true);