From scm-return-6405-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Thu Mar 24 02:38:24 2005 Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 39196 invoked from network); 24 Mar 2005 02:38:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Mar 2005 02:38:23 -0000 Received: (qmail 65927 invoked by uid 500); 24 Mar 2005 02:38:23 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 65778 invoked by uid 500); 24 Mar 2005 02:38:22 -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 65763 invoked by uid 99); 24 Mar 2005 02:38:22 -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; Wed, 23 Mar 2005 18:38:16 -0800 Received: (qmail 32194 invoked by uid 65534); 24 Mar 2005 02:30:54 -0000 Message-ID: <20050324023054.32192.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: Thu, 24 Mar 2005 02:30:54 -0000 Subject: svn commit: r158862 [7/9] - in geronimo/trunk/modules/interop: ./ src/idl/ src/java/org/apache/geronimo/interop/ src/java/org/apache/geronimo/interop/CosNaming/iiop_stubs/ src/java/org/apache/geronimo/interop/adapter/ src/java/org/apache/geronimo/interop/client/ src/java/org/apache/geronimo/interop/generator/ src/java/org/apache/geronimo/interop/naming/ src/java/org/apache/geronimo/interop/properties/ src/java/org/apache/geronimo/interop/repository/ src/java/org/apache/geronimo/interop/rmi/iiop/ src/java/org/apache/geronimo/interop/rmi/iiop/client/ src/java/org/apache/geronimo/interop/rmi/iiop/compiler/ src/java/org/apache/geronimo/interop/rmi/iiop/server/ src/java/org/apache/geronimo/interop/server/ src/java/org/apache/geronimo/interop/util/ To: scm@geronimo.apache.org From: adc@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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=3D158861= &r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Wed Mar 23 18:30:30 2005 @@ -17,50 +17,60 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import org.apache.geronimo.interop.*; -import org.apache.geronimo.interop.rmi.*; -import org.apache.geronimo.interop.util.*; -import java.io.*; -import java.lang.reflect.*; -import java.security.*; -import java.util.*; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.ObjectStreamClass; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.security.DigestOutputStream; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + import org.omg.CORBA.TCKind; =20 -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); - if (vt =3D=3D null) - { - synchronized (_valueTypeMap) - { - vt =3D (ValueType)_valueTypeMap.get(forClass); - if (vt =3D=3D null) - { - //vt =3D (ValueType)component.getInstance(); +import org.apache.geronimo.interop.SystemException; +import org.apache.geronimo.interop.util.ArrayUtil; +import org.apache.geronimo.interop.util.ExceptionUtil; +import org.apache.geronimo.interop.util.JavaClass; +import org.apache.geronimo.interop.util.JavaType; +import org.apache.geronimo.interop.util.SystemUtil; + + +/** + * * 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 ValueType getInstance(Class forClass) { + ValueType vt =3D (ValueType) _valueTypeMap.get(forClass); + if (vt =3D=3D null) { + synchronized (_valueTypeMap) { + vt =3D (ValueType) _valueTypeMap.get(forClass); + if (vt =3D=3D null) { vt =3D new ValueType(); - _valueTypeMap.put(forClass, vt); vt.init(forClass); + _valueTypeMap.put(forClass, vt); } } } return vt; } =20 - public static ValueType getInstanceByID(String id) - { + public static ValueType getInstanceByID(String id) { // TODO: handle multiple class loaders??? - ValueType vt =3D (ValueType)_idTypeMap.get(id); - if (vt =3D=3D null) - { - synchronized (_idTypeMap) - { - vt =3D (ValueType)_idTypeMap.get(id); - if (vt =3D=3D null) - { + ValueType vt =3D (ValueType) _idTypeMap.get(id); + if (vt =3D=3D null) { + synchronized (_idTypeMap) { + vt =3D (ValueType) _idTypeMap.get(id); + if (vt =3D=3D null) { Class theClass =3D getClass(id); vt =3D getInstance(theClass); _idTypeMap.put(id, vt); @@ -109,13 +119,13 @@ // package-private data // -------------------------------------------------------------------= ---- =20 - static final int NULL_VALUE_TAG =3D 0; - static final int NO_TYPE_VALUE_TAG =3D 0x7fffff00; - static final int SINGLE_TYPE_VALUE_TAG =3D 0x7fffff02; - static final int TRUNCATABLE_NO_TYPE_VALUE_TAG =3D 0x7fffff08; + static final int NULL_VALUE_TAG =3D 0; + static final int NO_TYPE_VALUE_TAG =3D 0x7fffff00; + static final int SINGLE_TYPE_VALUE_TAG =3D 0x7fffff02; + static final int TRUNCATABLE_NO_TYPE_VALUE_TAG =3D 0x7fffff08; static final int TRUNCATABLE_SINGLE_TYPE_VALUE_TAG =3D 0x7fffff0a; - static final int TYPE_LIST_VALUE_TAG =3D 0x7fffff06; - static final int INDIRECTION_TAG =3D 0xffffffff; + static final int TYPE_LIST_VALUE_TAG =3D 0x7fffff06; + static final int INDIRECTION_TAG =3D 0xffffffff; =20 static final int CASE_ARRAY =3D 1; static final int CASE_CLASS =3D 2; @@ -168,27 +178,20 @@ // static initializer // -------------------------------------------------------------------= ---- =20 - static - { + static { TC_ABSTRACT_BASE =3D new TypeCode(TCKind.tk_abstract_interface); TC_ABSTRACT_BASE.id("IDL:omg.org/CORBA/AbstractBase:1.0"); TC_ABSTRACT_BASE.name(""); =20 - try - { - if (JDK14) - { - _newInstance =3D java.io.ObjectStreamClass.class.getDeclar= edMethod("newInstance", new Class[] {}); + try { + if (JDK14) { + _newInstance =3D java.io.ObjectStreamClass.class.getDeclar= edMethod("newInstance", new Class[]{}); _newInstance.setAccessible(true); - } - else - { - _allocateNewObject =3D java.io.ObjectInputStream.class.get= DeclaredMethod("allocateNewObject", new Class[] { Class.class, Class.class = }); + } else { + _allocateNewObject =3D java.io.ObjectInputStream.class.get= DeclaredMethod("allocateNewObject", new Class[]{Class.class, Class.class}); _allocateNewObject.setAccessible(true); } - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } @@ -197,105 +200,70 @@ // public methods // -------------------------------------------------------------------= ---- =20 - public Object newInstance() - { - try - { - if (JDK14) - { - if (_class =3D=3D Object.class) - { + public Object newInstance() { + try { + if (JDK14) { + if (_class =3D=3D Object.class) { return new Object(); - } - else - { + } else { return _newInstance.invoke(_objectStreamClass, ArrayUt= il.EMPTY_OBJECT_ARRAY); } - } - else - { + } else { return _allocateNewObject.invoke(null, _allocateNewObjectA= rgs); } - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public String toString() - { + public String toString() { return "ValueType:" + JavaType.getName(_class); } =20 - public void readObject(Object _this, org.apache.geronimo.interop.rmi.i= iop.ObjectInputStream input) - { - try - { + public void readObject(Object _this, org.apache.geronimo.interop.rmi.i= iop.ObjectInputStream input) { + try { _readObject.invoke(_this, input.thisAsObjectArray); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public void writeObject(Object _this, org.apache.geronimo.interop.rmi.= iiop.ObjectOutputStream output) - { - try - { + public void writeObject(Object _this, org.apache.geronimo.interop.rmi.= iiop.ObjectOutputStream output) { + try { _writeObject.invoke(_this, output.thisAsObjectArray); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public Object readResolve(Object _this) - { - try - { + public Object readResolve(Object _this) { + try { return _readResolve.invoke(_this, ArrayUtil.EMPTY_OBJECT_ARRAY= ); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public Object writeReplace(Object _this) - { - try - { + public Object writeReplace(Object _this) { + try { return _writeReplace.invoke(_this, ArrayUtil.EMPTY_OBJECT_ARRA= Y); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public void readExternal(Object _this, org.apache.geronimo.interop.rmi= .iiop.ObjectInputStream input) - { - try - { + public void readExternal(Object _this, org.apache.geronimo.interop.rmi= .iiop.ObjectInputStream input) { + try { _readExternal.invoke(_this, input.thisAsObjectArray); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } =20 - public void writeExternal(Object _this, org.apache.geronimo.interop.rm= i=2Eiiop.ObjectOutputStream output) - { - try - { + public void writeExternal(Object _this, org.apache.geronimo.interop.rm= i=2Eiiop.ObjectOutputStream output) { + try { _writeExternal.invoke(_this, output.thisAsObjectArray); - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); } } @@ -304,67 +272,50 @@ // protected methods // -------------------------------------------------------------------= ---- =20 - protected void init(Class theClass) - { + protected void init(Class theClass) { boolean recursive =3D false; - if (_initMap.get(theClass) !=3D null) - { + if (_initMap.get(theClass) !=3D null) { // recursive =3D true; return; // Already initializing (recursive 'init' call). } _initMap.put(theClass, Boolean.TRUE); - try - { + try { _class =3D theClass; _objectStreamClass =3D ObjectStreamClass.lookup(_class); if (org.omg.CORBA.Object.class.isAssignableFrom(theClass) || javax.ejb.EJBHome.class.isAssignableFrom(theClass) || javax.ejb.EJBObject.class.isAssignableFrom(theClass) - || java.rmi.Remote.class.isAssignableFrom(theClass)) - { + || java.rmi.Remote.class.isAssignableFrom(theClass)) { helper =3D ObjectRefHelper.getInstance(theClass); isObjectRef =3D true; readWriteCase =3D CASE_IDL_OBJECT; - } - else if (org.omg.CORBA.portable.IDLEntity.class.isAssignableFr= om(theClass)) - { + } else if (org.omg.CORBA.portable.IDLEntity.class.isAssignable= From(theClass)) { helper =3D IDLEntityHelper.getInstance(theClass); isIDLEntity =3D true; readWriteCase =3D CASE_IDL_ENTITY; - } - else if (theClass =3D=3D String.class) - { + } else if (theClass =3D=3D String.class) { helper =3D StringHelper.SINGLETON; readWriteCase =3D CASE_STRING; - } - else if (theClass.isArray()) - { + } else if (theClass.isArray()) { Class elementClass =3D theClass.getComponentType(); element =3D getInstance(elementClass); isArray =3D true; - if (elementClass.isPrimitive()) - { + if (elementClass.isPrimitive()) { primitiveArray =3D PrimitiveType.get(elementClass); helper =3D PrimitiveType.getArrayHelper(elementClass); - } - else - { + } else { helper =3D new ArrayHelper(elementClass); } readWriteCase =3D CASE_ARRAY; - } - else if (theClass =3D=3D Class.class) - { + } else if (theClass =3D=3D Class.class) { readWriteCase =3D CASE_CLASS; } - if (_allocateNewObject !=3D null) - { + if (_allocateNewObject !=3D null) { Class bc =3D _class; - while (Serializable.class.isAssignableFrom(bc) && (bc.getS= uperclass() !=3D null)) - { + while (Serializable.class.isAssignableFrom(bc) && (bc.getS= uperclass() !=3D null)) { bc =3D bc.getSuperclass(); } - _allocateNewObjectArgs =3D new Object[] { _class, bc }; + _allocateNewObjectArgs =3D new Object[]{_class, bc}; } =20 isAny =3D _class =3D=3D java.lang.Object.class @@ -372,15 +323,13 @@ || _class =3D=3D java.io.Serializable.class; =20 isExternalizable =3D java.io.Externalizable.class.isAssignable= From(_class); - if (isExternalizable) - { - _readExternal =3D _class.getDeclaredMethod("readExternal",= new Class[] { ObjectInput.class } ); - _writeExternal =3D _class.getDeclaredMethod("writeExternal= ", new Class[] { ObjectOutput.class } ); + if (isExternalizable) { + _readExternal =3D _class.getDeclaredMethod("readExternal",= new Class[]{ObjectInput.class}); + _writeExternal =3D _class.getDeclaredMethod("writeExternal= ", new Class[]{ObjectOutput.class}); } =20 // SG: Hopefully we got all the info that is needed - if(recursive) - { + if (recursive) { return; } =20 @@ -388,89 +337,75 @@ java.lang.Class tmpClass =3D _class; ArrayList fieldList =3D new ArrayList(); Field[] javaFields =3D tmpClass.getDeclaredFields(); - + =20 // TODO: suppress sort for IDL-generated valuetypes Arrays.sort(javaFields, FieldComparator.SINGLETON); - + =20 // Create vector of non-static, non-transient fields. // Ensure that all fields are readable/writable using reflecti= on. int nf =3D javaFields.length; - for (int f =3D 0; f < nf; f++) - { + for (int f =3D 0; f < nf; f++) { Field javaField =3D javaFields[f]; int modifiers =3D javaField.getModifiers(); - if ((modifiers & (Modifier.STATIC | Modifier.TRANSIENT)) != =3D 0) - { + if ((modifiers & (Modifier.STATIC | Modifier.TRANSIENT)) != =3D 0) { continue; } - if (! javaField.isAccessible()) - { + if (!javaField.isAccessible()) { javaField.setAccessible(true); } ValueTypeField field =3D new ValueTypeField(javaField); fieldList.add(field); } =20 - fields =3D (ValueTypeField[])fieldList.toArray(new ValueTypeFi= eld[fieldList.size()]); + fields =3D (ValueTypeField[]) fieldList.toArray(new ValueTypeF= ield[fieldList.size()]); =20 // Check methods for readObject/writeObject. Also check for // abstract interfaces. Method[] methods =3D _class.getDeclaredMethods(); int countThrowsRemoteException =3D 0; int nm =3D methods.length; - for (int m =3D 0; m < nm; m++) - { + for (int m =3D 0; m < nm; m++) { Method method =3D methods[m]; Class[] types =3D method.getParameterTypes(); if (types.length =3D=3D 1 && types[0] =3D=3D java.io.ObjectInputStream.class && (method.getModifiers() & Modifier.PRIVATE) !=3D 0 - && method.getName().equals("readObject")) - { + && method.getName().equals("readObject")) { _readObject =3D method; - if (! _readObject.isAccessible()) - { + if (!_readObject.isAccessible()) { _readObject.setAccessible(true); } } if (types.length =3D=3D 1 && types[0] =3D=3D java.io.ObjectOutputStream.class && (method.getModifiers() & Modifier.PRIVATE) !=3D 0 - && method.getName().equals("writeObject")) - { + && method.getName().equals("writeObject")) { _writeObject =3D method; - if (! _writeObject.isAccessible()) - { + if (!_writeObject.isAccessible()) { _writeObject.setAccessible(true); } } =20 if (types.length =3D=3D 0 && method.getReturnType() =3D=3D java.lang.Object.clas= s - && method.getName().equals("writeReplace")) - { + && method.getName().equals("writeReplace")) { _writeReplace =3D method; - if (! _writeReplace.isAccessible()) - { + if (!_writeReplace.isAccessible()) { _writeReplace.setAccessible(true); } } if (types.length =3D=3D 0 - && method.getReturnType() =3D=3D java.lang.Object.class - && method.getName().equals("readResolve")) - { + && method.getReturnType() =3D=3D java.lang.Object.clas= s + && method.getName().equals("readResolve")) { _readResolve =3D method; - if (! _readResolve.isAccessible()) - { + if (!_readResolve.isAccessible()) { _readResolve.setAccessible(true); } } Class[] exceptions =3D method.getExceptionTypes(); - for (int i =3D 0; i < exceptions.length; i++) - { + for (int i =3D 0; i < exceptions.length; i++) { Class exception =3D exceptions[i]; - if (exception.isAssignableFrom(java.rmi.RemoteExceptio= n=2Eclass)) - { + if (exception.isAssignableFrom(java.rmi.RemoteExceptio= n=2Eclass)) { // TODO: check Java to IDL wording for this countThrowsRemoteException++; break; @@ -484,21 +419,20 @@ hasWriteReplace =3D _writeReplace !=3D null; hasReadResolve =3D _readResolve !=3D null; =20 - isAbstractInterface =3D ! isObjectRef - && _class.isInterface() - && countThrowsRemoteException =3D=3D methods.length; + isAbstractInterface =3D !isObjectRef + && _class.isInterface() + && countThrowsRemoteException =3D=3D met= hods.length; =20 Class superclass =3D _class.getSuperclass(); - if((superclass !=3D null) && (superclass !=3D java.lang.Object= .class) && (!isIDLEntity )) - { + if ((superclass !=3D null) && (superclass !=3D java.lang.Objec= t=2Eclass) && (!isIDLEntity)) { parent =3D getInstance(superclass); } =20 hasParentState =3D parent !=3D null - && (parent.fields.length > 0 - || parent.isExternalizable - || parent.hasReadOrWriteObject - || parent.hasParentState); + && (parent.fields.length > 0 + || parent.isExternalizable + || parent.hasReadOrWriteObject + || parent.hasParentState); =20 requiresCustomSerialization =3D hasWriteObject || isExternaliz= able; =20 @@ -506,57 +440,44 @@ initTypeCode(); =20 isAnyOrObjectRefOrAbstractInterface =3D isAny || isObjectRef |= | isAbstractInterface; - } - catch (Exception ex) - { + } catch (Exception ex) { throw ExceptionUtil.getRuntimeException(ex); - } - finally - { - if(!recursive) - { - _initMap.remove(theClass); + } finally { + if (!recursive) { + _initMap.remove(theClass); + } } } - } =20 - protected void initRepositoryID() - { + protected void initRepositoryID() { final String sixteenZeros =3D "0000000000000000"; final int requiredLength =3D 16; - if (isAny) - { + if (isAny) { id =3D "#ANY-TODO#"; return; } - if (isArray && primitiveArray !=3D 0) - { + if (isArray && primitiveArray !=3D 0) { id =3D "#ARRAY-TODO#"; return; } - if (_class =3D=3D String.class) - { + if (_class =3D=3D String.class) { id =3D "IDL:omg.org/CORBA/WStringValue:1.0"; return; } - if (isObjectRef) - { + if (isObjectRef) { id =3D "RMI:" + _class.getName() + ":" + sixteenZeros; return; } - if (_class =3D=3D java.lang.Class.class) - { + if (_class =3D=3D java.lang.Class.class) { id =3D "RMI:javax.rmi.CORBA.ClassDesc:2BABDA04587ADCCC:CFBF02C= F5294176B"; return; } - if (_class =3D=3D java.math.BigInteger.class) - { + 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 return; } - if (_objectStreamClass =3D=3D null) - { + if (_objectStreamClass =3D=3D null) { id =3D "???"; return; } @@ -567,80 +488,56 @@ int currentLength; int lengthNeeded; currentLength =3D structuralUIDString.length(); - if (currentLength < requiredLength) - { + if (currentLength < requiredLength) { lengthNeeded =3D requiredLength - currentLength; structuralUIDString =3D sixteenZeros.substring(0, lengthNeeded= ) + structuralUIDString; } currentLength =3D serialVersionUIDString.length(); - if (currentLength < requiredLength) - { + if (currentLength < requiredLength) { lengthNeeded =3D requiredLength - currentLength; serialVersionUIDString =3D sixteenZeros.substring(0, lengthNee= ded) + serialVersionUIDString; } id =3D "RMI:" + _class.getName() + ":" + structuralUIDString + ":"= + serialVersionUIDString; } =20 - protected void initTypeCode() - { - if (isObjectRef) - { + protected void initTypeCode() { + if (isObjectRef) { tc =3D new TypeCode(TCKind.tk_objref); tc.id(id); tc.name(""); - } - else if (isArray || isIDLEntity || _class =3D=3D String.class) - { + } else if (isArray || isIDLEntity || _class =3D=3D String.class) { tc =3D new TypeCode(TCKind.tk_value_box); tc.id(id); tc.name(""); - if (_class =3D=3D String.class) - { + if (_class =3D=3D String.class) { tc.content_type(new TypeCode(TCKind.tk_wstring)); - } - else if (isArray) - { + } else if (isArray) { TypeCode seqTC =3D new TypeCode(TCKind.tk_sequence); - if (primitiveArray !=3D 0) - { + if (primitiveArray !=3D 0) { seqTC.content_type(PrimitiveType.getTypeCode(primitive= Array)); - } - else - { + } else { seqTC.content_type(element.tc); } tc.content_type(seqTC); - } - else if (isIDLEntity) - { + } else if (isIDLEntity) { // TODO tc.content_type(helper.type()); } - } - else - { + } else { tc =3D new TypeCode(TCKind.tk_value); tc.id(id); tc.name(""); =20 // TODO: value modifier - if (requiresCustomSerialization) - { - tc.type_modifier((short)1); - } - else if (isAbstractInterface) - { - tc.type_modifier((short)2); - } - else - { - tc.type_modifier((short)0); + if (requiresCustomSerialization) { + tc.type_modifier((short) 1); + } else if (isAbstractInterface) { + tc.type_modifier((short) 2); + } else { + tc.type_modifier((short) 0); } - if (parent =3D=3D null) - { + if (parent =3D=3D null) { tc.concrete_base_type(TC_NULL); - } - else - { + } else { // TODO: check validity of this tc.concrete_base_type(TC_NULL); // tc.concrete_base_type(getTypeCode(parent)); @@ -650,119 +547,128 @@ } } =20 - static long computeStructuralUID(ValueType vt) - { + static long computeStructuralUID(ValueType vt) { Class c =3D vt._class; ObjectStreamClass osc =3D vt._objectStreamClass; ByteArrayOutputStream devnull =3D new ByteArrayOutputStream(512); long h =3D 0; - try - { - if (! java.io.Serializable.class.isAssignableFrom(c) - || c.isInterface()) - { + try { + if (!java.io.Serializable.class.isAssignableFrom(c) + || c.isInterface()) { return 0; } - if (java.io.Externalizable.class.isAssignableFrom(c)) - { + if (java.io.Externalizable.class.isAssignableFrom(c)) { return 1; } MessageDigest md =3D MessageDigest.getInstance("SHA"); DigestOutputStream mdo =3D new DigestOutputStream(devnull, md)= ; DataOutputStream data =3D new DataOutputStream(mdo); - if (vt.parent !=3D null) - { + if (vt.parent !=3D null) { data.writeLong(computeStructuralUID(vt.parent)); } - if (vt.hasWriteObject) - { + if (vt.hasWriteObject) { data.writeInt(2); - } - else - { + } else { data.writeInt(1); } List fieldList =3D new ArrayList(vt.fields.length); - for (int i =3D 0; i < vt.fields.length; i++) - { + for (int i =3D 0; i < vt.fields.length; i++) { fieldList.add(vt.fields[i].javaField); } - Field[] fields =3D (Field[])fieldList.toArray(new Field[fieldL= ist.size()]); + Field[] fields =3D (Field[]) fieldList.toArray(new Field[field= List.size()]); Arrays.sort(fields, FieldByNameComparator.SINGLETON); - for (int i =3D 0; i < vt.fields.length; i++) - { + for (int i =3D 0; i < vt.fields.length; i++) { Field f =3D fields[i]; data.writeUTF(f.getName()); data.writeUTF(JavaClass.getSignature(f.getType())); } data.flush(); byte[] hasharray =3D md.digest(); - for (int i =3D 0; i < Math.min(8, hasharray.length); i++) - { - h +=3D (long)(hasharray[i] & 255) << (i * 8); + for (int i =3D 0; i < Math.min(8, hasharray.length); i++) { + h +=3D (long) (hasharray[i] & 255) << (i * 8); } return h; - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 /** - ** Map an RMI/IDL Repository ID to a java.lang.Class. - **/ - static Class getClass(String id) - { - if (id.startsWith("RMI:")) - { + * * Map an RMI/IDL Repository ID to a java.lang.Class. + */ + static Class getClass(String id) { + if (id.startsWith("RMI:")) { int endClass =3D id.indexOf(':', 4); - if (endClass =3D=3D -1) - { + if (endClass =3D=3D -1) { throw new org.omg.CORBA.INV_IDENT(id); } String className =3D id.substring(4, endClass); - if (className.equals("javax.rmi.CORBA.ClassDesc")) - { + if (className.equals("javax.rmi.CORBA.ClassDesc")) { return Class.class; - } - else - { + } else { return loadClass(className); } - } - else if (id.equals("IDL:omg.org/CORBA/WStringValue:1.0")) - { + } else if (id.equals("IDL:omg.org/CORBA/WStringValue:1.0")) { return java.lang.String.class; - } - else if (id.startsWith("IDL:omg.org/")) - { + } else if (id.startsWith("IDL:omg.org/")) { int endClass =3D id.indexOf(':', 12); - if (endClass =3D=3D -1) - { + if (endClass =3D=3D -1) { throw new org.omg.CORBA.INV_IDENT(id); } - String className =3D "org.omg" + id.substring( "IDL:omg.org".l= ength(), endClass).replace('/', '.'); + String className =3D "org.omg" + id.substring("IDL:omg.org".le= ngth(), endClass).replace('/', '.'); return loadClass(className); - } - else if (id.startsWith("IDL:")) - { + } else if (id.startsWith("IDL:")) { int endClass =3D id.indexOf(':', 4); - if (endClass =3D=3D -1) - { + if (endClass =3D=3D -1) { throw new org.omg.CORBA.INV_IDENT(id); } String className =3D id.substring(4, endClass).replace('/', '.= '); return loadClass(className); - } - else - { + } else { throw new org.omg.CORBA.INV_IDENT(id); } } =20 - static Class loadClass(String className) - { - return ThreadContext.loadClass(className); + static Class loadClass(String className) { + Class c =3D null; + + System.out.println("loadClass(): " + className); + + try { + //c =3D Class.forName( className ); + c =3D ClassLoader.getSystemClassLoader().loadClass(className); + } catch (Exception e) { + e.printStackTrace(); + } + + //return ThreadContext.loadClass(className); + return c; + } + + public static void main(String args[]) + throws Exception { + Class c =3D Class.forName(args[0]); + ValueType vt =3D ValueType.getInstance(c); + System.out.println("vt =3D " + vt.toString()); + System.out.println("vt.id =3D " + vt.id); + System.out.println("vt.tc =3D " + vt.tc.id()); + + c =3D Class.forName("org.omg.CosNaming.NameComponent"); + vt =3D ValueType.getInstance(c); + System.out.println("vt =3D " + vt.toString()); + System.out.println("vt.id =3D " + vt.id); + System.out.println("vt.tc =3D " + vt.tc.id()); + + c =3D ValueType.getClass("RMI:mark.comps.Add:0000000000000000"); + System.out.println("c.getName() =3D " + c.getName()); + + c =3D ValueType.getClass("RMI:org.omg.CosNaming.NameComponent:7FD3= FB2290230F5E:F164A2194A66282A"); + System.out.println("c.getName() =3D " + c.getName()); + + c =3D ValueType.getClass("IDL:omg.org/CosNaming/NameComponent:1.0"= ); + System.out.println("c.getName() =3D " + c.getName()); + + c =3D ValueType.getClass("RMI:mark.AddData:4165959D0B2418DD:747FE2= 3938318E95"); + System.out.println("c.getName() =3D " + c.getName()); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/ValueTypeField.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/ValueTypeField.java?view=3Ddiff&r1=3D1= 58861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/ValueTypeField.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/ValueTypeField.java Wed Mar 23 18:30:30 2005 @@ -17,320 +17,169 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import org.apache.geronimo.interop.*; -import java.lang.reflect.*; +import java.lang.reflect.Field; =20 -public class ValueTypeField -{ +import org.apache.geronimo.interop.SystemException; + + +public class ValueTypeField { public final Field javaField; =20 public final int primitive; =20 public final ValueType type; =20 - private final boolean isFinal; - - private FinalFieldSetter finalFieldSetter; - - public ValueTypeField(Field field) - { + public ValueTypeField(Field field) { javaField =3D field; - if (field.getType().isPrimitive()) - { + if (field.getType().isPrimitive()) { primitive =3D PrimitiveType.get(field.getType()); type =3D null; - } - else - { + } else { primitive =3D 0; type =3D ValueType.getInstance(field.getType()); } - if(Modifier.isFinal(field.getModifiers())) - { - isFinal =3D true; - finalFieldSetter =3D FinalFieldSetter.getInstance(field); - } - else - { - isFinal =3D false; - } } =20 - public boolean getBoolean(Object that) - { - try - { + public boolean getBoolean(Object that) { + try { return javaField.getBoolean(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public byte getByte(Object that) - { - try - { + public byte getByte(Object that) { + try { return javaField.getByte(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public char getChar(Object that) - { - try - { + public char getChar(Object that) { + try { return javaField.getChar(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public double getDouble(Object that) - { - try - { + public double getDouble(Object that) { + try { return javaField.getDouble(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public float getFloat(Object that) - { - try - { + public float getFloat(Object that) { + try { return javaField.getFloat(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public int getInt(Object that) - { - try - { + public int getInt(Object that) { + try { return javaField.getInt(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public long getLong(Object that) - { - try - { + public long getLong(Object that) { + try { return javaField.getLong(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public short getShort(Object that) - { - try - { + public short getShort(Object that) { + try { return javaField.getShort(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public Object get(Object that) - { - try - { + public Object get(Object that) { + try { return javaField.get(that); - } - catch (Exception ex) - { + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setBoolean(Object that, boolean value) - { - try - { - if(isFinal) - { - finalFieldSetter.setBoolean(that, value); - } - else - { - javaField.setBoolean(that, value); - } - } - catch (Exception ex) - { + public void setBoolean(Object that, boolean value) { + try { + javaField.setBoolean(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setByte(Object that, byte value) - { - try - { - if(isFinal) - { - finalFieldSetter.setByte(that, value); - } - else - { - javaField.setByte(that, value); - } - } - catch (Exception ex) - { + public void setByte(Object that, byte value) { + try { + javaField.setByte(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setChar(Object that, char value) - { - try - { - if(isFinal) - { - finalFieldSetter.setChar(that, value); =20 - } - else - { - javaField.setChar(that, value); - } - } - catch (Exception ex) - { + public void setChar(Object that, char value) { + try { + javaField.setChar(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setDouble(Object that, double value) - { - try - { - if(isFinal) - { - finalFieldSetter.setDouble(that, value); - } - else - { - javaField.setDouble(that, value); - } - } - catch (Exception ex) - { + public void setDouble(Object that, double value) { + try { + javaField.setDouble(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setFloat(Object that, float value) - { - try - { - if(isFinal) - { - finalFieldSetter.setFloat(that, value); - } - else - { - javaField.setFloat(that, value); - } - } - catch (Exception ex) - { + public void setFloat(Object that, float value) { + try { + javaField.setFloat(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setInt(Object that, int value) - { - try - { - if(isFinal) - { - finalFieldSetter.setInt(that, value); - } - else - { - javaField.setInt(that, value); - } - } - catch (Exception ex) - { + public void setInt(Object that, int value) { + try { + javaField.setInt(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setLong(Object that, long value) - { - try - { - if(isFinal) - { - finalFieldSetter.setLong(that, value); - } - else - { - javaField.setLong(that, value); - } - } - catch (Exception ex) - { + public void setLong(Object that, long value) { + try { + javaField.setLong(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void setShort(Object that, short value) - { - try - { - if(isFinal) - { - finalFieldSetter.setShort(that, value); - } - else - { - javaField.setShort(that, value); - } - } - catch (Exception ex) - { + public void setShort(Object that, short value) { + try { + javaField.setShort(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } =20 - public void set(Object that, Object value) - { - try - { - if(isFinal) - { - finalFieldSetter.set(that, value); - } - else - { - javaField.set(that, value); - } - } - catch (Exception ex) - { + public void set(Object that, Object value) { + try { + javaField.set(that, value); + } catch (Exception ex) { throw new SystemException(ex); } } 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=3D158861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Wed Mar 23 18:30:30 2005 @@ -36,23 +36,27 @@ 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 = { =20 +public class ClientNamingContext implements Context, java.io.Serializable = { public static ClientNamingContext getInstance(Hashtable env) { - ClientNamingContext nc =3D (ClientNamingContext) contextMap.get(en= v); + ClientNamingContext nc =3D (ClientNamingContext) _contextMap.get(e= nv); if (nc =3D=3D null) { - synchronized (contextMap) { - nc =3D (ClientNamingContext) contextMap.get(env); + synchronized (_contextMap) { + nc =3D (ClientNamingContext) _contextMap.get(env); if (nc =3D=3D null) { nc =3D new ClientNamingContext(); nc.init(env); - contextMap.put(env, nc); + _contextMap.put(env, nc); } } } return nc; } =20 + // -------------------------------------------------------------------= ---- + // properties + // -------------------------------------------------------------------= ---- + public static final StringProperty usernameProperty =3D new StringProperty(SystemProperties.class, "java.naming.securi= ty.principal"); =20 @@ -63,45 +67,64 @@ new IntProperty(SystemProperties.class, "org.apache.geronimo.i= nterop.rmi.idleConnectionTimeout") .defaultValue(60); // seconds =20 - private static int idleConnectionTimeout =3D + // -------------------------------------------------------------------= ---- + // private data + // -------------------------------------------------------------------= ---- + + private static int _idleConnectionTimeout =3D idleConnectionTimeoutProperty.getInt(); =20 - private static int namingContextCacheTimeout =3D + private static int _namingContextCacheTimeout =3D SystemProperties.rmiNamingContextCacheTimeoutProperty.getInt()= ; =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 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; + 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 HashMap _cache =3D new HashMap(); + + private Hashtable _env; + + private ConnectionPool _connectionPool; =20 - private org.apache.geronimo.interop.CosNaming.NamingContext serverNami= ngContext; + private PropertyMap _connectionProperties; + + private org.apache.geronimo.interop.CosNaming.NamingContext _serverNam= ingContext; + static private HashMap _nameMap =3D new HashMap(); + + + private String _prefix; + + private String _username; + + private String _password; + + // -------------------------------------------------------------------= ---- + // public methods + // -------------------------------------------------------------------= ---- =20 public ConnectionPool getConnectionPool() { - return connectionPool; + return _connectionPool; } =20 public PropertyMap getConnectionProperties() { - return connectionProperties; + return _connectionProperties; } =20 public int getIdleConnectionTimeout() { - return idleConnectionTimeout; + return _idleConnectionTimeout; } =20 public String getUsername() { - return username; + return _username; } =20 public String getPassword() { - return password; + return _password; } =20 // -------------------------------------------------------------------= ---- @@ -117,22 +140,22 @@ name =3D name.substring(14); } =20 - String newName =3D (String) nameMap.get(name); + String newName =3D (String) _nameMap.get(name); if (newName !=3D null) { name =3D newName; } =20 - NameBinding nb =3D (NameBinding) cache.get(name); + NameBinding nb =3D (NameBinding) _cache.get(name); if (nb =3D=3D null) { - synchronized (cache) { - nb =3D (NameBinding) cache.get(name); + synchronized (_cache) { + nb =3D (NameBinding) _cache.get(name); if (nb !=3D null && nb.hasExpired()) { - cache.remove(name); + _cache.remove(name); nb =3D null; } if (nb =3D=3D null) { nb =3D resolve(name); - cache.put(name, nb); + _cache.put(name, nb); } } } @@ -140,16 +163,17 @@ } =20 public HostList lookupHost(String name) { - NameBinding nb =3D (NameBinding) hostListCache.get(name); + NameBinding nb =3D (NameBinding) _hostListCache.get(name); if (nb =3D=3D null) { - synchronized (hostListCache) { - nb =3D (NameBinding) hostListCache.get(name); + synchronized (_hostListCache) { + nb =3D (NameBinding) _hostListCache.get(name); if (nb !=3D null && nb.hasExpired()) { - hostListCache.remove(name); + _hostListCache.remove(name); nb =3D null; } - if (nb =3D=3D null) { =20 - hostListCache.put(name, nb); + if (nb =3D=3D null) { + nb =3D resolve_host(name); + _hostListCache.put(name, nb); } } } @@ -157,7 +181,7 @@ } =20 public static void bind(String bindName, String name) throws NamingExc= eption { - nameMap.put(bindName, name); + _nameMap.put(bindName, name); } =20 public void bind(Name name, Object obj) throws NamingException { @@ -193,18 +217,22 @@ } =20 public NamingEnumeration list(Name name) throws NamingException { + // TODO: support this throw new OperationNotSupportedException(); } =20 public NamingEnumeration list(String name) throws NamingException { + // TODO: support this throw new OperationNotSupportedException(); } =20 public NamingEnumeration listBindings(Name name) throws NamingExceptio= n { + // TODO: support this throw new OperationNotSupportedException(); } =20 public NamingEnumeration listBindings(String name) throws NamingExcept= ion { + // TODO: support this throw new OperationNotSupportedException(); } =20 @@ -225,10 +253,12 @@ } =20 public Object lookupLink(Name name) throws NamingException { + // TODO: support this throw new OperationNotSupportedException(); } =20 public Object lookupLink(String name) throws NamingException { + // TODO: support this throw new OperationNotSupportedException(); } =20 @@ -241,10 +271,12 @@ } =20 public Name composeName(Name name, Name prefix) throws NamingException= { + // TODO: support this throw new OperationNotSupportedException(); } =20 public String composeName(String name, String prefix) throws NamingExc= eption { + // TODO: support this throw new OperationNotSupportedException(); } =20 @@ -268,8 +300,12 @@ throw new OperationNotSupportedException(); } =20 + // -------------------------------------------------------------------= ---- + // protected methods + // -------------------------------------------------------------------= ---- + protected void init(Hashtable env) { - env =3D env; + _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."); @@ -278,16 +314,16 @@ } String url =3D urlObject.toString(); UrlInfo urlInfo =3D UrlInfo.getInstance(url); - serverNamingContext =3D (org.apache.geronimo.interop.CosNaming.Nam= ingContext) + _serverNamingContext =3D (org.apache.geronimo.interop.CosNaming.Na= mingContext) StubFactory.getInstance().getStub(org.apache.geronimo.inte= rop.CosNaming.NamingContext.class); - ObjectRef ncRef =3D (ObjectRef) serverNamingContext; + 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); + _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) { @@ -296,8 +332,8 @@ if (p =3D=3D null) { p =3D passwordProperty.getString(); } - username =3D u !=3D null ? u.toString() : null; - password =3D p !=3D null ? p.toString() : null; + _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")) @@ -319,21 +355,34 @@ 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() + _namingContex= tCacheTimeout; return nb; } try { org.apache.geronimo.interop.CosNaming.NameComponent[] resolveN= ame =3D {new org.apache.geronimo.interop.CosNaming.NameCompone= nt(name, "")}; - org.omg.CORBA.Object object =3D serverNamingContext.resolve(re= solveName); + org.omg.CORBA.Object object =3D _serverNamingContext.resolve(r= esolveName); NameBinding nb =3D new NameBinding(); nb.object =3D object; - nb.cacheTimeout =3D System.currentTimeMillis() + namingContext= CacheTimeout; + nb.cacheTimeout =3D System.currentTimeMillis() + _namingContex= tCacheTimeout; return nb; } catch (org.apache.geronimo.interop.CosNaming.NamingContextPackag= e=2ENotFound notFound) { throw new NameNotFoundException(name); } catch (Exception ex) { throw new javax.naming.NamingException(ExceptionUtil.getStackT= race(ex)); } + } + + protected NameBinding resolve_host(String host) { + HostList list =3D null; + if (_serverNamingContext instanceof org.apache.geronimo.interop.rm= i=2Eiiop.NameService) { + org.apache.geronimo.interop.rmi.iiop.NameService nameService = =3D (org.apache.geronimo.interop.rmi.iiop.NameService) _serverNamingContext= ; + list =3D new HostList(nameService.resolve_host(host)); + } + NameBinding nb =3D new NameBinding(); + nb.object =3D list; + //nb.cacheTimeout =3D System.currentTimeMillis() + // + (list !=3D null ? list.getCacheTimeout() : _namingContextCa= cheTimeout); + return nb; } } 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= =3D158861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Wed Mar 23 18:30:30 2005 @@ -39,8 +39,8 @@ import org.apache.geronimo.interop.util.ThreadContext; import org.apache.geronimo.interop.util.UTF8; =20 -public class Connection { =20 +public class Connection { public Connection() { } =20 @@ -50,6 +50,10 @@ return conn; } =20 + // -------------------------------------------------------------------= ---- + // properties + // -------------------------------------------------------------------= ---- + public static final BooleanProperty simpleIDLProperty =3D new BooleanProperty(SystemProperties.class, "org.apache.geroni= mo.interop.simpleIDL"); =20 @@ -57,56 +61,104 @@ new IntProperty(Connection.class, "socketTimeout") .defaultValue(SystemProperties.rmiSocketTimeoutProperty.getInt= ()); =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; - private CdrOutputStream parameters; - private CdrOutputStream requestOut; - private CdrInputStream results; - private String exceptionType; - private Exception exception; - private RequestHeader_1_2 requestHeader; - private int callForget; + // -------------------------------------------------------------------= ---- + // private data + // -------------------------------------------------------------------= ---- + + private static final boolean SIMPLE_IDL =3D simpleIDLProperty.getBoole= an(); + + private ServiceContext[] EMPTY_SERVICE_CONTEXT =3D {}; + + private String _url; + + private boolean _ok; + + private InstancePool _pool; + + private String _serverHost; + + private Socket _socket; + + private org.apache.geronimo.interop.rmi.iiop.ObjectInputStream _input; + + private org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream _outpu= t; + + private CdrOutputStream _parameters; =20 - private org.apache.geronimo.interop.rmi.iiop.ObjectInputStream input; - private org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream output= ; + private CdrOutputStream _requestOut; =20 - protected java.io.InputStream socketIn; - protected java.io.OutputStream socketOut; + private CdrInputStream _results; + + private String _exceptionType; + + private Exception _exception; + + private RequestHeader_1_2 _requestHeader; + + private int _callForget; + + // -------------------------------------------------------------------= ---- + // protected data + // -------------------------------------------------------------------= ---- + + protected java.io.InputStream _socketIn; + + protected java.io.OutputStream _socketOut; + + // -------------------------------------------------------------------= ---- + // public methods + // -------------------------------------------------------------------= ---- =20 public String getInstanceName() { - return url; + return _url; } =20 public void close() { - parameters =3D null; - input =3D null; - output =3D null; - if (ok) { - pool.put(this); + _parameters =3D null; +// _results.recycle(); +// _results =3D null; + _input =3D null; + _output =3D null; + if (_ok) { + _pool.put(this); } else { shutdown(); } } =20 public void beforeInvoke() { - ok =3D false; - parameters =3D CdrOutputStream.getInstance(); + _ok =3D false; + _parameters =3D CdrOutputStream.getInstance(); } =20 public void forget(Object requestKey) { + if (_callForget !=3D 0) { + /* + String key =3D (String)requestKey; + try + { + ClusterService cs =3D _results.getNamingContext().getClust= erService(); + if (_callForget =3D=3D 0xCFCFCFCF) + { + cs.forgetRequest(key); + } + else if (_callForget =3D=3D 0xDFDFDFDF) + { + cs.forgetResponse(key); + } + } + catch (Exception ignore) + { + // TODO: log in debug mode? + } + */ + } } =20 public void invoke(ObjectRef object, String method, Object requestKey,= int retryCount) { - RequestHeader_1_2 request =3D requestHeader; + _callForget =3D 0; // see 'forget' and 'processReplyServiceContext= ' =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.response_flags =3D 3; @@ -117,15 +169,13 @@ =20 request.reserved =3D new byte[3]; // Sun's generated org.omg.GIOP= .RequestHeader_1_2Helper wants this.... =20 - if (requestOut =3D=3D null) { - System.out.println( "requestOut =3D=3D null" ); - requestOut =3D CdrOutputStream.getInstance(); + if (_requestOut =3D=3D null) { + _requestOut =3D CdrOutputStream.getInstance(); } - System.out.println( "write_request" ); - requestOut.write_request(request, parameters); + _requestOut.write_request(request, _parameters); =20 try { - requestOut.send_message(socketOut, url);//_serverHost); + _requestOut.send_message(_socketOut, _url);//_serverHost); } catch (RuntimeException ex) { //if (object.$getAutomaticFailover()) //{ @@ -134,18 +184,18 @@ throw ex; } =20 - requestOut.reset(); + _requestOut.reset(); =20 - if (results =3D=3D null) { - results =3D CdrInputStream.getInstance(); + if (_results =3D=3D null) { + _results =3D CdrInputStream.getInstance(); } else { - results.reset(); + _results.reset(); } =20 - results.setNamingContext(object.$getNamingContext()); + _results.setNamingContext(object.$getNamingContext()); GiopMessage message; try { - message =3D results.receive_message(socketIn, url);//_serverHo= st); + message =3D _results.receive_message(_socketIn, _url);//_serve= rHost); } catch (BadMagicException ex) { throw new SystemException(ex); } catch (UnsupportedProtocolVersionException ex) { @@ -163,84 +213,88 @@ throw new SystemException("TODO: message type =3D " + mess= age.type); } =20 - ok =3D true; + _ok =3D true; } =20 public InstancePool getInstancePool() { - return pool; + return _pool; } =20 public void setInstancePool(InstancePool pool) { - this.pool =3D pool; + _pool =3D pool; } =20 public org.apache.geronimo.interop.rmi.iiop.ObjectInputStream getInput= Stream() { if (SIMPLE_IDL) { return getSimpleInputStream(); } - if (input =3D=3D null) { - input =3D org.apache.geronimo.interop.rmi.iiop.ObjectInputStre= am.getInstance(results); + if (_input =3D=3D null) { + _input =3D org.apache.geronimo.interop.rmi.iiop.ObjectInputStr= eam.getInstance(_results); } - return input; + return _input; } =20 public org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream getOutp= utStream() { if (SIMPLE_IDL) { return getSimpleOutputStream(); } - if (output =3D=3D null) { - output =3D org.apache.geronimo.interop.rmi.iiop.ObjectOutputSt= ream.getInstance(parameters); + if (_output =3D=3D null) { + _output =3D org.apache.geronimo.interop.rmi.iiop.ObjectOutputS= tream.getInstance(_parameters); } - return output; + return _output; } =20 public org.apache.geronimo.interop.rmi.iiop.ObjectInputStream getSimpl= eInputStream() { - if (input =3D=3D null) { - input =3D org.apache.geronimo.interop.rmi.iiop.SimpleObjectInp= utStream.getInstance(results); + if (_input =3D=3D null) { + _input =3D org.apache.geronimo.interop.rmi.iiop.SimpleObjectIn= putStream.getInstance(_results); } - return input; + return _input; } =20 public org.apache.geronimo.interop.rmi.iiop.ObjectOutputStream getSimp= leOutputStream() { - if (output =3D=3D null) { - output =3D org.apache.geronimo.interop.rmi.iiop.SimpleObjectOu= tputStream.getInstance(parameters); + if (_output =3D=3D null) { + _output =3D org.apache.geronimo.interop.rmi.iiop.SimpleObjectO= utputStream.getInstance(_parameters); } - return output; + return _output; } =20 public String getExceptionType() { - return exceptionType; + return _exceptionType; } =20 public Exception getException() { - if (exception =3D=3D null) { - if (exceptionType !=3D null) { - return new SystemException(exceptionType, new org.omg.CORB= A=2EUNKNOWN()); + if (_exception =3D=3D null) { + if (_exceptionType !=3D null) { + return new SystemException(_exceptionType, new org.omg.COR= BA.UNKNOWN()); } else { throw new IllegalStateException("no exception"); } } else { - return exception; + return _exception; } } =20 + // -------------------------------------------------------------------= ---- + // protected methods + // -------------------------------------------------------------------= ---- + // TODO: check why we have 'objectRef' parameter??? protected void init(String endpoint, ObjectRef objectRef, PropertyMap = connProps) { - url =3D "iiop://" + endpoint; - UrlInfo urlInfo =3D UrlInfo.getInstance(url); + _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 { - socket =3D new Socket(host, port); - socketIn =3D socket.getInputStream(); - socketOut =3D socket.getOutputStream(); - socket.setSoTimeout(1000 * socketTimeout); - serverHost =3D host; + _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)); } - requestHeader =3D new RequestHeader_1_2(); + _requestHeader =3D new RequestHeader_1_2(); } =20 public ServiceContext[] getServiceContext(ObjectRef object, Object req= uestKey, int retryCount) { @@ -332,7 +386,7 @@ || sc.context_id =3D=3D 0xDFDFDFDF) { // "CF..." indicates "Call Forget Request" // "DF..." indicates "Call Forget Response" - callForget =3D sc.context_id; + _callForget =3D sc.context_id; } } } @@ -342,31 +396,31 @@ } =20 protected void processUserException(ReplyHeader_1_2 reply) { - exception =3D null; - exceptionType =3D results.read_string(); - ok =3D true; + _exception =3D null; + _exceptionType =3D _results.read_string(); + _ok =3D true; } =20 protected void processSystemException(ReplyHeader_1_2 reply) { - exceptionType =3D "???"; - SystemExceptionReplyBody replyBody =3D SystemExceptionReplyBodyHel= per.read(results); + _exceptionType =3D "???"; + SystemExceptionReplyBody replyBody =3D SystemExceptionReplyBodyHel= per.read(_results); String id =3D replyBody.exception_id; 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(); + if (_results.hasMoreData()) { + stackTrace =3D _results.read_string() + ExceptionUtil.getDivid= er(); } - ok =3D true; + _ok =3D true; String exceptionClassName =3D "org.omg.CORBA." + id; try { Class exceptionClass =3D ThreadContext.loadClass(exceptionClas= sName); org.omg.CORBA.SystemException corbaException =3D (org.omg.CORB= A=2ESystemException) exceptionClass.newInstance(); 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); + _exception =3D new org.apache.geronimo.interop.SystemException= (stackTrace, corbaException); } catch (Exception ex) { - exception =3D new org.apache.geronimo.interop.SystemException(= stackTrace, + _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))); @@ -374,28 +428,30 @@ } =20 public void shutdown() { - if (socketOut !=3D null) { + if (_socketOut !=3D null) { try { - socketOut.close(); + _socketOut.close(); } catch (Exception ignore) { } - socketOut =3D null; + _socketOut =3D null; } - if (socketIn !=3D null) { + if (_socketIn !=3D null) { try { - socketIn.close(); + _socketIn.close(); } catch (Exception ignore) { } - socketIn =3D null; + _socketIn =3D null; } - if (socket !=3D null) { + if (_socket !=3D null) { try { - socket.close(); + _socket.close(); } catch (Exception ignore) { } - socket =3D null; + _socket =3D null; } } + + // log methods =20 protected String errorConnectFailed(String host, int port, Exception e= x) { String msg; Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/ConnectionPool.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/ConnectionPool.java?view=3Ddiff= &r1=3D158861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/ConnectionPool.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/ConnectionPool.java Wed Mar 23 18:30:30 2005 @@ -27,6 +27,7 @@ import org.apache.geronimo.interop.util.InstancePool; import org.apache.geronimo.interop.util.StringUtil; =20 + public class ConnectionPool { public static ConnectionPool getInstance(ClientNamingContext namingCon= text) { ConnectionPool object =3D new ConnectionPool(); @@ -34,21 +35,17 @@ return object; } =20 - private ClientNamingContext namingContext; - private HashMap poolMap; + // private data =20 - public Connection get(int protocol, String endpoint, ObjectRef objectR= ef) { - //System.out.println("ConnectionPool.get(): protocol: " + protocol= + ", endpoint: " + endpoint + ", objectRef: " + objectRef); + private ClientNamingContext _namingContext; =20 - InstancePool pool =3D getInstancePool(protocol, endpoint); - System.out.println("ConnectionPool.get(): pool: " + pool); - Connection conn =3D (Connection) pool.get(); - if (conn =3D=3D null) { - conn =3D newConnection(protocol, endpoint, objectRef, pool); - } - return conn; + private HashMap _poolMap; + + // public methods + + public Connection get(int protocol, String endpoint, ObjectRef objectR= ef) { + System.out.println("ConnectionPool.get(): protocol: " + protocol += ", endpoint: " + endpoint + ", objectRef: " + objectRef); =20 - /* HostList hostList =3D resolve(endpoint, objectRef); System.out.println("ConnectionPool.get(): hostlist: " + hostList); if (hostList =3D=3D null) { @@ -90,16 +87,17 @@ // TODO: I18N throw new SystemException("CONNECT FAILED: host list =3D " + h= ostList); } - */ } =20 public void put(Connection conn) { conn.getInstancePool().put(conn); } =20 + // protected methods + protected void init(ClientNamingContext namingContext) { - this.namingContext =3D namingContext; - poolMap =3D new HashMap(); + _namingContext =3D namingContext; + _poolMap =3D new HashMap(); } =20 /** @@ -156,14 +154,40 @@ protected InstancePool getInstancePool(final int protocol, final Strin= g endpoint) { System.out.println("ConnectionPool.getInstancePool(): protocol: " = + protocol + ", endpoint: " + endpoint); =20 - InstancePool pool =3D (InstancePool) poolMap.get(endpoint); + InstancePool pool =3D (InstancePool) _poolMap.get(endpoint); if (pool =3D=3D null) { - synchronized (poolMap) { - pool =3D (InstancePool) poolMap.get(endpoint); + synchronized (_poolMap) { + pool =3D (InstancePool) _poolMap.get(endpoint); if (pool =3D=3D null) { String poolName =3D Protocol.getName(protocol) + "://"= + endpoint; + //long idleTimeout =3D 1000 * _namingContext.getIdleCo= nnectionTimeout(); + //if (idleTimeout > 0) + //{ +/* + pool =3D new InstancePool + ( + poolName, + idleTimeout, + new TimeoutObject() + { + public void onTimeout(Object object) + { + Connection conn =3D (Connection)object; + if (RmiTrace.CONNECT) + { + RmiTrace.getInstance().traceDisconnect(Protocol.getName(protocol= ) + "://" + endpoint); + } + conn.shutdown(); + } + } + ); + */ + //} + //else + //{ pool =3D new InstancePool(poolName); - poolMap.put(endpoint, pool); + //} + _poolMap.put(endpoint, pool); } } } @@ -207,10 +231,7 @@ } =20 protected Connection iiopConnection(String endpoint, ObjectRef objectR= ef) { - System.out.println( "endpoint : " + endpoint ); - System.out.println( "objectRef : " + objectRef ); - System.out.println( "namingContext : " + namingContext ); - return Connection.getInstance(endpoint, objectRef, namingContext.g= etConnectionProperties()); + return Connection.getInstance(endpoint, objectRef, _namingContext.= getConnectionProperties()); } =20 protected Connection iiopsConnection(String endpoint, ObjectRef object= Ref) { @@ -225,15 +246,14 @@ throw new SystemException("TODO"); } =20 - /* protected HostList resolve(String endpoint, ObjectRef objectRef) { - - //if (objectRef instanceof org.apache.geronimo.interop.rmi.iiop.NameServ= ice - // && ! endpoint.startsWith("ns~mh~")) - //{ - // return null; // Avoid unbounded recursion - //} - +/* + if (objectRef instanceof org.apache.geronimo.interop.rmi.iiop.NameServic= e + && ! endpoint.startsWith("ns~mh~")) + { + return null; // Avoid unbounded recursion + } + */ HostList hostList =3D _namingContext.lookupHost(objectRef.$getHost= ()); // this uses a cache for good performance if (hostList !=3D null && hostList.getPreferredServers().size() =3D=3D 0 @@ -244,5 +264,4 @@ } return hostList; } - */ } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/NameBinding.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/NameBinding.java?view=3Ddiff&r1= =3D158861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/NameBinding.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/NameBinding.java Wed Mar 23 18:30:30 2005 @@ -18,8 +18,9 @@ package org.apache.geronimo.interop.rmi.iiop.client; =20 public class NameBinding { - public Object object; - public long cacheTimeout; + public Object object; + + public long cacheTimeout; =20 public boolean hasExpired() { long timeout =3D cacheTimeout; 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= 58861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Wed Mar 23 18:30:30 2005 @@ -29,6 +29,7 @@ import org.apache.geronimo.interop.util.NamedValueList; import org.apache.geronimo.interop.util.StringUtil; =20 + public class UrlInfo { public static UrlInfo getInstance(String url) { UrlInfo object =3D new UrlInfo(); @@ -45,84 +46,94 @@ return list; } =20 - private int protocol; - private String host; - private int port; - private String objectKey; - private PropertyMap properties; + // private data + + private int _protocol; + + private String _host; + + private int _port; + + private String _objectKey; + + private PropertyMap _properties; + + // internal methods =20 protected void init(String urlString) { int cssPos =3D urlString.indexOf("://"); if (cssPos =3D=3D -1) { throw new IllegalArgumentException(urlString); } - protocol =3D Protocol.getNumber(urlString.substring(0, cssPos)); + _protocol =3D Protocol.getNumber(urlString.substring(0, cssPos)); try { URL url =3D new URL("http" + urlString.substring(cssPos)); - host =3D url.getHost(); - port =3D url.getPort(); - if (port =3D=3D -1) { - switch (protocol) { + _host =3D url.getHost(); + _port =3D url.getPort(); + if (_port =3D=3D -1) { + switch (_protocol) { case Protocol.HTTP: - port =3D 80; // see http://www.iana.org/assignment= s/port-numbers + _port =3D 80; // see http://www.iana.org/assignmen= ts/port-numbers break; case Protocol.HTTPS: - port =3D 443; // see http://www.iana.org/assignmen= ts/port-numbers + _port =3D 443; // see http://www.iana.org/assignme= nts/port-numbers break; case Protocol.IIOP: - port =3D 683; // see http://www.iana.org/assignmen= ts/port-numbers + _port =3D 683; // see http://www.iana.org/assignme= nts/port-numbers break; case Protocol.IIOPS: - port =3D 684; // see http://www.iana.org/assignmen= ts/port-numbers + _port =3D 684; // see http://www.iana.org/assignme= nts/port-numbers break; default: throw new IllegalStateException("url =3D " + urlSt= ring); } } - objectKey =3D url.getFile(); - if (objectKey =3D=3D null) { - objectKey =3D ""; + _objectKey =3D url.getFile(); + if (_objectKey =3D=3D null) { + _objectKey =3D ""; } - int queryPos =3D objectKey.indexOf('?'); + int queryPos =3D _objectKey.indexOf('?'); if (queryPos !=3D -1) { - objectKey =3D objectKey.substring(0, queryPos); + _objectKey =3D _objectKey.substring(0, queryPos); } - objectKey =3D StringUtil.removePrefix(objectKey, "/"); - if (objectKey.length() =3D=3D 0) { - objectKey =3D "NameService"; + _objectKey =3D StringUtil.removePrefix(_objectKey, "/"); + if (_objectKey.length() =3D=3D 0) { + _objectKey =3D "NameService"; } String query =3D url.getQuery(); if (query =3D=3D null) { query =3D ""; } String props =3D StringUtil.removePrefix(query, "?").replace('= &', ','); - properties =3D new NamedValueList(props).getProperties(); + _properties =3D new NamedValueList(props).getProperties(); } catch (Exception ex) { throw new SystemException(ex); } } =20 + // public methods + public int getProtocol() { - return protocol; + return _protocol; } =20 public String getHost() { - return host; + return _host; } =20 public int getPort() { - return port; + return _port; } =20 public String getObjectKey() { - return objectKey; + return _objectKey; } =20 public PropertyMap getProperties() { - return properties; + return _properties; } =20 public String toString() { - return Protocol.getName(protocol) + "://" + host + ":" + port + "/= " + objectKey; + return Protocol.getName(_protocol) + "://" + _host + ":" + _port += "/" + _objectKey; } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/client/ValueInfo.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/client/ValueInfo.java?view=3Ddiff&r1= =3D158861&r2=3D158862 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/ValueInfo.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/client/ValueInfo.java Wed Mar 23 18:30:30 2005 @@ -18,30 +18,30 @@ package org.apache.geronimo.interop.rmi.iiop.client; =20 public class ValueInfo { - public String nameToBeResolved =3D null; - public Object objectToBeBound =3D null; + public String _nameToBeResolved =3D null; + public Object _objectToBeBound =3D null; =20 public ValueInfo(String nameToBeResolved) { - this.nameToBeResolved =3D nameToBeResolved; + _nameToBeResolved =3D nameToBeResolved; } =20 public ValueInfo(Object objectToBeBound) { - this.objectToBeBound =3D objectToBeBound; + _objectToBeBound =3D objectToBeBound; } =20 public void setNameToBeResolved(String name) { - nameToBeResolved =3D name; + _nameToBeResolved =3D name; } =20 public String getNameToBeResolved() { - return nameToBeResolved; + return _nameToBeResolved; } =20 public void setObjectToBeBound(Object object) { - objectToBeBound =3D object; + _objectToBeBound =3D object; } =20 public Object getObjectToBeBound() { - return objectToBeBound; + return _objectToBeBound; } }