Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 21023 invoked from network); 25 Mar 2005 12:57:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Mar 2005 12:57:10 -0000 Received: (qmail 89292 invoked by uid 500); 25 Mar 2005 12:57:04 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 89114 invoked by uid 500); 25 Mar 2005 12:57:02 -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 88892 invoked by uid 99); 25 Mar 2005 12:57:01 -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; Fri, 25 Mar 2005 04:56:56 -0800 Received: (qmail 1081 invoked by uid 65534); 25 Mar 2005 11:54:53 -0000 Message-ID: <20050325115453.1079.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: Fri, 25 Mar 2005 11:54:53 -0000 Subject: svn commit: r159005 [6/9] - in geronimo/trunk/modules: assembly/src/plan/ interop/ interop/src/idl/ interop/src/java/org/apache/geronimo/interop/ interop/src/java/org/apache/geronimo/interop/CosNaming/iiop_stubs/ interop/src/java/org/apache/geronimo/interop/adapter/ interop/src/java/org/apache/geronimo/interop/client/ interop/src/java/org/apache/geronimo/interop/generator/ interop/src/java/org/apache/geronimo/interop/naming/ interop/src/java/org/apache/geronimo/interop/properties/ interop/src/java/org/apache/geronimo/interop/repository/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/client/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/compiler/ interop/src/java/org/apache/geronimo/interop/rmi/iiop/server/ interop/src/java/org/apache/geronimo/interop/server/ interop/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/ObjectRef.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/ObjectRef.java?view=3Ddiff&r1=3D159004= &r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/ObjectRef.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/ObjectRef.java Fri Mar 25 03:54:30 2005 @@ -17,21 +17,23 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import java.util.Hashtable; - -import org.apache.geronimo.interop.IIOP.*; +import org.apache.geronimo.interop.*; +import org.apache.geronimo.interop.rmi.iiop.client.*; import org.apache.geronimo.interop.IOP.*; -import org.apache.geronimo.interop.SystemException; -import org.apache.geronimo.interop.rmi.iiop.client.ClientNamingContext; -import org.apache.geronimo.interop.rmi.iiop.client.Connection; -import org.apache.geronimo.interop.security.SimpleSubject; -import org.apache.geronimo.interop.util.FutureObject; -import org.apache.geronimo.interop.util.ThreadContext; -import org.apache.geronimo.interop.util.UTF8; -import org.apache.geronimo.interop.util.UnsignedShort; - +import org.apache.geronimo.interop.IIOP.*; +import org.apache.geronimo.interop.security.*; +import org.apache.geronimo.interop.util.*; +import java.util.*; + +public class ObjectRef extends CorbaObject +{ + //public static final Component $component =3D new Component(ObjectRef= .class); + + public static ObjectRef _getInstance() + { + return new ObjectRef(); //(ObjectRef)$component.getInstance(); + } =20 -public class ObjectRef implements org.omg.CORBA.Object { // -------------------------------------------------------------------= ---- // public data // -------------------------------------------------------------------= ---- @@ -44,19 +46,32 @@ // private data // -------------------------------------------------------------------= ---- =20 - private static FutureObject _defaultNamingContext =3D new FutureObject= () { - public Object evaluate() { + private static FutureObject _defaultNamingContext =3D new FutureObject= () + { + public Object evaluate() + { Hashtable env =3D new Hashtable(); return ClientNamingContext.getInstance(env); } }; =20 - private static Version VERSION_1_1 =3D new Version((byte) 1, (byte) 1)= ; + private static Version VERSION_1_1 =3D new Version((byte)1, (byte)1); =20 - private static Version VERSION_1_2 =3D new Version((byte) 1, (byte) 2)= ; + private static Version VERSION_1_2 =3D new Version((byte)1, (byte)2); =20 private static TaggedComponent[] NO_PROFILE_COMPONENTS =3D {}; =20 + /* + private static TaggedProfile AUTOMATIC_FAILOVER_PROFILE; + + static + { + AUTOMATIC_FAILOVER_PROFILE =3D new TaggedProfile(); + AUTOMATIC_FAILOVER_PROFILE.tag =3D AutomaticFailover.PROFILE_TAG; + AUTOMATIC_FAILOVER_PROFILE.profile_data =3D ArrayUtil.EMPTY_BYTE_A= RRAY; + } + */ + private int _iiopVersion =3D IIOP_VERSION_1_2; =20 private org.apache.geronimo.interop.IOP.IOR _ior; @@ -73,6 +88,8 @@ =20 private int _port =3D -1; =20 + //private boolean _automaticFailover; + public byte[] _objectKey; =20 public byte[] _objectState; @@ -80,50 +97,95 @@ public long _objectVersion; =20 // public methods - - public ObjectRef() { + =20 + public ObjectRef() + { + }=20 + + public Connection $connect() + { + try + { + Connection conn =3D $getNamingContext().getConnectionPool().ge= t(_protocol, $getEndpoint(), this); + conn.beforeInvoke(); + return conn; + } + catch (RuntimeException ex) + { + //if (_automaticFailover) + //{ + // throw new RetryInvokeException(ex); + //} + //else + //{ + throw ex; + //} + } } =20 - public Connection $connect() { - Connection conn =3D $getNamingContext().getConnectionPool().get(_p= rotocol, $getEndpoint(), this); - conn.beforeInvoke(); - return conn; + /* + public boolean $getAutomaticFailover() + { + return _automaticFailover; + } + */ + + /* + public void $setAutomaticFailover() + { + _automaticFailover =3D true; } + */ =20 - public int $getIiopVersion() { + public int $getIiopVersion() + { return _iiopVersion; } =20 - public void $setIiopVersion(int version) { + public void $setIiopVersion(int version) + { _iiopVersion =3D version; } =20 - public String $getID() { - if (_repositoryID =3D=3D null) { + public String $getID() + { + if (_repositoryID =3D=3D null) + { return ""; - } else { + } + else + { return _repositoryID; } } =20 - public void $setID(String id) { + public void $setID(String id) + { _repositoryID =3D id; } =20 - public org.apache.geronimo.interop.IOP.IOR $getIOR() { - if (_ior =3D=3D null) { + public org.apache.geronimo.interop.IOP.IOR $getIOR() + { + if (_ior =3D=3D null) + { ProfileBody_1_1 profileBody =3D new ProfileBody_1_1(); profileBody.iiop_version =3D _iiopVersion =3D=3D IIOP_VERSION_= 1_1 - ? VERSION_1_1 : VERSION_1_2; - if (_host =3D=3D null || _host.length() =3D=3D 0) { + ? VERSION_1_1 : VERSION_1_2; + if (_host =3D=3D null || _host.length() =3D=3D 0) + { profileBody.host =3D ThreadContext.getDefaultRmiHost(); - } else { + } + else + { profileBody.host =3D _host; } - if (_port =3D=3D -1) { - profileBody.port =3D (short) ThreadContext.getDefaultRmiPo= rt(); - } else { - profileBody.port =3D (short) _port; + if (_port =3D=3D -1) + { + profileBody.port =3D (short)ThreadContext.getDefaultRmiPor= t(); + } + else + { + profileBody.port =3D (short)_port; } profileBody.object_key =3D _objectKey; // TODO: if protocol using SSL, set port to 0 and set componen= ts @@ -137,129 +199,155 @@ =20 IOR ior =3D new IOR(); ior.type_id =3D $getID(); - ior.profiles =3D new TaggedProfile[]{profile}; + ior.profiles =3D new TaggedProfile[] { profile }; return ior; } return _ior; } =20 - public void $setIOR(org.apache.geronimo.interop.IOP.IOR ior) { + public void $setIOR(org.apache.geronimo.interop.IOP.IOR ior) + { _ior =3D ior; _endpoint =3D null; _objectKey =3D null; $getObjectKey(); // set _protocol, _host, _port, _objectKey } =20 - public ClientNamingContext $getNamingContext() { - if (_namingContext =3D=3D null) { - _namingContext =3D (ClientNamingContext) _defaultNamingContext= .getValue(); + public ClientNamingContext $getNamingContext() + { + if (_namingContext =3D=3D null) + { + _namingContext =3D (ClientNamingContext)_defaultNamingContext.= getValue(); } return _namingContext; } =20 - public void $setNamingContext(ClientNamingContext namingContext) { + public void $setNamingContext(ClientNamingContext namingContext) + { _namingContext =3D namingContext; } =20 - public int $getProtocol() { - if (_objectKey =3D=3D null) { + public int $getProtocol() + { + if (_objectKey =3D=3D null) + { $getObjectKey(); // to set _protocol } return _protocol; } =20 - public void $setProtocol(int protocol) { + public void $setProtocol(int protocol) + { _protocol =3D protocol; _ior =3D null; } =20 - public String $getHost() { - if (_objectKey =3D=3D null) { + public String $getHost() + { + if (_objectKey =3D=3D null) + { $getObjectKey(); // to set _host } return _host; } =20 - public void $setHost(String host) { + public void $setHost(String host) + { _host =3D host; _endpoint =3D null; _ior =3D null; } =20 - public int $getPort() { - if (_objectKey =3D=3D null) { + public int $getPort() + { + if (_objectKey =3D=3D null) + { $getObjectKey(); // to set _port } return _port; } =20 - public void $setPort(int port) { + public void $setPort(int port) + { _port =3D port; _endpoint =3D null; _ior =3D null; } =20 - public String $getEndpoint() { - if (_endpoint =3D=3D null) { + public String $getEndpoint() + { + if (_endpoint =3D=3D null) + { _endpoint =3D _host + ":" + _port; } return _endpoint; } =20 - public byte[] $getObjectKey() { - if (_objectKey =3D=3D null) { - if (_ior =3D=3D null) { + public byte[] $getObjectKey() + { + if (_objectKey =3D=3D null) + { + if (_ior =3D=3D null) + { throw new IllegalStateException("$getObjectKey: _ior =3D= =3D null && _objectKey =3D null"); } - TaggedProfile profile =3D _ior.profiles[0]; - if (profile.tag =3D=3D TAG_INTERNET_IOP.value - && _ior.profiles.length =3D=3D 1) { - ProfileBody_1_1 profileBody; - CdrInputStream input =3D CdrInputStream.getInstanceForEnca= psulation(); - input.setEncapsulation(profile.profile_data); - profileBody =3D ProfileBody_1_1Helper.read(input); - input.recycle(); - - _protocol =3D Protocol.IIOP; // TODO: IIOP/SSL etc. - _iiopVersion =3D profileBody.iiop_version.minor; - _host =3D profileBody.host; - _port =3D UnsignedShort.intValue(profileBody.port); - _objectKey =3D profileBody.object_key; - } else { - throw new SystemException("TODO"); + int n =3D _ior.profiles.length; + for (int i =3D 0; i < n; i++) + { + TaggedProfile profile =3D _ior.profiles[i]; + if (profile.tag =3D=3D TAG_INTERNET_IOP.value) + { + ProfileBody_1_1 profileBody; + CdrInputStream input =3D CdrInputStream.getInstanceFor= Encapsulation(); + input.setEncapsulation(profile.profile_data); + profileBody =3D ProfileBody_1_1Helper.read(input); + input.recycle(); + + _protocol =3D Protocol.IIOP; // TODO: IIOP/SSL etc. + _iiopVersion =3D profileBody.iiop_version.minor; + _host =3D profileBody.host; + _port =3D UnsignedShort.intValue(profileBody.port); + _objectKey =3D profileBody.object_key; + } } } return _objectKey; } =20 - public String $getObjectKeyString() { + public String $getObjectKeyString() + { return UTF8.toString($getObjectKey()); } =20 - public void $setObjectKey(byte[] objectKey) { + public void $setObjectKey(byte[] objectKey) + { _objectKey =3D objectKey; _ior =3D null; } =20 - public void $setObjectKey(String objectKey) { + public void $setObjectKey(String objectKey) + { $setObjectKey(UTF8.fromString(objectKey)); } =20 - public void $setObjectKey(String prefix, byte[] suffixBytes) { + public void $setObjectKey(String prefix, byte[] suffixBytes) + { byte[] prefixBytes =3D UTF8.fromString(prefix); int p =3D prefixBytes.length; int s =3D suffixBytes.length; byte[] objectKey =3D new byte[p + 1 + s]; System.arraycopy(prefixBytes, 0, objectKey, 0, p); - objectKey[p] =3D (byte) ':'; + objectKey[p] =3D (byte)':'; System.arraycopy(suffixBytes, 0, objectKey, p + 1, s); $setObjectKey(objectKey); } =20 - public void $setObjectKey(Class compClass) { + public void $setObjectKey(Class compClass) + { SimpleSubject subject =3D SimpleSubject.getCurrent(); if (subject !=3D null - && (subject.getFlags() & SimpleSubject.FLAG_SESSION_MANAGER) != =3D 0) { + && (subject.getFlags() & SimpleSubject.FLAG_SESSION_MANAGER) != =3D 0) + { // Initialize for simple IDL interoperability. ObjectKey objectKey =3D new ObjectKey(); objectKey.component =3D compClass.getName(); @@ -269,86 +357,16 @@ key[0] =3D 'I'; _iiopVersion =3D IIOP_VERSION_1_1; $setObjectKey(key); - } else { + } + else + { // Initialize for RMI-IIOP. $setObjectKey(compClass.getName()); } } =20 - public String[] _ids() { - String[] ids =3D - { - "" //_type - } - ; - return ids; - } - - public Object $getRequestKey() { - // - //if (_automaticFailover) - //{ - // return $getNamingContext().getRequestKey(); - //} - //else - //{ + public Object $getRequestKey() + { return null; - //} - } - - public boolean _is_a(String id) { - return false; - } - - // -------------------------------------------------------------------= ---- - // unimplemented public methods (only required for full CORBA ORB) - // -------------------------------------------------------------------= ---- - - public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context p1,= String p2, org.omg.CORBA.NVList p3, org.omg.CORBA.NamedValue p4) { - throw new org.omg.CORBA.BAD_OPERATION("_create_request"); - } - - public org.omg.CORBA.Request _create_request(org.omg.CORBA.Context p1,= String p2, org.omg.CORBA.NVList p3, org.omg.CORBA.NamedValue p4, org.omg.C= ORBA.ExceptionList p5, org.omg.CORBA.ContextList p6) { - throw new org.omg.CORBA.BAD_OPERATION("_create_request"); - } - - public org.omg.CORBA.Object _duplicate() { - throw new org.omg.CORBA.BAD_OPERATION("_duplicate"); - } - - public org.omg.CORBA.DomainManager[] _get_domain_managers() { - throw new org.omg.CORBA.BAD_OPERATION("_get_domain_manager"); - } - - public org.omg.CORBA.Object _get_interface_def() { - throw new org.omg.CORBA.BAD_OPERATION("_get_interface_def"); - } - - public org.omg.CORBA.Policy _get_policy(int p1) { - throw new org.omg.CORBA.BAD_OPERATION("_get_policy"); - } - - public int _hash(int p1) { - throw new org.omg.CORBA.BAD_OPERATION("_hash"); - } - - public boolean _is_equivalent(org.omg.CORBA.Object p1) { - throw new org.omg.CORBA.BAD_OPERATION("_is_equivalent"); - } - - public boolean _non_existent() { - throw new org.omg.CORBA.BAD_OPERATION("_non_existent"); - } - - public void _release() { - throw new org.omg.CORBA.BAD_OPERATION("_release"); - } - - public org.omg.CORBA.Request _request(String p1) { - throw new org.omg.CORBA.BAD_OPERATION("_request"); - } - - public org.omg.CORBA.Object _set_policy_override(org.omg.CORBA.Policy[= ] p1, org.omg.CORBA.SetOverrideType p2) { - throw new org.omg.CORBA.BAD_OPERATION("_set_policy_override"); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/ObjectRefHelper.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/ObjectRefHelper.java?view=3Ddiff&r1=3D= 159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/ObjectRefHelper.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/ObjectRefHelper.java Fri Mar 25 03:54:30 2005 @@ -17,25 +17,39 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 +import org.apache.geronimo.interop.*; +import org.apache.geronimo.interop.IOP.*; =20 - - -public class ObjectRefHelper implements ObjectHelper { - public static ObjectRefHelper getInstance(Class theClass) { +public class ObjectRefHelper implements ObjectHelper +{ + public static ObjectRefHelper getInstance(Class theClass) + { return new ObjectRefHelper(); } =20 - public Object read(ObjectInputStream input) { + public Object read(ObjectInputStream input) + { return input._cdrInput.read_Object(); } =20 - public void write(ObjectOutputStream output, Object value) { - if (value =3D=3D null || value instanceof ObjectRef) { - output._cdrOutput.write_Object((org.omg.CORBA.Object) value); - } else if (value instanceof RemoteInterface) { - RemoteInterface remote =3D (RemoteInterface) value; - output._cdrOutput.write_Object((org.omg.CORBA.Object) remote.$= getObjectRef()); - } else { + public void write(ObjectOutputStream output, Object value) + { + if (value =3D=3D null || value instanceof ObjectRef) + { + output._cdrOutput.write_Object((org.omg.CORBA.Object)value); + } + else if (value instanceof RemoteInterface) + { + RemoteInterface remote =3D (RemoteInterface)value; + ObjectRef objectRef =3D remote.getObjectRef(); + //if (value instanceof AutomaticFailover) + //{ + // objectRef.$setAutomaticFailover(); + //} + output._cdrOutput.write_Object(objectRef); + } + else + { throw new IllegalArgumentException("class =3D " + value.getCla= ss()); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/PrimitiveType.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/PrimitiveType.java?view=3Ddiff&r1=3D15= 9004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/PrimitiveType.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/PrimitiveType.java Fri Mar 25 03:54:30 2005 @@ -17,23 +17,26 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import org.apache.geronimo.interop.util.ArrayUtil; +import org.apache.geronimo.interop.util.*; =20 - -public class PrimitiveType { +public class PrimitiveType +{ public static final int BOOLEAN =3D 1; - public static final int BYTE =3D 2; - public static final int CHAR =3D 3; - public static final int DOUBLE =3D 4; - public static final int FLOAT =3D 5; - public static final int INT =3D 6; - public static final int LONG =3D 7; - public static final int SHORT =3D 8; - - public static final ObjectHelper BOOLEAN_ARRAY_HELPER =3D new ObjectHe= lper() { - public Object read(ObjectInputStream input) { + public static final int BYTE =3D 2; + public static final int CHAR =3D 3; + public static final int DOUBLE =3D 4; + public static final int FLOAT =3D 5; + public static final int INT =3D 6; + public static final int LONG =3D 7; + public static final int SHORT =3D 8; + + public static final ObjectHelper BOOLEAN_ARRAY_HELPER =3D new ObjectHe= lper() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_BOOLEAN_ARRAY; } boolean[] array =3D new boolean[n]; @@ -41,19 +44,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - boolean[] array =3D (boolean[]) value; + public void write(ObjectOutputStream output, Object value) + { + boolean[] array =3D (boolean[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_boolean_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper BYTE_ARRAY_HELPER =3D new ObjectHelpe= r() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper BYTE_ARRAY_HELPER =3D new ObjectHelpe= r() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_BYTE_ARRAY; } byte[] array =3D new byte[n]; @@ -61,19 +68,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - byte[] array =3D (byte[]) value; + public void write(ObjectOutputStream output, Object value) + { + byte[] array =3D (byte[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_octet_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper CHAR_ARRAY_HELPER =3D new ObjectHelpe= r() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper CHAR_ARRAY_HELPER =3D new ObjectHelpe= r() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_CHAR_ARRAY; } char[] array =3D new char[n]; @@ -81,19 +92,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - char[] array =3D (char[]) value; + public void write(ObjectOutputStream output, Object value) + { + char[] array =3D (char[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_char_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper DOUBLE_ARRAY_HELPER =3D new ObjectHel= per() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper DOUBLE_ARRAY_HELPER =3D new ObjectHel= per() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_DOUBLE_ARRAY; } double[] array =3D new double[n]; @@ -101,19 +116,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - double[] array =3D (double[]) value; + public void write(ObjectOutputStream output, Object value) + { + double[] array =3D (double[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_double_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper FLOAT_ARRAY_HELPER =3D new ObjectHelp= er() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper FLOAT_ARRAY_HELPER =3D new ObjectHelp= er() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_FLOAT_ARRAY; } float[] array =3D new float[n]; @@ -121,19 +140,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - float[] array =3D (float[]) value; + public void write(ObjectOutputStream output, Object value) + { + float[] array =3D (float[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_float_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper INT_ARRAY_HELPER =3D new ObjectHelper= () { - public Object read(ObjectInputStream input) { + public static final ObjectHelper INT_ARRAY_HELPER =3D new ObjectHelper= () + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_INT_ARRAY; } int[] array =3D new int[n]; @@ -141,19 +164,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - int[] array =3D (int[]) value; + public void write(ObjectOutputStream output, Object value) + { + int[] array =3D (int[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_long_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper LONG_ARRAY_HELPER =3D new ObjectHelpe= r() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper LONG_ARRAY_HELPER =3D new ObjectHelpe= r() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_LONG_ARRAY; } long[] array =3D new long[n]; @@ -161,19 +188,23 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - long[] array =3D (long[]) value; + public void write(ObjectOutputStream output, Object value) + { + long[] array =3D (long[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_longlong_array(array, 0, n); } } - ; + ; =20 - public static final ObjectHelper SHORT_ARRAY_HELPER =3D new ObjectHelp= er() { - public Object read(ObjectInputStream input) { + public static final ObjectHelper SHORT_ARRAY_HELPER =3D new ObjectHelp= er() + { + public Object read(ObjectInputStream input) + { int n =3D input._cdrInput.read_long(); - if (n =3D=3D 0) { + if (n =3D=3D 0) + { return ArrayUtil.EMPTY_SHORT_ARRAY; } short[] array =3D new short[n]; @@ -181,61 +212,100 @@ return array; } =20 - public void write(ObjectOutputStream output, Object value) { - short[] array =3D (short[]) value; + public void write(ObjectOutputStream output, Object value) + { + short[] array =3D (short[])value; int n =3D array.length; output._cdrOutput.write_long(n); output._cdrOutput.write_short_array(array, 0, n); } } - ; + ; =20 - public static int get(Class _class) { - if (_class =3D=3D boolean.class) { + public static int get(Class _class) + { + if (_class =3D=3D boolean.class) + { return BOOLEAN; - } else if (_class =3D=3D byte.class) { + } + else if (_class =3D=3D byte.class) + { return BYTE; - } else if (_class =3D=3D char.class) { + } + else if (_class =3D=3D char.class) + { return CHAR; - } else if (_class =3D=3D double.class) { + } + else if (_class =3D=3D double.class) + { return DOUBLE; - } else if (_class =3D=3D float.class) { + } + else if (_class =3D=3D float.class) + { return FLOAT; - } else if (_class =3D=3D int.class) { + } + else if (_class =3D=3D int.class) + { return INT; - } else if (_class =3D=3D long.class) { + } + else if (_class =3D=3D long.class) + { return LONG; - } else if (_class =3D=3D short.class) { + } + else if (_class =3D=3D short.class) + { return SHORT; - } else { - throw new IllegalArgumentException("class =3D " + _class.getNa= me()); + } + else + { + throw new IllegalArgumentException("class =3D " +_class.getNam= e()); } } =20 - public static ObjectHelper getArrayHelper(Class _class) { - if (_class =3D=3D boolean.class) { + public static ObjectHelper getArrayHelper(Class _class) + { + if (_class =3D=3D boolean.class) + { return BOOLEAN_ARRAY_HELPER; - } else if (_class =3D=3D byte.class) { + } + else if (_class =3D=3D byte.class) + { return BYTE_ARRAY_HELPER; - } else if (_class =3D=3D char.class) { + } + else if (_class =3D=3D char.class) + { return CHAR_ARRAY_HELPER; - } else if (_class =3D=3D double.class) { + } + else if (_class =3D=3D double.class) + { return DOUBLE_ARRAY_HELPER; - } else if (_class =3D=3D float.class) { + } + else if (_class =3D=3D float.class) + { return FLOAT_ARRAY_HELPER; - } else if (_class =3D=3D int.class) { + } + else if (_class =3D=3D int.class) + { return INT_ARRAY_HELPER; - } else if (_class =3D=3D long.class) { + } + else if (_class =3D=3D long.class) + { return LONG_ARRAY_HELPER; - } else if (_class =3D=3D short.class) { + } + else if (_class =3D=3D short.class) + { return SHORT_ARRAY_HELPER; - } else { - throw new IllegalArgumentException("class =3D " + _class.getNa= me()); + } + else + { + throw new IllegalArgumentException("class =3D " +_class.getNam= e()); } } =20 - public static org.omg.CORBA.TypeCode getTypeCode(int p) { - switch (p) { + public static org.omg.CORBA.TypeCode getTypeCode(int p) + { + switch (p) + { case BOOLEAN: return TypeCode.BOOLEAN; case BYTE: // java byte is IDL octet Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/Protocol.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/Protocol.java?view=3Ddiff&r1=3D159004&= r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/Protocol.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/Protocol.java Fri Mar 25 03:54:30 2005 @@ -17,52 +17,57 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -public abstract class Protocol { - public static final int IIOP =3D 1; +public abstract class Protocol +{ + public static final int IIOP =3D 1; public static final int IIOPS =3D 2; - public static final int HTTP =3D 3; + public static final int HTTP =3D 3; public static final int HTTPS =3D 4; =20 - public static String getName(int protocol) { - switch (protocol) { - case IIOP: - return "iiop"; - case IIOPS: - return "iiop"; - case HTTP: - return "http"; - case HTTPS: - return "https"; - default: - throw new IllegalArgumentException("protocol =3D " + proto= col); + public static String getName(int protocol) + { + switch (protocol) + { + case IIOP: return "iiop"; + case IIOPS: return "iiop"; + case HTTP: return "http"; + case HTTPS: return "https"; + default: throw new IllegalArgumentException("protocol =3D " + = protocol); } } =20 - public static String getScheme(int protocol) { - switch (protocol) { - case IIOP: - return "iiop:"; - case IIOPS: - return "iiop:"; - case HTTP: - return "http:"; - case HTTPS: - return "https:"; - default: - throw new IllegalArgumentException("protocol =3D " + proto= col); + public static String getScheme(int protocol) + { + switch (protocol) + { + case IIOP: return "iiop:"; + case IIOPS: return "iiop:"; + case HTTP: return "http:"; + case HTTPS: return "https:"; + default: throw new IllegalArgumentException("protocol =3D " + = protocol); } } =20 - public static int getNumber(String protocol) { - if (protocol.equals("iiop")) { + public static int getNumber(String protocol) + { + if (protocol.equals("iiop")) + { return IIOP; - } else if (protocol.equals("iiops")) { + } + else if (protocol.equals("iiops")) + { return IIOPS; - } else if (protocol.equals("http")) { + } + else if (protocol.equals("http")) + { return HTTP; - } else if (protocol.equals("https")) { + } + else if (protocol.equals("https")) + { return HTTPS; - } else { + } + else + { throw new IllegalArgumentException("protocol =3D " + protocol)= ; } } 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= 159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Fri Mar 25 03:54:30 2005 @@ -17,10 +17,11 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -public interface RemoteInterface { - public ObjectRef $getObjectRef(); - - public RemoteInterface $getSkeleton(); +import org.apache.geronimo.interop.adapter.Adapter; =20 - public void $invoke(String method, byte[] objectKey, Object instance, = ObjectInputStream input, ObjectOutputStream output); +public interface RemoteInterface { + 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); } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/RemoteObject.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/RemoteObject.java?view=3Ddiff&r1=3D159= 004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/RemoteObject.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/RemoteObject.java Fri Mar 25 03:54:30 2005 @@ -17,14 +17,32 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 +import org.apache.geronimo.interop.adapter.Adapter; + +import java.util.HashMap; + public abstract class RemoteObject { - public RemoteObject() { + + protected HashMap methods =3D new HashMap(10); + + public RemoteObject( ) { + registerMethods(); } =20 protected void registerMethods() { registerMethod("_is_a", -1); } =20 + protected void registerMethod( String methodName, int id ) + { + methods.put( methodName, new Integer(id) ); + } + + protected Integer getMethodId( String methodName ) + { + return (Integer)methods.get( methodName ); + } + public void invoke(int id, byte[] objectKey, Object instance, ObjectIn= putStream input, ObjectOutputStream output) { switch (id) { case -1: @@ -53,6 +71,4 @@ } =20 public abstract String[] getIds(); - - public abstract void registerMethod(String name, int id); } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/SecurityInfo.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/SecurityInfo.java?view=3Ddiff&r1=3D159= 004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/SecurityInfo.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/SecurityInfo.java Fri Mar 25 03:54:30 2005 @@ -36,26 +36,20 @@ (byte) 'P', (byte) 'A', (byte) 'S', (byte) 'S' }); =20 - public static Random _seedFactory =3D new Random(); + public static Random seedFactory =3D new Random(); + public String username; + public String password; =20 - public String username; - - public String password; - - // private data - - private static ThreadLocal _current =3D new ThreadLocal(); + private static ThreadLocal current =3D new ThreadLocal(); =20 public static SecurityInfo getCurrent() { - return (SecurityInfo) _current.get(); + return (SecurityInfo) current.get(); } =20 public static void setCurrent(SecurityInfo info) { - _current.set(info); + current.set(info); } =20 - // TODO: delegate to use DataProtection class - /** * * Encode a username or password to prevent accidental disclosure * * by packet sniffers etc. The intention is not to provide strong @@ -66,7 +60,7 @@ * * similar requirements in Random.java. */ public static byte[] encode(String plainText) { - int seed =3D _seedFactory.nextInt(); // data race, but we don't ca= re + int seed =3D seedFactory.nextInt(); // data race, but we don't car= e Random random =3D new Random(seed); byte[] utf8 =3D UTF8.fromString(plainText); int n =3D utf8.length; 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=3D159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Fri Mar 25 03:54:30 2005 @@ -17,56 +17,84 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import java.io.IOException; - -import org.apache.geronimo.interop.SystemException; -import org.apache.geronimo.interop.util.JavaObject; - - -public class SimpleObjectInputStream extends ObjectInputStream { - public static ObjectInputStream getInstance() { - return getInstance(CdrInputStream.getInstance()); +import org.apache.geronimo.interop.*; +import org.apache.geronimo.interop.rmi.*; +import org.apache.geronimo.interop.util.*; +import java.io.*; + +public class SimpleObjectInputStream extends ObjectInputStream +{ + //public static final Component component =3D new Component(SimpleObje= ctInputStream.class); + + public static ObjectInputStream getInstance() + { + ObjectInputStream ois =3D null; + try { + ois =3D new SimpleObjectInputStream(); + } catch (IOException e) { + e.printStackTrace(); //To change body of catch statement use = File | Settings | File Templates. + } + return ois; // getInstance(CdrInputStream.getInstance()); } =20 - public static ObjectInputStream getInstance(byte[] bytes) { + public static ObjectInputStream getInstance(byte[] bytes) + { return getInstance(CdrInputStream.getInstance(bytes)); } =20 - public static ObjectInputStream getInstance(org.apache.geronimo.intero= p=2Ermi.iiop.CdrInputStream cdrInput) { - ObjectInputStream input =3D null; - try { - input =3D new SimpleObjectInputStream(); - } catch (Exception ex) { - throw new SystemException(ex); - } - + public static ObjectInputStream getInstance(org.apache.geronimo.intero= p=2Ermi.iiop.CdrInputStream cdrInput) + { + ObjectInputStream input =3D getInstance(); // (SimpleObjectInputSt= ream)component.getInstance(); input.init(cdrInput); return input; } =20 + public static ObjectInputStream getPooledInstance() + { + ObjectInputStream input =3D null; // (SimpleObjectInputStream)_poo= l=2Eget(); + if (input =3D=3D null) + { + input =3D getInstance(); + } + return input; + } + // -------------------------------------------------------------------= ---- // private data // -------------------------------------------------------------------= ---- =20 + //private static ThreadLocalInstancePool _pool =3D new ThreadLocalInst= ancePool(SimpleObjectInputStream.class.getName()); + // -------------------------------------------------------------------= ---- // public methods // -------------------------------------------------------------------= ---- =20 - public SimpleObjectInputStream() throws IOException { + public SimpleObjectInputStream() throws IOException + { super(); } =20 - public void $reset() { + public void $reset() + { _cdrInput.reset(); } =20 - public void recycle() { + public void recycle() + { $reset(); + //_pool.put(this); + } + + public Exception readException(ValueType type) + { + return (Exception)readObject(type); } =20 - public Object readObject(ValueType type) { + public Object readObject(ValueType type) + { ObjectHelper h =3D type.helper; - if (h !=3D null) { + if (h !=3D null) + { return h.read(this); } byte[] bytes =3D _cdrInput.read_octet_sequence(); @@ -78,7 +106,8 @@ // protected methods // -------------------------------------------------------------------= ---- =20 - protected void init(org.apache.geronimo.interop.rmi.iiop.CdrInputStrea= m cdrInput) { + protected void init(org.apache.geronimo.interop.rmi.iiop.CdrInputStrea= m cdrInput) + { super.init(cdrInput); } } 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=3D159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Fri Mar 25 03:54:30 2005 @@ -17,53 +17,82 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -import java.io.IOException; - -import org.apache.geronimo.interop.SystemException; -import org.apache.geronimo.interop.util.ArrayUtil; -import org.apache.geronimo.interop.util.JavaObject; - - -public class SimpleObjectOutputStream extends ObjectOutputStream { - public static ObjectOutputStream getInstance() { - return getInstance(CdrOutputStream.getInstance()); - } - - public static ObjectOutputStream getInstance(CdrOutputStream cdrOutput= ) { - ObjectOutputStream output =3D null; +import org.apache.geronimo.interop.*; +import org.apache.geronimo.interop.rmi.*; +import org.apache.geronimo.interop.util.*; +import java.io.*; + +public class SimpleObjectOutputStream extends ObjectOutputStream +{ + //public static final Component component =3D new Component(SimpleObje= ctOutputStream.class); + + public static ObjectOutputStream getInstance() + { + ObjectOutputStream oos =3D null; try { - output =3D new SimpleObjectOutputStream(); - } catch (Exception ex) { - throw new SystemException(ex); + oos =3D new SimpleObjectOutputStream(); + } catch (IOException e) { + e.printStackTrace(); //To change body of catch statement use = File | Settings | File Templates. } + return oos; // getInstance(CdrOutputStream.getInstance()); + } =20 + public static ObjectOutputStream getInstance(CdrOutputStream cdrOutput= ) + { + ObjectOutputStream output =3D getInstance(); // (SimpleObjectOutpu= tStream)component.getInstance(); output.init(cdrOutput); return output; } =20 + public static ObjectOutputStream getPooledInstance() + { + ObjectOutputStream output =3D null; // (SimpleObjectOutputStream)_= pool.get(); + if (output =3D=3D null) + { + output =3D getInstance(); + } + return output; + } + // -------------------------------------------------------------------= ---- // private data // -------------------------------------------------------------------= ---- =20 + //private static ThreadLocalInstancePool _pool =3D new ThreadLocalInst= ancePool(SimpleObjectOutputStream.class.getName()); + // -------------------------------------------------------------------= ---- // public methods // -------------------------------------------------------------------= ---- =20 - public SimpleObjectOutputStream() throws IOException { + public SimpleObjectOutputStream() throws IOException + { super(); } =20 - public void $reset() { + public void $reset() + { _cdrOutput.reset(); } =20 - public void recycle() { + public void recycle() + { $reset(); + //_pool.put(this); + } + + public void writeException(ValueType type, Exception value) + { + String repositoryID =3D "IDL:" + type._class.getName().replace('.'= , '/') + ":1.0"; + _cdrOutput.write_string(repositoryID); + writeObject(type, value); + _hasException =3D true; } =20 - public void writeObject(ValueType type, Object value) { + public void writeObject(ValueType type, Object value) + { ObjectHelper h =3D type.helper; - if (h !=3D null) { + if (h !=3D null) + { h.write(this, value); return; } @@ -76,7 +105,8 @@ // protected methods // -------------------------------------------------------------------= ---- =20 - protected void init(CdrOutputStream cdrOutput) { + protected void init(CdrOutputStream cdrOutput) + { super.init(cdrOutput); } } Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/StringHelper.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/StringHelper.java?view=3Ddiff&r1=3D159= 004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/StringHelper.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringHelper.java Fri Mar 25 03:54:30 2005 @@ -17,14 +17,17 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -public class StringHelper implements ObjectHelper { +public class StringHelper implements ObjectHelper +{ public static final StringHelper SINGLETON =3D new StringHelper(); =20 - public Object read(ObjectInputStream input) { + public Object read(ObjectInputStream input) + { return input._cdrInput.read_string(); } =20 - public void write(ObjectOutputStream output, Object value) { - output._cdrOutput.write_string((String) value); + public void write(ObjectOutputStream output, Object value) + { + output._cdrOutput.write_string((String)value); } } Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/= 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=3Dauto&rev= =3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHelper.java Fri Mar 25 03:54:30 2005 @@ -0,0 +1,109 @@ +/** + * + * 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; + +/** + ** 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 + (java.lang.String[] _value) + { + if (_value =3D=3D null) + { + return null; + } + int _16 =3D _value.length; + java.lang.String[] _clone =3D new java.lang.String[_16]; + for (int _17 =3D 0; _17 < _16; _17++) + { + _clone[_17] =3D _value[_17]; + } + return _clone; + } + + public static java.lang.String[] read + (org.omg.CORBA.portable.InputStream _input) + { + int _18 =3D _input.read_ulong(); + java.lang.String[] value =3D new java.lang.String[_18]; + for (int _19 =3D 0; _19 < _18; _19++) + { + value[_19] =3D _input.read_string(); + } + return value; + } + + public static void write + (org.omg.CORBA.portable.OutputStream _output, + java.lang.String[] value) + { + if (value =3D=3D null) + { + value =3D new java.lang.String[0]; + } + int _20 =3D value.length; + _output.write_ulong(_20); + for (int _21 =3D 0; _21 < _20; _21++) + { + _output.write_string(value[_21]); + } + } + + public static org.omg.CORBA.TypeCode _type; + + public static org.omg.CORBA.TypeCode type() + { + if (_type =3D=3D null) + { + org.omg.CORBA.ORB orb =3D org.omg.CORBA.ORB.init(); + _type =3D orb.create_sequence_tc(0, orb.get_primitive_tc(org.o= mg.CORBA.TCKind.tk_string)); + } + return _type; + } + + public static void insert + (org.omg.CORBA.Any any, + java.lang.String[] value) + { + org.omg.CORBA.portable.OutputStream output =3D any.create_output_s= tream(); + write(output, value); + any.read_value(output.create_input_stream(), type()); + } + + public static java.lang.String[] extract + (org.omg.CORBA.Any any) + { + if (! any.type().equal(type())) + { + throw new org.omg.CORBA.BAD_OPERATION(); + } + return read(any.create_input_stream()); + } + + public static java.lang.String id() + { + return "IDL:com/sybase/djc/rmi/iiop/StringSeq:1.0"; + } +} Added: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/= 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=3Dauto&rev= =3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 (added) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringSeqHolder.java Fri Mar 25 03:54:30 2005 @@ -0,0 +1,58 @@ +/** + * + * 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; + +/** + ** 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; + + public StringSeqHolder() + { + } + + public StringSeqHolder + (java.lang.String[] _value) + { + value =3D _value; + } + + public org.omg.CORBA.TypeCode _type() + { + return org.apache.geronimo.interop.rmi.iiop.StringSeqHelper.type()= ; + } + + public void _read + (org.omg.CORBA.portable.InputStream _input) + { + value =3D org.apache.geronimo.interop.rmi.iiop.StringSeqHelper.rea= d(_input); + } + + public void _write + (org.omg.CORBA.portable.OutputStream _output) + { + org.apache.geronimo.interop.rmi.iiop.StringSeqHelper.write(_output= , value); + } +} Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/StringValueHelper.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/StringValueHelper.java?view=3Ddiff&r1= =3D159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/StringValueHelper.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/StringValueHelper.java Fri Mar 25 03:54:30 2005 @@ -17,14 +17,17 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -public class StringValueHelper implements ObjectHelper { +public class StringValueHelper implements ObjectHelper +{ public static final StringValueHelper SINGLETON =3D new StringValueHel= per(); =20 - public Object read(ObjectInputStream input) { + public Object read(ObjectInputStream input) + { return input._cdrInput.read_string(); } =20 - public void write(ObjectOutputStream output, Object value) { - output._cdrOutput.write_string((String) value); + public void write(ObjectOutputStream output, Object value) + { + output._cdrOutput.write_string((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=3D159004&= r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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 Fri Mar 25 03:54:30 2005 @@ -21,34 +21,55 @@ import org.omg.CORBA.TypeCodePackage.BadKind; import org.omg.CORBA.TypeCodePackage.Bounds; =20 - /** * * An implementation of CORBA 'TypeCode' for use with RMI-IIOP. */ -public class TypeCode extends org.omg.CORBA.TypeCode { +public class TypeCode + extends org.omg.CORBA.TypeCode +{ // -------------------------------------------------------------------= ---- // public data // -------------------------------------------------------------------= ---- =20 public static final TypeCode NULL =3D new TypeCode(TCKind.tk_null); + public static final TypeCode VOID =3D new TypeCode(TCKind.tk_void); + public static final TypeCode ANY =3D new TypeCode(TCKind.tk_any); + public static final TypeCode BOOLEAN =3D new TypeCode(TCKind.tk_boolea= n); + public static final TypeCode CHAR =3D new TypeCode(TCKind.tk_char); + public static final TypeCode WCHAR =3D new TypeCode(TCKind.tk_wchar); + public static final TypeCode OCTET =3D new TypeCode(TCKind.tk_octet); + public static final TypeCode SHORT =3D new TypeCode(TCKind.tk_short); + public static final TypeCode USHORT =3D new TypeCode(TCKind.tk_ushort); + public static final TypeCode LONG =3D new TypeCode(TCKind.tk_long); + public static final TypeCode ULONG =3D new TypeCode(TCKind.tk_ulong); + public static final TypeCode LONGLONG =3D new TypeCode(TCKind.tk_longl= ong); + public static final TypeCode ULONGLONG =3D new TypeCode(TCKind.tk_ulon= glong); + public static final TypeCode FLOAT =3D new TypeCode(TCKind.tk_float); + public static final TypeCode DOUBLE =3D new TypeCode(TCKind.tk_double); - public static final TypeCode LONGDOUBLE =3D new TypeCode(TCKind.tk_lon= gdouble); + + public static final TypeCode LONGDOUBLE =3D new TypeCode( + TCKind.tk_longdouble); + public static final TypeCode STRING =3D new TypeCode(TCKind.tk_string); + public static final TypeCode WSTRING =3D new TypeCode(TCKind.tk_wstrin= g); + public static final TypeCode OBJREF =3D new TypeCode(TCKind.tk_objref); + public static final TypeCode TYPECODE =3D new TypeCode(TCKind.tk_TypeC= ode); =20 // -------------------------------------------------------------------= ---- @@ -95,10 +116,12 @@ /** * @param kind */ - public TypeCode(TCKind kind) { + public TypeCode(TCKind kind) + { _kind =3D kind; _default =3D -1; - if (kind.value() =3D=3D TCKind._tk_objref) { + if (kind.value() =3D=3D TCKind._tk_objref) + { _type =3D "Object"; } } @@ -107,60 +130,84 @@ * @param tc * @return */ - public boolean equal(org.omg.CORBA.TypeCode tc) { - if (_indirection) { + public boolean equal(org.omg.CORBA.TypeCode tc) + { + if (_indirection) + { return _ref.equal(tc); } - try { + try + { int tk =3D _kind.value(); - if (tk !=3D tc.kind().value()) { + if (tk !=3D tc.kind().value()) + { return false; } // TODO: compare id() - if (_member_name !=3D null) { + if (_member_name !=3D null) + { int n =3D _member_name.length; - if (n !=3D tc.member_count()) { + if (n !=3D tc.member_count()) + { return false; } - for (int i =3D 0; i < n; i++) { - if (!equalIfNotEmpty(member_name(i), tc.member_name(i)= )) { + for (int i =3D 0; i < n; i++) + { + if (!equalIfNotEmpty(member_name(i), tc.member_name(i)= )) + { return false; } - if (!member_type(i).equal(tc.member_type(i))) { + if (!member_type(i).equal(tc.member_type(i))) + { return false; } } } - if (tk =3D=3D TCKind._tk_union) { - if (!discriminator_type().equal(tc.discriminator_type())) { + if (tk =3D=3D TCKind._tk_union) + { + if (!discriminator_type().equal(tc.discriminator_type())) + { return false; } int n =3D _member_name.length; - for (int i =3D 0; i < n; i++) { - if (!member_label(i).equal(tc.member_label(i))) { + for (int i =3D 0; i < n; i++) + { + if (!member_label(i).equal(tc.member_label(i))) + { return false; } } } if (tk =3D=3D TCKind._tk_array - || tk =3D=3D TCKind._tk_sequence - || tk =3D=3D TCKind._tk_string - || tk =3D=3D TCKind._tk_wstring) { - if (length() !=3D tc.length()) { + || + tk =3D=3D TCKind._tk_sequence + || + tk =3D=3D TCKind._tk_string + || tk =3D=3D TCKind._tk_wstring) + { + if (length() !=3D tc.length()) + { return false; } } if (tk =3D=3D TCKind._tk_alias - || tk =3D=3D TCKind._tk_array - || tk =3D=3D TCKind._tk_sequence) { - if (!content_type().equal(tc.content_type())) { + || + tk =3D=3D TCKind._tk_array + || tk =3D=3D TCKind._tk_sequence) + { + if (!content_type().equal(tc.content_type())) + { return false; } } return true; - } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) { + } + catch (org.omg.CORBA.TypeCodePackage.BadKind ex) + { throw new org.omg.CORBA.UNKNOWN(ex.toString()); - } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) { + } + catch (org.omg.CORBA.TypeCodePackage.Bounds ex) + { throw new org.omg.CORBA.UNKNOWN(ex.toString()); } } @@ -170,14 +217,16 @@ * @return */ public boolean equivalent - (org.omg.CORBA.TypeCode tc) { + (org.omg.CORBA.TypeCode tc) + { throw new org.omg.CORBA.NO_IMPLEMENT(); } =20 /** * @return */ - public org.omg.CORBA.TypeCode get_compact_typecode() { + public org.omg.CORBA.TypeCode get_compact_typecode() + { throw new org.omg.CORBA.NO_IMPLEMENT(); } =20 @@ -186,10 +235,14 @@ * @param b * @return */ - private boolean equalIfNotEmpty(String a, String b) { - if (a.length() =3D=3D 0 || b.length() =3D=3D 0) { + private boolean equalIfNotEmpty(String a, String b) + { + if (a.length() =3D=3D 0 || b.length() =3D=3D 0) + { return true; - } else { + } + else + { return a.equals(b); } } @@ -197,8 +250,10 @@ /** * @return */ - public TCKind kind() { - if (_indirection) { + public TCKind kind() + { + if (_indirection) + { return _ref.kind(); } return _kind; @@ -209,14 +264,18 @@ * @throws BadKind */ public String id() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.id(); } - if (_id !=3D null) { + if (_id !=3D null) + { return _id; } - if (_type !=3D null && _type.equals("Object")) { + if (_type !=3D null && _type.equals("Object")) + { return ""; } return default_id(); @@ -226,19 +285,25 @@ /** * @param id */ - public void id(String id) { - if (!id.equals("")) { + public void id(String id) + { + if (!id.equals("")) + { _id =3D id; - if (id.startsWith("IDL:") && id.endsWith(":1.0")) { + if (id.startsWith("IDL:") && id.endsWith(":1.0")) + { // Infer _type field from standard IDL format _id id =3D id.substring(4, id.length() - 4); - if (id.startsWith("omg.org/")) { + if (id.startsWith("omg.org/")) + { id =3D id.substring(8); } _type =3D ""; - for (; ;) { + for (; ;) + { int slash =3D id.indexOf('/'); - if (slash =3D=3D -1) { + if (slash =3D=3D -1) + { break; } _type =3D _type + id.substring(0, slash) + "::"; @@ -254,8 +319,10 @@ * @throws BadKind */ public String name() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.name(); } /* TODO? @@ -264,7 +331,8 @@ _name =3D (String)_names.get(new Integer(_kind.value())); } */ - if (_name =3D=3D null) { + if (_name =3D=3D null) + { throw new BadKind(); } return _name; @@ -274,7 +342,8 @@ /** * @param name */ - public void name(String name) { + public void name(String name) + { _name =3D name; } =20 @@ -283,11 +352,14 @@ * @throws BadKind */ public int member_count() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.member_count(); } - if (_member_name =3D=3D null) { + if (_member_name =3D=3D null) + { throw new BadKind(); } return _member_name.length; @@ -297,13 +369,16 @@ /** * @param count */ - public void member_count(int count) { + public void member_count(int count) + { _member_name =3D new String[count]; _member_type =3D new org.omg.CORBA.TypeCode[count]; - if (_kind.value() =3D=3D TCKind._tk_union) { + if (_kind.value() =3D=3D TCKind._tk_union) + { _member_label =3D new org.omg.CORBA.Any[count]; } - if (_kind.value() =3D=3D TCKind._tk_value) { + if (_kind.value() =3D=3D TCKind._tk_value) + { _member_visibility =3D new short[count]; } } @@ -315,14 +390,18 @@ * @throws Bounds */ public String member_name(int index) - throws BadKind, Bounds { - if (_indirection) { + throws BadKind, Bounds + { + if (_indirection) + { return _ref.member_name(index); } - if (_member_name =3D=3D null) { + if (_member_name =3D=3D null) + { throw new BadKind(); } - if (index < 0 || index >=3D _member_name.length) { + if (index < 0 || index >=3D _member_name.length) + { throw new Bounds(); } return _member_name[index]; @@ -333,7 +412,8 @@ * @param index * @param name */ - public void member_name(int index, String name) { + public void member_name(int index, String name) + { _member_name[index] =3D name; } =20 @@ -344,14 +424,18 @@ * @throws Bounds */ public org.omg.CORBA.TypeCode member_type(int index) - throws BadKind, Bounds { - if (_indirection) { + throws BadKind, Bounds + { + if (_indirection) + { return _ref.member_type(index); } - if (_member_type =3D=3D null) { + if (_member_type =3D=3D null) + { throw new BadKind(); } - if (index < 0 || index >=3D _member_type.length) { + if (index < 0 || index >=3D _member_type.length) + { throw new Bounds(); } return _member_type[index]; @@ -362,7 +446,8 @@ * @param index * @param type */ - public void member_type(int index, org.omg.CORBA.TypeCode type) { + public void member_type(int index, org.omg.CORBA.TypeCode type) + { _member_type[index] =3D type; } =20 @@ -373,14 +458,18 @@ * @throws Bounds */ public org.omg.CORBA.Any member_label(int index) - throws BadKind, Bounds { - if (_indirection) { + throws BadKind, Bounds + { + if (_indirection) + { return _ref.member_label(index); } - if (_member_label =3D=3D null) { + if (_member_label =3D=3D null) + { throw new BadKind(); } - if (index < 0 || index >=3D _member_label.length) { + if (index < 0 || index >=3D _member_label.length) + { throw new Bounds(); } return _member_label[index]; @@ -391,7 +480,8 @@ * @param index * @param label */ - public void member_label(int index, org.omg.CORBA.Any label) { + public void member_label(int index, org.omg.CORBA.Any label) + { _member_label[index] =3D label; } =20 @@ -400,12 +490,15 @@ * @throws BadKind */ public org.omg.CORBA.TypeCode discriminator_type() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.discriminator_type(); } if (_ref =3D=3D null - || _kind.value() !=3D TCKind._tk_union) { + || _kind.value() !=3D TCKind._tk_union) + { throw new BadKind(); } return _ref; @@ -415,7 +508,8 @@ /** * @param disc */ - public void discriminator_type(org.omg.CORBA.TypeCode disc) { + public void discriminator_type(org.omg.CORBA.TypeCode disc) + { _ref =3D disc; } =20 @@ -424,11 +518,14 @@ * @throws BadKind */ public int default_index() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.default_index(); } - if (_kind.value() !=3D TCKind._tk_union) { + if (_kind.value() !=3D TCKind._tk_union) + { throw new BadKind(); } return _default; @@ -438,9 +535,11 @@ /** * @param index */ - public void default_index(int index) { + public void default_index(int index) + { _default =3D index; - if (index !=3D -1) { + if (index !=3D -1) + { // We must store the member label for the discriminator type // as some legal value, so we use zero. _member_label[index] =3D new Any(_ref, "0"); @@ -452,13 +551,17 @@ * @throws BadKind */ public int length() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.length(); } int tk =3D _kind.value(); - if (tk !=3D TCKind._tk_string && tk !=3D TCKind._tk_wstring - && tk !=3D TCKind._tk_sequence && tk !=3D TCKind._tk_array) { + if (tk !=3D TCKind._tk_string && + tk !=3D TCKind._tk_wstring + && tk !=3D TCKind._tk_sequence && tk !=3D TCKind._tk_array) + { throw new BadKind(); } return _length; @@ -468,7 +571,8 @@ /** * @param length */ - public void length(int length) { + public void length(int length) + { _length =3D length; } =20 @@ -477,16 +581,21 @@ * @throws BadKind */ public org.omg.CORBA.TypeCode content_type() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.content_type(); } int tk =3D _kind.value(); if (_ref =3D=3D null || (tk !=3D TCKind._tk_alias - && tk !=3D TCKind._tk_array - && tk !=3D TCKind._tk_sequence - && tk !=3D TCKind._tk_value_box)) { + && + tk !=3D TCKind._tk_array + && + tk !=3D TCKind._tk_sequence + && tk !=3D TCKind._tk_value_box)) + { throw new BadKind(); } return _ref; @@ -496,7 +605,8 @@ /** * @param type */ - public void content_type(org.omg.CORBA.TypeCode type) { + public void content_type(org.omg.CORBA.TypeCode type) + { _ref =3D type; } =20 @@ -505,12 +615,15 @@ * @throws BadKind */ public short fixed_digits() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.fixed_digits(); } int tk =3D _kind.value(); - if (tk !=3D TCKind._tk_fixed) { + if (tk !=3D TCKind._tk_fixed) + { throw new BadKind(); } return _digits; @@ -520,7 +633,8 @@ /** * @param digits */ - public void fixed_digits(short digits) { + public void fixed_digits(short digits) + { _digits =3D digits; } =20 @@ -529,12 +643,15 @@ * @throws BadKind */ public short fixed_scale() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.fixed_scale(); } int tk =3D _kind.value(); - if (tk !=3D TCKind._tk_fixed) { + if (tk !=3D TCKind._tk_fixed) + { throw new BadKind(); } return _scale; @@ -544,7 +661,8 @@ /** * @param scale */ - public void fixed_scale(short scale) { + public void fixed_scale(short scale) + { _scale =3D scale; } =20 @@ -555,15 +673,19 @@ * @throws Bounds */ public short member_visibility - (int index) - throws BadKind, Bounds { - if (_indirection) { + (int index) + throws BadKind, Bounds + { + if (_indirection) + { return _ref.member_visibility(index); } - if (_member_type =3D=3D null) { + if (_member_type =3D=3D null) + { throw new BadKind(); } - if (index < 0 || index >=3D _member_visibility.length) { + if (index < 0 || index >=3D _member_visibility.length) + { throw new Bounds(); } return _member_visibility[index]; @@ -574,7 +696,8 @@ * @param index * @param visibility */ - public void member_visibility(int index, short visibility) { + public void member_visibility(int index, short visibility) + { _member_visibility[index] =3D visibility; } =20 @@ -583,12 +706,15 @@ * @throws BadKind */ public short type_modifier() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.type_modifier(); } int tk =3D _kind.value(); - if (tk !=3D TCKind._tk_value) { + if (tk !=3D TCKind._tk_value) + { throw new BadKind(); } return _type_modifier; @@ -598,7 +724,8 @@ /** * @param modifier */ - public void type_modifier(short modifier) { + public void type_modifier(short modifier) + { _type_modifier =3D modifier; } =20 @@ -607,12 +734,15 @@ * @throws BadKind */ public org.omg.CORBA.TypeCode concrete_base_type() - throws BadKind { - if (_indirection) { + throws BadKind + { + if (_indirection) + { return _ref.concrete_base_type(); } int tk =3D _kind.value(); - if (tk !=3D TCKind._tk_value) { + if (tk !=3D TCKind._tk_value) + { throw new BadKind(); } return _ref; @@ -622,7 +752,8 @@ /** * @param base */ - public void concrete_base_type(org.omg.CORBA.TypeCode base) { + public void concrete_base_type(org.omg.CORBA.TypeCode base) + { _ref =3D base; } =20 @@ -630,7 +761,8 @@ /** * @param ref */ - public void indirection(org.omg.CORBA.TypeCode ref) { + public void indirection(org.omg.CORBA.TypeCode ref) + { _ref =3D ref; _indirection =3D true; } @@ -639,7 +771,8 @@ /** * @param id */ - public void recursive(String id) { + public void recursive(String id) + { _id =3D id; _ref =3D null; _indirection =3D true; @@ -649,16 +782,21 @@ /** * */ - public void fix_recursive_members() { + public void fix_recursive_members() + { String id =3D _id =3D=3D null ? default_id() : _id; int n =3D _member_type.length; - for (int i =3D 0; i < n; i++) { + for (int i =3D 0; i < n; i++) + { TypeCode mt =3D (TypeCode) _member_type[i]; - if (mt._kind.value() =3D=3D TCKind._tk_sequence) { + if (mt._kind.value() =3D=3D TCKind._tk_sequence) + { TypeCode ct =3D (TypeCode) mt._ref; if (ct._indirection - && ct._ref =3D=3D null - && ct._id.equals(id)) { + && + ct._ref =3D=3D null + && ct._id.equals(id)) + { ct._ref =3D this; } } @@ -671,19 +809,23 @@ /** * @return */ - private String default_id() { + private String default_id() + { // Take _type, and generate _id, e.g. // if _type =3D "SessionManager::Manager", // then _id =3D "IDL:SessionManager/Manager:1.0". - if (_type =3D=3D null) { + if (_type =3D=3D null) + { return ""; } StringBuffer id =3D new StringBuffer(_type.length() + 10); id.append("IDL:"); int n =3D _type.length(); - for (int i =3D 0; i < n; i++) { + for (int i =3D 0; i < n; i++) + { char c =3D _type.charAt(i); - if (c =3D=3D ':' && i + 1 < n && _type.charAt(i + 1) =3D=3D ':= ') { + if (c =3D=3D ':' && i + 1 < n && _type.charAt(i + 1) =3D=3D ':= ') + { i++; } id.append(c =3D=3D ':' ? '/' : c); Modified: geronimo/trunk/modules/interop/src/java/org/apache/geronimo/inter= op/rmi/iiop/UnsupportedProtocolVersionException.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/interop/src/java/= org/apache/geronimo/interop/rmi/iiop/UnsupportedProtocolVersionException.ja= va?view=3Ddiff&r1=3D159004&r2=3D159005 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/UnsupportedProtocolVersionException.java (original) +++ geronimo/trunk/modules/interop/src/java/org/apache/geronimo/interop/rmi= /iiop/UnsupportedProtocolVersionException.java Fri Mar 25 03:54:30 2005 @@ -17,8 +17,10 @@ */ package org.apache.geronimo.interop.rmi.iiop; =20 -public class UnsupportedProtocolVersionException extends RuntimeException = { - public UnsupportedProtocolVersionException(String version) { +public class UnsupportedProtocolVersionException extends RuntimeException +{ + public UnsupportedProtocolVersionException(String version) + { super(version); } }